LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   kernel update question: do I have to reboot to upgrade to new kernel version in current? (https://www.linuxquestions.org/questions/slackware-14/kernel-update-question-do-i-have-to-reboot-to-upgrade-to-new-kernel-version-in-current-4175703543/)

tfrei 11-13-2021 10:06 AM

kernel update question: do I have to reboot to upgrade to new kernel version in current?
 
My usual practice is to update in current, then reboot in order to get the new kernel version installed, then run the mkinitrd_command_generator.sh scrpt to get the modules for the generic modules identified, and then reboot again to get to the new version of the generic kernel.

Is there a way to do this "on the fly" without the two reboots?

hazel 11-13-2021 10:11 AM

You can use the kexec command to switch kernels.

marav 11-13-2021 10:15 AM

Code:

/usr/share/mkinitrd/mkinitrd_command_generator.sh -k $NEW_KERNEL_VERSION

pghvlaans 11-13-2021 10:16 AM

You can make an initrd for any installed kernel by passing it to the script, e.g.:

Code:

$(/usr/share/mkinitrd/mkinitrd_command_generator.sh -r /boot/vmlinuz-generic)

business_kid 11-13-2021 10:20 AM

You can make the initrd for new kernel while running another kernel version. If you update grub.cfg, install the modules, run mkinitrd with the options to clear the directory /boot/initrd-tree and to use the relevant kernel version, and update the hard disk boot sector (I think) it should be possible to do it in one reboot.

Pithium 11-13-2021 10:25 AM

I use the new geninitrd command in -current.

1) update via slackpkg
2) as root: geninitrd
3) copy vmlinuz-generic and new initrd.gz to my efi partition
4) reboot

This works because when generating an initrd you can actually specify the kernel to create it for as mentioned by marav. The geninitrd script just automates this by detecting the newly installed kernel version even when the old kernel is still running.

tfrei 11-13-2021 10:51 AM

Thanks for the helpful suggestions. I'll start working with them.

yvesjv 11-14-2021 12:32 AM

Quote:

Originally Posted by hazel (Post 6300982)
You can use the kexec command to switch kernels.

Do you mean something like this?
https://www.linux.com/training-tutor...kexec-example/

allend 11-14-2021 12:54 AM

If you use slackpkg to update, do the initial 'slackpkg upgrade-all' without including the generic kernel. Then do a second 'slackpkg upgrade-all' (just need to hit the up arrow key). This way results in the /boot/vmlinuz symlink pointing to the generic kernel rather than the huge kernel. Then make the new initrd and update the bootloader.

chrisretusn 11-14-2021 02:19 AM

Quote:

Originally Posted by tfrei (Post 6300979)
My usual practice is to update in current, then reboot in order to get the new kernel version installed, then run the mkinitrd_command_generator.sh scrpt to get the modules for the generic modules identified, and then reboot again to get to the new version of the generic kernel.

Is there a way to do this "on the fly" without the two reboots?

Here is how I would to this.

Blacklist kernel-huge.
Have an /etc/mkinitrd.conf with my desired settings. "mkinitrd_command_generator.sh -c" can help with this.
Do the "slackpkg upgrade-all"
cd /boot
run "mkinitrd -F -k x.x.x" (-F to use /etc/mkinitrd.conf; -k the kernel version to use.)
run lilo
reboot
done one reboot.

kingbeowulf 11-14-2021 01:44 PM

Quote:

Originally Posted by chrisretusn (Post 6301157)
Here is how I would to this.

Blacklist kernel-huge.
Have an /etc/mkinitrd.conf with my desired settings. "mkinitrd_command_generator.sh -c" can help with this.
Do the "slackpkg upgrade-all"
cd /boot
run "mkinitrd -F -k x.x.x" (-F to use /etc/mkinitrd.conf; -k the kernel version to use.)
run lilo
reboot
done one reboot.

Or even more simply, and no kernel blacklisting (in case you DO need to boot huge for recovery):
Code:

# slackpkg update
# slackpkg install-new
# slackpkg upgrade-all
# slackpkg clean-system
# mkinitrd -c -k 5.15.2 -m ext4 -f ext4 /dev/nvme0n1p2

Note: My boot drive is NVME and filesystem is ext4. You really don't need much else or need to stuff mkinitrd.conf full of extras.

Now just copy initrd.gz and kernel-generic -> vmlinuz to /boot/efi/EFI/Slackware/ and reboot. My elilo.conf is simply:
Code:

chooser=simple
delay=1
timeout=1
#
image=vmlinuz
        label=slackware
        initrd=initrd.gz
        read-only
        append="root=/dev/nvme0n1p2 vga=normal ro acpi_enforce_resources=lax"

Note: 'acpi_enforce_resources=lax" is a workaround to get sensors working on the AMD Ryzen X570 motherboard, discussed here: https://www.linuxgalaxy.org/kingbeow...e-8688-sensor/

If using lilo, and lilo.conf is configured, just run lilo after mkinitrd then reboot. Specifying the kernel in the mkinitrd command line will enure which version gets grabbed for those that like the have a few laying about.

You really don't need much else or need to stuff mkinitrd.conf full of extras for most simple Desktop and Server installations.

tfrei 11-14-2021 05:47 PM

Thanks again for the help to everybody.

allend 11-14-2021 06:36 PM

Quote:

If using lilo, and lilo.conf is configured, just run lilo after mkinitrd then reboot.
This is dependent on the configuration in /etc/lilo.conf.
If 'image = /boot/vmlinuz' is set, then the order of upgrade of the generic and huge kernels is important.
If 'image = /boot/vmlinuz-generic' or 'image = /boot/vmlinuz-huge' is set, then the kernel type is specified.

Gerard Lally 11-14-2021 07:06 PM

Quote:

Originally Posted by allend (Post 6301135)
If you use slackpkg to update, do the initial 'slackpkg upgrade-all' without including the generic kernel. Then do a second 'slackpkg upgrade-all' (just need to hit the up arrow key). This way results in the /boot/vmlinuz symlink pointing to the generic kernel rather than the huge kernel. Then make the new initrd and update the bootloader.

If you do it this way, do the System.map and config symlinks also point to their generic equivalents? Do they need to? Config probably not, but System.map?

allend 11-14-2021 08:27 PM

If you install the generic kernel after the huge kernel, then the /boot/config and /boot/System.map symlinks will point to the generic kernel versions.


All times are GMT -5. The time now is 02:48 PM.