SOLVED Dual Images windows 10 and Ubuntu 16 with UEFI

  • Moderator

    @Fernando-Gietz The “issue” from my point of view is that your UEFI firmware is going real EFI which is actually a nice thing. But it is causing a problem.

    There is a really good resource on EFI here:

    On your bog-standard old-skool BIOS PC, […], the very start of the disk describes the partitions on the disk in a particular format, and contains a ‘boot loader’ […]

    Ok we do capture the MBR stuff in FOG! But now read on to the new stuff:

    UEFI booting: […] it is completely different. […] many UEFI firmwares implement some kind of BIOS compatibility mode, sometimes referred to as a CSM.

    Now you see why I think your system goes real EFI. Probably it doesn’t to the CSM stuff. So let’s talk about this:

    […] native UEFI booting […] UEFI boot manager […] can be configured by modifying architecturally defined global NVRAM variables.

    So here we go. The boot order/list in real native UEFI systems is not on disk. So far we don’t capture the NVRAM state of a machine as far as I know. This is definitely something we need to add to the todo list. On Windows only systems it’s probably working out fine most times so we don’t see an issue. But for UEFI dual booting systems we need to find a solution.

  • Moderator

    @fernando-gietz Ok if that commands works (sounds like you agree). Then you have a few options.

    1. Sebastian can do his magic and see if fog can detect this condition.
    2. (assuming your windows image is sysprep’d before image capture) Have fog copy in a setupcomplete.cmd file (or patch your current one) during post install script execution to have Windows run that command via the setupcomplete.cmd execution.
    3. If your windows system is not sysprep’d then have the post install script copy a batch file with the command in it, and a shortcut that points to where the batch file will be copied (i.e. c:\windows\setup). Place the short cut in the admin user’s startup directory. Have the batch file that is called delete the short cut in the startup directory once the batch file has run. This method is a bit more messy but does work.

    Strictly speaking I don’t see this as a fog issue since it existed before fog imaging. FOG imaging is only putting back what “should be” in place when it detects a windows setup. With that said, you do have a few ways to go about making this work, and without much pain.

  • Developer

    I test the changes that @george1421 says and works fine.
    The first boot goes direct to W10 but in the next one appears grub menu .

  • Developer

    @sebastian-roth I forget say it 😞 I rebuild the grub from Ubuntu live CD

  • Moderator

    @Fernando-Gietz Ahhhh, I see now what’s going on. Will explain when I get home…

  • Moderator

    @fernando-gietz said in Dual Images windows 10 and Ubuntu 16 with UEFI:

    W10 desktop appears, where is my Ubuntu? Well, don’t problem, I need to rebuilt the grub. To do it, I use the boot-repair tool

    Again this is the point where you loose me. How are you able to boot up Ubuntu and run boot-repair if Ubuntu is not in the boot selection as you say. I am just guessing here but possibly you use the Ubuntu DVD to boot a live system for repair?

    I will look into the tool when I get home…

  • Moderator

    @fernando-gietz Ok I find this article interesting.

    The most interesting part is at the very bottom section Note.

    Note: If after installing Ubuntu, you boot directly in Windows, check in UEFI settings for changing the boot order. If you see no option to set the boot to Ubuntu, you need to fix it from within Windows. When you are in Windows desktop, hover the mouse in left corner, right click and select administrator’s command prompt. Then run the following command:
    bcdedit /set "{bootmgr}" path \EFI\ubuntu\grubx64.efi

    If you deploy an images that is broken as you say. If you run this command in windows does it fix the problem. This isn’t the solution just yet, but it may be the clue to why.

  • Developer

    @george1421 Yes. You have understand all well

  • Moderator

    First let me say I don’t have a clue what is going on here, but I think I see a pattern.

    Master image creation.

    1. Install Windows
    2. Install Ubuntu
      System will only boot windows.
    3. Use ubuntu repair tool and now you have dual boot.

    Capture and deploy with FOG.

    1. Windows is installed
    2. Ubuntu is installed.
      System will only boot windows.
    3. Use ubuntu repair tool and now you have dual boot.

    Do I understand the logic flow here?

  • Developer


    root@U032668:~# gdisk -l /dev/sda
    GPT fdisk (gdisk) version 1.0.1
    Partition table scan:
      MBR: protective
      BSD: not present
      APM: not present
      GPT: present
    Found valid GPT with protective MBR; using GPT.
    Disk /dev/sda: 500118192 sectors, 238.5 GiB
    Logical sector size: 512 bytes
    Disk identifier (GUID): 611A1A7F-D5E7-4EB5-87EF-D447B71A8595
    Partition table holds up to 128 entries
    First usable sector is 34, last usable sector is 500118158
    Partitions will be aligned on 2048-sector boundaries
    Total free space is 924269 sectors (451.3 MiB)
    Number  Start (sector)    End (sector)  Size       Code  Name
       1          923648         1128447   100.0 MiB   EF00  EFI system partition
       2         1128448         1161215   16.0 MiB    0C01  Microsoft reserved ...
       3         1161216       205961215   97.7 GiB    0700  Basic data partition
       4       205961216       483586047   132.4 GiB   8300  
       5       483586048       500117503   7.9 GiB     8200  
    root@U032668:~# lsblk
    sda      8:0    0 238,5G  0 disk 
    ├─sda1   8:1    0   100M  0 part /boot/efi
    ├─sda2   8:2    0    16M  0 part 
    ├─sda3   8:3    0  97,7G  0 part 
    ├─sda4   8:4    0 132,4G  0 part /
    └─sda5   8:5    0   7,9G  0 part [SWAP]
    sr0     11:0    1  1024M  0 rom  
    root@U032668:~# blkid
    /dev/sda1: UUID="A47A-9C4F" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="90659379-55aa-43cc-a916-7909278e69d2"
    /dev/sda2: PARTLABEL="Microsoft reserved partition" PARTUUID="ff774eb9-c85f-4dae-aac5-9a8efd46e7b4"
    /dev/sda3: UUID="385A3AFA5A3AB48A" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="54366076-6bce-46ae-9046-8528edf1876f"
    /dev/sda4: UUID="e3fa93df-c9a8-4b1c-bcaf-7886256709cb" TYPE="ext4" PARTUUID="c1db2263-cf34-4d82-9954-2484e2c8bdde"
    /dev/sda5: UUID="c2fec154-bb2c-454c-ad54-8ca7ab1af203" TYPE="swap" PARTUUID="530e6d65-e5d7-4f4c-bb3b-44ccc6305467"
    root@U032668:~# pvdisplay
    El programa «pvdisplay» no está instalado. Puede instalarlo escribiendo:
    apt install lvm2
    root@U032668:~# lgdisplay
    No se ha encontrado la orden «lgdisplay», quizás quiso decir:
     La orden «lvdisplay» del paquete «lvm2» (main)
     La orden «vgdisplay» del paquete «lvm2» (main)
    lgdisplay: no se encontró la orden
    root@U032668:~# lvdisplay
    El programa «lvdisplay» no está instalado. Puede instalarlo escribiendo:
    apt install lvm2

  • @fernando-gietz said in Dual Images windows 10 and Ubuntu 16 with UEFI:

    When I run the boot-repair tool, the grub is rebuilt and we have our dual boot running fine.

    So we need FOS to detect when there is a dual boot system, and to just rebuild Grub every time it detects that.

    @Fernando-Gietz do you mind giving us the output of the below commands from that system please so we can start thinking about this:

    gdisk -l /dev/sda

    Please post the results into the following link, this is where we are collecting this stuff:

  • Developer

    Hi @sebastian-roth,

    sorry for my late answer, I have been out of the office these days.

    No fool questions, no fool questions 🙂

    I install my windows 10 LTSB 2016 version in the test computer with GPT partitions. If I capture this OS, I don’t have problmes to deploy it in other computer.

    Let’s go to do it dual!!!

    I power on my W10 computer and I install Ubuntu 16.06 in the computer. The process end successfully … great!! The computer reboot and … W10 desktop appears, where is my Ubuntu? Well, don’t problem, I need to rebuilt the grub. To do it, I use the boot-repair tool (I searched in google how repair the grub and appeared this solution, maybe, you can do it in several ways … But, be water my friend). When I run the boot-repair tool, the grub is rebuilt and we have our dual boot running fine.


    Now I capture the image from FOG, the proccess finishes well, but If I try to deploy the image in other computer, only boots from windows boot manager and I need to repair, again, the grub to works fine.

  • Moderator

    @Fernando-Gietz Can you explain more in detail. What error exactly do you see after deployment when trying to boot Linux. As well I guess we need to know more about how you recover from that state. You say you are not able to boot Linux, so how would you be able to install the boot-repair tool. Sorry, if my questions sound stupid. I’ve done a lot of boot loading stuff and it just doesn’t add up for me yet. I am sure we can figure this out and find a solution for you as soon as we fully understand the issue you see and how you do the boot-repair.

  • Developer

    The tool is boot-repair

    sudo add-apt-repository ppa:yannubuntu/boot-repair
    sudo apt-get update
    sudo apt-get install -y boot-repair

    If is there more ways to do it, I open my mind to them XD

    I am using 1.5.0 - RC 10

  • Moderator

    @Fernando-Gietz Please let us know which tool exactly you use to fix the bootloader. There are different ways to add boot entries. As well let us know which FOG version you are on at the moment.

    You can try setting Operation System setting for this image to Linux. Though this might cause a different issue for you.