View previous topic :: View next topic |
Author |
Message |
dpaddy Apprentice

Joined: 25 Jun 2008 Posts: 172
|
Posted: Wed Mar 12, 2025 2:03 pm Post subject: grub.cfg, boot options |
|
|
I tried to follow the handbook, but evidently have screwed things up (sigh). Here is the history as near as I can recall.
I first installed a distribution kernel, and that booted fine. I next built a custom kernel, starting with setting and checking /usr/src/linux Code: | # eselect kernel list
Available kernel symlink targets:
[1] linux-6.12.16-gentoo *
[2] linux-6.12.16-gentoo-dist | followed by what I thought would finish up (I can't remember the details... but that might not matter, keep reading...). However, the system wouldn't boot, complaining that a "root=" parameter was needed. I then edited /etc/default/grub Code: | # cat /etc/default/grub
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
#
# To populate all changes in this file you need to regenerate your
# grub configuration file afterwards:
# 'grub-mkconfig -o /boot/grub/grub.cfg'
#
# See the grub info page for documentation on possible variables and
# their associated values.
GRUB_DISTRIBUTOR="Gentoo"
# Default menu entry
#GRUB_DEFAULT=0
# Boot the default entry this many seconds after the menu is displayed
#GRUB_TIMEOUT=5
#GRUB_TIMEOUT_STYLE=menu
# Append parameters to the linux kernel command line
#GRUB_CMDLINE_LINUX=""
#
# Examples:
#
# Boot with network interface renaming disabled
GRUB_CMDLINE_LINUX="root=UUID=4ecf4ba4-ea4a-408a-9a02-6974e1e78498 rootfstype=xfs net.ifnames=0"
#
# Boot with systemd instead of sysvinit (openrc)
# GRUB_CMDLINE_LINUX="init=/usr/lib/systemd/systemd"
# Append parameters to the linux kernel command line for non-recovery entries
#GRUB_CMDLINE_LINUX_DEFAULT=""
# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console
# Resolution used on graphical terminal.
# The list of valid modes may be obtained using the 'vbeinfo' (PC BIOS) or
# 'videoinfo' (EFI) command from a GRUB boot prompt.
#GRUB_GFXMODE=640x480
# Set to 'text' to force the Linux kernel to boot in normal text
# mode, 'keep' to preserve the graphics mode set using
# 'GRUB_GFXMODE', 'WIDTHxHEIGHT'['xDEPTH'] to set a particular
# graphics mode, or a sequence of these separated by commas or
# semicolons to try several modes in sequence.
#GRUB_GFXPAYLOAD_LINUX=
# Path to theme spec txt file.
# The starfield is by default provided with use truetype.
# NOTE: when enabling custom theme, ensure you have required font/etc.
#GRUB_THEME="/boot/grub/themes/starfield/theme.txt"
# Background image used on graphical terminal.
# Can be in various bitmap formats.
#GRUB_BACKGROUND="/boot/grub/mybackground.png"
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to kernel
#GRUB_DISABLE_LINUX_UUID=true
# Comment if you don't want GRUB to pass "root=PARTUUID=xxx" parameter to kernel
GRUB_DISABLE_LINUX_PARTUUID=false
# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY=true
# Uncomment to disable generation of the submenu and put all choices on
# the top-level menu.
# Besides the visual affect of no sub menu, this makes navigation of the
# menu easier for a user who can't see the screen.
#GRUB_DISABLE_SUBMENU=y
# Uncomment to play a tone when the main menu is displayed.
# This is useful, for example, to allow users who can't see the screen
# to know when they can make a choice on the menu.
#GRUB_INIT_TUNE="60 800 1" | Not knowing how to proceed from here, I did the following Quote: | cd /usr/src/linux
make && make modules_install
make install
reboot | At this point JOI (my custom kernel boots, woot!). So what is my problem? Well, /boot/grub/grub.cfg contains strange entries like Code: | linux /boot/vmlinuz-6.12.16-gentoo root=UUID=4ecf4ba4-ea4a-408a-9a02-6974e1e78498 ro root=UUID=4ecf4ba4-ea4a-408a-9a02-6974e1e78498 rootfstype=xfs net.ifnames=0 | -- note the repetition of "root=", once with "ro" and once without -- and that file nolonger has any entry for the distribution kernel. Indeed, power cycling no longer presents the distribution kernel as an option. Moreover, the options that are presented, with the exception of the first, will not boot. I have three questions:
1) If the repetition of "root=" (in /boot/grub/grub.cfg) is not required, then how do I remove it (the file cautions against editing)?
2) How can I regain the option of booting the distribution kernel while keeping my custom kernel as the default?
3) How can I remove the options which do not boot?
In case it matters, I attempted to prevent the future emerge of gentoo-kernel Code: | emerge --deselect sys-kernel/gentoo-kernel | for the reason that it is my understanding such emerge would automagically install some kernel or other (I don't want any automagic messing with kernels). So if answering my questions above necessarily involves somehow enabling automagic installation of distribution kernels, then how, and after that then how can I prevent subsequent messing with Sasquatch (I don't want automagic messing with kernels). |
|
Back to top |
|
 |
alamahant Advocate

Joined: 23 Mar 2019 Posts: 3958
|
Posted: Wed Mar 12, 2025 5:18 pm Post subject: |
|
|
Quote: |
GRUB_CMDLINE_LINUX="root=UUID=4ecf4ba4-ea4a-408a-9a02-6974e1e78498 rootfstype=xfs net.ifnames=0"
|
Do you have an initramfs?
You can not use root=UUID=4ecf4ba4-ea4a-408a-9a02-6974e1e78498 without using also an initramfs.
The reason being UUID is user space.It needs / to be mounted for it to be available.
Use
to create your initramfs.
If you insist on going initramfs-less then use
Code: |
root=PARTUUID=xxxxxxxxxxxxxxxxxxxxx
|
in default/grub
as this is available before / is mounted.
Quote: |
2) How can I regain the option of booting the distribution kernel while keeping my custom kernel as the default?
|
Use the arrow keys in grub screen to select the other kernel.
Quote: |
Not knowing how to proceed from here, I did the following
Quote:
cd /usr/src/linux
make && make modules_install
make install
reboot
At this point JOI (my custom kernel boots, woot!). So what is my problem? Well, /boot/grub/grub.cfg contains strange entries like
|
Wrong.you just rebuilt the kernel.
You sould have just run:
Code: |
grub-mkconfig -o /boot/grub/grub.cfg
|
But maybe
make install
ran also the above.
So whats the problem???
If you boot,you boot!!!
Congrats! _________________

Last edited by alamahant on Wed Mar 12, 2025 5:34 pm; edited 1 time in total |
|
Back to top |
|
 |
grknight Retired Dev

Joined: 20 Feb 2015 Posts: 2054
|
Posted: Wed Mar 12, 2025 5:33 pm Post subject: |
|
|
I won't comment on the distribution kernel as I don't know the details.
However, adding root= to GRUB_CMDLINE_LINUX is usually not necessary as grub-mkconfig will do this itself. |
|
Back to top |
|
 |
dpaddy Apprentice

Joined: 25 Jun 2008 Posts: 172
|
Posted: Wed Mar 12, 2025 6:39 pm Post subject: |
|
|
Yes, I have an initramfs Code: | ls -l /boot/*
-rw-r--r-- 1 root root 7179670 Mar 12 08:10 /boot/System.map-6.12.16-gentoo
-rw-r--r-- 1 root root 7179670 Mar 11 14:58 /boot/System.map-6.12.16-gentoo.old
-rw-r--r-- 1 root root 143325 Mar 12 08:10 /boot/config-6.12.16-gentoo
-rw-r--r-- 1 root root 143325 Mar 11 14:58 /boot/config-6.12.16-gentoo.old
-rw-r--r-- 1 root root 10725154 Mar 12 08:10 /boot/initramfs-6.12.16-gentoo.img
-rw-r--r-- 1 root root 9040633 Mar 11 14:58 /boot/initramfs-6.12.16-gentoo.img.old
-rw-r--r-- 1 root root 11535360 Mar 12 08:10 /boot/vmlinuz-6.12.16-gentoo
-rw-r--r-- 1 root root 11535360 Mar 11 14:58 /boot/vmlinuz-6.12.16-gentoo.old
/boot/grub:
total 36
drwxr-xr-x 2 root root 33 Mar 12 08:11 fonts
-rw------- 1 root root 7751 Mar 12 08:10 grub.cfg
-rw------- 1 root root 5807 Mar 12 08:10 grub.cfg~
-rw-r--r-- 1 root root 1024 Mar 12 08:11 grubenv
drwxr-xr-x 2 root root 4096 Mar 12 08:11 locale
drwxr-xr-x 3 root root 31 Mar 12 08:11 themes
drwxr-xr-x 2 root root 8192 Mar 12 08:11 x86_64-efi
|
It just occurred to me (yes, I am quite slow) that the answer to my third question might be as easy as Moreover, removing root= to GRUB_CMDLINE_LINUX in /etc/default/grub answers my first question; both first and third questions resolved by the preceeding followed by subsequent Code: | # rm /boot/grub/grub.cfg
# grub-mkconfig -o /boot/grub/grub.cfg | I cannot use the arrow keys in the grub screen to select the distribution kernel because there is no such option presented, as was also the case before removing *.old from /boot. Perhaps that is unsurprising since there seems to be no distribution anything in /boot (see listing above). That leaves only my second question, namely Quote: | How can I regain the option of booting the distribution kernel while keeping my custom kernel as the default? | Given the contents of /boot listed above, perhaps the answer... Quote: | ...necessarily involves somehow enabling automagic installation of distribution kernels, then how, and after that then how can I prevent subsequent messing with Sasquatch (I don't want automagic messing with kernels) | Yes, if I boot then I boot (woot!), but I would nevertheless like to have a distribution kernel as a boot option while keeping my custom kernel as the boot default. |
|
Back to top |
|
 |
|
|
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
|
|