[SOLVED] [slackware novice] setting generic kernel for grub2
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.
[slackware novice] setting generic kernel for grub2
Hi, I read this post - Switch to a generic kernel. Most of the documentation is for Lilo bootloader. I couldn't see any official help on setting generic kernel using grub-mkconfig. Can you please give me to detail steps of setting generic kernel for grub bootloader(or link to it)?
[ I tried to resolve this by seeing few threads. However, they were having different errors.
I created initrd.gz by following steps in docs.slackware.com. Added its entry in /etc/grub.d/40_custom. When I selected this entry from boot menu, I got error '/boot/initrd.gz not found'. I recently installed 14.1. I am new to Slackware. As 14.2 is released and I haven't done much on currently installed OS, I would move to 14.2. However, I think these errors will be in 14.2 too. I think, these are not errors, but I am missing something while achieving this]
In my case(s) (I run grub2 on multiple machines), I have a boot partition that is formatted ext2. Everything else is in an LVM logical volume, although you don't have to use LVM.
I created initrd.gz by following steps in docs.slackware.com. Added its entry in /etc/grub.d/40_custom. When I selected this entry from boot menu, I got error '/boot/initrd.gz not found'.
The answer to these two questions should help locate the culprit.
Unless your initrd.gz is named something else, you shouldn't need to modify /etc/grub.d/40_custom - what did you add in there?
Does the file exist: /boot/initrd.gz ?
If your /boot is on a different partition, make sure it's mounted already when you run the mkinitrd and grub-mkconfig commands.
If you created initrd.gz, and your generic kernel exists;
Backup your existing /boot/grub/grub.cfg and create a new grub.cfg with this command;
Code:
grub-mkconfig -o /boot/grub/grub.cfg
The output of this should list all kernels (and matching initrd's, if they exist)
For example, I named mine "vmlinuz-custom-<version>, so mine says;
Code:
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-custom-4.4.14
Found initrd image: /boot/initrd-custom-4.4.14.gz
Found linux image: /boot/vmlinuz-custom-4.1.27
Found initrd image: /boot/initrd-custom-4.1.27.gz
Note: Because I have a custom filename, I did have to tweak 40_custom so that the script knows what pattern to look for. If yours is just called initrd.gz then that will be found automatically.
Last edited by Hangaber; 07-02-2016 at 11:17 PM.
Reason: Typo
Stock /etc/grub.d/40_custom doesn't have anything that would generate a menu entry in it.
Code:
root@testbed:~# cat /etc/grub.d/40_custom
#!/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.
root@testbed:~#
Last edited by Richard Cranium; 07-03-2016 at 12:59 AM.
My boot partition has ext4 filesystem. It looks as following. Should it be ext2?
Code:
Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x5b7f48cf
Device Boot Start End Blocks Id System
/dev/sda1 2048 318048255 159023104 7 HPFS/NTFS/exFAT
/dev/sda2 318048256 318560255 256000 83 Linux
/dev/sda3 318560256 326948863 4194304 82 Linux swap
/dev/sda4 326948864 625142447 149096792 83 Linux
Quote:
Originally Posted by Hangaber
The answer to these two questions should help locate the culprit.
Unless your initrd.gz is named something else, you shouldn't need to modify /etc/grub.d/40_custom - what did you add in there?
................
Does the file exist: /boot/initrd.gz ?
If your /boot is on a different partition, make sure it's mounted already when you run the mkinitrd and grub-mkconfig commands.
If you created initrd.gz, and your generic kernel exists;
Backup your existing /boot/grub/grub.cfg and create a new grub.cfg with this command;
Code:
grub-mkconfig -o /boot/grub/grub.cfg
The output of this should list all kernels (and matching initrd's, if they exist)
For example, I named mine "vmlinuz-custom-<version>, so mine says;
Code:
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-custom-4.4.14
Found initrd image: /boot/initrd-custom-4.4.14.gz
Found linux image: /boot/vmlinuz-custom-4.1.27
Found initrd image: /boot/initrd-custom-4.1.27.gz
Note: Because I have a custom filename, I did have to tweak 40_custom so that the script knows what pattern to look for. If yours is just called initrd.gz then that will be found automatically.
I have following kernels and initrds in boot folder.
I have renamed initrd.gz(which I have created using Slackware script mkinitrd_command_generator.sh) to initrd-generic-3.10.17. After this I ran 'grub-mkconfig -o /boot/grub/grub.cfg'. However, there isn't any change in grub.cfg. I don't see any entry about initrd.cfg
I have renamed initrd.gz(which I have created using Slackware script mkinitrd_command_generator.sh) to initrd-generic-3.10.17. After this I ran 'grub-mkconfig -o /boot/grub/grub.cfg'. However, there isn't any change in grub.cfg. I don't see any entry about initrd.cfg
Either rename "initrd-generic-3.10.17" to "initrd.gz", or;
Edit file "/etc/grub.d/10_linux", and at about line 202, insert something like this;
Code:
"initrd-generic-${version}" \
(so it'll end up something like this...)
Code:
"initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}" \
"initrd-generic-${version}" \
"initrd.gz"; do
Thanks Hangaber, Richard Cranium, mralk3. I have upgraded(clean install) to 14.2. This time I didn't face any issues while installing LILO. And I could set the generic kernel by following steps mentioned in Slackware Documentation. As I can't give more details of issue anymore, marking this one as 'Solved'. Thanks for your inputs.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.