You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ sudo -u rabbitmq systemctl
.... some output ....
$ sudo -u postgres systemctl
Traceback (most recent call last):
File "/usr/bin/systemctl", line 6408, in <module>
systemctl_debug_log = os_path(_root, expand_path(SYSTEMCTL_DEBUG_LOG, not _user_mode))
File "/usr/bin/systemctl", line 420, in expand_path
RUN = get_RUN(root)
File "/usr/bin/systemctl", line 334, in get_RUN
os.makedirs(path) # "/tmp/run"
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 17] File exists: '/tmp/run'
Looking at the code, it appeared that systemctl should have detected that the user was not "root" and used /tmp/run-$user, but on closer inspection it's actually setting root=True if the --user CLI option isn't set.
Essentially there's confusion about what the root flag means:
Running with euid=0
Running systemctl on "system" units (versus "user" units)
Possible solutions:
Maybe use /tmp/run.{os.geteuid()} ?
I would have suggested removing /tmp/run after execution completes, but if there's two copies running at the same time, that would break things even more.
I've encountered a small bug:
Looking at the code, it appeared that systemctl should have detected that the user was not "root" and used /tmp/run-$user, but on closer inspection it's actually setting
root=True
if the--user
CLI option isn't set.Essentially there's confusion about what the
root
flag means:Possible solutions:
/tmp/run.{os.geteuid()}
?/tmp/run
after execution completes, but if there's two copies running at the same time, that would break things even more./tmp/run.{os.getpid()}
and remove it after?Thanks for taking the time to write this package, it's really helpful!
The text was updated successfully, but these errors were encountered: