I want to set up an Ubuntu laptop for a person with 0 experience of linux and who does not want to learn more than just use a few programs (replacement for Windows for an older family member; she really likes ubuntu, finds it easy enough to use, and snappy :) ).

I want to make sure all updates are applied. I am aware of (and have enabled / set up for full update once a day) unattended-upgrades. However, I am worried that if the laptop is mostly being used for quite short amounts of time and conscientiously shut off, the upgrades may not be applied by the unattended thing.

  • Is this worry based on reality? Does unattended-upgrades attempt to upgrade immediately when the laptop is turned on (does not seem so as I still get quite a lot installed with apt each time I switch it on, though unattended-upgrades is set up), or does it do it only 'once a day at 01.00 am' or something like that, in which case it may never be called?

  • Would calling this kind of script from the root crontab (ie adding an @reboot bash script_update.sh to sudo crontab -e) help? :


# A little script to:
#   - wait that internet is available
#   - wait for the automatic software update to be finished running
#   - apply the apt-get update and upgrade to the system
# This means that updates are installed automatically without
# asking confirmation. This should be ok for most vanilla uses.
# set the XX_SET_PATH to the log file
# To make it run automatically, put it in crontab:
# sudo crontab -e
# and in the root crontab that gets opened:
# @reboot bash PATH_TO_THE_SCRIPT.sh

function check_online
    netcat -z -w 5 53 && return 1 || return 0

function wait_online
    echo "wait to be online"
    declare -i IS_ONLINE=0

    while [ $IS_ONLINE -eq 0 ]; do
        # We're offline. Sleep for a bit, then check again
        sleep 2;

    echo "now online"

    echo " "
    echo "new reboot"
    echo "wait for 20 minutes to make sure no conflicting catch of dpkg lock"
    sleep 1200
    echo "now start update upgrade..."
    apt-get update
    apt-get upgrade -y
    apt-get autoremove
} >> XX_SET_PATH 2>&1


Unattended Upgrades (UU) will attempt to run as soon as it's timer tells it to. If the system happens to be off when the timer expires, then UU will notice during boot and will run a couple minutes after boot.

  • You DON'T need to add your own script. The UU developers anticipated this use case.

Your own use case ("I still get quite a lot installed with apt") occurs when folks are updating from multiple pockets: -security, -updates, third party repos, etc. UU's default settings are to use -security only. You can change those settings if you wish, but it's usually unnecessary for casual users.

  • You DON'T need to change UU setting to match your usage. The default settings seem to suit the anticipated usage of the user that you envision.

Firefox and other web browsers that are distributed by Ubuntu (i.e. not Chrome) are updated through the -security pocket. This means that your user will always have the safest browser version available via UU.

Advice: It's probably wise to set up your casual user on an LTS release, to reduce the amount of support you must provide.

| improve this answer | |
  • Also, add the molly-guard package manpages.ubuntu.com/manpages/bionic/man8/molly-guard.8.html and put a physical molly-guard en.wiktionary.org/wiki/molly-guard over the power button – K7AAY Feb 26 at 19:48
  • 1
    Many thanks, this is the kind of info I had been looking for in a long time :) – Zorglub29 Feb 26 at 20:41
  • 1
    Not sure why I should do this @K7AAY? I understand the software molly-guard to avoid intempestive reboots due to updates (?), but not the physical one. I still want that the laptop can be started ^^ . – Zorglub29 Feb 26 at 20:45
  • Make them think twice about turning the system off instead of properly running shutdown. If you teach them just to turn off the screen (or closing it for a laptop) instead of powering off, and the molly guard is in place, you will get fewer puzzled calls from them. – K7AAY Feb 26 at 21:41
  • 1
    @Zorglub29 Boomers OK! I identify as a Boomer, and I appreciate the concept. Maybe explaining how economical modern CPUs are when they idle may help, along with the suggestion to turn off the screen/close the lid, as the display consumes a lot of juice, might suffice? – K7AAY Feb 27 at 19:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.