[lxc-users] Cgroup saga continues - lxc-autostart woes.

Ben Green ben at bristolwireless.net
Sat Nov 21 21:25:15 UTC 2020


Hi all,

I've been wrestling with cgroups for ages, trying to get limits applied 
to containers. I've created a directories 'forcontainers' which exist in 
/sys/fs/cgroup/*/forcontainers/ on the advice of Serge E. Hallyn. It 
works perfectly well during normal operation but I can't find a way to 
get it to boot and run the autostarting servers up properly. I find that 
the /sys/fs/cgroup/memory/forcontainers/lxc/<container name>/tasks is 
completely empty. My .service file looks like this:

    [Unit]
    Description=Psand run script to add appropriate
    After=network.target lxccgroup-add-dirs.service
    RequiresMountsFor=/sys/fs/cgroup/memory

    [Service]
    ExecStart=/usr/local/sbin/lxc-start-lxcadmin-servers
    Type=oneshot
    RemainAfterExit=yes

    [Install]
    WantedBy=multi-user.target
    Alias=lxc-start-lxcadmin-servers.service

And it script basically running this:

    #!/bin/bash

    /sbin/runuser -l lxcadmin -c 'lxc-autostart'

Am I missing something obvious? Should I be launching lxc-autostart in a 
better way like wrapped in bash? I've written about this before there 
was an associated kernel bug, but it doesn't affect my current install. 
I can't believe it's taken so long getting this into production.

-- 
Cheers,
Ben Green



More information about the lxc-users mailing list