i install systemd package, and run systemd --user. it report the following error.
what i should setup to let systemd to find default.target file?
[op@my-200 my-repo]$ sudo XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR /nix/store/4xn6z5k11ixb1sy278jn02bi40lh7aas-systemd-243.7/lib/systemd/systemd --user
Unit default.target not found.
Falling back to rescue target: rescue.target
Unit rescue.target not found.
error log for running without sudo :
[op@my-200 my-repo]$ /nix/store/4xn6z5k11ixb1sy278jn02bi40lh7aas-systemd-243.7/lib/systemd/systemd --user --log-level=debug
systemd 243 running in user mode for user 1000/op. (+PAM +AUDIT -SELINUX +IMA +APPARMOR +SMACK -SYSVINIT +UTMP -LIBCRYPTSETUP +GCRYPT -GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID -ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid)
Found cgroup on /sys/fs/cgroup/systemd, legacy hierarchy
Using cgroup controller name=systemd. File system hierarchy is at /sys/fs/cgroup/systemd/user.slice/user-1000.slice/session-2.scope.
Failed to create /user.slice/user-1000.slice/session-2.scope/init.scope control group: Permission denied
Failed to allocate manager object: Permission denied
Failed to read pids.max attribute of cgroup root, ignoring: No such file or directory
the sudo locate root user file, so it don’t find.
when i switch to current user, it seems need to add all kind of different permission .
sudo chmod -R o+rw /sys/fs/cgroup/systemd/user.slice/user-1000.slice
...
Serializing 30-systemd-environment-d-generator to memfd.
Successfully forked off '(direxec)' as PID 27479.
Skipping PR_SET_MM, as we don't have privileges.
/nix/store/4xn6z5k11ixb1sy278jn02bi40lh7aas-systemd-243.7/lib/systemd/user-environment-generators/30-systemd-environment-d-generator succeeded.
(sd-executor) succeeded.
Failed to create generator directories: Permission denied
Failed to read pids.max attribute of cgroup root, ignoring: No such file or directory
redhat systemd command is okay to use
sudo chmod -R o+rw /sys/fs/cgroup/systemd/user.slice/user-1000.slice
/usr/lib/systemd/systemd --user