#45 add systemd unit

systemd (1)

We guess pglgui needs some adaptions, details are in the TODO file.

Anyone who is actually using systemd should report how it works currently: I guess everything works, except that systemd restarts pgl after a "Stop" was issued from pglgui.

1 Attachments


  • jre-phoenix

    Thanks a lot. We already have added systemd support in the development repository.
    Unfortunately we broke the code somewhere else, so currently we can't release (development is stalled for some months already due to that). Still hoping to fix that soon.
    Anyway, I'll have a look at your file and check whether we can improve our implementation.

    Thanks again.

  • hasufell

    Let me know which one to use and I'll add it to gentoo. (we optionally support systemd)

    Last edit: hasufell 2013-09-23
  • jre-phoenix

    By now the one from our git repository. It's been tested at least by the ARCH Linux guys. I've informed its main author about this thread here to have a look at this file.

    BTW the Makefile is already adapted to use systemd.

  • CBke

    This file is a copy from AUR (archlinux)

  • Gilrain

    That's why it seemed so familiar ;-)

    The only differences with the one already in git are the removal of "RemainAfterExit" in favor of "TimeoutStartSec=0" and the 2nd "After=" line which includes iptables and shorewall to the list of firewalls. It was a recurring demand from Archers, not sure if it needs to be added upstream since they are not listed in the init file...

    Also, I had forgotten to implement the pglcmd reload function. It's now corrected in the attachment.

    Last edit: Gilrain 2013-09-24
  • jre-phoenix

    • status: open --> pending
    • assigned_to: jre-phoenix
  • jre-phoenix

    updated systemd with Gilrain's file in the git repository. Hope to release soon

  • jre-phoenix

    I just released 2.2.3, so most of this issue should be done. But pglgui still needs to implement some systemd stuff (if it is comiled with --with-systemd.

  • jre-phoenix

    • Description has changed:


    --- old
    +++ new
    @@ -1 +1,3 @@
    -add unit for systemd
    +We guess pglgui needs some adaptions, details are in the TODO file.
    +Anyone who is actually using systemd should report how it works currently: I guess everything works, except that systemd restarts pgl after a "Stop" was issued from pglgui.
    • assigned_to: jre-phoenix --> Carlos
    • Priority: 9 --> 5
  • Gilrain

    Status of systemd support by the v2.2.4 GUI

    (patched with systemd-timer.diff)

    Every button is tested by manually starting pgl.service before each operation (except Start, obviously). The tray icon and Control tab of the GUI recognize that pgld is active and logs are displayed.

    Stop: terminates the daemon as expected. systemd marks the service as "inactive (dead)" by acknowledging a call to "Process: 2903 ExecStop=/usr/bin/pglcmd stop (code=exited, status=0/SUCCESS)".
    Start: launches the daemon, systemd has no clue.
    Restart: daemon is terminated and launched again, systemd lists it as inactive. Same behavior as with Stop/Start.
    Reload: the configuration is reloaded as reported in the log, systemd doesn't know about it.
    Update: blocklists are updated, systemd blissfully unaware.

    Checking either Start PeerGuardian at system boot or Update the blocklists automatically on the Configure tab doesn't affect systemd behavior.


    (completes the information from the TODO file)

    Stop: systemctl stop pgl.service
    Start: systemctl start pgl.service
    Restart: systemctl restart pgl.service
    Reload: systemctl reload pgl.service
    Update: systemctl start pgl-update.service

    Start PeerGuardian at system boot: systemctl enable pgl.service
    Don't start PeerGuardian at system boot: systemctl disable pgl.service

    Three possibilities to figure out whether in systemd automatic boot is
    currently enabled (in order to show the (un)tick in pglgui correctly:
    - command line: 'systemctl --quiet is-enabled pgl.service' exits with 0 if
    the service is enabled, 1 when disabled. --quiet suppresses the textual
    outputs 'enabled' or 'disabled'.
    - parsing: 'systemctl show --property=UnitFileState pgl.service' outputs
    'UnitFileState=enabled', 'disabled' being its other state.
    - dbus

    Update the blocklists automatically must enable and query "pgl-update.timer" using the methods described above. The interval is set by "OnCalendar=" in pgl-update.timer but changes should be done in the local configuration (/etc/systemd/system) not in the system wide folder (/usr/lib/systemd/system).
    The best approach would be to ship an override folder "/etc/systemd/system/pgl.timer.d" with a "99-frequency.conf" file containing only the header "[Timer]" and its setting "OnCalendar=daily" which the GUI could alter to suit the user's choice (daily, weekly or monthly). That way command line users can also benefit.


  • jre-phoenix

    Thanks alot! Also to willemw for some private mail input.

    Further open todos (in pglcmd):
    - add soft requirement on network.target for pgl-update.[service|timer]
    - probably add "Restart=always" in pgl.service
    - honor the INIT="[0|1]" and CRON="[0|1]" variables, remove/deprecate them and/or document that they are ignored with systemd
    - adapt Debian packaging, which currently asks the user about INIT and CRON