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:
Open the Console tab and press return to show the login prompt.
Log in with the username
pi
and passwordraspberry
.Update the device using:
sudo apt-get update && sudo apt-get upgrade -y
When the installation is complete, click the Restart button towards the top-right.
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:
Create a Raspberry Pi 4 device using the stock firmware
Raspberry Pi OS Desktop (11.2.0).
Close the warning window about the default SSH password.
Click through the Welcome to Raspberry Pi window.
The last screen will ask if you want to update. Click Next.
Restart the device when the update completes.
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:
Run
lsmod
in the console to list the modules that are loaded into the kernel.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
, andnfnetlink
, 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.
Install docker and look for a
Job for docker.service failed
message.sudo apt-get update && sudo apt-get install -y docker.io
Check if the service for docker is running.
sudo systemctl status docker
- If you see a
failed
state, continue to the Fixing the Updated Kernel File section to correct your issue.
- If you see a
Fixing the Updated Kernel File
To fix the updated kernel file:
Connect to your device's VPN using the Connect tab.
Find your device's LAN IP on the bottom-right of the Connect tab. In our example, we will use
10.11.0.7
.On your virtual device, locate the path to your kernel file. In our example, we will use
/boot/kernel8.img
.ls /boot/ker*
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 ./
Extract the
img
file.gunzip -cd kernel8.img > kernel
Upload the kernel file in the Kernel section of the Settings tab.
Wait for the upload to complete then click SAVE & REBOOT.
Confirm the kernel is working properly using
lsmod
orsudo systemctl status docker
.Clean up your local system.
rm kernel8.img kernel
You're all set!