I'm trying to set per-user limits on processes, most of them are run with sudo --user. Why do user-1001 and user-1008 on my system have the slice files, but I can't get it on 1009?
# systemctl set-property user-1009.slice CPUQuota=50% Failed to set unit properties on user-1009.slice: Unit user-1009.slice is not loaded. # systemctl status user-1009.slice ● user-1009.slice Loaded: loaded Active: inactive (dead)
I tried manually creating the file
# touch /etc/systemd/system/user-1009.slice # systemctl status user-1009.slice ● user-1009.slice Loaded: masked (/etc/systemd/system/user-1009.slice; masked; vendor preset: disabled) Active: inactive (dead) # systemctl set-property user-1009.slice CPUQuota=50% Failed to set unit properties on user-1009.slice: Unit user-1009.slice is not loaded.
Also this doesn't make sense to me, the testprocess (PID 26668) shows in ps -U 1009, but it's running under the slice for user-1008 (because user-1008 used sudo to run it?)
# ps -U 1009 ; systemctl status user-1008.slice PID TTY TIME CMD 15727 pts/1 00:00:00 bash 26668 ? 00:00:00 testprocess ● user-1008.slice - User Slice of testuser Loaded: loaded (/run/systemd/system/user-1008.slice; static; vendor preset: disabled) Drop-In: /run/systemd/system/user-1008.slice.d └─50-After-systemd-logind\x2eservice.conf, 50-After-systemd-user-sessions\x2eservice.conf, 50-Description.conf, 50-TasksMax.conf Active: active since Thu 2018-08-30 19:35:01 EDT; 2 days ago CGroup: /user.slice/user-1008.slice └─session-1801668.scope └─26668 ./testprocess
Searching around, all I could find is people saying to login as the user to fix this, but obviously the user has processes open. And I tried using su - user1009 in another terminal, but that didn't seem to help