You are not logged in.

#1 2023-10-10 22:36:55

Nico792
Member
Registered: 2023-09-24
Posts: 18

[SOLVED]Grub doesn't detect Arch, even though I configure it from Arch

Hi, I am trying to add other os boot options to grub. What I did (all maybe relevant information):

Edit fstab (this was not required, but this is just something I wanted to do): (fstab has been backed up)

# Static information about the filesystems.
# See fstab(5) for details.

# <file system> <dir> <type> <options> <dump> <pass>
# /dev/nvme0n1p6
UUID=c2cb89b8-c6a7-44f2-ba26-98be335a5a10	/         	ext4      	rw,relatime	0 1

# /dev/nvme0n1p3
UUID=71D5-4ADD      	/efi     	vfat      	rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro	0 2

UUID=93f408be-c02a-4c67-a0b4-14be490f1e6f	/ubuntu		ext4		rw,relatime	0 3

/ubuntu is just a mount of my ubuntu partition so I can access my files, this already existed. My change was to change /boot into /efi

I rebooted at this point to see if this would work fine, it did. I saw no errors when booting.

Then I ran this command:

grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id=Universal Boot

this gave no errors

Then I ran this: (I backed up the old config)

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

it outputted this:

Generating grub configuration file ...
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Found Windows Boot Manager on /dev/nvme0n1p1@/efi/Microsoft/Boot/bootmgfw.efi
Found Ubuntu 22.04.3 LTS (22.04) on /dev/nvme0n1p5
Adding boot menu entry for UEFI Firmware Settings ...
done

Here lies the problem, when I tried this previously, I just rebooted at this point and only then figured out that I couldn't boot back into arch (thank god for the backup). I know at this point why I wasn't able to, this is the config it generated:

#
# 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 c2cb89b8-c6a7-44f2-ba26-98be335a5a10
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
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 ###

### 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 ###
menuentry 'Windows Boot Manager (on /dev/nvme0n1p1)' --class windows --class os $menuentry_id_option 'osprober-efi-DC86-0EFE' {
	insmod part_gpt
	insmod fat
	search --no-floppy --fs-uuid --set=root DC86-0EFE
	chainloader /efi/Microsoft/Boot/bootmgfw.efi
}
menuentry 'Ubuntu 22.04.3 LTS (22.04) (on /dev/nvme0n1p5)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-93f408be-c02a-4c67-a0b4-14be490f1e6f' {
	insmod part_gpt
	insmod ext2
	search --no-floppy --fs-uuid --set=root 93f408be-c02a-4c67-a0b4-14be490f1e6f
	linux /boot/vmlinuz-6.2.0-33-generic root=UUID=93f408be-c02a-4c67-a0b4-14be490f1e6f ro quiet splash $vt_handoff
	initrd /boot/initrd.img-6.2.0-33-generic
}
submenu 'Advanced options for Ubuntu 22.04.3 LTS (22.04) (on /dev/nvme0n1p5)' $menuentry_id_option 'osprober-gnulinux-advanced-93f408be-c02a-4c67-a0b4-14be490f1e6f' {
	menuentry 'Ubuntu (on /dev/nvme0n1p5)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-6.2.0-33-generic--93f408be-c02a-4c67-a0b4-14be490f1e6f' {
		insmod part_gpt
		insmod ext2
		search --no-floppy --fs-uuid --set=root 93f408be-c02a-4c67-a0b4-14be490f1e6f
		linux /boot/vmlinuz-6.2.0-33-generic root=UUID=93f408be-c02a-4c67-a0b4-14be490f1e6f ro quiet splash $vt_handoff
		initrd /boot/initrd.img-6.2.0-33-generic
	}
	menuentry 'Ubuntu, with Linux 6.2.0-33-generic (on /dev/nvme0n1p5)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-6.2.0-33-generic--93f408be-c02a-4c67-a0b4-14be490f1e6f' {
		insmod part_gpt
		insmod ext2
		search --no-floppy --fs-uuid --set=root 93f408be-c02a-4c67-a0b4-14be490f1e6f
		linux /boot/vmlinuz-6.2.0-33-generic root=UUID=93f408be-c02a-4c67-a0b4-14be490f1e6f ro quiet splash $vt_handoff
		initrd /boot/initrd.img-6.2.0-33-generic
	}
	menuentry 'Ubuntu, with Linux 6.2.0-33-generic (recovery mode) (on /dev/nvme0n1p5)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-6.2.0-33-generic--93f408be-c02a-4c67-a0b4-14be490f1e6f' {
		insmod part_gpt
		insmod ext2
		search --no-floppy --fs-uuid --set=root 93f408be-c02a-4c67-a0b4-14be490f1e6f
		linux /boot/vmlinuz-6.2.0-33-generic root=UUID=93f408be-c02a-4c67-a0b4-14be490f1e6f ro recovery nomodeset dis_ucode_ldr
		initrd /boot/initrd.img-6.2.0-33-generic
	}
	menuentry 'Ubuntu, with Linux 6.2.0-32-generic (on /dev/nvme0n1p5)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-6.2.0-32-generic--93f408be-c02a-4c67-a0b4-14be490f1e6f' {
		insmod part_gpt
		insmod ext2
		search --no-floppy --fs-uuid --set=root 93f408be-c02a-4c67-a0b4-14be490f1e6f
		linux /boot/vmlinuz-6.2.0-32-generic root=UUID=93f408be-c02a-4c67-a0b4-14be490f1e6f ro quiet splash $vt_handoff
		initrd /boot/initrd.img-6.2.0-32-generic
	}
	menuentry 'Ubuntu, with Linux 6.2.0-32-generic (recovery mode) (on /dev/nvme0n1p5)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-6.2.0-32-generic--93f408be-c02a-4c67-a0b4-14be490f1e6f' {
		insmod part_gpt
		insmod ext2
		search --no-floppy --fs-uuid --set=root 93f408be-c02a-4c67-a0b4-14be490f1e6f
		linux /boot/vmlinuz-6.2.0-32-generic root=UUID=93f408be-c02a-4c67-a0b4-14be490f1e6f ro recovery nomodeset dis_ucode_ldr
		initrd /boot/initrd.img-6.2.0-32-generic
	}
}

### 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 ###

Note that although other os's (ubuntu and windows) have entries, but Arch doesn't. I've been trying to figure out why that is, but I have no clue. I also couldn't find the issue in the wiki troubleshooting, but I may have overlooked it.

If anyone has any idea of what I should do, I'd appreciate the help!

extra context. here are some more files:
my old working 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 c2cb89b8-c6a7-44f2-ba26-98be335a5a10
    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-c2cb89b8-c6a7-44f2-ba26-98be335a5a10' {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_gpt
	insmod fat
	search --no-floppy --fs-uuid --set=root 71D5-4ADD
	echo 'loading linux-zen ...'
	linux /vmlinuz-linux-zen root=UUID=c2cb89b8-c6a7-44f2-ba26-98be335a5a10 rw loglevel=3
	echo 'Loading init ramdisk ...'
	initrd /initramfs-linux-zen.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 ###

I tried to copy the arch entry into the other file, this gave me the option to boot into arch, however it booted into emergency mode and wasn't able to access root to log me into that, so I reverted that change. And besides that I am pretty sure grub is supposed to just detect arch.

/etc/default/grub:

# GRUB boot loader configuration

GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Arch"
GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3"
GRUB_CMDLINE_LINUX=""

# 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

# Set to 'countdown' or 'hidden' to change timeout behavior,
# press ESC key to display menu.
GRUB_TIMEOUT_STYLE=menu

# 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 `videoinfo'
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

# Uncomment and set to the desired menu colors.  Used by normal and wallpaper
# modes only.  Entries specified as foreground/background.
#GRUB_COLOR_NORMAL="light-blue/black"
#GRUB_COLOR_HIGHLIGHT="light-cyan/blue"

# Uncomment one of them for the gfx desired, a image background or a gfxtheme
#GRUB_BACKGROUND="/path/to/wallpaper"
#GRUB_THEME="/path/to/gfxtheme"

# Uncomment to get a beep at GRUB start
#GRUB_INIT_TUNE="480 440 1"

# Uncomment to make GRUB remember the last selection. This requires
# setting 'GRUB_DEFAULT=saved' above.
#GRUB_SAVEDEFAULT=true

# Uncomment to disable submenus in boot menu
#GRUB_DISABLE_SUBMENU=y

# Probing for other operating systems is disabled for security reasons. Read
# documentation on GRUB_DISABLE_OS_PROBER, if still want to enable this
# functionality install os-prober and uncomment to detect and include other
# operating systems.
GRUB_DISABLE_OS_PROBER=false

The only change I consciously made here was to un comment the last line

lsblk -f:

NAME        FSTYPE FSVER LABEL            UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
loop0                                                                                0   100% /var/lib/snapd/snap/intellij-idea-community/456
                                                                                              /var/lib/sna
                                                                                              pd/snap/inte
                                                                                              llij-idea-co
                                                                                              mmunity/456
loop1                                                                                0   100% /var/lib/snapd/snap/core18/2790
                                                                                              /var/lib/sna
                                                                                              pd/snap/core
                                                                                              18/2790
loop2                                                                                0   100% /var/lib/snapd/snap/snapd/20092
                                                                                              /var/lib/sna
                                                                                              pd/snap/snap
                                                                                              d/20092
nvme0n1
├─nvme0n1p1 vfat   FAT32 SYSTEM           DC86-0EFE
├─nvme0n1p2
├─nvme0n1p3 vfat   FAT32                  71D5-4ADD                               383M    23% /efi
├─nvme0n1p4 ntfs         Windows RE tools D2B408CBB408B3CF
├─nvme0n1p5 ext4   1.0                    93f408be-c02a-4c67-a0b4-14be490f1e6f  370.9G     9% /ubuntu
└─nvme0n1p6 ext4   1.0                    c2cb89b8-c6a7-44f2-ba26-98be335a5a10  424.8G    11% /var/lib/snapd/snap
                                                                                              /

Last edited by Nico792 (2023-10-11 11:13:59)

Offline

#2 2023-10-11 00:10:43

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,237

Re: [SOLVED]Grub doesn't detect Arch, even though I configure it from Arch

When "changing /boot to /efi" did you copy over initramfs and vmlinuz-linux-zen over to /boot as well/reinstalled the linux package so that the relevant images get regenerated?

Last edited by V1del (2023-10-11 00:11:36)

Offline

#3 2023-10-11 07:02:00

Nico792
Member
Registered: 2023-09-24
Posts: 18

Re: [SOLVED]Grub doesn't detect Arch, even though I configure it from Arch

this is what /efi contains:

❯ la
total 116M
drwxr-xr-x 5 root root 4.0K Oct 11 00:05 EFI
-rwxr-xr-x 1 root root  36M Oct 10 23:06 initramfs-linux-fallback.img
-rwxr-xr-x 1 root root 9.6M Oct 10 23:06 initramfs-linux.img
-rwxr-xr-x 1 root root  37M Oct 10 23:06 initramfs-linux-zen-fallback.img
-rwxr-xr-x 1 root root 9.6M Oct 10 23:06 initramfs-linux-zen.img
-rwxr-xr-x 1 root root  13M Oct  9 16:18 vmlinuz-linux
-rwxr-xr-x 1 root root  14M Oct  9 16:18 vmlinuz-linux-zen

Do I need to move the images back to /boot?

I tried doing

sudo mkinitcpio -p linux-zen

and it complained saying this:

==> Building image from preset: /etc/mkinitcpio.d/linux-zen.preset: 'default'
==> Using default configuration file: '/etc/mkinitcpio.conf'
  -> -k /boot/vmlinuz-linux-zen -g /boot/initramfs-linux-zen.img --microcode /boot/*-ucode.img
==> ERROR: specified kernel image does not exist: '/boot/vmlinuz-linux-zen'
==> Building image from preset: /etc/mkinitcpio.d/linux-zen.preset: 'fallback'
==> Using default configuration file: '/etc/mkinitcpio.conf'
  -> -k /boot/vmlinuz-linux-zen -g /boot/initramfs-linux-zen-fallback.img -S autodetect --microcode /boot/*-ucode.img
==> ERROR: specified kernel image does not exist: '/boot/vmlinuz-linux-zen'

I would normally just copy things over but I'm trying to not break my system

EDIT: /boot  only contains a grub dir with all the grub files in there

Last edited by Nico792 (2023-10-11 07:04:38)

Offline

#4 2023-10-11 10:14:53

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,237

Re: [SOLVED]Grub doesn't detect Arch, even though I configure it from Arch

Yes copy all of these over to /boot. I'd surmise that's your reason for switching ESP locations, is it not?

Offline

#5 2023-10-11 11:13:03

Nico792
Member
Registered: 2023-09-24
Posts: 18

Re: [SOLVED]Grub doesn't detect Arch, even though I configure it from Arch

Yes that did it, thank you very much!

Offline

Board footer

Powered by FluxBB