deb-systemd-helper crashes while removing packages with unusual (but legal) Alias in unit config
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
init-system-helpers (Ubuntu) |
Fix Released
|
Medium
|
Martin Pitt |
Bug Description
While working on mysql-5.6 package we met unusual (maybe even partially incorrect) Alias option in systemd unit config:
Alias=mysql.service
It is unusual because mysql.service is the original name of the service which can be found inside /lib/systemd/
Installation went well and the following alias symlink has been created:
/etc/systemd/
Service was accessible via systemctl and everything was fine.
When you try to remove/purge the package you get the following error:
/usr/bin/
This happens because deb-systemd-helper tries to 'mask' service the following way:
sub mask_service {
my ($scriptname, $service_path) = @_;
my $mask_link = '/etc/systemd/
if (-e $mask_link) {
# If the link already exists, don’t do anything.
return if -l $mask_link && readlink(
debug "$mask_link already exists, not masking.";
return;
}
make_
symlink(
<...>
}
Check for '-e $mask_link' FAILS because symlink's TARGET (/lib/systemd/
WORKAROUND: If apt-get remove/purge crashes with the error mentioned above you need to manually remove symlink inside /etc/systemd/system (/etc/systemd/
I'm not sure if we want to fix that.
On one hand, this situation is pretty rare.
On other hand though, such Alias=<
This issue with Alias= has been fixed (by removing this useless Alias) in mysql-5.6 so that's not a blocker for us.
description: | updated |
tags: | added: systemd-boot |
Changed in init-system-helpers (Ubuntu): | |
status: | Triaged → In Progress |
Simple reproducer:
$ cat /lib/systemd/ system/ selfalias. service
[Unit]
Description=alias to self
[Service]
ExecStart=/bin/true
[Install] multi-user. target .service
WantedBy=
Alias=selfalias
$ sudo DPKG_MAINTSCRIP T_PACKAGE= 1 deb-systemd-helper enable selfalias.service system/ selfalias. service{ ,.removed} HELPER_ DEBUG=1 DPKG_MAINTSCRIP T_PACKAGE= 1 deb-systemd-helper mask selfalias.service
$ sudo mv /lib/systemd/
$ sudo _DEB_SYSTEMD_