Results 1 to 4 of 4

Thread: Unattended Upgrades Not Refreshing APT

  1. #1
    Join Date
    2023-Feb
    Posts
    2

    Post Unattended Upgrades Not Refreshing APT

    Hey there!

    Thank you in advance to anyone who reads through what I have to say here. I've tried to include as much detail as possible in my post as I'm new to these forums.

    I wrote a script on my Debian 12 Bookworm box (a test system at home) and wanted to apply similar changes to my Kali boxes. My current version of Kali on both machines is 2022.4. Below are the steps I performed on my Debian box to get unattended-upgrades installed/configured. (Please note that I closely followed this article for the steps below: https://unix.stackexchange.com/quest...very-few-hours)

    • Install unattended-upgrades
      Code:
      sudo apt update && sudo apt -y install unattended-upgrades
    • Commented out all lines of /etc/apt/apt.conf.d/50unattended-upgrades (with sed)
    • Appended the following lines to the bottom of /etc/apt/apt.conf.d/50unattended-upgrades

    Code:
    Unattended-Upgrade::Origins-Pattern {
        "origin=Debian,codename=\${distro_codename}-updates";
        "origin=Debian,codename=\${distro_codename},label=Debian";
        "origin=Debian,codename=\${distro_codename},label=Debian-Security";
        "origin=Debian,codename=\${distro_codename}-security,label=Debian-Security";
    };
    Unattended-Upgrade::AutoFixInterruptedDpkg "true";
    Unattended-Upgrade::MinimalSteps "true";
    Unattended-Upgrade::Remove-Unused-Kernel-Packages "true";
    Unattended-Upgrade::Remove-New-Unused-Dependencies "true";
    Unattended-Upgrade::Remove-Unused-Dependencies "true";
    Unattended-Upgrade::OnlyOnACPower "true";
    • Created an apt-daily.timer override file at /etc/systemd/system/apt-daily.timer/override.conf with the following contents (to allow APT updates at 2 AM daily):

    Code:
    [Timer]
    OnCalendar=
    OnCalendar=*-*-* 2:00
    RandomizedDelaySec=0s

    • Created an apt-daily.timer override file at /etc/systemd/system/apt-daily-upgrade.timer/override.conf with the following contents (to allow APT upgrades at 2:10 AM daily):

    Code:
    [Unit]
    Description=Daily apt download activities
        
    [Timer]
    OnCalendar=*-*-* 2:10
    RandomizedDelaySec=0s
    Persistent=true
       
    [Install]
    WantedBy=timers.target
    • Commented out all lines of /etc/apt/apt.conf.d/20auto-upgrades (with sed). (I'm assuming the "//" characters are still the right ones to comment lines out for this file. Couldn't find opposing info online)
    • Appended the following lines to /etc/apt/apt.conf.d/20auto-upgrades. (Note, "always" was added in a recent update to APT by Paul Wise. Kali's current version of APT is higher than 2.4.1)

    Code:
    APT::Periodic::Update-Package-Lists "always";
    APT::Periodic::Unattended-Upgrade "always";
    • Ran:
      Code:
      sudo systemctl daemon-reload
    • Ran:
      Code:
      sudo systemctl restart apt-daily.timer
    • Ran:
      Code:
      sudo systemctl restart apt-daily-upgrade.timer
    • Ran:
      Code:
      sudo systemctl restart unattended-upgrades.service


    After following these steps on my Debian 12 box, I can see the system gets updated each day. I verify this by running 2 commands:
    • Code:
      systemctl list-timers --all apt-daily.timer
    • Code:
      cat /var/log/dpkg.log


    My Debian 12 box has been running well for the past week and the behavior is as expected. When I followed these steps on Kali 2022.4, I see the correct past and upcoming update cycles with
    Code:
    systemctl list-timers --all apt-daily.timer
    . After watching for a few days, I checked the /var/log/dpkg.log file and see nothing has changed since I last manually ran this command around a week ago.
    Code:
    sudo apt update && sudo apt -y upgrade
    I don't know if I'm just missing something, but I wouldn't turn down any ideas/suggestions. Thank you in advance for your help!

  2. #2
    Join Date
    2021-May
    Location
    UK
    Posts
    772
    Think this;

    APT::Periodic::Update-Package-Lists "always";
    APT::Periodic::Unattended-Upgrade "always";

    should be this;

    APT::Periodic::Update-Package-Lists "1";
    APT::Periodic::Unattended-Upgrade "1";

    https://wiki.debian.org/UnattendedUp...8on_systemd.29

  3. #3
    Join Date
    2021-May
    Location
    UK
    Posts
    772

  4. #4
    Join Date
    2023-Feb
    Posts
    2
    Hey there, thank you @Fred Sheehan for the suggestion. I implemented your suggestion, restarted all services, tested this for a couple weeks, and can confirm this didn't fix the behavior unfortunately. In fact, the second article you shared, from pimylifeup.com, talks about using "always" instead of "1" for "more granular control". All that being said, I'm not sure what could be wrong, but I'm back to the drawing board. I do appreciate your suggestion though!

Similar Threads

  1. I can?t open software & upgrades
    By J4sfill in forum Kali Linux General Questions
    Replies: 1
    Last Post: 2023-08-27, 22:56
  2. Faster updates/upgrades
    By scubahalo in forum General Archive
    Replies: 0
    Last Post: 2014-02-11, 04:43
  3. Refreshing Kali
    By sekhar in forum TroubleShooting Archive
    Replies: 0
    Last Post: 2013-06-22, 10:46

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •