Skip to main content

Updating Linux Kernel on Raspberry Pi 4

You can update the Linux kernel on your virtual Raspberry Pi 4 board using either the command line or the Desktop firmware's GUI "Welcome to Raspberry Pi". Following sections explain the required steps and potential issues.

Update Using the Console Command Line

To update the kernel using the console command line:

  1. Open the Console tab and press return to show the login prompt.

  2. Log in with the username pi and password raspberry.

    Logged in

  3. Update the device using:

    sudo apt-get update && sudo apt-get upgrade -y
  4. When the installation is complete, click the Restart button towards the top-right.

  5. Continue to the Identifying Issues with the Device Kernel section to check for issues with your kernel.

Update Using the Welcome to Raspberry Pi GUI on the Desktop Firmware

To update the kernel using the desktop firmware GUI:

  1. Create a Raspberry Pi 4 device using the stock firmware Raspberry Pi OS Desktop (11.2.0).

  2. Close the warning window about the default SSH password.

    Close SSH popup

  3. Click through the Welcome to Raspberry Pi window.

  4. The last screen will ask if you want to update. Click Next.

    Update software

  5. Restart the device when the update completes.

  6. Continue to the Identifying Issues with the Device Kernel section to check for issues with your kernel.

Identifying Issues with the Device Kernel

In this section we check if modules are loaded into the kernel and try to install and run Docker.

List the Loaded Kernel Modules

To list the loaded kernel modules:

  1. Run lsmod in the console to list the modules that are loaded into the kernel.

    List the loaded kernel modules

  2. Review the results.

    • If the list is empty (or nearly empty,) you likely have kernel issues that need to be manually resolved. Continue to the Fixing the Updated Kernel File section to correct your issue.

    • If the list comes back with multiple results, such as xt_conntrack, nft_chain_nat, xt_MASQUERADE, nf_nat, nf_conntrack_netlink, nf_defrag_ipv6, nf_defrag_ipv4, nf_conntrack nft_counter, xt_addrtype, nft_compat, nf_tables, and nfnetlink, the kernel is likely behaving normally.

Try to Install and Run Docker

Running docker requires a properly configured kernel. If docker installs but the service fails to run, you may be having an issue with your updated kernel.

  1. Install docker and look for a Job for docker.service failed message.

    sudo apt-get update && sudo apt-get install -y docker.io

    Job for docker service failed

  2. Check if the service for docker is running.

    sudo systemctl status docker

    Docker failed

Fixing the Updated Kernel File

To fix the updated kernel file:

  1. Connect to your device's VPN using the Connect tab.

  2. Find your device's LAN IP on the bottom-right of the Connect tab. In our example, we will use 10.11.0.7.

    Find your LAP IP

  3. On your virtual device, locate the path to your kernel file. In our example, we will use /boot/kernel8.img.

    ls /boot/ker*

    Locate the kernel img file

  4. From your computer's terminal, download the VM's kernel using scp and the LAN IP and kernel path we just found.

    scp  pi@10.11.0.7:/boot/kernel8.img ./
  5. Extract the img file.

    gunzip -cd kernel8.img > kernel
  6. Upload the kernel file in the Kernel section of the Settings tab.

    Upload new kernel

  7. Wait for the upload to complete then click SAVE & REBOOT.

  1. Confirm the kernel is working properly using lsmod or sudo systemctl status docker.

    Docker running

  2. Clean up your local system.

    rm kernel8.img kernel
  3. You're all set!