8

As documented here, if there is a core update, the computer will automatically update, then reboot.

I wish to have automatic updates on, but do not wish to have the machine automatically reboot. Is there a way to do this?

muru
  • 197,895
  • 55
  • 485
  • 740
Magneon
  • 183
  • 1
    Could be helpful if the "As Documented here" actually was valid – doug Aug 20 '17 at 14:28
  • It was when this was asked. Here's another similar question: https://askubuntu.com/questions/886873/disable-ubuntu-core-autoupdate

    It appears that you can't disable autoupdate.

    – Magneon Aug 20 '17 at 22:06
  • @Magneon In your link it suggests setting automatic updates to a specific time window. Why not have it run at 3am when a reboot won't inconvenience you? You can shut off your monitor and leave your Raspberry Pi turned on as it wouldn't use much electricity. – WinEunuuchs2Unix Aug 21 '17 at 01:15
  • 1
    This use case of for an industrial robot that could be run at an unfixed schedule of the customer's choice. There isn't really a good fixed schedule where the machine can be rebooted. Ideally updates would be swapped in as the machine turns on, or after prompting the user. – Magneon Aug 21 '17 at 12:52
  • Based on this discussion I doubt you can do what you want atm, I could be mistaken.. https://forum.snapcraft.io/t/disabling-automatic-refresh-for-snap-from-store/707/26 – doug Aug 21 '17 at 22:44
  • I got page not found when click the refer document link. – eetsurt Aug 24 '17 at 04:30

2 Answers2

2

I was trying to track down the Snappy Ubuntu Core source code and the closest I could find was this which has an accepted answer that I find unacceptable. With the source code many developers seeking to turn off auto-updates might be able to accomplish a goal akin to your own.

The second best solution for them, and perhaps yourself, is to find the name of the binary that performs auto-updating. Let's say for example it is called a. Rename it to b. Replace a with a simple program that displays "Hello World". During system boot call b in startup scripts.

Basically whenever you want to update your OS (or "Store" as they like to call it) at your convenience simply reboot your machine. After the update it will reboot again. On the second reboot when b is called the first reboot already updated the applications (called "snaps") so the second reboot would perform without an update.

Whenever Ubuntu tries to run auto-updates behind your back, it will simply be running a new program that writes "Hello World" to /var/log/syslog.

I'm not using Raspberry Pi 2 so I can't find the name of the auto-update program that needs to be renamed to "b". Hopefully someone else does use it and can provide the name.

  • This is a pretty poor solution, but seems like the best way so far. What it means for me is that snappy core can't be used in an embedded robots project that otherwise could make great use of the technology. I'd prefer not to have to fight the system for basic functionality (especially when an update from canonical could break this fix pretty easily). – Magneon Aug 31 '17 at 16:03
  • I'm hoping the developers who need this to prevent their updates from rebooting will take the idea and make a polished function. I could not sign onto their website (in the link) to suggest it to them. – WinEunuuchs2Unix Aug 31 '17 at 17:08
0

As far as I know there is no way to prevent/or let Ubuntu don't reboot after upgrading automatically.

But as a workaround you can enable the rootpw flag in your sudoers, to making sudo reboot which trigger at the end of the upgrade (I guess) ask for the root password instead of user password. open it via visudo

Defaults rootpw

Or if the upgrade process is doing like this upgrade && reboot as an example it will ask you for password for upgrade part command and will execute next command with cached your password. you may need to reset this catch so it will ask for password again when second reboot wants to trigger.

sudo -K

or you can set timestamp_timeout parameter to let sudo ask password for every commands invoking by sudo.

αғsнιη
  • 35,660