You are not logged in.

#1 2023-09-22 14:18:08

hertelukas
Member
Registered: 2023-09-22
Posts: 4

[SOLVED] Archlinux not showing up in grub - using existing grub

I currently daily drive fedora (nvme1n1), but want to dual boot to arch (next to windows). My system uses UEFI, and due to grub already being installed, I used a whole drive as my partition (nvme0n1p1) for arch - using btrfs.

Fedora uses `/boot/grub2/grub.cfg` (nvme1n1p2) for legacy BIOS and `/boot/efi/EFI/fedora/grub.cfg` (nvme1n1p1) for UEFI. Running `grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg` detects arch:

Generating grub configuration file ...
Found Arch Linux on /dev/nvme0n1p1
Found Windows Boot Manager on /dev/nvme1n1p1@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for UEFI Firmware Settings ...
done

But it does not appear when rebooting into grub. To make sure that I did not accidentally use a different grub config, I set the timer to 15 seconds and only remade this file, and indeed the timer is now 15 seconds.

Some hopefully useful information:

Disk /dev/sda: 465.76 GiB, 500107862016 bytes, 976773168 sectors
Disk model: Samsung SSD 850
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 0666E6D1-55E2-4DA8-9ECE-35275892D093

Device     Start       End   Sectors   Size Type
/dev/sda1   2048     34815     32768    16M Microsoft reserved
/dev/sda2  34816 976773119 976738304 465.7G Microsoft basic data


Disk /dev/sdb: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: ST1000DM003-1CH1
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x40d205b3

Device     Boot Start        End    Sectors   Size Id Type
/dev/sdb1        2048 1953521663 1953519616 931.5G  7 HPFS/NTFS/exFAT


Disk /dev/nvme0n1: 894.25 GiB, 960197124096 bytes, 1875385008 sectors
Disk model: Force MP510
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 4FD0249D-4B14-4493-A92A-9E90BDAB52D4

Device         Start        End    Sectors   Size Type
/dev/nvme0n1p1  2048 1875384319 1875382272 894.3G Linux filesystem


Disk /dev/nvme1n1: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: Samsung SSD 970 EVO Plus 1TB
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 3C849A7A-EAA6-4F6A-AC14-7047F98282D7

Device           Start        End    Sectors   Size Type
/dev/nvme1n1p1    2048    1230847    1228800   600M EFI System
/dev/nvme1n1p2 1230848    3327999    2097152     1G Linux filesystem
/dev/nvme1n1p3 3328000 1953523711 1950195712 929.9G Linux filesystem

and my fstab on arch looks like this: (note that the devices have different names, but this should be correct)

# <file system> <dir> <type> <options> <dump> <pass>
# /dev/nvme1n1p1 LABEL=arch
UUID=8e5093aa-45b7-476b-8a85-79e733e36eca       /               btrfs           rw,relatime,ssd,discard=async,space_cache=v2,subvolid=5,subvol=/    0 0

# /dev/nvme0n1p1
UUID=989F-11FC          /efi            vfat            rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro       0 2

UUID=8e5093aa-45b7-476b-8a85-79e733e36eca       /home           btrfs           rw,relatime,ssd,discard=async,space_cache=v2,subvol=/home  0 0

I happily provide further information, if useful or needed.

Last edited by hertelukas (2023-09-23 14:00:25)

Offline

#2 2023-09-22 15:08:15

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,768

Re: [SOLVED] Archlinux not showing up in grub - using existing grub

Post the grub.cfg that got created.

Technically this is a fedora question, as their GRUB needs to properly detect and apply configurations to set up the Arch kernel, but let's see what it actually generates.

Offline

#3 2023-09-22 15:35:07

hertelukas
Member
Registered: 2023-09-22
Posts: 4

Re: [SOLVED] Archlinux not showing up in grub - using existing grub

I tried grub-mkconfig from inside arch, by using chroot from the live USB stick. -> I tried to overwrite the fedora config, and because from arch, even though I mounted all partitions, os-prober didn't detect anything at all, I destroyed the config.

Therefore, I loaded into a fedora live environment, mounted the EFI partition and ran grub2-mkconfig. Every OS got detected (arch, windows and fedora) but after rebooting, I can only select windows - not even my original fedora install.

Here is the result from the live usb, detecting everything but only allowing me to boot into windows.

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

### BEGIN /etc/grub.d/00_header ###
set pager=1

if [ -f ${config_directory}/grubenv ]; then
  load_env -f ${config_directory}/grubenv
elif [ -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 ext2
search --no-floppy --fs-uuid --set=root 8fe0120d-7a70-4e73-8185-f8521c2529e0
    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_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/01_users ###
if [ -f ${prefix}/user.cfg ]; then
  source ${prefix}/user.cfg
  if [ -n "${GRUB2_PASSWORD}" ]; then
    set superusers="root"
    export superusers
    password_pbkdf2 root ${GRUB2_PASSWORD}
  fi
fi
### END /etc/grub.d/01_users ###

### BEGIN /etc/grub.d/08_fallback_counting ###
insmod increment
# Check if boot_counter exists and boot_success=0 to activate this behaviour.
if [ -n "${boot_counter}" -a "${boot_success}" = "0" ]; then
  # if countdown has ended, choose to boot rollback deployment,
  # i.e. default=1 on OSTree-based systems.
  if  [ "${boot_counter}" = "0" -o "${boot_counter}" = "-1" ]; then
    set default=1
    set boot_counter=-1
  # otherwise decrement boot_counter
  else
    decrement boot_counter
  fi
  save_env boot_counter
fi
### END /etc/grub.d/08_fallback_counting ###

### BEGIN /etc/grub.d/10_linux ###
insmod ext2
search --no-floppy --fs-uuid --set=root 8fe0120d-7a70-4e73-8185-f8521c2529e0
insmod ext2
search --no-floppy --fs-uuid --set=boot 8fe0120d-7a70-4e73-8185-f8521c2529e0

# This section was generated by a script. Do not modify the generated file - all changes
# will be lost the next time file is regenerated. Instead edit the BootLoaderSpec files.
#
# The blscfg command parses the BootLoaderSpec files stored in /boot/loader/entries and
# populates the boot menu. Please refer to the Boot Loader Specification documentation
# for the files format: https://systemd.io/BOOT_LOADER_SPECIFICATION/.

# The kernelopts variable should be defined in the grubenv file. But to ensure that menu
# entries populated from BootLoaderSpec files that use this variable work correctly even
# without a grubenv file, define a fallback kernelopts variable if this has not been set.
#
# The kernelopts variable in the grubenv file can be modified using the grubby tool or by
# executing the grub2-mkconfig tool. For the latter, the values of the GRUB_CMDLINE_LINUX
# and GRUB_CMDLINE_LINUX_DEFAULT options from /etc/default/grub file are used to set both
# the kernelopts variable in the grubenv file and the fallback kernelopts variable.
if [ -z "${kernelopts}" ]; then
  set kernelopts="root=UUID=8fe0120d-7a70-4e73-8185-f8521c2529e0 ro  "
fi

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

### BEGIN /etc/grub.d/10_reset_boot_success ###
# Hiding the menu is ok if last boot was ok or if this is a first boot attempt to boot the entry
if [ "${boot_success}" = "1" -o "${boot_indeterminate}" = "1" ]; then
  set menu_hide_ok=1
else
  set menu_hide_ok=0 
fi
# Reset boot_indeterminate after a successful boot
if [ "${boot_success}" = "1" ] ; then
  set boot_indeterminate=0
# Avoid boot_indeterminate causing the menu to be hidden more than once
elif [ "${boot_indeterminate}" = "1" ]; then
  set boot_indeterminate=2
fi
# Reset boot_success for current boot 
set boot_success=0
save_env boot_success boot_indeterminate
### END /etc/grub.d/10_reset_boot_success ###

### BEGIN /etc/grub.d/12_menu_auto_hide ###
if [ x$feature_timeout_style = xy ] ; then
  if [ "${menu_show_once}" ]; then
    unset menu_show_once
    save_env menu_show_once
    set timeout_style=menu
    set timeout=60
  elif [ "${menu_auto_hide}" -a "${menu_hide_ok}" = "1" ]; then
    set orig_timeout_style=${timeout_style}
    set orig_timeout=${timeout}
    if [ "${fastboot}" = "1" ]; then
      # timeout_style=menu + timeout=0 avoids the countdown code keypress check
      set timeout_style=menu
      set timeout=0
    else
      set timeout_style=hidden
      set timeout=1
    fi
  fi
fi
### END /etc/grub.d/12_menu_auto_hide ###

### BEGIN /etc/grub.d/14_menu_show_once ###
if [ x$feature_timeout_style = xy ]; then
  if [ "${menu_show_once_timeout}" ]; then
    set timeout_style=menu
    set timeout="${menu_show_once_timeout}"
    unset menu_show_once_timeout
    save_env menu_show_once_timeout
  fi
fi
### END /etc/grub.d/14_menu_show_once ###

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

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

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

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Windows Boot Manager (on /dev/nvme0n1p1)' --class windows --class os $menuentry_id_option 'osprober-efi-989F-11FC' {
	insmod part_gpt
	insmod fat
	search --no-floppy --fs-uuid --set=root 989F-11FC
	chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}


# Other OS found, undo autohiding of menu unless menu_auto_hide=2
if [ "${orig_timeout_style}" -a "${menu_auto_hide}" != "2" ]; then
  set timeout_style=${orig_timeout_style}
  set timeout=${orig_timeout}
fi
### END /etc/grub.d/30_os-prober ###

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

### BEGIN /etc/grub.d/35_fwupd ###
### END /etc/grub.d/35_fwupd ###

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

But in general, it should work to have only one btrfs partition for my arch installation, right? This was my first concern. Maybe grub can't find the arch kernel.

Offline

#4 2023-09-22 16:04:49

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,768

Re: [SOLVED] Archlinux not showing up in grub - using existing grub

That config is indeed completely broken now... the "installed" GRUB strongly relies on heuristics and special configs provided by the host system you originally used to set up GRUB (most distributions ship with specific configs for GRUB and how they want to handle the kernel, it's not entirely trviial to just run grub-mkconfig from different context on a GRUB that wasn't originally the distribution that installed GRUB), so your best bet is to boot that live disk, actually chroot into the fedora install with all partitions properly mounted and regenerate from the chroot.

Using the full disk for btrfs shouldn't be an inherent issue for GRUB (but generally speaking, there are lots of usecases that get confused when a drive doesn't have a partition table, you are strongly reccommended to set one up anyway)

Offline

#5 2023-09-22 16:11:36

hertelukas
Member
Registered: 2023-09-22
Posts: 4

Re: [SOLVED] Archlinux not showing up in grub - using existing grub

Thanks, I will try that!

I generated a gpt partition table, but with only one partition, this should be okay, or not?

Offline

#6 2023-09-22 16:50:10

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,768

Re: [SOLVED] Archlinux not showing up in grub - using existing grub

That's fine, yes.

Offline

#7 2023-09-23 13:59:44

hertelukas
Member
Registered: 2023-09-22
Posts: 4

Re: [SOLVED] Archlinux not showing up in grub - using existing grub

For future reference, I was not able to mount the efi partition when chroot-ing from the Fedora live-USB to my Fedora installation.

Therefore I installed arch again, deleted Grub and regenerated Grub after following the installation guide. - My Fedora installation still does not show up, but my windows and arch installation does. I probably screwed up my Fedora installation, I will update this post if I should know more.

Offline

Board footer

Powered by FluxBB