Raspberry Pi Auto Update Packages

Folks - I have found cron-apt package to automatically update your Raspberry Pi. Right now it is default to run update at 0400L but you can change that in the crontab. You still have to periodically run rpi-update manually since I don’t feel comfortable running kernel/firmware update automatically.

sudo apt-get install cron-apt -y
ls -hal /etc/cron-apt/config
ls -hal /etc/cron-apt/action.d/
echo ‘MAILON=“output”’ | sudo tee -a /etc/cron-apt/config
echo ‘DEBUG=“verbose”’ | sudo tee -a /etc/cron-apt/config
sudo touch /etc/cron-apt/action.d/5-security
echo ‘upgrade -y -o APT::Get::Show-Upgraded=true’ | sudo tee -a /etc/cron-apt/action.d/5-security
sudo touch /etc/cron-apt/config.d/5-security
echo ‘OPTIONS=“-o quiet=1 -o APT::Get::List-Cleanup=false -o Dir::Etc::SourceList=/etc/apt/sources.list.d/security.list -o Dir::Etc::SourceParts="/dev/null"”’ | sudo tee -a /etc/cron-apt/config.d/5-security
sudo chmod -R 755 /var/log/cron-apt
sudo cat /var/log/cron-apt/log

You will have to wait for next cycle to run before you see the log file or you can force run cron-apt in download (-d) mode to manually test it.

/Tailwinds :bulb:

Not very keen on automatic updates but good stuff if that is your cup of tea.
Just curious couldn’t you use the unattended-upgrades package as well?

Good point, I haven’t tried unattended-pkg yet but that seems a viable option as well. For now this is running for last three months without issues on multiple pi around the house. I did add a short python script to trigger for email and growl notification with list of changes.

Was looking into it seems there are some hoops to jump through in order to get it to work on Raspbian so probably best to stick with what you came up with.