Activity log for bug #1439793

Date Who What changed Old value New value Message
2015-04-02 17:33:22 Oleg Strikov bug added bug
2015-04-02 17:33:55 Oleg Strikov 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'; # If the file already exists, the user most likely copied the .service # file to /etc/ to change it in some way. In this case we don’t need to # mask the .service in the first place, since it will not be removed by # dpkg. 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. 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.
2015-04-03 12:32:49 Robie Basak bug added subscriber Robie Basak
2015-04-03 12:33:33 Robie Basak tags systemd-boot
2015-04-09 09:14:52 Martin Pitt init-system-helpers (Ubuntu): status New Triaged
2015-04-09 09:14:54 Martin Pitt init-system-helpers (Ubuntu): importance Undecided Medium
2015-04-09 09:14:56 Martin Pitt init-system-helpers (Ubuntu): assignee Martin Pitt (pitti)
2015-04-09 10:27:56 Martin Pitt init-system-helpers (Ubuntu): status Triaged In Progress
2015-04-09 11:04:49 Martin Pitt init-system-helpers (Ubuntu): status In Progress Fix Committed
2015-04-09 12:26:59 Launchpad Janitor branch linked lp:ubuntu/vivid-proposed/init-system-helpers
2015-04-09 13:21:55 Launchpad Janitor init-system-helpers (Ubuntu): status Fix Committed Fix Released
2015-05-24 13:16:06 Launchpad Janitor branch linked lp:debian/init-system-helpers