You are not logged in.

#1 2017-10-15 18:16:53

a-kmd
Member
Registered: 2017-10-15
Posts: 6

Setting up GRUB post install

Hello,
I have installed Arch on encrypted device using lvm on LUKS.
systemd-boot works fine, I have no problems with booting and using arch. However, I want to setup dual boot from another Disk (Windows). To do that I plan to use GRUB.
I have installed GRUB and configured it:

GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Arch"
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX="cryptdevice=UUID=2e29953b-cb43-460c-8ec1-b9b4acfed69c:lvm:allow-discards"

# Preload both GPT and MBR modules so that they are not missed
GRUB_PRELOAD_MODULES="part_gpt part_msdos"

# Uncomment to enable booting from LUKS encrypted devices
GRUB_ENABLE_CRYPTODISK=y

# Uncomment to enable Hidden Menu, and optionally hide the timeout count
#GRUB_HIDDEN_TIMEOUT=5
#GRUB_HIDDEN_TIMEOUT_QUIET=true

# Uncomment to use basic console
GRUB_TERMINAL_INPUT=console

# Uncomment to disable graphical terminal
#GRUB_TERMINAL_OUTPUT=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
GRUB_GFXMODE=auto

# Uncomment to allow the kernel use the same resolution used by grub
GRUB_GFXPAYLOAD_LINUX=keep

# Uncomment if you want GRUB to pass to the Linux kernel the old parameter
# format "root=/dev/xxx" instead of "root=/dev/disk/by-uuid/xxx"
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
GRUB_DISABLE_RECOVERY=true
#GRUB_SAVEDEFAULT="true"

Running grub-install creates files:

#grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=grub
#ls /boot/grub
fonts  grub.cfg  grub.cfg.example  grubenv  i386-pc  locale  themes  x86_64-efi
#ls /boot/EFI/grub
grubx64.efi

Unfortunately grub-probe does not work

#grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-linux
Found initrd image(s) in /boot: initramfs-linux.img
Found fallback initrd image(s) in /boot: initramfs-linux-fallback.img
error: invalid volume.
grub-probe: error: cannot find a GRUB drive for /dev/sda2.  Check your device.map.
done

I do not have sda2 (why is it trying to access it??) at all and my Windows disk is dev/nvme0n1

#parted -l
Model: ATA ST31000524AS (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      32.3kB  1000GB  1000GB  primary


Model: ATA WDC WD4000AAJS-6 (scsi)
Disk /dev/sdb: 400GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start  End    Size   Type     File system  Flags
 1      2560B  400GB  400GB  primary  ntfs


Model: ATA Samsung SSD 840 (scsi)
Disk /dev/sdc: 256GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End    Size   File system  Name        Flags
 1      1049kB  263MB  262MB  fat32        EFI System  boot, esp
 2      263MB   256GB  256GB               Linux LVM   lvm


Model: Unknown (unknown)
Disk /dev/nvme0n1: 512GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End    Size   Type     File system  Flags
 1      1049kB  525MB  524MB  primary  ntfs         boot
 2      525MB   512GB  512GB  primary  ntfs 

This is my blocks:

#lsblk -p 
NAME                       MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
/dev/sda                     8:0    0 931.5G  0 disk  
├─/dev/sda1                  8:1    0   200G  0 part  
└─/dev/sda2                  8:2    0 731.5G  0 part  
/dev/sdb                     8:16   0 372.6G  0 disk  
└─/dev/sdb1                  8:17   0 372.6G  0 part  
/dev/sdc                     8:32   0 238.5G  0 disk  
├─/dev/sdc1                  8:33   0   250M  0 part  /boot
└─/dev/sdc2                  8:34   0 238.2G  0 part  
  └─/dev/mapper/lvm        254:0    0 238.2G  0 crypt 
    ├─/dev/mapper/vg0-swap 254:1    0    12G  0 lvm   [SWAP]
    └─/dev/mapper/vg0-root 254:2    0 226.2G  0 lvm   /home
/dev/nvme0n1               259:0    0   477G  0 disk  
├─/dev/nvme0n1p1           259:1    0   500M  0 part  
└─/dev/nvme0n1p2           259:2    0 476.5G  0 part  

I have little understanding what to do next. I can try to guess or google more but fundamentally I do not understand what I'm doing. Most of wiki's/blogs says what to do in a specific scenario (as you can see this is a little bit more complicated than basic dual booting from /dev/sda). But I really would appreciate if someone could explain me what is going on and what should I be looking for. Why do I need grub-probe? Why do I need to have Windows efi file in my /sdc /boot instead of just telling GRUB to chain load windows boot manager from /nvme0n1? What the hell is hd0(1,2,3) in GRUB configuration (I understand that this stands for a disk number, but how do I know the disk number of nvme disk)?

I could use just general guidance of what to look for. I know there is tons of documentation on EFI and bootloaders, but I do not want to learn all of it just to boot into Windows, I would gladly learn basic principles though.

Offline

#2 2017-10-15 18:35:47

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: Setting up GRUB post install

Any particular reason for switching to grub? Systemd-boot works just fine for dual-booting Windows.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#3 2017-10-15 18:49:29

a-kmd
Member
Registered: 2017-10-15
Posts: 6

Re: Setting up GRUB post install

Any particular reason for switching to grub? Systemd-boot works just fine for dual-booting Windows.

Actually, I really wanted to use systemd-boot, but I failed to add any boot record to the menu (it was odd, efibootmgr was showing entries but there were no files created in /boot and no entries added to the boot menu). I googled and I've read somewhere that systemd-boot does not support booting from another disk (that might have been outdated info) and GRUB seemed to have more information on the web. If someone could help me with systemd-boot I would prefer it over GRUB.

Offline

#4 2017-10-15 20:00:45

loadlover
Member
Registered: 2017-05-10
Posts: 103

Re: Setting up GRUB post install

I can't really help, but I fairly recently set up Arch to dual-boot along with Windows 10 using both systemd-boot and GRUB. Both worked fine, but I did find os-prober a bit problematic. One option is to manually configure GRUB (not too difficult). Sorry, not much help.

EDIT: Oh you're using grub-probe? Oh. I didn't use that.

- Loady

Last edited by loadlover (2017-10-15 20:06:52)

Offline

#5 2017-10-15 20:05:22

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: Setting up GRUB post install

a-kmd wrote:

I googled and I've read somewhere that systemd-boot does not support booting from another disk.

That's correct, but as long as you're using the same ESP for Arch and Windows then the Windows EFI is on the same disk.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#6 2017-10-15 20:16:54

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: Setting up GRUB post install

a-kmd wrote:

but there were no files created in /boot and no entries added to the boot menu

You have to add them yourself.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#7 2017-10-15 20:36:26

a-kmd
Member
Registered: 2017-10-15
Posts: 6

Re: Setting up GRUB post install

loadlover - the problem here is that Windows is on another drive and on top of that the drive is a nvme drive

slithery wrote:

That's correct, but as long as you're using the same ESP for Arch and Windows then the Windows EFI is on the same disk.

This is what I was thinking - that I need to create Windows EFI boot partition on my linux drive (/sdc) and this somehow should point to nvme. That sounds overly complicated compared to chain loading different drive?

Anarchist wrote:

You have to add them yourself.

Well, ok. For some reason I cannot see it, usually it says, do:

 #efibootmgr -c -d /dev/sdX -p 2 -w -L Windows -l \EFI\Microsoft\Boot\bootmgfw.efi 

and that's it, no indication how to add files after that

Offline

#8 2017-10-15 20:41:08

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: Setting up GRUB post install


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#9 2017-10-15 20:43:15

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: Setting up GRUB post install

a-kmd wrote:

This is what I was thinking - that I need to create Windows EFI boot partition on my linux drive (/sdc) and this somehow should point to nvme. That sounds overly complicated compared to chain loading different drive?

One of the main design features of UEFI systems is that you only need one EFI partition to manage all of your OS's. If you have more than one then you're doing things wrong.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#10 2017-10-15 20:45:10

loqs
Member
Registered: 2014-03-06
Posts: 19,113

Re: Setting up GRUB post install

systemd-bootmgr only reads the ESP if the Windows boot loader and the linux kernel are both on the ESP then where the rest of those installs is located should not matter.
systemd-bootmgr should automatically look for \EFI\Microsoft\Boot\bootmgfw.efi and dynamically create an entry for Windows if present.
This is all covered in Systemd-boot#EFI_boot

Last edited by loqs (2017-10-15 20:46:34)

Offline

#11 2017-10-15 21:13:29

a-kmd
Member
Registered: 2017-10-15
Posts: 6

Re: Setting up GRUB post install

Anarchitst wrote:

...

Do you want output of bootctl?

# bootctl 
Using EFI System Partition at /boot.
System:
     Firmware: UEFI 2.31 (American Megatrends 4.655)
  Secure Boot: disabled
   Setup Mode: user

Current Loader:
      Product: systemd-boot 234
          ESP: /dev/disk/by-partuuid/9bfe8a9c-43a6-4754-ad80-2bc7a3eb9b95
         File: └─/EFI/BOOT/BOOTX64.EFI

Boot Loader Binaries:
          ESP: /boot (/dev/disk/by-partuuid/9bfe8a9c-43a6-4754-ad80-2bc7a3eb9b95)
         File: └─/EFI/systemd/systemd-bootx64.efi (systemd-boot 234)
         File: └─/EFI/BOOT/BOOTX64.EFI (systemd-boot 234)

Boot Loader Entries in EFI Variables:
        Title: arch
           ID: 0x0000
       Status: active, boot-order
    Partition: /dev/disk/by-partuuid/9bfe8a9c-43a6-4754-ad80-2bc7a3eb9b95
         File: └─/EFI/ARCH/GRUBX64.EFI

        Title: grub
           ID: 0x0001
       Status: active, boot-order
    Partition: /dev/disk/by-partuuid/9bfe8a9c-43a6-4754-ad80-2bc7a3eb9b95
         File: └─/EFI/GRUB/GRUBX64.EFI

        Title: UEFI OS
           ID: 0x0002
       Status: active, boot-order
    Partition: /dev/disk/by-partuuid/9bfe8a9c-43a6-4754-ad80-2bc7a3eb9b95
         File: └─/EFI/BOOT/BOOTX64.EFI

        Title: Linux Boot Manager
           ID: 0x0004
       Status: active, boot-order
    Partition: /dev/disk/by-partuuid/9bfe8a9c-43a6-4754-ad80-2bc7a3eb9b95
         File: └─/EFI/systemd/systemd-bootx64.efi

As you can see there is no Windows entry, bootctl does not detect one and does not create one.

slithery wrote:

One of the main design features of UEFI systems is that you only need one EFI partition to manage all of your OS's. If you have more than one then you're doing things wrong.

Thanks a lot. I did not knew that. Could you give a hint how to create a new EFI entry for windows?
As I mentioned above in answer for Anarchist:

Well, ok. For some reason I cannot see it, usually it says, do:

#efibootmgr -c -d /dev/sdX -p 2 -w -L Windows -l \EFI\Microsoft\Boot\bootmgfw.efi

and that's it, no indication how to add files after that

Although I can list new entry in efibootmgr I do not see it after reboot

# efibootmgr
BootCurrent: 0002
Timeout: 1 seconds
BootOrder: 0005,0003,0000,0001,0002,0004
Boot0000* arch
Boot0001* grub
Boot0002* UEFI OS
Boot0003* Hard Drive 
Boot0004* Linux Boot Manager
Boot0005* Windows

bootctl does not show Windows and /boot/EFI/Microsoft does not exist

loqs wrote:

systemd-bootmgr only reads the ESP if the Windows boot loader and the linux kernel are both on the ESP then where the rest of those installs is located should not matter.
systemd-bootmgr should automatically look for \EFI\Microsoft\Boot\bootmgfw.efi and dynamically create an entry for Windows if present.
This is all covered in Systemd-boot#EFI_boot

That's the problem - Windows is not on the ESP and entry was not created.

Offline

#12 2017-10-15 21:32:03

progandy
Member
Registered: 2012-05-17
Posts: 5,322

Re: Setting up GRUB post install

Moving the windows esp and merging it with your linux esp shoudn't be too difficult if you want to go that route.
(I've never done it before since I have neither EFI nor a second disk)

Edit: This should give you the necessary steps, you should be able to skip the creation and use your "linux" esp instead. Please make sure to create a backup of the contents your ESP before modifying it and have a live cd / usb available in case you need to restore it.
https://superuser.com/questions/665923/ … ther-drive

Last edited by progandy (2017-10-15 21:36:11)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#13 2017-10-15 21:41:14

loqs
Member
Registered: 2014-03-06
Posts: 19,113

Re: Setting up GRUB post install

One complication progandy it looks like Windows was installed in bios/MBR mode.  I am taking this from Windows being on the nvme and the nvme being MBR instead of GPT.

Offline

#14 2017-10-15 21:54:06

progandy
Member
Registered: 2012-05-17
Posts: 5,322

Re: Setting up GRUB post install

loqs wrote:

One complication progandy it looks like Windows was installed in bios/MBR mode.  I am taking this from Windows being on the nvme and the nvme being MBR instead of GPT.

Right. Somehow I missed that. nvme also has only two partitions, the ntfs reserved system partition and the main partition in ntfs. There is no no fat32 esp.

In that case it might work to use a windows recovery disk to convert the nvme to gpt and add the efi files to the already existing esp, otherwise you have to reinstall windows.


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#15 2017-10-16 11:33:20

a-kmd
Member
Registered: 2017-10-15
Posts: 6

Re: Setting up GRUB post install

progandy wrote:

Right. Somehow I missed that. nvme also has only two partitions, the ntfs reserved system partition and the main partition in ntfs. There is no no fat32 esp.

In that case it might work to use a windows recovery disk to convert the nvme to gpt and add the efi files to the already existing esp, otherwise you have to reinstall windows.

If that helps I already have efi files in Windows disk

I really appreciate that you are trying to help me guys, but I do not yet understand the problem exactly and not just looking for any fix that works, I really want to understand why this thing is not working.
From what I gather I need to have record in .efi file that points to partition UUID, then that .efi file is loaded by boot manager. Is that correct?
I have partition UUID for Arch and Windows. However I am not able to create a record and generate .efi file - isn't that what I should be doing? Why is it necessary to fix anything in Windows partition table? I would think that is possible to handle it via linux boot manager alone?

Offline

#16 2017-10-16 13:27:03

progandy
Member
Registered: 2012-05-17
Posts: 5,322

Re: Setting up GRUB post install

As far as I know, Windows is limiting itself to two installation modes:
* MBR (msdos) disk with BIOS/Legacy boot
* GPT disk with UEFI boot

You can use GRUB in EFI mode and chainload windows legacy mode.
Systemd-boot requires all operating systems to use efi. If you want to use it, then you have to convert windows to EFI.


By the way, your partition table for sda seems strange. parted lists a single 1000GB partition, while lsblk shows two partitions sda1 and sda2 with a total of 931GB.

Last edited by progandy (2017-10-16 13:29:40)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#17 2017-10-16 13:36:09

a-kmd
Member
Registered: 2017-10-15
Posts: 6

Re: Setting up GRUB post install

progandy wrote:

As far as I know, Windows is limiting itself to two installation modes:
* MBR (msdos) disk with BIOS/Legacy boot
* GPT disk with UEFI boot

You can use GRUB in EFI mode and chainload windows legacy mode.
Systemd-boot requires all operating systems to use efi. If you want to use it, then you have to convert windows to EFI.


By the way, your partition table for sda seems strange. parted lists a single 1000GB partition, while lsblk shows two partitions sda1 and sda2 with a total of 931GB.

Thank you for the explanation.

I will:
1) Fix my sda (os probe had problems with it, maybe it will help)
2) Move Windows to GPT (but I was booting windows in UEFI mode with secure boot, so it is a little bit strange that it was running on Legacy)
Maybe after that normal methods will start working, if not I will come back here.

Last edited by a-kmd (2017-10-16 13:45:02)

Offline

Board footer

Powered by FluxBB