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

Serge E. Hallyn serge at hallyn.com
Sat Nov 21 21:54:05 UTC 2020


On Sat, Nov 21, 2020 at 09:25:15PM +0000, Ben Green wrote:
> 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

I've never used lxc-autostart, but looking at the manpage, do you
have lxc.start.auto set in the containers you want to start?  What
do the configs look like?

Do the containers actually start but in the wrong cgroup?  Or do
they just not start?

> 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.


More information about the lxc-users mailing list