Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
kernel, boot, grub
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
jankom
Guru
Guru


Joined: 30 Aug 2021
Posts: 346
Location: USA

PostPosted: Sun Nov 03, 2024 11:41 pm    Post subject: kernel, boot, grub Reply with quote

I just have a simple question:
How important, or is it necessary, to have a line in my /etc/portage/make.conf file
Code:
GRUB_PLATFORMS="efi-64"
My system works fine, and I'm getting comfortable with Gentoo since my initial installation in 2021. Previously I had some linux experience with RedHat Fc-3 and CentOS. So the GRUB_PLATFORM definition is from the 2021 installation when I was trying to make my gentoo system work.

The reason I ask this question is because now I have an Akamai linode computing instance, also with Gentoo linux, but I'm unable to update the kernel there. I have done kernel compile and updates many times on my FC-3 linux and also on my current home Gentoo desktop machine.

The linode computing instance has kernel panic after kernel update (I can recover from it with rescue subsystem, chroot, etc), but the only difference I noted is that my home pc has the GRUB_PLATFOR definition, and a /boot/efi/ directory.

Jankom
Back to top
View user's profile Send private message
Ralphred
l33t
l33t


Joined: 31 Dec 2013
Posts: 645

PostPosted: Mon Nov 04, 2024 1:11 am    Post subject: Reply with quote

The GRUB_PLATFORM setting is really only used by the user when "installing the bootloader", as a function of grub-install. Grub still supports installing it's bootloader binary(s) directly to MBR*, or as an EFI compatible binary in a suitable place/partition**. If the machine is booting to the point grub is being loaded, and in turn is trying load the kernel, until you need to update the grub binaries by running grub-install then GRUB_PLATFORM won't cause you an issue. If you are unsure you can build grub with GRUB_PLATFORMS="efi-64 pc" and specify which to use at the time of running grub-install.

*Requires grub to be built with GRUB_PLATFORMS="pc"
**Requires grub to be built with GRUB_PLATFORMS="efi-64"
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5062
Location: Bavaria

PostPosted: Mon Nov 04, 2024 1:31 am    Post subject: Reply with quote

jankom,

the most common cause for a kernel panic at system startup is that the kernel receives (in this case FROM grub) incorrect information about its root partition (this is the kernel command line parameter “root=...”). But if root= is correct for you, then it would be helpful to get all the exact information of the kernel panic (if necessary by photo). The second most common cause is that the kernel is missing the modules it needs to access the root partition; see more here: https://forums.gentoo.org/viewtopic-p-8688524.html#8688524
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
jankom
Guru
Guru


Joined: 30 Aug 2021
Posts: 346
Location: USA

PostPosted: Mon Nov 04, 2024 6:00 pm    Post subject: Solved Reply with quote

Thank you - my simple question is answered. Apparently when I installed the gentoo system on my home pc I followed the gentoo instructions and added the GRUB_PLATFORMS definition.

As far as the linode gentoo boot kernel panic is concerned I think it is a linode issue. Originally I purchased the linnode computing instance in 2018 with xubuntu OS. Later on I decided to make it gentoo and similar to my home gentoo pc. However, I built my home gentoo pc with downloaded gentoo image for gui desktop
[5] default/linux/amd64/17.1/desktop (stable) *
and later updated to
[46] default/linux/amd64/23.0/split-usr/desktop (stable) *
based on eix-sync update notes at the time.
The linode computing instance was built automatically by Akamai linode selecting a gentoo OS. Initially the gentoo profile was
[1] default/linux/amd64/17.1 (stable) *
and later updated to
[45] default/linux/amd64/23.0/split-usr (stable) *
based on eix-sync update notes just like home pc.

However, I noticed that uname -r on linode was different than /usr/src/linux from ex-syn operations. I've contacted the linode Customer Support, and while they were eager to help could not really explain and solve the dilemma; they often referred me to gentoo.

After your answers I tried all sorts of things with gub, but ended up with boot failures and rescue disk; linode has a rescue boot option on their web console where I can access my linode disk, make change an do chroot.

I ended up with using the current linode kernel, i.e. booting from somewhere else, not using /boot and grub files.

Thanks for the quick reaction and answer to my "simple question". I'll mark this topic as SOLVED.

jankom (janos)

P.S.
Here is the kernel panic:
Code:
Unable to mount root fs on unknown-block(0,0)
Hardware name: Linode Compute Instance, BIOS Not Specified
[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) ]


The boot should be on /dev/sda - this is how I can access my system from a web console in my linode account. I mount media/sda and then chroot there to get back to my working set up (6.1.32 kernel and recreate grub).

One other information: after compiling kernel make install is complaining about not finding Lilo. The make install in /usr/src/linux does copy vmlinuz and System.map to /boot but without -6.6.52-gentoo... suffixes, and without an initramf file. The grub-mkconfig command does not recognize the new files in /boot unless I rename this with -6.6.52-gentoo suffixes. But then rebooting is with kernel panic.

So I just give up and use the linode kernel for booting.
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5062
Location: Bavaria

PostPosted: Mon Nov 04, 2024 6:40 pm    Post subject: Re: Solved Reply with quote

jankom wrote:
Here is the kernel panic:
Code:
Unable to mount root fs on unknown-block(0,0)
Hardware name: Linode Compute Instance, BIOS Not Specified
[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) ]

First of all: Your kernel panic has nothing to do with your Gentoo profile.

I think the reason is: You are/want booting a kernel which needs (and has) an initramfs ... BUT ... grub does not load the initramfs - so kernel has none !

You must know: You will get this kernel panic only because the kernel tries itself to mount the root partition (when there is an initramfs active, it is the job of the initramfs to mount the root partition) and it says:
Code:
...  unknown-block(0,0)

0,0 means no access to disc at all == not able to mount the root partition because NOT ABLE to reach the disc (If kernel would be able to reach the disc but has wrong information about the root partitionthen you would have numbers in parenthesis)

This is only possible if some modules for reaching the harddisc are not already in kernel (because they are compiled as <M>odule and not static <*> because ususally the initramfs loads all necessary modules).

So: Check the /boot/grub/grub.cfg ... there is surely an entry to boot this kernel ... but with missing information about the initramfs-FILE (or pointing to a wrong position).

jankom wrote:
One other information: after compiling kernel make install is complaining about not finding Lilo. The make install in /usr/src/linux does copy vmlinuz and System.map to /boot but without -6.6.52-gentoo... suffixes, and without an initramf file. The grub-mkconfig command does not recognize the new files in /boot unless I rename this with -6.6.52-gentoo suffixes. But then rebooting is with kernel panic.

I guess you dont have installed "installkernel" ?

You must know: "grub-mkconfig" search/finds only kernels (and its initramfs') with a specific name schema. If you dont use "installkernel" you will get wrong names after a "make install" ... and these names are not found by grub-mkconfig.

I guess your renaming of the kernel is wrong => You have got an entry in grub.cfg for the kernel itself BUT without initramfs.

If you need further help we would need:

* grub.cfg
* ls -l /boot

Maybe read: https://wiki.gentoo.org/wiki/Installkernel
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
jankom
Guru
Guru


Joined: 30 Aug 2021
Posts: 346
Location: USA

PostPosted: Mon Nov 04, 2024 7:59 pm    Post subject: Reply with quote

Great information, THX.
Now I understand the boot process a little better, the role of initramf. What generates the initramfs? On my home pc it is always there after I compile an updated kernel, and I don't issue installkernel command. Everything works at home whenever I update the kernel (make, make install, make install-modules, etc.)

My home pc has installkernel, but my linode computing instance does not.

The currently working linode is:
Code:
gellert@jgklinux ~ $ uname -r
6.10.2-x86_64-linode165
gellert@jgklinux ~ $ ls /usr/src/
linux-6.6.52-gentoo
gellert@jgklinux ~ $ ls -l /boot
total 44552
-rw-r--r-- 1 root root  4045234 Nov  4 16:58 System.map-6.1.31-gentoo-x86_64
-rw-r--r-- 1 root root  7304168 Nov  4 16:58 System.old
drwxr-xr-x 6 root root     4096 Nov  4 16:58 grub
-rw-r--r-- 1 root root 11171760 Nov  4 16:58 initramfs-6.1.31-gentoo-x86_64.img
-rw-r--r-- 1 root root 10246464 Nov  4 16:58 vmlinuz-6.1.31-gentoo-x86_64
-rw-r--r-- 1 root root 12837888 Nov  4 16:58 vmlinuz.old
gellert@jgklinux ~ $ su -c "cat /boot/grub/grub.cfg"
Password:
#
# 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 ###
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 ext2
set root='hd0'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0 --hint-efi=hd0 --hint-baremetal=ahci0  8e44ff7e-7406-138f-d16c-f7925ba1f9a5
else
  search --no-floppy --fs-uuid --set=root 8e44ff7e-7406-138f-d16c-f7925ba1f9a5
fi
    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/10_linux ###
menuentry 'Gentoo GNU/Linux' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-8e44ff7e-7406-138f-d16c-f7925ba1f9a5' {
        load_video
        if [ "x$grub_platform" = xefi ]; then
                set gfxpayload=keep
        fi
        insmod gzio
        insmod ext2
        set root='hd0'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0 --hint-efi=hd0 --hint-baremetal=ahci0  8e44ff7e-7406-138f-d16c-f7925ba1f9a5
        else
          search --no-floppy --fs-uuid --set=root 8e44ff7e-7406-138f-d16c-f7925ba1f9a5
        fi
        echo    'Loading Linux 6.1.31-gentoo-x86_64 ...'
        linux   /boot/vmlinuz-6.1.31-gentoo-x86_64 root=UUID=8e44ff7e-7406-138f-d16c-f7925ba1f9a5 ro 
        echo    'Loading initial ramdisk ...'
        initrd  /boot/initramfs-6.1.31-gentoo-x86_64.img
}
submenu 'Advanced options for Gentoo GNU/Linux' $menuentry_id_option 'gnulinux-advanced-8e44ff7e-7406-138f-d16c-f7925ba1f9a5' {
        menuentry 'Gentoo GNU/Linux, with Linux 6.1.31-gentoo-x86_64' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.1.31-gentoo-x86_64-advanced-8e44ff7e-7406-138f-d16c-f7925ba1f9a5' {
                load_video
                if [ "x$grub_platform" = xefi ]; then
                        set gfxpayload=keep
                fi
                insmod gzio
                insmod ext2
                set root='hd0'
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint-bios=hd0 --hint-efi=hd0 --hint-baremetal=ahci0  8e44ff7e-7406-138f-d16c-f7925ba1f9a5
                else
                  search --no-floppy --fs-uuid --set=root 8e44ff7e-7406-138f-d16c-f7925ba1f9a5
                fi
                echo    'Loading Linux 6.1.31-gentoo-x86_64 ...'
                linux   /boot/vmlinuz-6.1.31-gentoo-x86_64 root=UUID=8e44ff7e-7406-138f-d16c-f7925ba1f9a5 ro 
                echo    'Loading initial ramdisk ...'
                initrd  /boot/initramfs-6.1.31-gentoo-x86_64.img
        }
        menuentry 'Gentoo GNU/Linux, with Linux 6.1.31-gentoo-x86_64 (recovery mode)' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.1.31-gentoo-x86_64-recovery-8e44ff7e-7406-138f-d16c-f7925ba1f9a5' {
                load_video
                if [ "x$grub_platform" = xefi ]; then
                        set gfxpayload=keep
                fi
                insmod gzio
                insmod ext2
                set root='hd0'
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint-bios=hd0 --hint-efi=hd0 --hint-baremetal=ahci0  8e44ff7e-7406-138f-d16c-f7925ba1f9a5
                else
                  search --no-floppy --fs-uuid --set=root 8e44ff7e-7406-138f-d16c-f7925ba1f9a5
                fi
                echo    'Loading Linux 6.1.31-gentoo-x86_64 ...'
                linux   /boot/vmlinuz-6.1.31-gentoo-x86_64 root=UUID=8e44ff7e-7406-138f-d16c-f7925ba1f9a5 ro single
                echo    'Loading initial ramdisk ...'
                initrd  /boot/initramfs-6.1.31-gentoo-x86_64.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
        menuentry 'UEFI Firmware Settings' $menuentry_id_option 'uefi-firmware' {
                fwsetup
        }
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 ###
gellert@jgklinux ~ $

jankom
Back to top
View user's profile Send private message
Ralphred
l33t
l33t


Joined: 31 Dec 2013
Posts: 645

PostPosted: Mon Nov 04, 2024 8:16 pm    Post subject: Re: Solved Reply with quote

pietinger wrote:
I think the reason is: You are/want booting a kernel which needs (and has) an initramfs ... BUT ... grub does not load the initramfs - so kernel has none !

This needs to be checked before jankom goes down the initramfs path. Yes, grub is installed without efi-64, and the kernel panic suggests that an initramfs is required for the kernel to boot from /dev/sda. BUT switching /dev/sda to gpt (if necessary) and making a >=150k efi partition is a preferable solution (IMHO) to using an initramfs. But that's only if the problem extends that far,
Code:
...  unknown-block(0,0)
suggests to me a storage/interface driver that should be "=y" is "=m", not error that would force an initramfs to be instantiated for the kernel to understand/decrypt/etc the rootfs.

jankom has complete control over his/her kernel config, and I'd stake half my crypto on: jankom uses "make localmodconfig" and "emerge installkernel" (plus make install, grub stuff etc.) and the kernel panic gets fixed.
I'd stake the other half on "gpt conversion" and an EFI friendly boot binary fixing any other issue (UEFI capability of a linode instance withstanding OFC)

Yes, "Akamai linode" may supply a patched kernel, and include an initramfs because anyone not familiar with "configuring a machine specific kernel" thinks that that is what is normal/needed, or even it may be needed for legitimate reasons, but the info I have from this thread leads me to doubt such.

Edit: Once again I get distracted half way through a reply; this time OP added more (very VERY fscking confusing) information:
Code:
gellert@jgklinux ~ $ uname -r
6.10.2-x86_64-linode165
gellert@jgklinux ~ $ ls /usr/src/
linux-6.6.52-gentoo
gellert@jgklinux ~ $ ls -l /boot
~~~ no hint of a 6.10.2 kernel ~~~
gellert@jgklinux ~ $ su -c "cat /boot/grub/grub.cfg"
~~~ again, no hint of a 6.10.2 kernel ~~~

Please post the output of cat /etc/fstab, lslbk and blkid, thanks.
Back to top
View user's profile Send private message
jankom
Guru
Guru


Joined: 30 Aug 2021
Posts: 346
Location: USA

PostPosted: Mon Nov 04, 2024 9:14 pm    Post subject: Reply with quote

Quote:
OP added more (very VERY fscking confusing) information:
Sorry, I forgot to mention that on ny linode access web site there is a Configuration tab where I can define "Boot Settings" such as 'GRUB 2 or the currently selected 'latest 64 bit', and uname -r shows the 6.10...
Up until recently 'GRUB 2' was active with the 6.1.32 gentoo kernel as shown in the grub.cfg. The 6.1.32 was probably from linode's build disk when I changed my linode OS from xubuntu. My current, compiled kernel is the 6.6.52, and this is what I was unable to set correctly fro booting, this is where initramfs is missing, and this is what make install command installs as vmlinuz, Sustem.map without suffixes.

The requested info follows:
Code:
gellert@jgklinux ~ $ cat /etc/fstab
# /etc/fstab: static file system information.
#
...,most <commented lines removed to save space>
#       the blkid(8) command.

/dev/sda                /               ext4            noatime         0 1
/dev/sdb                none            swap            sw              0 0
/swapfile               none            swap            default         0 0
gellert@jgklinux ~ $
gellert@jgklinux ~ $ lsblk   
NAME  MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sda     8:0    0 49.5G  0 disk /
sdb     8:16   0  512M  0 disk [SWAP]
nbd0   43:0    0    0B  0 disk
...<all the way up to nbd15, again to save space>
gellert@jgklinux ~ $ blkid
/dev/sdb: LABEL="linode-swap" UUID="f1408ea6-59a0-11ed-bc9d-525400000001" TYPE="swap"
/dev/sda: LABEL="linode-root" UUID="8e44ff7e-7406-138f-d16c-f7925ba1f9a5" BLOCK_SIZE="4096" TYPE="ext4"
gellert@jgklinux ~ $
Back to top
View user's profile Send private message
Ralphred
l33t
l33t


Joined: 31 Dec 2013
Posts: 645

PostPosted: Mon Nov 04, 2024 9:59 pm    Post subject: Reply with quote

jankom wrote:
I can define "Boot Settings" such as 'GRUB 2 or the currently selected 'latest 64 bit', and uname -r shows the 6.10...
Up until recently 'GRUB 2' was active with the 6.1.32 gentoo kernel as shown in the grub.cfg.

When selecting 'latest 64 bit' gives you an "invisible to the the traditional file system layout" kernel, that obviously works, creating and supporting/maintaining your own feels like reinventing the wheel...
Code:
/dev/sda                /               ext4            noatime         0 1
So other than no partition table, nothing funky at all - I stand by my, albeit redundant, "make localmodconfig" advice. If you feel the need, I'd try it from the 6.10 environment first though, less interaction required, probably.
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5062
Location: Bavaria

PostPosted: Mon Nov 04, 2024 10:11 pm    Post subject: Reply with quote

jankom,

we need more informations ... because your linode is a bit unusual ... and gives us some questions ->

a) you said you want boot 6.6.53 ... but there is no 6.6.53 in your /boot ?!
b) /boot/vmlinuz-6.1.31-gentoo-x86_64 (and all other files) have a date from today ?! Why?
c) I see only sda and sdb (being root-partition and swap) ... but where is grub installed ? I mean the 1st part of grub (not the 2nd part of grub residing in /boot/grub)
d) What can you boot ? Gentoo ? Which version? (uname -a) or XubuntuOS? Did you ever run Gentoo here?
e) How have you installed Gentoo on Linode? Booting with our GentooLiveCD? and then installing with AMD64 Handbook? Or other methods?
f) Do you use gentoo-sources at your home or our (binary) distribution kernel? (or genkernel?) You said: You do at home "make && make install && make modules_install" (this smells for gentoo-sources or genkernel) ... do you use at home "dracut" (or "ugrd") -> Do you want to do the same here ? ->
g) How you have installed the kernel here on Linode? Was it 6.1.32? A Gentoo-kernel? Or was it pre-installed?

So, I would like to ask you:

1. Tell us everything what has worked in the past until day X.
2. What happend on day X / what have you tried to do (detailed steps)
3. What have you renamed (from/to)?

To see more clear we would need more then lslbk and blkid ... best would be the "dmesg" of that thing/OS you can boot here; this tells us also something about the used hardware. Also a "lspci -nnk" and a "lsmod" (Please use wgetpaste for dmesg). Does "efibootmgr" gives you some results or is this not an UEFI system? Does "zcat /proc/config.gz" gives you the configuration of the current running kernel? If yes, put it in a file and give it also to us ...

... and many answers from above questions. ;-)

Before trying anything else ... we should know the current situation and understand it ... not to make more damage (as we already have :lol: ).
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum