Skip to Content

How to Downgrade Kernel of Ubuntu Server on Raspberry Pi

Resolve CIFS share I/O errors on Ubuntu Server 22.04.4 LTS for Raspberry Pi by downgrading the kernel. Learn how to implement this fix and regain control over your headless server.

The Challenge: I/O Errors & Kernel Bugs

Docker backups relying on CIFS shares may encounter I/O errors when using Ubuntu Server 22.04.4 LTS on Raspberry Pi. This issue stems from a confirmed bug in the current kernel version (5.15.0-1050-raspi), impacting CIFS share accessibility. Similar problems have been reported on Linux Mint systems, suggesting a broader kernel-related concern.

Solution 1: Kernel Downgrade

Since Raspberry Pi’s Ubuntu Server lacks GRUB, traditional kernel downgrade methods are inapplicable. However, we can leverage the system’s package management to achieve our goal. Follow these steps to downgrade the kernel and eliminate I/O errors:

Prerequisites

SSH access to your Raspberry Pi running Ubuntu Server 22.04.4 LTS.

Downgrade Procedure

  1. Choose a stable kernel version preceding 5.15.0-1050-raspi. Researching available options and their compatibility is crucial.
  2. Refresh the package lists to ensure you have access to the latest information about available kernel versions. Execute the following command: sudo apt update
  3. Install the chosen kernel version using the apt install command. Replace <target_kernel_version> with the specific version you identified: sudo apt install linux-image-<target_kernel_version> linux-headers-<target_kernel_version>
  4. Restart your Raspberry Pi to activate the newly installed kernel: sudo reboot
  5. Once the system reboots, verify the active kernel version using the following command: uname -r
    The output should display the downgraded kernel version.
  6. Remove Old Kernel (Optional): If desired, remove the problematic kernel version to conserve disk space. However, keeping it as a fallback option is recommended: sudo apt remove linux-image-5.15.0-1050-raspi linux-headers-5.15.0-1050-raspi

Solution 2: Boot from Earlier Kernel on Raspberry Pi

To address the issue with your Raspberry Pi, you can opt to boot an earlier kernel version (5.15.0-1049-raspi) that is still available on your system. This approach ensures that future kernel upgrades remain unaffected once the smb issue is resolved.

The kernel files for your Raspberry Pi are stored in the /boot directory. However, the actual booting process utilizes files located within /boot/firmware.

To boot from a different kernel, you need to replace the /boot/firmware/initrd.img and /boot/firmware/vmlinuz files with the version you prefer from the /boot directory. Execute the following commands:

sudo cp /boot/vmlinuz-5.15.0-1049-raspi /boot/firmware/vmlinuz
sudo cp /boot/initrd.img-5.15.0-1049-raspi /boot/firmware/initrd.img
sudo chmod +rx /boot/firmware/vmlinuz /boot/firmware/initrd.img

If you wish to revert to the current kernel, run the following commands:

sudo cp /boot/vmlinuz-5.15.0-1050-raspi /boot/firmware/vmlinuz
sudo cp /boot/initrd.img-5.15.0-1050-raspi /boot/firmware/initrd.img
sudo chmod +rx /boot/firmware/vmlinuz /boot/firmware/initrd.img

When a new kernel is available through apt, these files will be automatically overwritten as part of the kernel package’s post-install script.

Conclusion

By downgrading the kernel on your Raspberry Pi’s Ubuntu Server, you can effectively resolve I/O errors with CIFS shares and restore smooth Docker backup functionality. Remember to choose a compatible and stable kernel version for optimal results.