Mask Unit files over DBus doesn't work?

Gyorgy Szekely hoditohod at gmail.com
Thu Dec 14 10:57:08 UTC 2023


Hi,
Sorry if this is not the right place for questions, please point me in the
right direction.

I'm trying to replace `systemctl` command invocations in our project with
DBus calls. Starting/stopping services, requesting service properties work
fine, but masking/unmasking do not.

This is the behavior I want to replicate with DBus:

    $ systemctl mask serial-getty at ttymxc0.service
    Created symlink /etc/systemd/system/serial-getty at ttymxc0.service →
/dev/null.

    $ systemctl status serial-getty at ttymxc0.serviceserial-getty at ttymxc0.service
         Loaded: masked (Reason: Unit serial-getty at ttymxc0.service is
masked.)
         Active: inactive (dead)

    $ systemctl start serial-getty at ttymxc0.service
    Failed to start serial-getty at ttymxc0.service: Unit
serial-getty at ttymxc0.service is masked.

This is what happens when I use DBus: (with busctl for the sake of this
discussion)

    $ busctl call org.freedesktop.systemd1 /org/freedesktop/systemd1
org.freedesktop.systemd1.Manager MaskUnitFiles asbb 1
serial-getty at ttymxc0.service false false
    a(sss) 1 "symlink" "/etc/systemd/system/serial-getty at ttymxc0.service"
"/dev/null"

    $ systemctl status serial-getty at ttymxc0.serviceserial-getty at ttymxc0.service - Serial Getty on ttymxc0
         Loaded: loaded (/usr/lib/systemd/system/serial-getty at .service;
enabled; vendor preset: disabled)
         Active: inactive (dead)

The reported symlink is there in both cases, but while in the 1st case the
service is indeed masked and cannot be started, in the 2nd case no such
thing is reported and the service can be started.

I haven't found much documentation on systemd DBUS mask/unmask method
calls. Apparently I'm missing something, but I don't know what.

OS: Custom 32bit ARM, systemd 244

Any ideas?

Thanks and regards,
   Gyorgy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20231214/daef333a/attachment.htm>


More information about the systemd-devel mailing list