6

I keep getting this error on apt-get upgrade:

Installing unattended-upgrades (0.93.1+nmu1) ...
Failed to start unattended-upgrades.service: Unit unattended-upgrades.service failed to load: Invalid argument. See system logs and 'systemctl status unattended-upgrades.service' for details.
invoke-rc.d: initscript unattended-upgrades, action "start" failed.
● unattended-upgrades.service - Unattended Upgrades Shutdown
   Loaded: error (Reason: Invalid argument)
   Active: inactive (dead)
     Docs: man:unattended-upgrade(8)

jun 06 18:29:32 PRODUCTION systemd[1]: unattended-upgrades.service lacks ExecStart setting. Refusing.
jun 06 18:29:32 PRODUCTION systemd[1]: unattended-upgrades.service lacks ExecStart setting. Refusing.
jun 06 18:29:32 PRODUCTION systemd[1]: unattended-upgrades.service lacks ExecStart setting. Refusing.
jun 06 18:32:41 PRODUCTION systemd[1]: unattended-upgrades.service lacks ExecStart setting. Refusing.
jun 06 18:32:41 PRODUCTION systemd[1]: unattended-upgrades.service lacks ExecStart setting. Refusing.
jun 06 18:32:41 PRODUCTION systemd[1]: unattended-upgrades.service lacks ExecStart setting. Refusing.
jun 06 18:32:41 PRODUCTION systemd[1]: unattended-upgrades.service lacks ExecStart setting. Refusing.
jun 06 18:33:24 PRODUCTION systemd[1]: unattended-upgrades.service lacks ExecStart setting. Refusing.
jun 06 18:33:24 PRODUCTION systemd[1]: unattended-upgrades.service lacks ExecStart setting. Refusing.
jun 06 18:33:24 PRODUCTION systemd[1]: unattended-upgrades.service lacks ExecStart setting. Refusing.
dpkg: erro ao processar o pacote unattended-upgrades (--configure):
 subprocesso script post-installation returned exit status code 6
Errors were found while processing:
 unattended-upgrades
E: Sub-process /usr/bin/dpkg returned an error code (1)

I don't care about unattended-upgrades, it can be removed. I tried apt-get remove but no luck there:

Removing unattended-upgrades (0.93.1+nmu1) ...
Failed to stop unattended-upgrades.service: Unit unattended-upgrades.service not loaded.
invoke-rc.d: initscript unattended-upgrades, action "stop" failed.
dpkg: error processing package unattended-upgrades (--remove):
 subprocess script pre-removal returned exit status error 5
Errors were found while processing:
 unattended-upgrades
E: Sub-process /usr/bin/dpkg returned an error code (1)

The messages have been translated as some of them were not in english.

I have debian jessie with sid repository configured.

uname -a: Linux PRODUCTION 3.16.0-4-amd64 #1 SMP Debian 3.16.43-2 (2017-04-30) x86_64 GNU/Linux

cat /etc/debian_version: 9.0

I just want that nasty error gone, I don't care how. either by removing the package or fixing the issue, but I don't seem to be able to remove it, nor am I able to fix it due to lack of knowledge :)

Any hint?

3 Answers 3

10
systemctl mask unattended-upgrades

Explanation:

systemd units can be overridden by the adminstrator putting a file with the same name in /etc/systemd/system.

This mechanism can also be used to "mask" a service from being activated by socket activation, manual starts, or any other method. Instead of creating a file with the same name, if there is a symbolic link to /dev/null, then the unit is effectively ignored.

So you can ab(use) systemctl mask, to replace the contents of the unit with nothing.

To avoid the possibility confusion in future, check that you remove the mask once you have removed the package. systemctl unmask unattended-upgrades.

2
  • spot on! may the force be with you :) Jun 7, 2017 at 8:33
  • I tried doing it carefully, by adding --runtime switch. This makes the change temporary. Then turned off the service using sysv-rc-conf. Seems to work.
    – Jarekczek
    Jul 3, 2017 at 20:13
4

I also ran into this problem, and it seems that the cause of this is that systemd is too old to support the unattended-upgrades.service file which omits the ExecStart configuration. Make sure that the systemd package is also upgraded (version 232 worked for me).

If the problem persists (as it did for me), then systemd might not have been restarted during the upgrade (I think it should happen automatically, but I think it didn't for me). To fix that, run:

sudo systemctl daemon-reexec

This restarts systemd, running the newer version which should support the new service file just fine.

1

Same problem on Debian 9 with latest systemd and unattended-upgrade packages. So I edited this file:

/lib/systemd/system/unattended-upgrades.service

and add this line:

ExecStart=/bin/true

just before ExecStop line and everything is ok now while service is not masked.

2
  • Thanks for writing your experience! It would be better not to edit a packaged file in /lib, because it will be overwritten by any package updates. Instead you could create a file /etc/systemd/system/unattended-upgrades.service.d/override.conf with two lines, [Service] and ExecStart=/bin/true. (Or more conveniently, use systemctl edit unattended-upgrades). And if this problem is still occurring, you might wish to report the bug to Debian
    – sourcejedi
    May 16, 2019 at 15:30
  • 1
    Yeah. you are right! even using systemd mask command is better solution for such this things.
    – Sadeq
    May 18, 2019 at 3:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .