[SOLVED] setting up initrd / generic kernel in Grub2...can't load generic
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.
Distribution: Mint 16 RC, Elementary OS Luna, Crunchbang
Posts: 166
Rep:
setting up initrd / generic kernel in Grub2...can't load generic
So I am trying to figure out how to load the generic kernel in Grub2.
1. I have run the /usr/hare/mkinitrd/mkinitrd_command_generator.sh and ran the output:
Code:
/usr/share/mkinitrd/mkinitrd_command_generator.sh
#
# mkinitrd_command_generator.sh revision 1.40
#
# This script will now make a recommendation about the command to use
# in case you require an initrd image to boot a kernel that does not
# have support for your storage or root filesystem built in
# (such as the Slackware 'generic' kernels').
# A suitable 'mkinitrd' command will be:
mkinitrd -c -k 2.6.33.4-smp -f ext4 -r /dev/sda5 -m jbd2:mbcache:ext4 -o /boot/initrd.gz
root@laptop1:/home/user1# mkinitrd -c -k 2.6.33.4-smp -f ext4 -r /dev/sda5 -m jbd2:mbcache:ext4 -o /boot/initrd.gz
OK: /lib/modules/2.6.33.4-smp/kernel/fs/jbd2/jbd2.ko added.
OK: /lib/modules/2.6.33.4-smp/kernel/fs/mbcache.ko added.
OK: /lib/modules/2.6.33.4-smp/kernel/fs/ext4/ext4.ko added.
6697 blocks
/boot/initrd.gz created.
Be sure to run lilo again if you use it.
now following this, from Kubuntu, I ran update-grub. The part of grub.cfg that contains the Slackware listings show this:
Code:
### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Slackware Linux (Slackware 13.1.0) (on /dev/sda5)" {
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set da42e122-79d6-4215-aa8c-7b42cdfe8876
linux /boot/vmlinuz-generic-2.6.33.4 root=/dev/sda5
}
menuentry "Slackware Linux (Slackware 13.1.0) (on /dev/sda5)" {
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set da42e122-79d6-4215-aa8c-7b42cdfe8876
linux /boot/vmlinuz-generic-smp-2.6.33.4-smp root=/dev/sda5
}
menuentry "Slackware Linux (Slackware 13.1.0) (on /dev/sda5)" {
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set da42e122-79d6-4215-aa8c-7b42cdfe8876
linux /boot/vmlinuz-huge-2.6.33.4 root=/dev/sda5
}
menuentry "Slackware Linux (Slackware 13.1.0) (on /dev/sda5)" {
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set da42e122-79d6-4215-aa8c-7b42cdfe8876
linux /boot/vmlinuz-huge-smp-2.6.33.4-smp root=/dev/sda5
}
### END /etc/grub.d/30_os-prober ###
Since nothing had changed from before (note have been only able to load the huge kernels, generics kernel panic), I then added a custom entry to etc/grub.d/40_custom (as ubuntu asks for) rather than editing the grub.cfg file. My addition is:
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 Linux (Slackware 13.1.0) (on /dev/sda5)" {
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set da42e122-79d6-4215-aa8c-7b42cdfe8876
linux /boot/vmlinuz-generic-smp-2.6.33.4-smp root=/dev/sda5
intird /boot/initrd.gz
}
which then makes the updated grub.cfg file
Code:
### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Slackware Linux (Slackware 13.1.0) (on /dev/sda5)" {
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set da42e122-79d6-4215-aa8c-7b42cdfe8876
linux /boot/vmlinuz-generic-2.6.33.4 root=/dev/sda5
}
menuentry "Slackware Linux (Slackware 13.1.0) (on /dev/sda5)" {
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set da42e122-79d6-4215-aa8c-7b42cdfe8876
linux /boot/vmlinuz-generic-smp-2.6.33.4-smp root=/dev/sda5
}
menuentry "Slackware Linux (Slackware 13.1.0) (on /dev/sda5)" {
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set da42e122-79d6-4215-aa8c-7b42cdfe8876
linux /boot/vmlinuz-huge-2.6.33.4 root=/dev/sda5
}
menuentry "Slackware Linux (Slackware 13.1.0) (on /dev/sda5)" {
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set da42e122-79d6-4215-aa8c-7b42cdfe8876
linux /boot/vmlinuz-huge-smp-2.6.33.4-smp root=/dev/sda5
}
### END /etc/grub.d/30_os-prober ###
### 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.
menuentry "Slackware Linux (Slackware 13.1.0) (on /dev/sda5)" {
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set da42e122-79d6-4215-aa8c-7b42cdfe8876
linux /boot/vmlinuz-generic-smp-2.6.33.4-smp root=/dev/sda5
intird /boot/initrd.gz
}
### END /etc/grub.d/40_custom ###
can someone please point me in the right direction as to why this will not load. Many thanks from a newbie.
Click here to see the post LQ members have rated as the most helpful post in this thread.
could you tell me if Ubuntu is on the sda drive also. I have had some problems with install on sdb1 and slackware on sda1 and ubuntu thinking slackware is sdb1 and ubuntu is sda1.
Quote:
insmod ext2
and you see grub may not be loading ext4 but when you load the vmlinuz huge it has the ext4 module. but the generic kernel will not have it.so when it goes to look for the initrd.img it will be unable to mount the ext4 fs . you will be unable to sync or file system.
No root device.
Quote:
The next time you get to the Grub2 menu, type "c" to get to the Grub prompt. Type "lsmod" and it will show which modules are loaded. You will find ext2 listed as one of the loaded modules.
Hint: If too many modules are loaded, they may scroll off the page. To see them all, type "set pager=1" and you will be able to scroll through the list using the ENTER key.
Try to load ext4 with "insmod ext4". On my computer, I get a "error: file not found" since the ext4 module doesn't exist.
Like you, I get a kernel panic in Slackware if I boot using the top menu entry (the "generic" kernel), but boot fine if I use the "huge" kernel. This is (as far as I know / can guess) not a problem with Grub2, it's to do with Slackware configuration - especially considering the huge kernel boots, and the only difference between the menu entries is the "linux /boot..." line. If you wanted to track down the source of the error, then you'd have to look at the difference between the huge and the generic kernels.
EDIT: No luck for me, at least, with Drakeo's suggestion, but that's the sort of thing I would expect it to be and the error I get is something like "Unable to mount root VFS filesystem on unknown block (0,18)"
menuentry "Slackware Linux (Slackware 13.1.0) (on /dev/sda5)" {
insmod ext2
set root='(hd0,5)' <--------------this is /dev/sda6
search --no-floppy --fs-uuid --set da42e122-79d6-4215-aa8c-7b42cdfe8876
linux /boot/vmlinuz-generic-smp-2.6.33.4-smp root=/dev/sda5 <------------this is not in sync
intird /boot/initrd.gz <--------------------this is not in sync
do you see that. point it to. this will cause your problem
like I said grub2 has problems with mapping drives and reading bios.
Examples of the difference between Linux and GRUB device names.
#!/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 Linux (Slackware 13.1.0) (on /dev/sda5)" {
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set da42e122-79d6-4215-aa8c-7b42cdfe8876
linux /boot/vmlinuz-generic-smp-2.6.33.4-smp root=/dev/sda5
intird /boot/initrd.gz
}
"intird" should be "initrd"
Also, if you want "update-grub" to detect the initrd automatically, rename it to "initrd.gz-generic-smp-2.6.33.4-smp"
@Drakeo
It's slightly different in Grub2, the first drive is counted as 0, and the first partition is 1.
Distribution: Mint 16 RC, Elementary OS Luna, Crunchbang
Posts: 166
Original Poster
Rep:
Quote:
Originally Posted by piratesmack
There is a typo in your custom menu entry
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 Linux (Slackware 13.1.0) (on /dev/sda5)" {
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set da42e122-79d6-4215-aa8c-7b42cdfe8876
linux /boot/vmlinuz-generic-smp-2.6.33.4-smp root=/dev/sda5
intird /boot/initrd.gz
}
"intird" should be "initrd"
Also, if you want "update-grub" to detect the initrd automatically, rename it to "initrd.gz-generic-smp-2.6.33.4-smp"
[/code]
Piratesmack, I feel silly for making such a trivial error in spelling, however this did, infact, make the custom menu entry, and thus the generic smp kernel bootable. On to trying to clean up grub and making grub recognize it without the need for a custom additional (5 now) entries for Slackware. Thanks!
Quote:
Also, if you want "update-grub" to detect the initrd automatically, rename it to "initrd.gz-generic-smp-2.6.33.4-smp"
in which config file are you referring to? Editing the main grub.cfg file so I dont have to have the custom boot option? Thanks again for helping a novice. I'm sure it should be taken with a grain of salt, but Ubuntu warns in bold "DO NOT EDIT THIS FILE, it is genated using templates from /etc/grub.d and settings from /etc/default/grub".
Can i Just ignore this and edit the non-working generic boot option to be the same as the current (spelling corrected) custom entry?
---------
also thanks to Drakeo
Last edited by Ubunoob001; 01-04-2011 at 09:56 PM.
Have been fairly annoyed over the years that most "solutions" to getting a /boot initrd working seem to automatically keep **ASSUMING** that the Slackware bootloader is LILO instead of grub2.
This false assumption continues to be problematic for those having Grub2 load other distros and then getting continually, almost blindingly, push-pushed within the Slackware help guides into install the generic Slackware kernel with an initrd (of course using LILO) for maximum efficiency. Encouragement as in http://docs.slackware.com/slackware:beginners_guide and http://docs.slackware.com/slackbook:booting
I think that the better solution is to go ahead and follow the 'mkinitrd' suggestions at http://docs.slackware.com/slackbook:booting and then halt before doing all that LILO junk the Slackware guides keep throwing at you. At that point, the previously mentioned steps for adding one or more file entry for /etc/grub.d/* are immensely helpful, followed by manually adding the ending generic kernel and initrd lines as
Code:
linux /boot/vmlinuz-generic-smp-2.6.33.4-smp root=/dev/sda5
initrd /boot/initrd.gz-generic-smp-2.6.33.4-smp
Then run "update-grub" to detect the initrd here automatically and form a good working /boot/grub/grub.cfg
seem to automatically keep **ASSUMING** that the Slackware bootloader is LILO instead of grub2.
Quote:
Originally Posted by nycace36
This false assumption
Quote:
Originally Posted by nycace36
that LILO junk the Slackware guides keep throwing at you
There is a reason people do that. Slackware uses LILO by default. Of course the guides are going to mention how to use the default setup. Not everyone runs dual boot with other distros that use grub, and while there are some Slackers that prefer grub(2) over LILO, many do not and they like the fact that Slackware uses LILO.
All that being said, if you feel that a lot of users are running into the same issues as you, you're more than welcome to update the Slackware docs. The forum isn't always the easiest place for other users to find information like this, since the terms in a search engine would turn up a lot of unrelated results.
I think that the better solution is to go ahead and follow the 'mkinitrd' suggestions at http://docs.slackware.com/slackbook:booting and then halt before doing all that LILO junk the Slackware guides keep throwing at you.
You know that that is a Wiki link, right?
Instead of spewing your angry words, get wise and request a Wiki account or join the mailing list, so that you can propose a modification to that page. Or if you do not want an account, use the "Discussion" page to write your suggestions.
Creating good documentation is not trivial, and it's very easy to stand at the sideline and point your finger. The Wiki team is always glad to get suggestions.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.