SUSE 15 OS Updates via GRUB
by Ramses Soto-Navarro ramses@sotosystems.com, 10/26/2022
Overview
Copy Kernel
Modify GRUB
GRUB Boot Parameters
Erase GRUB Boot Entry
Troubleshooting
Overview
Brief notes on how to update SUSE 15 SP3 to SP4 via GRUB boot, without using the virtual guest CDROM. Perform an offline OS upgrade using the server’s own hard disk without a need to attach any devices (like USB drive or DVD ISO); use a local network source mounted repository for the installation media. The audience is experienced Linux administrators.
Copy Kernel
Mount the installation ISO on a another computer and copy the kernel and ramdisk onto the /boot/ directory of the computer to be updated:
# ls -lh /u1/iso/SLE-15-SP3-Full-x86_64-GM-Media1.iso # echo "/dev/sr0 /media/cdrom udf,iso9660 user,noauto 0 0" >> /etc/fstab # mkdir /media/cdrom # mount /dev/cdrom # cp -a /media/cdrom/boot/x86_64/loader/{linux,initrd,isolinux.cfg} /tmp/ # cp /media/cdrom/EFI/BOOT/grub.cfg /tmp/ # sync # umount /media/cdrom
Copy the files remotely to the system to be updated:
# scp /tmp/linux suse153:/boot/linux-upgrade # scp /tmp/initrd suse153:/boot/initrd-upgrade
Modify GRUB
On target system, recreate the new GRUB entry for the upgrade:
# vi /etc/grub.d/40_custom menuentry "SUSE 15 SP4 Upgrade" { linux /linux-upgrade initrd /initrd-upgrade }
Modify GRUB defaults then rebuild GRUB; backup first:
# cp -a /boot/grub2/grub.cfg{,.$RANDOM.bak} # cp -a /etc/default/grub{,.$RANDOM.bak} # vi /etc/default/grub GRUB_DISTRIBUTOR= GRUB_DEFAULT=saved GRUB_HIDDEN_TIMEOUT=0 GRUB_TIMEOUT=8 GRUB_CMDLINE_LINUX_DEFAULT="" GRUB_CMDLINE_LINUX="" GRUB_ENABLE_CRYPTODISK="n" # grub2-mkconfig -o /boot/grub2/grub.cfg # reboot
GRUB Boot Parameters
GRUB parameters can be entered at the boot prompt as follows:
- First, verify that a web repository is available.
- Mount the installation ISO to an Apache index.
- Select the boot parameter.
- Press ‘e’ to enter the GRUB boot edit
- Add to the “linux-upgrade” kernel parameters, for example:
linux /linux-upgrade ifcfg=*="172.30.0.132/24,172.30.0.1,172.30.0.75,example.com" upgrade=1 install=http://http://172.24.80.26/suse15sp4/dvd1
- Net parameters sequence: “IP,GW,DNS,DOMAIN”
- Press F10 to when done, and to boot with the new temporary parameters.
- The parameters can also be permanently added to the boot append in the GRUB configuration above.
NOTE: if it returns: “To use the selected repository a matching boot image is needed. Download it now and restart?”; Press “Yes”, then enter to continue…
Proceed with the upgrade.
Erase GRUB Boot Entry
- Simply reverse the steps
- Rebuild GRUB.
Troubleshooting
Deinstall any unecessary third party packages before proceeding.
# systemctl disable fail2ban ; systemctl stop fail2ban # zypper remove fail2ban python3-pyinotify python3-systemd
Disable kdump and disable the previous registration before rebooting for the upgrade:
# systemctl disable kdump # SUSEConnect --de-register # SUSEConnect --cleanup # zypper ref
The End.