SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
The documentation about using the generic Kernel assumes that one uses lilo, but I'm using Grub2. I created inird.gz and when I select the generic Kernel in the Grub menu it works fine. But by default it still boots the huge kernel. So what should I do to boot the generic Kernel by default?
for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do
allows you to configure menu lines for the desired kernels.
In order not to load initrd to the huge kernel for the time being, the solution found is to comment the line in the /boot/grub/grub.cfg file.
For that I stole the generic kernel entry from /boot/grub/grub.cfg and put it in /etc/grub.d/06_custom
I'm sure yours will be different, but just for illustration, my 06_custom file:
Code:
#!/bin/sh
exec tail -n +3 $0
# 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.
menuentry 'Slackware-14.2+ GNU/Linux (generic)' {
load_video
insmod gzio
insmod part_msdos
insmod ext2
set root='hd1,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1 <drive-uuid>
else
search --no-floppy --fs-uuid --set=root <drive-uuid>
fi
echo 'Loading Linux ...'
linux /vmlinuz-generic root=/dev/mapper/cryptvg-root ro
echo 'Loading initial ramdisk ...'
initrd /initrd.gz
}
After that, a `grub-mkconfig -o /boot/grub/grub.cfg` should generate the right file.
allows you to configure menu lines for the desired kernels.
In order not to load initrd to the huge kernel for the time being, the solution found is to comment the line in the /boot/grub/grub.cfg file.
Thanks for your reply! But I do not understand what I should do. If never done any configuration on grub, so how should I configure this line?
Also you suggested to configure /boot/grub/grub.cfg but this files says that it shouldn't be modified so I'm not sure if this is the correct approach.
For that I stole the generic kernel entry from /boot/grub/grub.cfg and put it in /etc/grub.d/06_custom
I'm sure yours will be different, but just for illustration, my 06_custom file:
Code:
#!/bin/sh
exec tail -n +3 $0
# 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.
menuentry 'Slackware-14.2+ GNU/Linux (generic)' {
load_video
insmod gzio
insmod part_msdos
insmod ext2
set root='hd1,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1 <drive-uuid>
else
search --no-floppy --fs-uuid --set=root <drive-uuid>
fi
echo 'Loading Linux ...'
linux /vmlinuz-generic root=/dev/mapper/cryptvg-root ro
echo 'Loading initial ramdisk ...'
initrd /initrd.gz
}
After that, a `grub-mkconfig -o /boot/grub/grub.cfg` should generate the right file.
There is no 06_custom file. I have a 40_custom and a 41_custom. So which one should I modify?
There is no 06_custom file. I have a 40_custom and a 41_custom. So which one should I modify?
Neither, you create a new custom file, but make it a number lower than the 10_linux (which detects Linux kernels). That way when you run `grub-mkconfig -o /boot/grub/grub.cfg` the 06_custom stuff ("06" is not forced, just <10) will come before the auto-detected 10_linux stuff. You set your custom file to pick up your generic kernel only, and then grub will always boot that one first.
No doubt there's other ways to do it, but that's how I've got my system set up. The benefit is that after kernel upgrades it's enough to:
# generate new initrd if necessary (I use `mkinitrd -F`)
# grub-mkconfig -o /boot/grub/grub.cfg
and you're done (no need to edit grub.cfg or anything like that).
Another option If your not multi-booting with other linux distros is to edit the first menu entry in /boot/grub/grub.cfg and don’t never run grub-mkconfig again.
Thanks for your reply! But I do not understand what I should do. If never done any configuration on grub, so how should I configure this line?
Also you suggested to configure /boot/grub/grub.cfg but this files says that it shouldn't be modified so I'm not sure if this is the correct approach.
Code:
for i in /boot/vmlinuz /boot/vmlinuz-generic ; do
This way you will only have the menu lines for vmlinuz and vmlinuz-generic.
GRUB_DISABLE_SUBMENU and GRUB_DISABLE_RECOVERY from /etc/default/grub (the GRUB configuration file) are easy to understand.
GRUB_DEFAULT=0 defaults to first menu option (vmlinuz)
GRUB_DEFAULT=1 defaults to the second menu option (vmlinuz-generic)
In this way it is not necessary to run the command:
Code:
grub-mkconfig -o /boot/grub/grub.cfg
when updating the kernel but it is still necessary to create initrd.
If you can, try in a virtual machine eg. VirtualBox.
Possibly just a typo, but if your initrd file is called "inird", change it to initrd.gz or something that the "11_linux_slackcustom" looks for (lines 194 to 204).
The exact filename of the generic kernel is important too. When I run grub-mkconfig, the generic kernel is added first (with the initrd) and so that boots by default.
You can test what order the line teoberi posted is finding files by running something like this one-liner;
Code:
for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-*; do echo $i; done
The documentation about using the generic Kernel assumes that one uses lilo, but I'm using Grub2. I created inird.gz and when I select the generic Kernel in the Grub menu it works fine. But by default it still boots the huge kernel. So what should I do to boot the generic Kernel by default?
Once I've convinced myself that the generic kernel gives me all I need, I do this. Delete kernel-huge via slackpkg, then recreate initrd and grub.cfg.
Kernel-huge without loading microcode for the processor and without initrd can be considered as a backup solution in case of problems related to loading microcode or initrd.
I leave it as the first option in the GRUB menu without any changes.
There is also the alternative with Slackware DVD + chroot but it is a bit more work!
Once I've convinced myself that the generic kernel gives me all I need, I do this. Delete kernel-huge via slackpkg, then recreate initrd and grub.cfg.
Thanks, but I would like to keep the huge kernel for a reason: If I move the boot drive to another machine with different hardware I need the huge kernel, right? This is something I need to do some times.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.