mvo5 / unattended-upgrades

Automatic installation of security upgrades on apt based systems
GNU General Public License v2.0
278 stars 78 forks source link

unattended-upgrades for laptop #351

Open DavidHenryThoreau opened 8 months ago

DavidHenryThoreau commented 8 months ago

I'm using unattended-upgrades for desktop and server which works very well, but I'm trying to configure it to laptop but I've set additional variables and it still does not work :

echo "
// Enable the update/upgrade script (0=disable)
APT::Periodic::Enable "1";

// Do "apt-get update" automatically every n-days (0=disable)
APT::Periodic::Update-Package-Lists "1";

// Do "apt-get upgrade --download-only" every n-days (0=disable)
APT::Periodic::Download-Upgradeable-Packages "1";

// Run the "unattended-upgrade" security upgrade script
// every n-days (0=disabled)
// Requires the package "unattended-upgrades" and will write
// a log in /var/log/unattended-upgrades
APT::Periodic::Unattended-Upgrade "1";

// Do "apt-get autoclean" every n-days (0=disable)
APT::Periodic::AutocleanInterval "20";

// Define basic patterns
//Unattended-Upgrade::Origins-Pattern {
//        "origin=${distro_id},codename=${distro_codename}";
//        "origin=Armbian";
//};

APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Verbose "1";
Unattended-Upgrade::Remove-New-Unused-Dependencies "true";
Unattended-Upgrade::Remove-Unused-Dependencies "true";
Unattended-Upgrade::OnlyOnACPower "false";
//Unattended-Upgrade::Automatic-Reboot "true";
//Unattended-Upgrade::Automatic-Reboot-Time "02:30";

Unattended-Upgrade::Origins-Pattern {
        "origin=*";
      };" > /etc/apt/apt.conf.d/02-armbian-periodic

dpkg-divert --no-rename --add /etc/apt/apt.conf.d/02-armbian-periodic

SYSTEMD_EDITOR=tee systemctl edit apt-daily.timer <<EOF
[Timer]
OnBootSec=1min
RandomizedDelaySec=0
EOF

systemctl restart apt-daily.timer

SYSTEMD_EDITOR=tee systemctl edit apt-daily-upgrade.timer <<EOF
[Timer]
OnBootSec=3min
RandomizedDelaySec=0
EOF

systemctl restart apt-daily-upgrade.timer

SYSTEMD_EDITOR=tee systemctl edit apt-daily-upgrade.service <<EOF
[Unit]
ConditionACPower=false
EOF

systemctl restart apt-daily-upgrade.service

sed -i 's/ANACRON_RUN_ON_BATTERY_POWER.*/ANACRON_RUN_ON_BATTERY_POWER=yes/' /etc/default/anacron

echo -ne "[Unit]\nConditionACPower=" >> /etc/systemd/system/anacron.service.d/on-ac.conf

systemctl daemon-reload
systemctl restart anacron

unattended-upgrades --dry-run --debug

systemctl list-timers