[lxc-users] LXC container and Systemd

Goran sendmailtogoran at gmail.com
Fri Aug 10 09:38:00 UTC 2018


Always the same behavior, if the binary is executed as a user
different from root, systemd does not find the binary.

In this case

# which bash
/usr/bin/bash

can't be found by systemd. ExecStart=whatsoever does not work. It
doesn't matter if it's bash or grafana-server as long the user differs
from root.

2018-08-10 3:04 GMT+02:00 Fajar A. Nugraha <list at fajar.net>:
> On Thu, Aug 9, 2018 at 8:11 PM, Goran <sendmailtogoran at gmail.com> wrote:
>>
>> I did as you told. What I can say is that the user/group directive are
>> the problem.
>>
>> With this config it works:
>>
>
>
> Now we're getting somehwere :D
>
>
>>
>> [Unit]
>> Description=Grafana service
>> After=network.target
>>
>> [Service]
>> # User=grafana
>> # Group=grafana
>> # WorkingDirectory=/usr/share/grafana
>> # ExecStart=/usr/bin/grafana-server -config=/etc/grafana.ini
>> ExecStart=/usr/bin/runuser -s /bin/bash -g grafana -l grafana -c
>> 'grafana-server -config=/etc/grafana.ini -homepath /usr/share/grafana'
>> LimitNOFILE=10000
>> TimeoutStopSec=20
>> SuccessExitStatus=0 2
>>
>> [Install]
>> WantedBy=multi-user.target
>>
>> What I don't understand is why the user/group directive are not
>> accepted and quitted with error
>>
>> Aug 09 13:06:10 monitor systemd[25843]: grafana.service: Failed to
>> determine user credentials: No such process
>> Aug 09 13:06:10 monitor systemd[25843]: grafana.service: Failed at
>> step USER spawning /usr/bin/runuser: No such process
>>
>
>
> This looks promising: "/usr/bin/runuser: No such process"
>
> Try something like this:
>
> [Service]
> User=grafana
> Group=grafana
> ExecStart=/bin/bash -c 'grafana-server -config=/etc/grafana.ini -homepath
> /usr/share/grafana'
>
> --
> Fajar
>
> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users


More information about the lxc-users mailing list