<div dir="ltr">I was able to resolve the lock issue, today. It seems like the environment variable XDG_RUNTIME_DIR holds the value of that directory per-user. while using sudo it didn't change the directory, and still set to the login user. I found the correct directory using `ls -alh /run/user/*` (the one thats owned by the lxc user), and then manually setting the XDG_RUNTIME_DIR to that path. Afterwards lxc-create works.<div>But now im getting a different error due to dbus, it looks like cgmanager call to create cgroup is failing</div><div><div><br></div><div><br></div><div> lxc-start 1420309721.946 ERROR lxc_cgmanager - call to cgmanager_create_sync failed: invalid request</div><div> lxc-start 1420309721.946 ERROR lxc_cgmanager - Failed to create hugetlb:testx</div><div> lxc-start 1420309721.946 ERROR lxc_cgmanager - Error creating cgroup hugetlb:testx</div></div><div><br></div><div>I have tried the cgm commands, as a different user since the user which needs to run lxc dont have sudo access. Following are the output</div><div><div>-- ranjib@agent01:~ $ sudo cgm create all go</div><div>method return sender=(null sender) -> dest=(null destination) reply_serial=1</div><div> int32 1</div><div>method return sender=(null sender) -> dest=(null destination) reply_serial=1</div><div> int32 1</div><div>method return sender=(null sender) -> dest=(null destination) reply_serial=1</div><div> int32 1</div><div>method return sender=(null sender) -> dest=(null destination) reply_serial=1</div><div> int32 1</div><div>method return sender=(null sender) -> dest=(null destination) reply_serial=1</div><div> int32 1</div><div>method return sender=(null sender) -> dest=(null destination) reply_serial=1</div><div> int32 1</div><div>method return sender=(null sender) -> dest=(null destination) reply_serial=1</div><div> int32 1</div><div>method return sender=(null sender) -> dest=(null destination) reply_serial=1</div><div> int32 1</div><div>method return sender=(null sender) -> dest=(null destination) reply_serial=1</div><div> int32 1</div><div>method return sender=(null sender) -> dest=(null destination) reply_serial=1</div><div> int32 1</div><div><br></div><div>-- ranjib@agent01:~ $ sudo cgm chown all go 111 117</div><div>method return sender=(null sender) -> dest=(null destination) reply_serial=1</div><div>method return sender=(null sender) -> dest=(null destination) reply_serial=1</div><div>method return sender=(null sender) -> dest=(null destination) reply_serial=1</div><div>method return sender=(null sender) -> dest=(null destination) reply_serial=1</div><div>method return sender=(null sender) -> dest=(null destination) reply_serial=1</div><div>method return sender=(null sender) -> dest=(null destination) reply_serial=1</div><div>method return sender=(null sender) -> dest=(null destination) reply_serial=1</div><div>method return sender=(null sender) -> dest=(null destination) reply_serial=1</div><div>method return sender=(null sender) -> dest=(null destination) reply_serial=1</div><div>method return sender=(null sender) -> dest=(null destination) reply_serial=1</div><div><br></div><div>-- ranjib@agent01:~ $ sudo cgm movepid all go 18764</div><div>Error org.freedesktop.DBus.Error.InvalidArgs: invalid request</div><div>Error org.freedesktop.DBus.Error.InvalidArgs: invalid request</div><div>Error org.freedesktop.DBus.Error.InvalidArgs: invalid request</div><div>Error org.freedesktop.DBus.Error.InvalidArgs: invalid request</div><div>Error org.freedesktop.DBus.Error.InvalidArgs: invalid request</div><div>Error org.freedesktop.DBus.Error.InvalidArgs: invalid request</div><div>Error org.freedesktop.DBus.Error.InvalidArgs: invalid request</div><div>Error org.freedesktop.DBus.Error.InvalidArgs: invalid request</div><div>Error org.freedesktop.DBus.Error.InvalidArgs: invalid request</div><div>Error org.freedesktop.DBus.Error.InvalidArgs: invalid request</div></div><div><br></div><div><br></div><div>Clearly the last one is failing, but im not sure why. I have installed libpam-systemd and reboot the server, without any effect. Also i dont know if the previous two cgm calls were successful, but their exit code was 0.</div><div><br></div><div><br></div><div>any help?</div><div>thanks in advance,</div><div>ranjib</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jan 3, 2015 at 9:14 AM, Nicholas J Ingrassellino <span dir="ltr"><<a href="mailto:nick@lifebloodnetworks.com" target="_blank">nick@lifebloodnetworks.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>I am having the same issue.<br>
<br>
After an<br>
<blockquote><i>sudo su - lxc</i><br>
</blockquote>
I try using<br>
<blockquote><i>lxc-create</i><br>
</blockquote>
. I get<br>
<blockquote><i>lxc-create: Permission denied - failed to create
directory '/run/user/1000/lock/'</i><i><br>
</i></blockquote>
which is the uid of the "logged in" user. I am writing up
instructions to host a how-to on my blog and can not find any
clues as to a solution.<br>
<div><br>
<hr style="min-height:1px"><br>
</div><div><div class="h5">
On 12/27/2014 10:54 PM, Ranjib Dey wrote:<br>
</div></div></div>
<blockquote type="cite"><div><div class="h5">
<div dir="ltr">
<div>
<div>Hi list,</div>
<div>Im trying to create an unprivileged container on ubuntu
14.04 with lxc 1.0.6. The user(named `go`) which will
create containers is a CI agent (GoCD, its like jenkins).
After installing the CI software, i am manually adding
subuid and subgid using the usermod -a -g file. I have also
created the appropriate /etc/lxc/lxc-usernet and othet
configurations. When i try to create a container from the
download template it fails. The first error shows that it
tries to create a lock directory in a folder owned by wrong
user. Note, my login user is different, and im using `sudo
su - go` to become the user. I tried doing the cgm trick as
well (cgm create all .., cgm chown all ..), without much
luck. </div>
<div><br>
</div>
<div><br>
</div>
<div>go@host01:~$ lxc-create -o test.log -l debug -n test -t
download -- -d ubuntu -a amd64 -r trusty</div>
<div><br>
</div>
<div>lxc-create: Permission denied - failed to create
directory '/run/user/1001/lock/'</div>
<div>WARN: could not reopen tty: Permission denied</div>
<div>WARN: could not reopen tty: Permission denied</div>
<div>WARN: could not reopen tty: Permission denied</div>
<div>lxc-create: Error opening
/tmp/111/lxc//var/go/.local/share/lxc/test</div>
<div>lxc-create: failed to save starting configuration for
test</div>
<div>lxc-create: Error creating container test</div>
<div><br>
</div>
</div>
<div><br>
</div>
<div>Following is the content of the test.log</div>
<div><br>
</div>
<div>
<div>lxc-create 1419737316.440 ERROR lxc_utils - Permission
denied - failed to create directory '/run/user/1001/lock/'</div>
<div>lxc-create 1419737316.440 WARN lxc_log - lxc_log_init
called with log already initialized</div>
<div>lxc-create 1419737316.440 INFO lxc_confile - read uid
map: type u nsid 0 hostid 3311264 range 65537</div>
<div>lxc-create 1419737316.440 INFO lxc_confile - read uid
map: type g nsid 0 hostid 3311264 range 65537</div>
<div>lxc-create 1419737316.562 ERROR lxc_lock - Error
opening /tmp/111/lxc//var/go/.local/share/lxc/test</div>
<div>lxc-create 1419737316.563 ERROR lxc_container - failed
to save starting configuration for test</div>
<div>lxc-create 1419737316.563 ERROR lxc_create_ui - Error
creating container test</div>
<div>lxc-create 1419737772.411 ERROR lxc_utils - Permission
denied - failed to create directory '/run/user/1001/lock/'</div>
<div>lxc-create 1419737772.411 WARN lxc_log - lxc_log_init
called with log already initialized</div>
<div>lxc-create 1419737772.412 INFO lxc_confile - read uid
map: type u nsid 0 hostid 3311264 range 65537</div>
<div>lxc-create 1419737772.412 INFO lxc_confile - read uid
map: type g nsid 0 hostid 3311264 range 65537</div>
<div>lxc-create 1419737772.544 ERROR lxc_lock - Error
opening /tmp/111/lxc//var/go/.local/share/lxc/test</div>
<div>lxc-create 1419737772.544 ERROR lxc_container - failed
to save starting configuration for test</div>
<div>lxc-create 1419737772.545 ERROR lxc_create_ui - Error
creating container test</div>
</div>
<div><br>
</div>
<div>
<div>go@host01:~$ ls -alh /run/user/</div>
<div>total 0</div>
<div>drwxr-xr-x 6 root root 120 Dec 28 03:02 .</div>
<div>drwxr-xr-x 28 root root 940 Dec 28 03:02 ..</div>
<div>drwx------ 2 ranjib ranjib 40 Dec 28 02:58 1001</div>
<div>drwx------ 2 newrelic newrelic 40 Dec 28 02:57 109</div>
<div>drwx------ 2 go go 40 Dec 28 02:57 111</div>
<div><br>
</div>
</div>
</div>
<br>
<fieldset></fieldset>
<br>
</div></div><pre>_______________________________________________
lxc-users mailing list
<a href="mailto:lxc-users@lists.linuxcontainers.org" target="_blank">lxc-users@lists.linuxcontainers.org</a>
<a href="http://lists.linuxcontainers.org/listinfo/lxc-users" target="_blank">http://lists.linuxcontainers.org/listinfo/lxc-users</a></pre>
</blockquote>
<br>
</div>
<br>_______________________________________________<br>
lxc-users mailing list<br>
<a href="mailto:lxc-users@lists.linuxcontainers.org">lxc-users@lists.linuxcontainers.org</a><br>
<a href="http://lists.linuxcontainers.org/listinfo/lxc-users" target="_blank">http://lists.linuxcontainers.org/listinfo/lxc-users</a><br></blockquote></div><br></div>