LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 07-02-2016, 12:55 PM   #1
gnus
Member
 
Registered: Aug 2015
Distribution: Slackware
Posts: 35

Rep: Reputation: Disabled
[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]
 
Old 07-02-2016, 02:22 PM   #2
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
OK, how is your system set up?

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.

Code:
root@hp635:~# fdisk -l /dev/sda
Disk /dev/sda: 232.9 GiB, 250059350016 bytes, 488397168 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
Disklabel type: gpt
Disk identifier: 44C7FDC9-555A-41DF-88B0-B29E0DE2285D

Device       Start       End   Sectors   Size Type
/dev/sda1     2048   1050623   1048576   512M Linux filesystem
/dev/sda2  1050624 488397134 487346511 232.4G Linux LVM
root@hp635:~# cat /etc/fstab
/dev/cryptvg/swaplv swap             swap        defaults         0   0
/dev/cryptvg/rootlv /                ext4        defaults         1   1
/dev/sda1        /boot            ext2        defaults         1   2
/dev/cryptvg/homelv /home            jfs       defaults         1   2
/dev/cryptvg/optlv /opt             ext4        defaults         1   2
/dev/cryptvg/tmplv /tmp             ext4        defaults         1   2
/dev/cryptvg/usrlv /usr             ext4        defaults         1   2
/dev/cryptvg/varlv /var             ext4        defaults         1   2
/dev/cryptvg/varloglv /var/log         ext4        defaults         1   2
/dev/cryptvg/usrlocallv /usr/local ext4       defaults,journal_async_commit 1 2
#/dev/cdrom      /mnt/cdrom       auto        noauto,owner,ro,comment=x-gvfs-show 0   0
/dev/fd0         /mnt/floppy      auto        noauto,owner     0   0
devpts           /dev/pts         devpts      gid=5,mode=620   0   0
proc             /proc            proc        defaults         0   0
tmpfs            /dev/shm         tmpfs       defaults         0   0
 
Old 07-02-2016, 05:11 PM   #3
mralk3
Slackware Contributor
 
Registered: May 2015
Distribution: Slackware
Posts: 1,900

Rep: Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050
You can find information about installing grub during Slackware installation here.

Are you using UEFI hardware? If so, please look at this.

There is also the documentation for grub located on your system at: /usr/share/doc/grub-2.00. The INSTALL text file is very helpful.
 
Old 07-02-2016, 11:16 PM   #4
Hangaber
Member
 
Registered: Sep 2004
Location: USA
Distribution: Slackware
Posts: 163

Rep: Reputation: 51
Quote:
Originally Posted by gnus View Post
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
 
Old 07-03-2016, 12:58 AM   #5
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
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.
 
Old 07-03-2016, 09:46 AM   #6
gnus
Member
 
Registered: Aug 2015
Distribution: Slackware
Posts: 35

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Richard Cranium View Post
OK, how is your system set up?
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 View Post
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.
Code:
-rw-r--r--  1 root root 4579269 Jul  3 00:07 initrd-generic-3.10.17
drwxr-xr-x 14 root root    1024 Jul  3 00:07 initrd-tree
lrwxrwxrwx  1 root root      20 Jul  2 01:12 vmlinuz -> vmlinuz-huge-3.10.17
-rw-r--r--  1 root root 3450176 Feb 15  2014 vmlinuz-generic-3.10.17
-rw-r--r--  1 root root 6436992 Feb 15  2014 vmlinuz-huge-3.10.17
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

Last edited by gnus; 07-03-2016 at 09:47 AM.
 
Old 07-03-2016, 11:12 AM   #7
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
Could you post the contents of your /boot/grub/grub.cfg?
 
Old 07-03-2016, 11:33 AM   #8
Hangaber
Member
 
Registered: Sep 2004
Location: USA
Distribution: Slackware
Posts: 163

Rep: Reputation: 51
Quote:
Originally Posted by gnus View Post
I have following kernels and initrds in boot folder.
Code:
-rw-r--r--  1 root root 4579269 Jul  3 00:07 initrd-generic-3.10.17
drwxr-xr-x 14 root root    1024 Jul  3 00:07 initrd-tree
lrwxrwxrwx  1 root root      20 Jul  2 01:12 vmlinuz -> vmlinuz-huge-3.10.17
-rw-r--r--  1 root root 3450176 Feb 15  2014 vmlinuz-generic-3.10.17
-rw-r--r--  1 root root 6436992 Feb 15  2014 vmlinuz-huge-3.10.17
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
...then run grub-mkconfig again.
Code:
grub-mkconfig -o /boot/grub/grub.cfg
 
Old 07-05-2016, 09:04 AM   #9
gnus
Member
 
Registered: Aug 2015
Distribution: Slackware
Posts: 35

Original Poster
Rep: Reputation: Disabled
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] setting up initrd / generic kernel in Grub2...can't load generic Ubunoob001 Slackware 12 03-20-2015 07:32 AM
[SOLVED] Slackware 14.1 Generic Kernel pr0xibus Slackware 7 10-19-2014 04:36 PM
[SOLVED] Kernel Panic with generic kernel on Dell poweredge 2850 Slackware 14.1 Dieselchair Slackware 44 08-22-2014 06:46 PM
[SOLVED] Can't Get GRUB2 To Boot Slack Generic Kernel Sumguy Slackware 22 05-15-2014 03:07 PM
slackware 14.1 3.10.17 kernel question on setting up generic kernel Bertman123 Slackware 22 01-14-2014 09:47 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 03:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration