[lxc-users] GUI app in lxd

2016-03-11 Thread zztest

Hi!

A couple of years ago, Graber wrote a neat article about how to run a 
GUI app in LXC 
(https://www.stgraber.org/2014/02/09/lxc-1-0-gui-in-containers/). I 
would like to do this in LXD, but have no idea how to translate those 
LXC settings to LXD. Is it even possible?


Please point me to a doc or tutorial if one exists.  If not, please 
explain how to convert each of the "lxc.mount.entry" settings (from the 
article) listed below to their LXD equivalents.


lxc.mount.entry = /dev/dri dev/dri none bind,optional,create=dir
lxc.mount.entry = /dev/snd dev/snd none bind,optional,create=dir
lxc.mount.entry = /tmp/.X11-unix tmp/.X11-unix none 
bind,optional,create=dir

lxc.mount.entry = /dev/video0 dev/video0 none bind,optional,create=file
lxc.hook.pre-start = 
/home/USERNAME/.local/share/lxc/precise-gui/setup-pulse.sh


Thank you!
zamzing.
___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

[lxc-users] Unable to copy container with snapshots to remote host

2016-03-11 Thread zztest

Hi!

I am copying several containers from one host to a remote on a LAN and 
it works well except when a container has snapshots. Local seems to 
timeout waiting for remote to finish doing something and errors out. How 
can I extend the connection timeout?


I ran:
$ lxc copy --verbose --debug wallabag02 jt3media:wallabag03
...

and ended up with:

DBUG[03-10|00:03:19] 
1.0/operations/cd8b6893-9f2b-48cf-bac2-af3c01b6dbc2/wait
error: Get 
https://jt3media:8443/1.0/operations/cd8b6893-9f2b-48cf-bac2-af3c01b6dbc2/wait: 
Unable to connect to: jt3media:8443



In addition, the remote is left in an undefined state. That is, "lxc 
list" does not show the copied container, but I cannot copy it again. I 
get an "already exists" error:


$ lxc delete jt3media:wallabag03
error: couldn't detect filesystem for 
'/var/lib/lxd/containers/wallabag03': no such file or directory


$ lxc copy wallabag02 jt3media:wallabag03
error: The container/snapshot already exists

Only the snapshot subvolume was created on remote, but deleting it does 
not clear the error.  Isn't "lxc copy" transactional? How do I reset the 
database and remove the partially complete copy?


Finally, I noticed that "migration" subvolumes are created on local for 
each copy attempt, but "lxc list" does not list them. What is the best 
way to clean those files?


I am running Ubuntu Wily with lxc v2.0.0.rc2  on btrfs on all the hosts. 
The container is about 800 MB and has one snapshot.


Thanks!
zamzing

___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

Re: [lxc-users] LXD "offline" migration

2016-03-12 Thread zztest

Use the lxc "move" command:

 lxc move [remote:] [remote:]


On 2016-03-12 14:23, david.an...@bli.uzh.ch wrote:

Hi

For simple "offline" migration, i.e. migration of a stopped container,
can I just copy /var/lib/lxd/containers/xyz to another host or do I
need to use specific lxc commands?
Can I move images in a similar way, by simply copying
/var/lib/lxd/images/xyz to another host?

Thanks

___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

Re: [lxc-users] LXD "offline" migration

2016-03-14 Thread zztest

On 2016-03-13 04:27, david.an...@bli.uzh.ch wrote:

What encryption is LXD using for the move behind the scenes?

-"lxc-users"  wrote:
-

Use the lxc "move" command:

 lxc move [remote:] [remote:]

On 2016-03-12 14:23, david.an...@bli.uzh.ch wrote:

Hi

For simple "offline" migration, i.e. migration of a stopped

container,

can I just copy /var/lib/lxd/containers/xyz to another host or do I
need to use specific lxc commands?
Can I move images in a similar way, by simply copying
/var/lib/lxd/images/xyz to another host?

Thanks


___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users [1]


Links:
--
[1] http://lists.linuxcontainers.org/listinfo/lxc-users

___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users


I am not quite sure, but I think it depends on the underlying 
filesystems of the hosts. For example, if they are both btrfs, it will 
use "btrfs send" to move the container, but if they don't match it will 
use rsync.


___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

[lxc-users] Wildcard in lxd commands?

2016-03-16 Thread zztest
Will wildcards be supported in lxd commands? For example, I'd like to do 
this:


  $ lxc info host:*

or

  $ lxc info host:web*

and get info on all containers/containers starting with "web" on host.

Is there a quick/easy way to do something similar now?


___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

Re: [lxc-users] Wildcard in lxd commands?

2016-03-18 Thread zztest

On 2016-03-16 11:12, Serge Hallyn wrote:

Quoting zzt...@openmailbox.org (zzt...@openmailbox.org):

Will wildcards be supported in lxd commands? For example, I'd like
to do this:

  $ lxc info host:*

or

  $ lxc info host:web*

and get info on all containers/containers starting with "web" on host.

Is there a quick/easy way to do something similar now?


See 'lxc help list'.  Filters should get you what you want.
___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users


How would I use that in a command?  For example would I stop dozens of 
containers whose names begin with "web" using the filter?

___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

[lxc-users] How to set LXD container locale?

2016-03-19 Thread zztest
None of the typical ways of setting locales seem to stick in my Ubuntu 
container in an Ubuntu host (Ubuntu 15.10, LXD 2.0.0.rc4)


The host's locale shows this

LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=


but the container shows this


LANG=
LANGUAGE=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"

/etc/default/locale contains the same value (LANG="en_US.UTF-8") in both 
the container and the host, but I cannot get it to set in the container. 
How is the locale set/changed in an LXD container?


Thanks.


___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

Re: [lxc-users] Wildcard in lxd commands?

2016-03-19 Thread zztest

On 2016-03-17 07:07, Mark Constable wrote:

On 17/03/16 23:01, Janne Savikko wrote:

You can not use filters to list running or stopped containers. Lxc
start or stop do not support filters, only container name (or names).
You though can always pipe commands if you want to stop dozens of
containers whose names begin with "web" (note! lxc list keyword
filter compares from the start of the name, so "lxc list eb" does not
work in this case):


   $ lxc list web|grep RUNNING|awk '{ print $2 }'|xargs lxc stop


It's still rather awkward to reliably script a start/stop of a single
container that happens to be called "web" when there might be web1,
web2 etc. An explicit non-filtered arg to lxc list with optional regex
would be more useful. Plus an option to have plain non-tablewriter
output for easier script parsing.

[[ `lxc list -cs web` = RUNNING ]]; echo $?

___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users


I agree. lxc list would be immensely useful if it could output just a 
list of names or other single attribute of containers that match 
particular criteria. That could then be fed to a command. Something easy 
to remember like:


lxc list -cn --name=web* --state=running | lxc stop {}

___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

Re: [lxc-users] How to set LXD container locale?

2016-03-19 Thread zztest

On 2016-03-19 10:16, Stéphane Graber wrote:

On Sat, Mar 19, 2016 at 03:33:11AM -0700, zzt...@openmailbox.org wrote:

None of the typical ways of setting locales seem to stick in my Ubuntu
container in an Ubuntu host (Ubuntu 15.10, LXD 2.0.0.rc4)

The host's locale shows this

LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=


but the container shows this


LANG=
LANGUAGE=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"

/etc/default/locale contains the same value (LANG="en_US.UTF-8") in 
both the
container and the host, but I cannot get it to set in the container. 
How is

the locale set/changed in an LXD container?

Thanks.


Note that if you're using "lxc exec", LXD only executes the shell that
you asked for, it doesn't setup a PAM session for you, so you start 
with

an empty environment.

One way to solve that is to do a "su root" which will then send you
through the PAM stack (if your container has one) which will then 
source

any needed environment.

Another way if you don't want to go through PAM, is to set environment
variables directly on the container or one of its profiles, like:

lxc config set CONTAINER environment.LC_ALL=en_US.UTF-8

LXD will then set those environment variables for you every time you
exec a command inside the container.

___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users


Thanks Stéphane. "su " works. What's the difference between that 
and "lxc exec CONTAINER -- /bin/bash"?  And is there another way to 
enter the container without using "lxc exec" that will setup PAM (or at 
least do it automatically)?


___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

Re: [lxc-users] Graphics and sound with LXD

2016-03-31 Thread zztest

On 2016-03-29 23:03, efersept wrote:

I was able to get graphics working fairly easily by "mounting" the
necessary devices via the 'lxc config device add   ...'
tool, however the following:

 lxc.hook.pre-start =
/home/USERNAME/.local/share/lxc/precise-gui/setup-pulse.sh

  still has me mystified.

 First off I can not find documentation of how to create hooks in an
LXD configuration. Secondly I do not have enough knowledge of what
this script is doing, other than to change the paths and user names,
to alter it properly. Thirdly, there is no equivalent directories that
I am aware of that are used by lxd.

 I have looked at flockport's documentation and they mention several
alternative ways to implement this but all seem to have some legacy
lxc dependency of some kind.

 I did create a /tmp/.lxc directory then ran the script changing the
path to /tmp/.lxc/.pulse_socket and the user name and this seemed to
be successful. Also successfully 'export
PULSE_SERVER=/tmp/.lxc/.pulse_socket', also without error. But when I
tried 'lxc config device add  /tmp/.lxc/.pulse_socket
unix-char /tmp/.lxc/.pulse_socket' it returned the following error:

 error: Failed to setup device: Failed to get device attributes: Not a
device

 perhaps this is obvious to some of you but I could really use help
with this.

___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users



I don't know if you got the script from  Stéphane's LXC article 
(https://www.stgraber.org/2014/02/09/lxc-1-0-gui-in-containers/), but in 
it he say's it is used to "tell pulseaudio on the host to bind 
/home/ubuntu/.pulse_socket in the container, checking that it’s not 
already setup."


Unfortunately I do not know how to translate that to LXD. As far as I 
can tell (by looking at the lxc-to-lxd script) hooks are not supported 
yet. Perhaps there is a workaround?


Could you please post an example of the lxd config commands you used to 
make your graphics work?


I wonder why more people are not asking/answering questions about LXD 
GUI containers; information on the subject is very scarce. Even 
Stéphane's new series of LXD articles does not cover it. Is LXD not 
recommended for GUI use?




___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

Re: [lxc-users] Graphics and sound with LXD

2016-04-01 Thread zztest

On 2016-03-31 18:11, efersept wrote:

I don't know if you got the script from  Stéphane's LXC article

(https://www.stgraber.org/2014/02/09/lxc1-0-gui-in-containers/ [1]),
but in it he say's it is used to "tell pulseaudio on the host to bind
_/home/ubuntu/_.pulse_socket in the container, checking that it’s
not already setup."

 Well initially I got the script from flockport but went back to
Stéphane's LXC article
(https://www.stgraber.org/2014/02/09/lxc1-0-gui-in-containers/ [1])
and did realize that I was using a script for privileged containers.
Fixed the script and it is still having problems. The script when
executed manually does not return any errors however pulse still does
not export in the container and the .pulse_socket is not created in
/home/ubuntu directory of the container and yes I specified the entire
correct path in the script.
 I believe the problem may be id mapping as described in the
aforementioned blog series. The following would be added to the lxc
config file:

lxc.id_map = u 0 10 1000
lxc.id_map = g 0 10 1000
lxc.id_map = u 1000 1000 1
lxc.id_map = g 1000 1000 1
lxc.id_map = u 1001 101001 64535
lxc.id_map = g 1001 101001 64535

 the user ubuntu in the container needs to be mapped to the same user
id as the normal user in the host. I am unaware of how this can be
done in the LXD config file or if an equivalent configuration can even
be made with LXD.

 I think that if someone knows how this can be done in the LXD config
file, and also how hooks can be implemented, that sound could be
quickly enabled. If someone has any ideas please feel free to share
them.

 >Unfortunately I do not know how to translate that to LXD. As far as
I can tell (by looking at the lxc-to-lxd script) hooks are not
supported yet. Perhaps there is a workaround?

 >Could you please post an example of the lxd config commands you used
to make your graphics work?

 As I mentioned this was surprisingly easy. I found the following
commands that someone had posted in an old lxc-users mailing. Sorry, I
can not remember who it was.

 lxc config device add qt5-development /dev/nvidia0 unix-char
path=/dev/nvidia0

 lxc config device add qt5-development /dev/nvidiactl unix-char
path=/dev/nvidiactl

 lxc config device add qt5-development /dev/nvidia-uvm unix-char
path=/dev/nvidia-uvm

 lxc config device add qt5-development /dev/video0 unix-char
path=/dev/video0
 lxc config device add qt5-development /dev/tty0 unix-char
path=/dev/tty0

 lxc config device add qt5-development /dev/tty7 unix-char
path=/dev/tty7

 lxc config device add qt5-development /dev/tty8 unix-char
path=/dev/tty8

 lxc config device add qt5-development /dev/fb0 unix-char
path=/dev/fb0
 e99dd6437665
 lxc config device add qt5-development /dev/dri unix-char
path=/dev/dri

 lxc config device add qt5-development /dev/dri/card0 unix-char
path=/dev/dri/card0

I replicated everything except the nvidia lines as they do not apply
to me. Also I found that I was not able to "mount" directories with
this command like /dev/dri and /dev/snd. I had to execute a line for
each device in these directies such as /dev/dri/card0 and so on. After
this the config file looked like the following:

name: gc1
 profiles:
 - default
 config:
   volatile.base_image:
e99dd64376651ed3b81bf312d2cfde1ef0a58ecd296a9ae4b654bda733f832ee
   volatile.eth0.hwaddr: 00:16:3e:0f:6d:36
   volatile.last_state.idmap:
'[{"Isuid":true,"Isgid":false,"Hostid":50,"Nsid":0,"Maprange":458752},{"Isuid":false,"Isgid":true,"Hostid":50,"Nsid":0,"Maprange":458752}]'
 devices:
   /dev/dri/card0:
 path: /dev/dri/card0
 type: unix-char
   /dev/dri/controlD64:
 path: /dev/dri/controlD64
 type: unix-char
   /dev/dri/renderD128:
 path: /dev/dri/renderD128
 type: unix-char
   /dev/fb0:
 path: /dev/fb0
 type: unix-char
   /dev/snd/controlC0:
 path: /dev/snd/controlC0
 type: unix-char
   /dev/snd/hwC0D0:
 path: /dev/snd/hwC0D0
 type: unix-char
   /dev/snd/hwC0D3:
 path: /dev/snd/hwC0D3
 type: unix-char
   /dev/snd/pcmC0D0c:
 path: /dev/snd/pcmC0D0c
 type: unix-char
   /dev/snd/pcmC0D0p:
 path: /dev/snd/pcmC0D0p
 type: unix-char
   /dev/snd/pcmC0D3p:
 path: /dev/snd/pcmC0D3p
 type: unix-char
   /dev/snd/pcmC0D7p:
 path: /dev/snd/pcmC0D7p
 type: unix-char
   /dev/snd/pcmC0D8p:
 path: /dev/snd/pcmC0D8p
 type: unix-char
   /dev/snd/seq:
 path: /dev/snd/seq
 type: unix-char
   /dev/snd/timer:
 path: /dev/snd/timer
 type: unix-char
   /dev/tty0:
 path: /dev/tty0
 type: unix-char
   /dev/tty7:
 path: /dev/tty7
 type: unix-char
   /dev/tty8:
 path: /dev/tty8
 type: unix-char
   /dev/video0:
 path: /dev/video0
 type: unix-char
   root:
 path: /
 type: disk
 ephemeral: false

Then launched gc1 and ssh -X ubuntu@10.0.1.16 and launched a browser
and chromium-bsu. Both worked flawlessly but without sound.

 >I wonder why more people are not asking/answering questions a

Re: [lxc-users] LXC ubuntu locales

2016-04-01 Thread zztest

On 2016-04-01 09:24, enrico stano wrote:

Hi,

I have a really simple Ubuntu Trusty LXC container and I noticed that
while creating it from the standard ubuntu LXC template it uses the
same locales as its host.

This seems really weird to me since I expect that the container should
be as agnostic as possible from the host.

What did I try?

Host: Arch Linux kernel 4.4.5
Container: Ubuntu 14.04

Host: Lubuntu kernel 3.5
Container: Ubuntu 14.04

in the first case I only have en_US.UTF8 as locale in the host, didn't
noticed anything weird in LXC.

In the other case the host has es_ES.UTF8, some on the LXC container
right after the lxc-create command.

Ho can I assure that every time the container has en_US.UTF8 or any
other standard as locale?

In the configuration file man I didn't find anything related to
locales.

Many thanks!

Bye,

Enrico

--

· Enrico Stano
 ·

· twitter @enricostano
___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users


In an recent answer to my question about locales, Stéphane suggested 
this:
"set environment variables directly on the container or one of its 
profiles, like:


lxc config set CONTAINER environment.LC_ALL=en_US.UTF-8

LXD will then set those environment variables for you every time you 
exec a command inside the container."


Hope that helps.


___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users