Regular Maintenance

sudo apt update
sudo apt upgrade

Error during Regular Maintenance: 11: Resource temporarily unavailable

This is a solution for handling resource shortage detected during sudo upgrade.

E: Could not get lock /var/lib/dpkg/lock – open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

Check if apt exists with the ps command. If it does, wait a bit and retry, or if possible, restarting may be quicker.

ps aux | grep -i apt

Stopping Regular apt update

There were symptoms of OOM (Out-of-Memory) resulting from apt running every day at 6 AM and 6 PM (memory is limited). Since the following are the defaults, automatic startup has been stopped.

$ systemctl cat apt-daily.timer
# /lib/systemd/system/apt-daily.timer
[Unit]
Description=Daily apt download activities

[Timer]
OnCalendar=*-*-* 6,18:00
RandomizedDelaySec=12h
Persistent=true

[Install]
WantedBy=timers.target
$ systemctl cat apt-daily-upgrade.timer
# /lib/systemd/system/apt-daily-upgrade.timer
[Unit]
Description=Daily apt upgrade and clean activities
After=apt-daily.timer

[Timer]
OnCalendar=*-*-* 6:00
RandomizedDelaySec=60m
Persistent=true

[Install]
WantedBy=timers.target

Disabling automatic execution with apt.systemd.daily (AutoAptEnable).

sudo vi /usr/lib/apt/apt.systemd.daily
# check if the user really wants to do something
#AutoAptEnable=1  # default is yes
AutoAptEnable=0  # default is yes
eval $(apt-config shell AutoAptEnable APT::Periodic::Enable)
if [ $AutoAptEnable -eq 0 ]; then
    exit 0
fi