<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - systemctl fails with "Invalid argument" when using both --global and --root flags"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=90897">90897</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>systemctl fails with "Invalid argument" when using both --global and --root flags
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>systemd
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux (All)
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>general
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>systemd-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>pespin.shar@gmail.com
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>systemd-bugs@lists.freedesktop.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>