How to see what packages updates available on Alpine Linux nixCraft

On Debian or Ubuntu Linux, one can run ‘apt list --upgradable‘ command to see and list available package updates. On RHEL, we can use ‘dnf check-update‘ to list available updates on screen. However, the apk command does not have an option to show and list available security software updates. But fear not. Some other tricks can list, and you can see what packages updates are available on Alpine Linux using the apk command.

Tutorial details
Difficulty level Easy
Root privileges No
Requirements apk command
Listing Available Package Updates on Alpine LinuxListing Available Package Updates on Alpine Linux

Listing Available Package Updates on Alpine Linux (click to enlarge)

However, there is no option to list security updates or app updates separately as we do on RHEL or SUSE Linux.

Applying security and other app updates on Alpine

Now you know how to show and list all available packages upgrade on Alpine Linux, it is time to apply those security updates. Type:
# apk upgrade
Apply Security Updates on Alpine Linux

Apply Security Updates on Alpine Linux

What next?

I installed Alpine Linux in sys disk mode. However, router and embedded system users might need to use lbu to save the system state before rebooting the system. For example, I have Alpine installed on RPi, and I need to run ‘lbu commit -d after apk upgrade:
# apk update
# apk -u list
# apk upgrade
# lbu commit -d
# reboot

See the lbu command help by typing the lbu commit -h or lbu -h commands.

Now you know how to check and install Updates on Alpine Linux. If Linux kernel installed, you must reboot Alpine Linux box by using the reboot command or shutdown command:
# reboot
You may have to restart services when necessary libs are updates on Alpine box. We can list such services with the following lsof command and then restart those services one-by-one using the service command:
# lsof | grep -E -i 'deleted'

# service httpd restart
See “How to restart systemd without rebooting Linux when critical libraries installed” for more info.

Summing up

Keeping the system secure is essential. One of the simplest methods to keep your Alpine Linux secure is to list and apply all available software updates immediately. For example, see apk command man page by typing the following man command:
man apk


Posted by Contributor