Rebooting from a faulty kernel
Reviewed on 16 June 2023 • Published on 23 November 2022
Rescue mode allows you to boot your Instance into a temporary operating system, running from the Instance’s RAM. Rescue mode is often used to diagnose and resolve issues such as faulty kernel configurations, networking issues, firewall configurations…etc.
Requirements:
- You have an account and are logged into the Scaleway console
- You have created an Instance
- You have installed and configured the Scaleway CLI-Tools on your local computer
- Switch the Instance’s
boot-type
torescue
and reboot your Instance into rescue mode using the CLI-Tools:scw instance server update {Instance_ID} boot-type=rescuescw instance server reboot {Instance_ID}Note:Replace
{Instance_ID}
with the unique ID of your Instance, e.g.0500ebd2-d70d-49af-a969-3ac09b6f7fff
. - Once the Instance is rebooted, log into your Instance using SSH and set up the environment to be able to chroot into it:
Then mount the partitions:cat /proc/partitionsmajor minor #blocks name8 0 9765625 sda8 1 9634536 sda18 14 3072 sda148 15 126976 sda15mount /dev/sda1 /mntmount /dev/sda15 /mnt/boot/efimount -o bind /sys /mnt/sysmount -o bind /proc /mnt/procmount -o bind /dev /mnt/dev
- Once mounted, use the
chroot
command to get into your Instances’ root filesystem. You can then change theGRUB_DEFAULT
value to boot using the previous kernel:chroot /mntnano /etc/default/grubChange the value ofTip:In the example above, we use
nano
as text editor. Feel free to use your favorite text editor to edit the file.GRUB_DEFAULT
to `“1 > 2”:Save the file and exit the text editor.# head /etc/default/grub# If you change this file, run 'update-grub' afterward to update# /boot/grub/grub.cfg.# For full documentation of the options in this file, see:# info -f grub -n 'Simple configuration'GRUB_DEFAULT="1>2"GRUB_TIMEOUT=5GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`GRUB_CMDLINE_LINUX_DEFAULT=""GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200 earlyprintk=ttyS0,115200 consoleblank=0" - Update the
grub
boatloader` to apply the kernel’s update# update-grubGenerating grub configuration file ...Found linux image: /boot/vmlinuz-6.0.0-0.deb11.2-cloud-amd64Found initrd image: /boot/initrd.img-6.0.0-0.deb11.2-cloud-amd64Found linux image: /boot/vmlinuz-5.19.0-0.deb11.2-cloud-amd64Found initrd image: /boot/initrd.img-5.19.0-0.deb11.2-cloud-amd64Found linux image: /boot/vmlinuz-5.10.0-19-cloud-amd64Found initrd image: /boot/initrd.img-5.10.0-19-cloud-amd64done - Switch back the Instance’s
boot_type
tolocal
and reboot the Instance:Your Instance reboots on the previously installed kernel.scw instance server update {Instance_ID} boot-type=localscw instance server reboot {Instance_ID}
Examples of failed boots
- In the following example, the Instance may only boot with the root filesystem in
read-only
mode:[ OK ] Finished Remove Stale Onli…ext4 Metadata Check Snapshots.[ 4.219158] cloud-init[542]: Traceback (most recent call last):[ 4.220328] cloud-init[542]: File "/usr/bin/cloud-init", line 33, in <module>[ 4.221518] cloud-init[542]: sys.exit(load_entry_point('cloud-init==20.4.1', 'console_scripts', 'cloud-init')())[ 4.223064] cloud-init[542]: File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 891, in main[ 4.224435] cloud-init[542]: retval = util.log_time([ 4.225251] cloud-init[542]: File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 2348, in log_time[ 4.226838] cloud-init[542]: ret = func(*args, **kwargs)[ 4.227743] cloud-init[542]: File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 600, in status_wrapper[ 4.229478] cloud-init[542]: util.ensure_dirs((data_d, link_d,))[ 4.230501] cloud-init[542]: File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 1534, in ensure_dirs[ 4.232014] cloud-init[542]: ensure_dir(d, mode)[ 4.232540] cloud-init[542]: File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 1591, in ensure_dir[ 4.233980] cloud-init[542]: chmod(path, mode)[ 4.234756] cloud-init[542]: File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 1830, in chmod[ 4.235672] cloud-init[542]: os.chmod(path, real_mode)[ 4.236227] cloud-init[542]: OSError: [Errno 30] Read-only file system: '/var/lib/cloud/data'[FAILED] Failed to start Apply the …ngs specified in cloud-config.