LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 10-14-2019, 04:18 AM   #1
3rensho
Senior Member
 
Registered: Mar 2008
Location: Deutschland
Distribution: Slackware64-current
Posts: 1,023

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
GRUB and generic kernel


I am switching over to the generic kernel (4.19.79 at present). Read the README.initrd but it only covers configuring LILO and I use GRUB2. I've built the kernel, modules, firmware, headers and have run the mkinitrd command to create the initrd-tree and initrd.gz in /boot. Ran grub-mkconfig -o /boot/grub/grub.cfg. Is there any other config that I need so that when I reboot the initrd can be found and booting will happen without a problem ??? Thanks in advance.
 
Old 10-14-2019, 05:37 AM   #2
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,573
Blog Entries: 19

Rep: Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452
It looks to me as if you have done everything necessary. If you're not sure, you can look at the grub.cfg file and check that the new Slackware stanza contains everything it should and that you still have the old one as a fallback.
 
Old 10-14-2019, 05:38 AM   #3
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,346

Rep: Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589
If the default entry isn't the one you want to boot, edit /etc/default/grub and rerun grub-mkconfig, so the the entry you want to use will boot by default.
Another way, which is what I do is create a /etc/grub.d/05_custom with the following entries similar to these, edit the ? to match your system, will put the said entries first in your grub menu.
Code:
menuentry 'Slackware-generic'{
        load_video
        insmod gzio
        insmod part_gpt
        insmod ext2
        set root='hd0,gpt?'
       	echo    'Loading Slackware-generic ...'
        linux   /boot/vmlinuz-generic root=/dev/sda? ro
        initrd /boot/initrd.gz
}

menuentry 'Slackware-huge'{
        load_video
        insmod gzio
        insmod part_gpt
        insmod ext2
        set root='hd0,gpt?'
        echo    'Loading Slackware-Huge...'
        linux   /boot/vmlinuz-huge root=/dev/sda7 ro
        
}
run grub-mkconfig, unless something goes wrong shouldn't have to run grub-mkconfig after a kernel upgrade.

Last edited by colorpurple21859; 10-14-2019 at 05:41 AM.
 
Old 10-14-2019, 05:51 AM   #4
3rensho
Senior Member
 
Registered: Mar 2008
Location: Deutschland
Distribution: Slackware64-current
Posts: 1,023

Original Poster
Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
Tried booting. It found initrd

Loading kernel modules from initrd image

insmod loaded jbd2.ko, mbcache.ko, ext4.ko

then coughed blood with

Mount can't find /mnt in /mnt/fstab

Will boot Knoppix and have a look at your suggestion colorpurple

System is Raid 1 with ext4 fs usually mounted on /dev/md126

Last edited by 3rensho; 10-14-2019 at 05:53 AM.
 
Old 10-14-2019, 06:13 AM   #5
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,057

Rep: Reputation: Disabled
Don't forget to run:
Code:
grub-install <drive>
where <drive> is the drive's name like /dev/sda for instance.

Last edited by Didier Spaier; 10-14-2019 at 06:17 AM.
 
Old 10-14-2019, 06:37 AM   #6
3rensho
Senior Member
 
Registered: Mar 2008
Location: Deutschland
Distribution: Slackware64-current
Posts: 1,023

Original Poster
Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
The system has had grub installed from the get go. The only thing I have changed is moving from the huge kernel to the generic version. After building the kernel and associated bits like modules, firmware and headers I had run mkinitrd and then grub-mkconfig. Why the need to reinstall grub?
 
Old 10-14-2019, 07:17 AM   #7
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,573
Blog Entries: 19

Rep: Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452
/mnt/fstab looks weird. I've never seen that before; it should be /etc/fstab. The only thing I can think of is that grub has been given the wrong root partition. Again check your grub.cfg.
 
Old 10-14-2019, 08:41 AM   #8
3rensho
Senior Member
 
Registered: Mar 2008
Location: Deutschland
Distribution: Slackware64-current
Posts: 1,023

Original Poster
Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
I agree Hazel. For now I am building the huge kernel again so I will have a running machine. I'll do further searching as time permits. Thanks to all so far.
 
1 members found this post helpful.
Old 10-14-2019, 10:06 AM   #9
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,573
Blog Entries: 19

Rep: Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452
Why didn't you keep the old kernel as a fallback until you knew the new kernel could boot? It would have saved you a lot of aggro.
 
Old 10-14-2019, 10:30 AM   #10
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
https://github.com/Richard-Cranium/SlackwareGrub2 might help.

It assumes that you name your initrd to match the kernel version, i.e. initrd-4.19.79.gz for the 4.19.79 kernel. I use it myself, for what that's worth.
 
1 members found this post helpful.
Old 10-14-2019, 12:43 PM   #11
3rensho
Senior Member
 
Registered: Mar 2008
Location: Deutschland
Distribution: Slackware64-current
Posts: 1,023

Original Poster
Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
Thanks Richard for that. Will have a look see. Too right Hazel.
 
Old 10-14-2019, 02:05 PM   #12
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,057

Rep: Reputation: Disabled
The default util/grub.d/10-linux.in in the source archive includes this code snippet:
Code:
  initrd_real=
  for i in "initrd.img-${version}" "initrd-${version}.img" "initrd-${version}.gz" \
       "initrd-${version}" "initramfs-${version}.img" \
       "initrd.img-${alt_version}" "initrd-${alt_version}.img" \
       "initrd-${alt_version}" "initramfs-${alt_version}.img" \
       "initramfs-genkernel-${version}" \
       "initramfs-genkernel-${alt_version}" \
       "initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \
       "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}"; do
    if test -e "${dirname}/${i}" ; then
      initrd_real="${i}"
      break
    fi
  done
But in Slackware the initrd is usually just named initrd.gz so inird_real is not set and the line initrd= not fed by grub-mkconfig.

This patch solves that when building grub:
Code:
diff -Naur grub-2.00.orig/util/grub.d/10_linux.in grub-2.00/util/grub.d/10_linux.in
--- grub-2.00.orig/util/grub.d/10_linux.in    2012-04-18 23:24:38.000000000 +0200
+++ grub-2.00/util/grub.d/10_linux.in    2012-06-30 07:53:03.765625589 +0200
@@ -198,7 +198,8 @@
        "initramfs-genkernel-${version}" \
        "initramfs-genkernel-${alt_version}" \
        "initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \
-       "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}"; do
+       "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}" \
+       "initrd.gz"; do
     if test -e "${dirname}/${i}" ; then
       initrd="$i"
       break
Alternatively, you can patch directly /etc/grub.d/10_linux to avoid rebuilding grub just for that.

Last edited by Didier Spaier; 10-14-2019 at 02:18 PM.
 
1 members found this post helpful.
Old 10-17-2019, 04:34 AM   #13
Nille_kungen
Member
 
Registered: Jul 2005
Distribution: Slackware64-current
Posts: 587

Rep: Reputation: 201Reputation: 201Reputation: 201
The only thing that should differ going from huge to generic kernel is initrd.
If you have problems creating an initrd then /usr/share/mkinitrd/mkinitrd_command_generator.sh might help (it can also be run interactive -i).
You don't need to patch anything /boot/initrd.gz should work by default.

Last edited by Nille_kungen; 10-17-2019 at 04:42 AM.
 
Old 10-17-2019, 04:52 AM   #14
3rensho
Senior Member
 
Registered: Mar 2008
Location: Deutschland
Distribution: Slackware64-current
Posts: 1,023

Original Poster
Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
No, I had no problems creating the initrd. It was found at boot and loaded several modules (see above). It was only after that booting gave up apparently looking for an fstab in /mnt/fstab which obviously doesn't exist. I'll get back to trying the generic kernel again in a few days when I have some time.
 
Old 10-17-2019, 07:03 AM   #15
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
for kernels and grub I use


( I have added echo so these scripts will only show what is to be done )
Code:
#!/bin/bash

Kernel=(/boot/vmlinuz*-*-*)

for version in ${Kernel[@]}
do
   [[ -e /boot/initrd-${version##*-}.gz ]] || \
   echo mkinitrd \
    -c \
    -k ${version##*-} \
    -f ext4 \
    -r /dev/vg_slackware/lv_root \
    -m usb-storage:ehci-hcd:ehci-pci:uhci-hcd:jbd2:mbcache:crc32c-intel:ext4 \
    -L -l uk -u \
    -o /boot/initrd-${version##*-}.gz
done
echo grub-mkconfig -o /boot/grub/grub.cfg
obviously you will need to adapt it for your setup
The important part is -o /boot.... , this will generate an initrd for each kernel version you have, grub-mkconfig will then happily generate a grub.cfg using the correct initrd for each kernel.

to get multiple kernels. you need to blacklist, and install manually
you can grab the latest kernel packages with this script ( after updating pkg lists )

Code:
#!/bin/bash

mirror="$(grep -m1 -v ^# /etc/slackpkg/mirrors)"
while read pkg
do
  for ext in .txt .txz.asc .txz
  do
    [[ -e ./${pkg#./}${ext} ]]  && continue
    GetList+=(${pkg#./}${ext})
    [[ ${ext} != \.txz ]]          && continue
    Install+=(${pkg##*/})
  done 
done < <(awk '/kernel-[gmh][eo]/{print $7"/"$6}' /var/lib/slackpkg/pkglist)

echo wget -c ${GetList[@]/#/ ${mirror}}
you then install manually, e.g.
Code:
installpkg kernel*79*txz
( or finish my script and use the Install array )

Last edited by Firerat; 10-17-2019 at 07:44 AM. Reason: typos
 
  


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
kernel-generic and kernel-generic-smp ?? liuyug Slackware - Installation 5 06-01-2014 07:01 PM
Infinite Grub Loop: GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB... beeblequix MEPIS 2 11-02-2013 10:56 PM
what are initrd.img-2.6.28-11-generic and vmlinuz-2.6.28-11-generic? karuna-bdc Linux - Newbie 11 07-17-2009 05:00 AM
GART TLB error generic level generic Clydesdale Linux - Hardware 0 08-13-2007 06:18 PM

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

All times are GMT -5. The time now is 01:11 AM.

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