5

A few times over the past few weeks I've been working and suddenly my desktop disappears and my machine completely reboots.

Having had it happen again this morning I've traced through the syslog and the closest event I can find that might be associated is unattended-upgrades.service: Succeeded:

Jul 14 10:02:42 pc charon: 05[NET] sending packet: from 192.168.1.214[4500] to 123.321.123.321[4500] (92 bytes)
Jul 14 10:03:02 pc charon: 08[IKE] sending keep alive to 123.321.123.321[4500]
Jul 14 10:03:03 pc systemd[1]: unattended-upgrades.service: Succeeded.
Jul 14 10:03:03 pc systemd[1]: Stopping Session 2 of user philip.
Jul 14 10:03:03 pc systemd[1]: Removed slice system-clean\x2dmount\x2dpoint.slice.
Jul 14 10:03:03 pc systemd[1]: Removed slice system-getty.slice.
Jul 14 10:03:03 pc systemd[2039]: Stopped target GNOME Wayland Session (session: gnome).
Jul 14 10:03:03 pc systemd[2039]: Stopped target GNOME Session.
Jul 14 10:03:03 pc systemd[2039]: Stopped target GNOME Wayland Session.
Jul 14 10:03:03 pc systemd[2039]: Stopped target GNOME Session (session: gnome).
Jul 14 10:03:03 pc systemd[2039]: Stopped target GNOME Accessibility settings.
Jul 14 10:03:03 pc systemd[2039]: Stopped target GNOME Color management.
Jul 14 10:03:03 pc systemd[2039]: Stopped target GNOME Date & Time handling.
Jul 14 10:03:03 pc systemd[2039]: Stopped target GNOME Maintenance of expirable data.

I'm not against unattended upgrades normally, but a silent reboot without warning is really bad. This morning I had 15 windows open and was in the middle of debugging some tricky code. It's taken me 30 minutes to get back to where I was.

Is a silent reboot with unattended upgrades something that's normal / configurable?

What's the recommended way to stop this reboot happening?


The strange thing is this doesn't appear to be configured to do so:

$ grep -irnC2 reboot /etc/apt/apt.conf.d/
/etc/apt/apt.conf.d/50unattended-upgrades-90-//Unattended-Upgrade::Remove-Unused-Dependencies "false";
/etc/apt/apt.conf.d/50unattended-upgrades-91-
/etc/apt/apt.conf.d/50unattended-upgrades:92:// Automatically reboot *WITHOUT CONFIRMATION* if
/etc/apt/apt.conf.d/50unattended-upgrades:93://  the file /var/run/reboot-required is found after the upgrade
/etc/apt/apt.conf.d/50unattended-upgrades:94://Unattended-Upgrade::Automatic-Reboot "false";
/etc/apt/apt.conf.d/50unattended-upgrades-95-
/etc/apt/apt.conf.d/50unattended-upgrades:96:// Automatically reboot even if there are users currently logged in
/etc/apt/apt.conf.d/50unattended-upgrades:97:// when Unattended-Upgrade::Automatic-Reboot is set to true
/etc/apt/apt.conf.d/50unattended-upgrades:98://Unattended-Upgrade::Automatic-Reboot-WithUsers "true";
/etc/apt/apt.conf.d/50unattended-upgrades-99-
/etc/apt/apt.conf.d/50unattended-upgrades:100:// If automatic reboot is enabled and needed, reboot at the specific
/etc/apt/apt.conf.d/50unattended-upgrades-101-// time instead of immediately
/etc/apt/apt.conf.d/50unattended-upgrades-102-//  Default: "now"
/etc/apt/apt.conf.d/50unattended-upgrades:103://Unattended-Upgrade::Automatic-Reboot-Time "02:00";
/etc/apt/apt.conf.d/50unattended-upgrades-104-
/etc/apt/apt.conf.d/50unattended-upgrades-105-// Use apt bandwidth limit feature, this example limits the download

2 Answers2

3

Whether or not unattended-upgrades reboots your system is controlled by entries in the configuration file /etc/apt/apt.conf.d/50unattended-upgrades

Mine is set to not allow reboots (the default), the pertinent section of the file looks like this

// Automatically reboot *WITHOUT CONFIRMATION*
//  if the file /var/run/reboot-required is found after the upgrade 
//Unattended-Upgrade::Automatic-Reboot "false";

// If automatic reboot is enabled and needed, reboot at the specific // time instead of immediately // Default: "now" //Unattended-Upgrade::Automatic-Reboot-Time "02:00";

0

not work. currently ( 2024 ) there are many options which are confusing and not easy to understand.

# file: /etc/apt/apt.conf.d/50unattended-upgrades
 92 // Automatically reboot *WITHOUT CONFIRMATION* if
 93 //  the file /var/run/reboot-required is found after the upgrade
 94 //Unattended-Upgrade::Automatic-Reboot "false";
 95
 96 // Automatically reboot even if there are users currently logged in
 97 // when Unattended-Upgrade::Automatic-Reboot is set to true
 98 //Unattended-Upgrade::Automatic-Reboot-WithUsers "true";
 99
100 // If automatic reboot is enabled and needed, reboot at the specific
101 // time instead of immediately
102 //  Default: "now"
103 //Unattended-Upgrade::Automatic-Reboot-Time "02:00";

so, the simplest way is to disable this service:

refer to: Terminate unattended-upgrades or whatever is using apt in ubuntu 18.04 or later editions

Siwei
  • 401