Unattended Upgrades failing with variable reference error
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
unattended-upgrades (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
When running unattended-upgrades with auto-remove enabled the script complains about a variable being referenced before assignment:
```
# unattended-upgrade -d
[...]
Removing unused kernel packages: linux-image-
Keeping 2 auto-removable package(s) because it would also remove the following packages which should be kept in this step: [...]
Traceback (most recent call last):
File "/usr/bin/
sys.
File "/usr/bin/
options.verbose or options.debug, options.dry_run)
File "/usr/bin/
if res:
UnboundLocalError: local variable 'res' referenced before assignment
```
This causes the apt-daily-
```
# systemctl status apt-daily-
● apt-daily-
Loaded: loaded (/lib/systemd/
Active: inactive (dead) since Sat 2018-10-20 06:17:09 CEST; 6h ago
Docs: man:apt(8)
Main PID: 32708 (code=exited, status=0/SUCCESS)
Oct 20 06:16:00 myhost systemd[1]: Starting Daily apt upgrade and clean activities...
Oct 20 06:17:09 myhost apt.systemd.
Oct 20 06:17:09 myhost apt.systemd.
Oct 20 06:17:09 myhost apt.systemd.
Oct 20 06:17:09 myhost apt.systemd.
Oct 20 06:17:09 myhost apt.systemd.
Oct 20 06:17:09 myhost apt.systemd.
Oct 20 06:17:09 myhost apt.systemd.
Oct 20 06:17:09 myhost apt.systemd.
Oct 20 06:17:09 myhost systemd[1]: Started Daily apt upgrade and clean activities.
# apt-get --just-print upgrade | grep ^Inst | wc -l
99
```
Mapped to the current source code of the script within the bionic branch the error occurs in this line:
Used version of the package:
```
# apt-cache policy unattended-upgrades
unattended-
Installed: 1.1ubuntu1.18.04.5
Candidate: 1.1ubuntu1.18.04.5
Version table:
*** 1.1ubuntu1.18.04.5 500
500 http://
500 http://
500 http://
500 http://
100 /var/lib/
1.1ubuntu1 500
500 http://
500 http://
500 http://
500 http://
```