Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

help: Cannot set property ExecStopPost, or unknown property. #432

Open
jinjianming opened this issue Jan 10, 2024 · 1 comment
Open

help: Cannot set property ExecStopPost, or unknown property. #432

jinjianming opened this issue Jan 10, 2024 · 1 comment

Comments

@jinjianming
Copy link

The systemd service is an earlier version, and there was an error creating the systemd using dbus. ExecStopPost, or unknown property

systemctl --version
systemd 219
import (
	"fmt"
	systemd "github.com/coreos/go-systemd/v22/dbus"
	dbus "github.com/godbus/dbus/v5"
)
                 ...
	newProps := []systemd.Property{
                 ...
		systemd.PropExecStart(args, false),

		{
			Name: "ExecStopPost",
			// force & lazy unmount to cleanup possibly dead mountpoints
			Value: dbus.MakeVariant([]execCmd{execCmd{"/bin/umount", []string{"/bin/umount", "-f", "-l", "/xxx"}, false}}),
		},
                 ...
	}

	// The name of the transient service
	serviceName := "xxx.service"

	_, err = conn.StartTransientUnit(serviceName, "replace", newProps, nil)

I found the following error through dbus-monitor --system

method call time=1704875752.714736 sender=:1.0 -> destination=org.freedesktop.DBus serial=4741 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetConnectionUnixUser
   string ":1.202"
method return time=1704875752.714742 sender=org.freedesktop.DBus -> destination=:1.0 serial=122 reply_serial=4741
   uint32 0
error time=1704875752.715074 sender=:1.0 -> destination=:1.202 error_name=org.freedesktop.DBus.Error.PropertyReadOnly reply_serial=2
   string "Cannot set property ExecStopPost, or unknown property."
signal time=1704875752.715114 sender=:1.0 -> destination=(null destination) serial=4743 path=/org/freedesktop/systemd1; interface=org.freedesktop.systemd1.Manager; member=UnitNew
   string "my-transient-geesefs-mount.service"
@jinjianming
Copy link
Author

I noticed that some materials seem to have this attribute renamed from StoppPost to ExecStoppPost in system v237, but I changed the code and the same issue with StoppPost. The only issue is that the attribute name was changed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant