[lxc-users] LXC container and Systemd

Goran sendmailtogoran at gmail.com
Fri Aug 10 10:12:07 UTC 2018


Your test-asuser.service works as intended. If I change the user and
group to grafana it shows the same problems.

# id grafana
uid=207(grafana) gid=207(grafana) groups=207(grafana)

# cat /etc/passwd
...
grafana:x:207:207::/var/lib/grafana:/sbin/nologin
...

cat /etc/group
...
grafana:x:207:
...

Thanks for all the help

2018-08-10 11:58 GMT+02:00 Fajar A. Nugraha <list at fajar.net>:
> On Fri, Aug 10, 2018 at 4:38 PM, Goran <sendmailtogoran at gmail.com> wrote:
>>
>> 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.
>>
>
>
> This test unit works fine for me in lxd. Container created using "lxc launch
> images:archlinux arch-test"
>
> ######
> # cat /etc/systemd/system/test-asuser.service
> [Unit]
> Description=run as user test
>
> [Service]
> User=nobody
> Group=nobody
>
> Type=oneshot
> ExecStart=/bin/bash -c 'echo $(date) id is $(id) >> /tmp/test-asuser.log'
> ######
>
> How did you create your container? If you use lxc (not lxd), try the
> 'download' template.
>
> --
> 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