touch-packages team mailing list archive
-
touch-packages team
-
Mailing list archive
-
Message #68928
[Bug 1439793] Re: deb-systemd-helper crashes while removing packages with unusual (but legal) Alias in unit config
This bug was fixed in the package init-system-helpers - 1.22ubuntu9
---------------
init-system-helpers (1.22ubuntu9) vivid; urgency=medium
Cherry-pick tests and a bug fix from Debian git:
* t/001-deb-systemd-helper.t: Verify that the commands exit successfully.
* t/001-deb-systemd-helper.t: Add tests for Alias= handling.
* t/001-deb-systemd-helper.t: Add tests for Alias and mask handling with
uninstalled .service file (as in package postrm scripts).
* deb-systemd-helper: Ignore Also= and Alias= referring to itself, and avoid
mask symlink creation errors on systems where units with those have
already been installed. Add corresponding test to
001-deb-systemd-helper.t. (LP: #1439793)
-- Martin Pitt <martin.pitt@xxxxxxxxxx> Thu, 09 Apr 2015 13:10:17 +0200
** Changed in: init-system-helpers (Ubuntu)
Status: Fix Committed => Fix Released
--
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to init-system-helpers in
Ubuntu.
https://bugs.launchpad.net/bugs/1439793
Title:
deb-systemd-helper crashes while removing packages with unusual (but
legal) Alias in unit config
Status in init-system-helpers package in Ubuntu:
Fix Released
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/system/<...> This Alias option doesn't make any sense (mysql service will be accessible as mysql.service even without this alias) and my assumption is that it was created because the author was not sure if it's okay not to have any aliases at all or you need at least one. Anyhow this seems to be legal to do that (i was not able to find any documents which state that this is incorrect) even if it's something useless.
Installation went well and the following alias symlink has been created:
/etc/systemd/system/mysq.service --> /lib/systemd/system/mysql.service
Service was accessible via systemctl and everything was fine.
When you try to remove/purge the package you get the following error:
/usr/bin/deb-systemd-helper: error: unable to link /etc/systemd/system/mysql.service to /dev/null: File exists
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/system/' . basename($service_path);
if (-e $mask_link) {
# If the link already exists, don’t do anything.
return if -l $mask_link && readlink($mask_link) eq '/dev/null';
debug "$mask_link already exists, not masking.";
return;
}
make_path(dirname($mask_link));
symlink('/dev/null', $mask_link) or
error("unable to link $mask_link to /dev/null: $!");
<...>
}
Check for '-e $mask_link' FAILS because symlink's TARGET
(/lib/systemd/system/mysql.service) doesn't exists while doing postrm
and '-e' FOLLOWS symlinks. That's why we go to symlink(...) call
directly which fails because symlink already exists.
WORKAROUND: If apt-get remove/purge crashes with the error mentioned
above you need to manually remove symlink inside /etc/systemd/system
(/etc/systemd/system/mysql.service in our case) and rerun apt-get
remove/purge.
I'm not sure if we want to fix that.
On one hand, this situation is pretty rare.
On other hand though, such Alias=<original-name> situation is somewhat legal and we may want to handle it correctly.
This issue with Alias= has been fixed (by removing this useless Alias)
in mysql-5.6 so that's not a blocker for us.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/init-system-helpers/+bug/1439793/+subscriptions
References