You are not logged in.

#1 2024-03-02 18:53:56

Turtyo
Member
Registered: 2023-03-26
Posts: 20

[SOLVED] PC boots to UEFI instead of GRUB after dual Arch install

Hello !

I tried to install Arch alongside my existing Arch install (because I want to replace the previous Windows dual boot I did). I did this from a USB stick.
I followed the installation guide until step 3.7, skipped 3.8 (since I already had grub due to the previous Arch install) and rebooted.
Until there, no problem, I could boot to the old Arch install. After checking that I had os-prober installed, I ran:

 grub-mkconfig -o /boot/grub/grub.cfg 

I had to activate it by uncommenting

 GRUB_DISABLE_OS_PROBER=false 

in /etc/default/grub
I also installed grub-customizer to edit the grub entries (since I thought that both entries would be named as Arch, and that would be a bit confusing) but I exited without saving to check with a reboot first.
The PC now boots directly to UEFI (or maybe it boots to GRUB, breaks and falls back to UEFI).

I tried to at least boot into my old Arch, so I booted the USB stick again, and following this comment , I mounted the partitions of my old Arch install, did

 arch-chroot /mnt 

and ran grub-mkconfig again, hoping this would solve the problem. I had commented the OS_PROBER line again to prevent problems with that.
It did not solve the problem.

I saw there was a recent help thread that was about a dual Arch boot too, but the method and problem seem a bit different so I preferred to ask advice first before trying to install GRUB again.

Here is current disk partitioning:

/sda
sda1 ext4 my partition for the new /home
sda3 ext4 my partition for the old /home

/nvme0n1
nvme0n1p1 FAT32 EFI
nvme0n1p2 ext4 the root partition of my new Arch install
nvme0n1p4 NFTS a remnant of Windows
nvme0n1p5 SWAP shared between my two Arch install
nvme0n1p6 ext4 root of my old Arch install

Any help is appreciated. I backed up my data before so if it's absolutely necessary I can erase everything, but I would rather not.
I'm not sure what are the consequences of reinstalling GRUB, but I'm guessing it's not too bad ?

Last edited by Turtyo (2024-03-05 18:08:12)

Offline

#2 2024-03-03 17:30:56

cryptearth
Member
Registered: 2024-02-03
Posts: 1,090

Re: [SOLVED] PC boots to UEFI instead of GRUB after dual Arch install

Do you use the ESP as /boot on both Arch installs? If so you likely overwritten the kernel and initramfs.
Although I haven't tried it to me try to install two or more linux distributions with grub the ESP should be mounted as /efi or /boot/efi and only used for grub and it's config while the /boot folders are either on thier own partition per install or part of the / partition so kernel and initrd are kept separate per install.

Offline

#3 2024-03-03 18:06:34

Turtyo
Member
Registered: 2023-03-26
Posts: 20

Re: [SOLVED] PC boots to UEFI instead of GRUB after dual Arch install

I checked fstab when I tried to get my first Arch install back. I mount the EFI FAT32 partition to /efi on the old install.
On the new install, I mounted it to /boot/efi. The /boot is part of each install, so they are one they're own partition too (respectively, p6 and p2, as written in my original message). Maybe I misunderstood what you meant by that though.
I was thinking earlier that maybe I broke things because the mount point of /dev/nvmen1p1 (the EFI partition) was different on the two installs, and that it confused the os-prober when I tried to detect the newest install.
On the old install, I mounted p2 on the /mnt of p6 and executed the os-prober. I think that part was correct.

Offline

#4 2024-03-04 15:46:28

cryptearth
Member
Registered: 2024-02-03
Posts: 1,090

Re: [SOLVED] PC boots to UEFI instead of GRUB after dual Arch install

/boot is the designated space for anything the system needs to boot. If you share it between different systems it will cause issues.
So having /boot as part of the / partition and mount the ESP on a different directory is a good thing. It shouldn't matter if it's /efi or /boot/efi.
The goal is to have it only for grub and not the kernel and initrd - so far you're all good.
As your uefi is able to at least boot grub it seems to be only a matter of grub config to have two different entries, one per install.
As far as I'm aware about os-prober to able to find boot files the partition contain them has to be mounted somewhere. So if you have access to one of the systems in should be sufficient to just mount the other one on like /mnt and run grub-mkconfig with the override set in the defaults config.

Another option could be to not use os-prober but to copy the entry of the accessible system and just change the uuid.

As for shared swap: I'm not sure but it could cause issues.

Offline

#5 2024-03-04 18:30:22

Turtyo
Member
Registered: 2023-03-26
Posts: 20

Re: [SOLVED] PC boots to UEFI instead of GRUB after dual Arch install

Hey, thank you the input regarding the different mountpoint for the EFI partition.

As I said in my original post:

Turtyo wrote:

I tried to at least boot into my old Arch, so I booted the USB stick again, and following this comment, I mounted the partitions of my old Arch install

This comment describes mounting the partitions after being in a chroot, and executing grub-mkconfig -o to make a new config file.
I already tried this, but I will try again just in case. I will take the occasion to get some command output since I didn't include that in my first post (sorry about that). I'm not too sure about modifying the entry without os-prober, wouldn't it be safer to install grub again instead ?

I'm also unsure if the UEFI is actually booting GRUB or not, since I just see a black screen, disk powering up in the PC and I'm brought directly to the UEFI screen. I don't see any GRUB entry nor option.

For shared swap, I found several places that said it was fine to have shared swap: here and here for example. I know those aren't doc in themselves but I found other similar stuff in other places. And it makes sense, since the swap is used as an extension of RAM and it's cleared on shutdown if you don't hibernate/suspend to disk (which I don't do). I could be wrong though, maybe there is a side effect on boot and GRUB.

Offline

#6 2024-03-04 19:08:51

cryptearth
Member
Registered: 2024-02-03
Posts: 1,090

Re: [SOLVED] PC boots to UEFI instead of GRUB after dual Arch install

Well, to get at least grub working you need one of two options:

1) have a uefi boot entry pointing to esp/EFI/<grub>/grubx64.efi (where <grub> is the bootloader-id used in the install command)
2) have grub installed with the --removable flag so it installs itself in the fallback path esp/EFI/boot/bootx64.efi

If you can boot any live system (an arch install preferable) you should be able to mount one of your installs to /mnt, mount the esp at the correct mountpoint within it - use arch-chroot to chroot into it - and get a clean grub working with

grub-install --target=x86_64-efi --efi-directory=<esp mountpoint> --bootloader-id=grub

This way you should get at least a new grub entry in your uefi - or add the --removable flag - this way your uefi should pick it up on its own.
Use

efibootmgr

to verify the install was ok.

If this worked you should be able to get a config done

grub-mkconfig -o <esp mountpoint>/grub/grub.cfg

Note that the grub config has to be placed where you install grub to - not just blindly in /boot as this is not accessible by grub at the early stage to even find the boot partition.

Offline

#7 2024-03-04 19:20:06

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,489
Website

Re: [SOLVED] PC boots to UEFI instead of GRUB after dual Arch install

cryptearth wrote:
grub-mkconfig -o <esp mountpoint>/grub/grub.cfg

Note that the grub config has to be placed where you install grub to - not just blindly in /boot as this is not accessible by grub at the early stage to even find the boot partition.

That is not correct. The path is always /boot/grub/grub.cfg and in this case the OP's /boot/ is on the root partition.

https://wiki.archlinux.org/title/GRUB#G … d_grub.cfg

Turtyo wrote:

I also installed grub-customizer

Remove that, it just breaks things.


Para todos todo, para nosotros nada

Offline

#8 2024-03-04 19:33:31

Turtyo
Member
Registered: 2023-03-26
Posts: 20

Re: [SOLVED] PC boots to UEFI instead of GRUB after dual Arch install

Here is the fstab of my old config:

cat /mnt/etc/fstab
# Static information about the filesystems.
# See fstab(5) for details.

# <file system> <dir> <type> <options> <dump> <pass>
# /dev/nvme0n1p6
UUID=7dd090e4-86e2-46b6-9aa9-f2a7080ea654	/         	ext4      	rw,relatime	0 1

# /dev/nvme0n1p1 LABEL=SYSTEM_DRV
UUID=BECC-B6E4      	/efi      	vfat      	rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro	0 2

# /dev/nvme0n1p5
UUID=9c376f2f-9c5e-4fd1-9b74-629cbf0066bf	none      	swap      	defaults  	0 0

# /dev/sda3
# (identifier)  	(location, eg sda5)   (format, eg ext3 or ext4)      (some settings) 
UUID=32391faf-5aca-460f-9110-04d265e3dc8e   /home    ext4         rw,relatime       0       2 

The fstab of the new Arch install:

cat/mnt/etc/fstab
# /dev/nvme0n1p2
UUID=66038177-4f18-4170-8ce2-f595bf4bd632	/         	ext4      	rw,relatime	0 1

# /dev/nvme0n1p1 LABEL=SYSTEM_DRV
UUID=BECC-B6E4      	/boot/efi 	vfat      	rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro	0 2

# /dev/sda1
UUID=97f2d023-0410-4af4-aef9-a0b87b06550b	/home     	ext4      	rw,relatime	0 2

# /dev/nvme0n1p5
UUID=9c376f2f-9c5e-4fd1-9b74-629cbf0066bf	none      	swap      	defaults  	0 0

And the grub.cfg

cat /mnt/boot/grub/grub.cfg
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
insmod part_gpt
insmod part_msdos
if [ -s $prefix/grubenv ]; then
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="0"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root 7dd090e4-86e2-46b6-9aa9-f2a7080ea654
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
fi
terminal_input console
terminal_output gfxterm
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-7dd090e4-86e2-46b6-9aa9-f2a7080ea654' {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_gpt
	insmod ext2
	search --no-floppy --fs-uuid --set=root 7dd090e4-86e2-46b6-9aa9-f2a7080ea654
	echo	'Loading Linux linux ...'
	linux	/boot/vmlinuz-linux root=UUID=7dd090e4-86e2-46b6-9aa9-f2a7080ea654 rw  loglevel=3 quiet
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initramfs-linux.img
}
submenu 'Advanced options for Arch Linux' $menuentry_id_option 'gnulinux-advanced-7dd090e4-86e2-46b6-9aa9-f2a7080ea654' {
	menuentry 'Arch Linux, with Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-7dd090e4-86e2-46b6-9aa9-f2a7080ea654' {
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_gpt
		insmod ext2
		search --no-floppy --fs-uuid --set=root 7dd090e4-86e2-46b6-9aa9-f2a7080ea654
		echo	'Loading Linux linux ...'
		linux	/boot/vmlinuz-linux root=UUID=7dd090e4-86e2-46b6-9aa9-f2a7080ea654 rw  loglevel=3 quiet
		echo	'Loading initial ramdisk ...'
		initrd	/boot/initramfs-linux.img
	}
	menuentry 'Arch Linux, with Linux linux (fallback initramfs)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-7dd090e4-86e2-46b6-9aa9-f2a7080ea654' {
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_gpt
		insmod ext2
		search --no-floppy --fs-uuid --set=root 7dd090e4-86e2-46b6-9aa9-f2a7080ea654
		echo	'Loading Linux linux ...'
		linux	/boot/vmlinuz-linux root=UUID=7dd090e4-86e2-46b6-9aa9-f2a7080ea654 rw  loglevel=3 quiet
		echo	'Loading initial ramdisk ...'
		initrd	/boot/initramfs-linux-fallback.img
	}
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/25_bli ###
if [ "$grub_platform" = "efi" ]; then
  insmod bli
fi
### END /etc/grub.d/25_bli ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/30_uefi-firmware ###
if [ "$grub_platform" = "efi" ]; then
	fwsetup --is-supported
	if [ "$?" = 0 ]; then
		menuentry 'UEFI Firmware Settings' $menuentry_id_option 'uefi-firmware' {
			fwsetup
		}
	fi
fi
### END /etc/grub.d/30_uefi-firmware ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg
fi
### END /etc/grub.d/41_custom ###

And just to be sure, some ls at some places to be sure that everything is in the correct place

ls -p /mnt/boot
efi/
grub/
initramfs-linux.img
initramfs-linux-fallback.img
vmlinuz-linux
ls -p /mnt/boot/grub
fonts/
grub.cfg
grubenv
locale/
themes/
x86_64-efi/

Offline

#9 2024-03-04 19:50:19

Turtyo
Member
Registered: 2023-03-26
Posts: 20

Re: [SOLVED] PC boots to UEFI instead of GRUB after dual Arch install

Can I just remove grub-customizer with a normal pacman -Ry ? Or do I need to arch-chroot first ?
I'm curious to know why something that breaks grub is available on the repo

So just to be sure, mount all partitions according to my fstab (see above), arch-chroot then:

 grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=grub

But it's a bit confusing, because I mount /dev/nvmen1p1 to /efi according to my first fstab. Shouldn't the fstab entry point to /boot/efi ?
And check with

efibootmgr
grub-mkconfig -o /boot/grub/grub.cfg

The fact that the fstab points to /efi in the old config seems a bit strange, no ? I don't see when I would have edited the fstab of my old config though.
Would a lsblk -f be needed here ? For maybe a bit more clarity than my hand typed version in my first post.
And thank you for helping me you two

Last edited by Turtyo (2024-03-04 19:52:34)

Offline

#10 2024-03-04 20:18:51

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,489
Website

Re: [SOLVED] PC boots to UEFI instead of GRUB after dual Arch install

Turtyo wrote:

Can I just remove grub-customizer with a normal pacman -Ry ? Or do I need to arch-chroot first ?

You will need to chroot into the system to remove the package; `pacman -Ry` won't work though.

Turtyo wrote:

I'm curious to know why something that breaks grub is available on the repo

Me too.

Turtyo wrote:

But it's a bit confusing, because I mount /dev/nvmen1p1 to /efi according to my first fstab. Shouldn't the fstab entry point to /boot/efi ?

The systemd developers recommend not using /boot/efi/ any more because it complicates autofs mounts[1]. Either will work with GRUB though.

It would probably be best to share the `efibootmgr` output here.

[1] https://uapi-group.org/specifications/s … unt-points


Para todos todo, para nosotros nada

Offline

#11 2024-03-04 20:29:06

Turtyo
Member
Registered: 2023-03-26
Posts: 20

Re: [SOLVED] PC boots to UEFI instead of GRUB after dual Arch install

If pacman won't work, do I need to manually remove the package from a /usr/bin or something like that ? Wouldn't that break dependencies? Not that it's my biggest problem right now though lol
I will probably change the mount point of the EFI partition in my new install so that it points to /efi instead of /boot/efi.
Here is the output of `efibootmgr`

BootCurrent: 0002
Timeout: 0 seconds
BootOrder: 2001,0004,0003,2003,2002
Boot0000* EFI Network 0 for IPv4 (54-E1-AD-43-64-17) 	PciRoot(0x0)/Pci(0x1c,0x3)/Pci(0x0,0x0)/MAC(54e1ad436417,0)/IPv4(0.0.0.0,0,DHCP,0.0.0.0,0.0.0.0,0.0.0.0)RC
Boot0001* EFI Network 0 for IPv6 (54-E1-AD-43-64-17) 	PciRoot(0x0)/Pci(0x1c,0x3)/Pci(0x0,0x0)/MAC(54e1ad436417,0)/IPv6([::],0,Static,[::],[::],64)RC
Boot0002* EFI USB Device (SMI     USB DISK)	PciRoot(0x0)/Pci(0x14,0x0)/USB(17,0)/HD(1,MBR,0x8cc6f18c,0x1cf800,0x7800)RC
Boot0003* Windows Boot Manager	HD(1,GPT,4dfaab9d-60aa-4708-86a4-44d7805eda40,0x800,0x82000)/\EFI\Microsoft\Boot\bootmgfw.efi57494e444f5753000100000088000000780000004200430044004f0042004a004500430054003d007b00390064006500610038003600320063002d0035006300640064002d0034006500370030002d0061006300630031002d006600330032006200330034003400640034003700390035007d00000000000100000010000000040000007fff0400
Boot0004* GRUB	HD(1,GPT,4dfaab9d-60aa-4708-86a4-44d7805eda40,0x800,0x82000)/\EFI\GRUB\grubx64.efi
Boot0007* EFI Network 0 for IPv4 (54-E1-AD-43-64-17) 	PciRoot(0x0)/Pci(0x1c,0x3)/Pci(0x0,0x0)/MAC(54e1ad436417,0)/IPv4(0.0.0.0,0,DHCP,0.0.0.0,0.0.0.0,0.0.0.0)RC
Boot0008* EFI Network 0 for IPv6 (54-E1-AD-43-64-17) 	PciRoot(0x0)/Pci(0x1c,0x3)/Pci(0x0,0x0)/MAC(54e1ad436417,0)/IPv6([::],0,Static,[::],[::],64)RC
Boot0009* Windows Boot Manager	HD(2,GPT,3a9ac3fd-daaf-46db-bec7-7cbeb802e3ad,0x96800,0x32000)/\EFI\Microsoft\Boot\bootmgfw.efi57494e444f5753000100000088000000780000004200430044004f0042004a004500430054003d007b00390064006500610038003600320063002d0035006300640064002d0034006500370030002d0061006300630031002d006600330032006200330034003400640034003700390035007d00000032000100000010000000040000007fff0400
Boot2001* EFI USB Device	RC
Boot2002* EFI DVD/CDROM	RC
Boot2003* EFI Network	RC

Offline

#12 2024-03-05 08:25:13

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 23,447

Re: [SOLVED] PC boots to UEFI instead of GRUB after dual Arch install

pacman will work but -Ry is not a removal command, you're more likely to look for -Rns or so.

Judging by that efibootmgr output, your GRUB should be there and bootable

Offline

#13 2024-03-05 18:06:41

Turtyo
Member
Registered: 2023-03-26
Posts: 20

Re: [SOLVED] PC boots to UEFI instead of GRUB after dual Arch install

yes idk why I said -Ry, I usually use -Rn
I tried to generate the grub.cfg after removing grub-customizer, but that did not work.

Problem was solved after reinstalling grub with:

 grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id=GRUB

My next steps will be to boot on USB key to change things on the new partition (now that i got my old arch install back): mount the EFI partition to /efi instead of /boot/efi and generate the fstab again, then go back to my main partition and generate the grub.cfg with the os-prober activated. I'll probably do a backup of grub.cfg before, just in case.
I think grub-customizer is the thing that broke my grub, because that's basically the only thing i did that was not in the manual (but I assumed was safe if it was on the official repo...)

Thank you for the help ! I will mark this as solved and I hope to not break something else soon smile

Last edited by Turtyo (2024-03-05 18:09:14)

Offline

Board footer

Powered by FluxBB