Unattended upgrades - daily sudo apt update?

New debian user here. I’m using sway and have a script in my waybar config to look for upgrades and indicate if any are available. However, it typically doesn’t find anything because I first need to run a sudo apt update first.

I don’t really want to figure out someway to do a sudo through this script and was curious how gnome finds updates without me needing to enter a password.

It looks like I can use unattended upgrades to do the apt update.

<a href="">https://wiki.debian.org/UnattendedUpgrades</a>

though I don’t want it to do upgrades until I do a sudo apt upgrade after being notified of upgrades. I created a 02periodic file in /etc/apt/apt.config.d as indicated, but I only included the lines

APT::Periodic::Enable “1”;

APT::Periodic::Update-Package-Lists “1”;

Will this run an apt update every day for me? Is there any issue I’m unaware of in doing this? Thanks for any help!

bizdelnick, (edited )

Why did you create it manually? You should just edit the existing file. And this can be done via sudo dpkg-reconfigure unattended-upgrades IIRC.

bizdelnick,

On my system that file is /etc/apt/apt.conf.d/20auto-upgrades. You can read description of its parameters in comments in the /usr/lib/apt/apt.systemd.daily script. It does not require unattended-upgrades to work.

BTW I have unattended-upgrades enabled for many years on all my systems, both desktops and servers, and it never caused any troubles when only stable repos are configured.

rescue_toaster,

My system did not already have that 20auto-upgrades file. I went through the others in the directory and none seemed to contain those relevant lines. I just checked my other ubuntu system, which did have the 20auto-upgrades AND a 10periodic with the same lines, which is likely redundant.

GuyNoIRQ,
@GuyNoIRQ@infosec.pub avatar

Maybe just allow apt update specifically via the sudoers conf so you can cron job it to run without being prompted for user input, or just run it in cron as root.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • debian@lemmy.ml
  • ethstaker
  • DreamBathrooms
  • InstantRegret
  • magazineikmin
  • ngwrru68w68
  • Durango
  • thenastyranch
  • Youngstown
  • rosin
  • slotface
  • tacticalgear
  • mdbf
  • kavyap
  • khanakhh
  • provamag3
  • osvaldo12
  • GTA5RPClips
  • cubers
  • cisconetworking
  • everett
  • tester
  • modclub
  • megavids
  • Leos
  • normalnudes
  • anitta
  • JUstTest
  • lostlight
  • All magazines