Page 1 of 3 123 LastLast
Results 1 to 10 of 25

Thread: "sddm" ignores "HaltCommand"

  1. #1
    Join Date
    Oct 2008
    Location
    Germany, Bremen
    Posts
    59

    Question "sddm" ignores "HaltCommand"

    Hi Forum,

    to perform some backup on system shutdown (not on system reboot), I want to change the command which is executed if the user powers off the system by selecting "shutdown". So I changed the "HaltCommand" to:

    Code:
    [General]
    HaltCommand=/bin/systemctl isolate hts-backup-poweroff.service
    Entering the command manually works perfectly, however it seems that "HaltCommand" is ignored, regardless whether I put in in a file in "/etc/sddm.conf.d" (KDE writes it correctly into "kde_settings.conf") or whether I create a "/etc/sddm.conf".

    The sddm version is 0.18.1 on my Leap 15.1, as 15.2 does not provide a newer one, I for now refrained from testing on 15.2.

    Did I oversee something ?

    Greetings, The Wumpus.

  2. #2
    Join Date
    Sep 2012
    Posts
    6,323

    Default Re: "sddm" ignores "HaltCommand"

    Does this command work when you run it manually?

  3. #3
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    4,002

    Default Re: "sddm" ignores "HaltCommand"

    Quote Originally Posted by the_wumpus View Post
    Code:
    [General]
    HaltCommand=/bin/systemctl isolate hts-backup-poweroff.service
    Usually, ‘/bin/systemctl’ is a symbolic link to ‘/usr/bin/systemctl’ …
    • It may well be that, SDDM is picky and, the “/usr/bin/” path has to be used if the default value is not to be used – the man page states:

    Code:
           HaltCommand=
                  Halt command.  Default value is "/usr/bin/systemctl poweroff".

  4. #4
    Join Date
    Oct 2008
    Location
    Germany, Bremen
    Posts
    59

    Default Re: "sddm" ignores "HaltCommand"

    Quote Originally Posted by arvidjaar View Post
    Does this command work when you run it manually?
    Yes, it does. Stops any not required service, performs backup (using rsnapshot), powers off.

  5. #5
    Join Date
    Oct 2008
    Location
    Germany, Bremen
    Posts
    59

    Default Re: "sddm" ignores "HaltCommand"

    Quote Originally Posted by dcurtisfra View Post
    Usually, ‘/bin/systemctl’ is a symbolic link to ‘/usr/bin/systemctl’ …
    • It may well be that, SDDM is picky and, the “/usr/bin/” path has to be used if the default value is not to be used – the man page states:

    Code:
           HaltCommand=
                  Halt command.  Default value is "/usr/bin/systemctl poweroff".
    Thank you very much for this hint. However, it made no difference. I tried both the kde-settings.conf in /etc/sddm.conf.d, as well as a manually created /etc/sddm.conf.

  6. #6
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    4,002

    Question Re: "sddm" ignores "HaltCommand"

    @the_wumpus:

    Is the content of the unit files associated with the unit “hts-backup-poweroff.service” similar to the content of the following files associated with systemd units?
    • /usr/lib/systemd/system/poweroff.target
    • /usr/lib/systemd/system/systemd-poweroff.service

    The “poweroff” service contains “/usr/bin/systemctl --force poweroff” – I suspect that, “--force” is there for a good reason …

    I'm also a little bit suspicious of the association of “.target” with the systemctl command “isolate” …

  7. #7
    Join Date
    Oct 2008
    Location
    Germany, Bremen
    Posts
    59

    Question Re: "sddm" ignores "HaltCommand"

    Hello dcurtisfra,

    I am also not fully convinced that my "systemd" implementation of backup + poweroff is the most optimal variant, however I verified it and it works w/o issues if I call it manually. The "hts-backup-poweroff.service" service itself starts "hts-backup.service", and once this is finished it executes "/usr/bin/systemctl poweroff" like specified as default value.

    What I forgot to mention is that the system behaves normally as if no custom "HaltCommand" is provided, that is it performs a shutdown with final power off. I therefore assume that the ignoring has nothing to do with my service, but it's rather a sddm issue.

    Regards, The Wumpus

  8. #8
    Join Date
    Oct 2008
    Location
    Germany, Bremen
    Posts
    59

    Default Re: "sddm" ignores "HaltCommand"

    Quote Originally Posted by the_wumpus View Post
    I therefore assume that the ignoring has nothing to do with my service, but it's rather a sddm issue.
    As a test, I replaced my custom HaltCommand with "/usr/bin/systemctl reboot", which is the default for RebootCommand. Again, the machine performed a power-off instead the expected reboot, so anything I write to "HaltCommand" is just ignored.

    Any Ideas ?

  9. #9
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    13,285
    Blog Entries
    2

    Default Re: "sddm" ignores "HaltCommand"

    Am curious what you are trying to accomplish with a custom halt command embedded in your DM as opposed to the default command (which you verified works manually).

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  10. #10
    Join Date
    Oct 2008
    Location
    Germany, Bremen
    Posts
    59

    Default Re: "sddm" ignores "HaltCommand"

    Hi TSU,

    Well, the idea is that if the machine is powered off (by the user selecting "shut down" from the desktop, or from the DM), some backup shall be performed before the real power-off. However, I do not want to change the original systemd power-off services etc., instead I created my own systemd services and scripts which work if started manually via shell.
    The only thing what is missing now is to call these own services instead of the original ones when the user issues a shut down via the DM. That should be possible by providing a custom "HaltCommand", however it seems that anything I put in there is ignored.

    Regards, the_wumpus

Page 1 of 3 123 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •