21

I have a process as listed in htop under Command stating the following:

/usr/bin/python3 /usr/share/unattended-upgrades/unattended-upgrade-shutdown --wait-for-signal

Judging by the:

--wait-for-signal

and some researching about what unattended-upgrades is, it makes me think there's something else that needs to be updated so i tried shutting down the server a couple of times, running:

 sudo unattended-upgrade

and following these steps but it's still there even though the system is up-to-date.

Is it just there to check for when there's another upgrade to be done?

Should i worry about it or just leave it be?

Thanks in advance.

2 Answers 2

19

It's a safety feature. Leave it alone.

Apt data (packages and metadata) can be corrupted if apt happens to be running when the system halts (shuts down). The unattended-updates-shutdown script temporarily inhibits a shutdown signal until apt finishes.

The script cannot prevent corruption due to a sudden power loss, or holding the power button, while apt happens to be running. Another reason to avoid those, and to keep regular backups.

The script is in Python, including the developer's comments. Feel free to read it and see for yourself.

4
  • 5
    Why doesn't unattended-updates inhibit shutdown only for the time the update is actually running instead of having a separate inhibitor process at all times? Feb 17, 2019 at 10:09
  • 1
    I ran apt update. ITs been 5 minutes (fresh 20.04 install) its still running and the status file has : "Progress: 80.0 % (libnss3)" in file /var/run/unattended-upgrades.progress how long will it run?
    – tgkprog
    Aug 6, 2020 at 21:48
  • 7
    Why is it implemented in python? Takes 10MB of RAM, even on ARM Debian. Doesn't sound like an efficient linux approach, but something hack together. May 8, 2021 at 15:17
  • 2
    @VincentAlex it's implemented in Python because the developer chose to implement in Python. It is open source software -- any participant (including you) is welcome to contribute real improvements.
    – user535733
    May 8, 2021 at 15:24
7

I ran into this same issue recently as well, while checking for unattended-upgrades running in the background during my image baking process. Basically, I would wait for apt locks to be released, then proceed with my updates.

I used to run this:

while pgrep unattended; do sleep 10; done;

before executing any of my scripts as they would randomly fail at some odd intervals with unattended-upgrades running while me trying to do apt install/upgrade/update with a dpkg lock error.

So I asked for the right way to check for unattended upgrades working in the background and TJ- from IRC gave me a really elegant solution! Disable the u-u service whilst bootstrap scripts are busy. As in:

systemctl mask unattended-upgrades.service
systemctl stop unattended-upgrades.service

then re-enable after you finish your bake:

systemctl unmask unattended-upgrades.service
systemctl start unattended-upgrades.service

In addition, you can run this to make sure you don't kick off your process prematurely:

while systemctl is-active --quiet unattended-upgrades.service; do sleep 1; done

Probably not what you were looking for but this was extremely helpful for me. This might be related to: https://bugs.launchpad.net/ubuntu/+source/unattended-upgrades/+bug/1803137

1
  • systemctl stop unattended-upgrades.service stops unattended-upgrade-shutdown running NOT the unattended upgrades
    – tekumara
    Jan 19 at 5:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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