4

After I do this on my Debian Stretch:

sudo apt install cgroup-bin cgroup-tools cgroupfs-mount libcgroup1

I can issue this:

sudo systemctl set-property user-1000.slice CPUQuota=40% 

I have 4 vCPU host, each CPU takes 10% hit with "stress -cpu 4", but after reboot, I can no longer get the "CPUQuota" to work, again.

I have already have "GRUB_CMDLINE_LINUX_DEFAULT="cgroup_enable=memory swapaccount=1"

So how do I get systemd resource management to work after each reboot without having to reissue:

sudo apt --reinstall install cgroup-bin cgroup-tools cgroupfs-mount libcgroup1 
1

This is how I fixed the problem. (For some reason, after cgroupfs-mount is installed, the file /lib/systemd/system/cgroupfs-mount.service is linked to /dev/null.)

sudo apt --reinstall instll cgroupfs-mount
sudo rm /lib/systemd/system/cgroupfs-mount.service
sudo systemctl daemon-reload

Now created systemd service file:

sudo nano /lib/systemd/system/cgroupfs-mount.service

[Unit]
Description=CGroups FS Mount

[Service]
Type=oneshot
ExecStart=/etc/init.d/cgroupfs-mount start
ExecStop=/etc/init.d/cgroupfs-mount stop
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Once the file is created, issue:

sudo systemctl daemon-reload

Check on the status and enable startup during boot:

sudo systemctl status cgroupfs-mount
sudo systemctl enable cgroupfs-mount

Now test:

sudo systemctl set-property user-1000.slice CPUQuota=40%
sudo systemctl daemon-reload

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.