Bug 90897

Summary: systemctl fails with "Invalid argument" when using both --global and --root flags
Product: systemd Reporter: Pau Espin Pedrol <pespin.shar>
Component: generalAssignee: systemd-bugs
Status: RESOLVED FIXED QA Contact: systemd-bugs
Severity: normal    
Priority: medium CC: pespin.shar, ross
Version: unspecified   
Hardware: Other   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Pau Espin Pedrol 2015-06-08 13:34:36 UTC
I am trying to run systemctl from a script to enable some systemd user session services inside a sysroot which is going to be used by an embedded system later.

I found out, though, that when I run systemctl with both --global (to specify I want to enable a user systemd service) and --root (to specify the sysroot of the target system) parameters, I just get an error. For instance, it can easily be checked like this:

# systemctl --global enable myapp.service
ln -s '/usr/lib/systemd/user/myapp.service' '/etc/systemd/user/default.target.wants/myapp.service'

# systemctl --global --root=/ enable myapp.service
Operation failed: Invalid argument


Is that a bug or an expected behavior? how should I accomplish what I want to do if that's expected?


More information:
~# systemctl --version
systemd 211
+PAM +LIBWRAP -AUDIT -SELINUX +IMA +SYSVINIT -LIBCRYPTSETUP -GCRYPT +ACL +XZ -SECCOMP -APPARMOR
Comment 1 Lennart Poettering 2016-06-09 18:15:14 UTC
This works fine with v230. Closing.
Comment 2 Pau Espin Pedrol 2016-06-18 17:40:59 UTC
I confirm this is fixed for me now too. I'm using systemctl version 229.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.