On Debian/Ubuntu servers I enable unattended-upgrades for the security pocket only, with automatic reboot disabled and a notification instead. Feature updates and major versions stay manual. The common failure is not the tool, it is forgetting that a kernel or libc update does nothing until the service or the machine restarts: needrestart (or checkrestart) tells you what still runs old code.

Also worth checking: apt-get -s upgrade weekly, so you see what is waiting.

What is your policy: fully automatic with reboots in a maintenance window, notify-only, or everything by hand? Any horror story with auto-updates?

Open-source agent that lists the versions exposed by a Linux host: https://github.com/AttackScout/attackscout-agent — I work on AttackScout.

  • Dingaling@lemmy.ml
    link
    fedilink
    English
    arrow-up
    7
    ·
    22 hours ago

    People seem to love overcomplicating this subject but it’s not hard

    APT based distros:

    apt-get update
    apt-get upgrade -y
    reboot
    

    EL distros:

    dnf update
    reboot
    
    • Use root crontab to schedule, or one of the /etc/cron.[daily|weekly|monthly] dirs. I use a variety of schedules at work - 2nd and 4th Tuesdays of each month. Every day for DMZs. 70 or 80 vms at a time.

    Provisos:

    • Ensure root email reaches you, so you see any repo or package manager errors from crontab.
    • You can wrap this in a bash script. Or use ansible. Add whatever additions you need (notifications, logger lines, shutting stuff down in a particular order - whatever your pets need).

    Defences:

    • You should have reliable repos already. Remember that dnf can have multiple sources per repo if you want redundancy (We use an internal mirror for speed, but if that does go down, then the vms failover to the internet)
    • What about a bad package? It happens, but rare. At scale, ansible with batches and break lines if a certain percentage fail. Use inventory groups to prioritise non-production machines first as canaries)
    • Don’t trust a repo source against supply-chain attacks? Then never use their software, let alone add its repo. But you will have to trust your distro. No way around that.
    • Critical systems? Then you’re into the realm of soak-testing and staging. Beyond the scope of this, but even there, the actual patching is very similar, just with staged repos instead of live ones. And anyway, critical stuff should be HA.

    Benefits:

    • Rebooting often means finding problems faster. Your systems should always be able to reboot by themselves. Any failures need to be resolved or automated through. Anyone who is proud of their high uptimes needs taking outside and leaving by the bins.
    • Whilst you can check for needsrestart, what’s the point when you can reboot in less than a minute and be certain? Clear those caches and flush those buffers, recover leaking memory and freshen the place up, be 100% certain you’re using the latest kernel and every app has the latest library.

    We’ve been doing this for years on hundreds of vms, using Centos Linux, Rocky and Debian distros. Problems caused by reboots are negligible and would have been a problem anyway. Problems caused by bad distro packages are rare - maybe once a year. (I don’t recall any on Debian, but have had the odd one on Rocky and CentOs before it)

    Build bouncy systems. Don’t be scared of rebooting.

  • JoeKrogan@lemmy.world
    link
    fedilink
    arrow-up
    11
    ·
    1 day ago

    Fully automatic reboot at 3am if needed. Working well for years and upgrades from debian 6 to 13 so far

  • eldavi@lemmy.ml
    link
    fedilink
    English
    arrow-up
    1
    ·
    17 hours ago

    a sandbox group that mirrors production and are the only ones to get the updates and tested before your production boxes get the updates – this it the ONLY way that works.

  • Eager Eagle@lemmy.world
    link
    fedilink
    English
    arrow-up
    5
    ·
    1 day ago

    fully automatic and automated reboots, I don’t have the patience to babysit servers anymore, and that was more stressful than rewarding anyway

  • The Doctor@lemmy.ml
    link
    fedilink
    English
    arrow-up
    1
    ·
    18 hours ago

    Before anybody asks: Incremental system backups daily to offsite storage. That said…

    Debian and Ubuntu: Automatic unattended upgrades all across the board.

    Arch: Full system upgrade every 90 days.

  • sudoer777@lemmy.ml
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    1 day ago

    Full unattended-upgrades for my Debian homelab servers (due for replacement) because I don’t care about downtime and it has never broken anything. Manual updates for my personal NixOS server (that I’m also about to replace) because I never set up automatic updates. Weekly manual updates for a production Ubuntu server (that’s hopefully about to get axed) because whoever set it up and was supposed to be maintaining it before was an idiot so updates need to be planned carefully.