[lxc-users] LXC container and Systemd

Fajar A. Nugraha list at fajar.net
Fri Aug 10 09:58:09 UTC 2018


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20180810/ac2ce8e4/attachment.html>


More information about the lxc-users mailing list