Re: [lxc-users] not able to run glxdemo from inside lxc container

2016-11-02 Thread manik sheeri
I was able to resolve this issue.

I had to add nvidia device nodes in the lxc container config file.

lxc.cgroup.devices.allow = c 195:* rwm
lxc.mount.entry = /dev/nvidia0 dev/nvidia0 none bind,optional,create=file
lxc.mount.entry = /dev/nvidiactl dev/nvidiactl none bind,optional,create=file
lxc.mount.entry = /dev/nvidia-modeset dev/nvidia-modeset none
bind,optional,create=file


On Wed, Nov 2, 2016 at 5:00 AM, <lxc-users-requ...@lists.linuxcontainers.org
> wrote:

> Send lxc-users mailing list submissions to
> lxc-users@lists.linuxcontainers.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.linuxcontainers.org/listinfo/lxc-users
> or, via email, send a message with subject or body 'help' to
> lxc-users-requ...@lists.linuxcontainers.org
>
> You can reach the person managing the list at
> lxc-users-ow...@lists.linuxcontainers.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of lxc-users digest..."
>
> Today's Topics:
>
>    1. not able to run glxdemo from inside lxc container (manik sheeri)
>    2. Error in playing a sound using ALSA inside LXC container
>   (manik sheeri)
>
>
> -- Forwarded message --
> From: manik sheeri <sheeri185adi...@gmail.com>
> To: lxc-users@lists.linuxcontainers.org
> Cc:
> Date: Tue, 1 Nov 2016 14:09:06 -0700
> Subject: [lxc-users] not able to run glxdemo from inside lxc container
>
> I have created lxc container of our custom toolchain that has many
> packages. Related to graphics, I have installed nvidia 367.27 driver
> using the nvidia installer inside this container(called mk7icontainer)
>
> The nvidia driver libraries/binaries are installed at path
> /usr/share/nvidia path inside this container.
>
> I have also installed mesa installed in path /usr inside container.
>
> I compiled the glxdemo source code using the command as:
>
> gcc -g glxdemo.c -Wl,--rpath-link,/usr/share/nvidia/lib 
> -Wl,-rpath,/usr/share/nvidia/lib \
> -Wl,--rpath-link,/usr/share/nvidia/lib/tls 
> -Wl,-rpath,/usr/share/nvidia/lib/tls \
> -Wl,--rpath-link,/usr/share/nvidia/lib/vdpau  
> -Wl,-rpath,/usr/share/nvidia/lib/vdpau \
> -Wl,--rpath-link,/usr/share/nvidia/lib/xorg/modules 
> -Wl,-rpath,/usr/share/nvidia/lib/xorg/modules \
> -Wl,--rpath-link,/usr/share/nvidia/lib/xorg/modules/drivers 
> -Wl,-rpath,/usr/share/nvidia/lib/xorg/modules/drivers \
> -Wl,--rpath-link,/usr/share/nvidia/lib/xorg/modules/extensions 
> -Wl,-rpath,/usr/share/nvidia/lib/xorg/modules/extensions -lX11 -lGL -lGLU 
> -lglut -lm -o glxdemo
>
>
> Inside the container, I have
>
> DISPLAY=":0"
> XAUTHORITY=/root/.Xauthority
>
> I am starting the bash in the container using below command:
>
> sudo lxc-attach -n mk7icontainer --clear-env  -- /usr/bin/bash
>
> My host machine is running Ubuntu 16.0.4 and I installed the same nvidia
> 367.27 driver using its installer. It is running fine. I can even run
> glxdemo on host machine without any issues.
>
> However, when I try to run glxdemo inside the container ( compiled using
> above mentioned command), I get the following error:
>
> X Error of failed request:  BadValue (integer parameter out of range for 
> operation)
> Major opcode of failed request:  154 (GLX)
> Minor opcode of failed request:  3 (X_GLXCreateContext)
> Value in failed request:  0x0
> Serial number of failed request:  24
> Current serial number in output stream:  25
>
> anyone got any idea what is wrong here?
>
>
>
> Source code for glxdemo is :
>
> #include 
> #include 
> #include 
> #include 
> static void redraw( Display *dpy, Window w )
> {
>printf("Redraw event\n");
>glClear( GL_COLOR_BUFFER_BIT );
>
>glColor3f( 1.0, 1.0, 0.0 );
>glRectf( -0.8, -0.8, 0.8, 0.8 );
>glXSwapBuffers( dpy, w );
> }
>
> static void resize( unsigned int width, unsigned int height )
> {
>printf("Resize event\n");
>glViewport( 0, 0, width, height );
>glMatrixMode( GL_PROJECTION );
>glLoadIdentity();
>glOrtho( -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 );
> }
>
> static Window make_rgb_db_window( Display *dpy,
>   unsigned int width, unsigned int height )
> {
>int attrib[] = { GLX_RGBA,
> GLX_RED_SIZE, 1,
> GLX_GREEN_SIZE, 1,
> GLX_BLUE_SIZE, 1,
> GLX_DOUBLEBUFFER,
> None };
>int scrnum;
>XSetWindowAttributes attr;
>unsigned long mask;
>Window root;
>Window win;
>GLXContext ctx;
>XVisualInfo *visin

[lxc-users] Error in playing a sound using ALSA inside LXC container

2016-11-01 Thread manik sheeri
I am using host Ubuntu 16.0.4 system to run my lxc container. I uninstalled
pulseaudio as I wanted to use ALSA directly.

After uninstalling pulseaudio from the host machine, I was able to play
sounds using the command like one below(on host machine):

aplay /usr/share/sounds/alsa/Rear_Right.wav

Inside the lxc container, I have installed alsa libs and alsa utils. When I
use the same command as above inside the container, I get the following
errors:

ALSA lib confmisc.c:768:(parse_card) cannot find card '0'
ALSA lib conf.c:4248:(_snd_config_evaluate) function
snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4248:(_snd_config_evaluate) function snd_func_concat
returned error: No such file or directory
ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
ALSA lib conf.c:4248:(_snd_config_evaluate) function snd_func_refer
returned error: No such file or directory
ALSA lib conf.c:4727:(snd_config_expand) Evaluate error: No such file
or directory
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM default
aplay: main:654: audio open error: No such file or directory

The sound devices inside container are:

bash-4.2# ls -al /dev/snd/*
crw-rw 1 root   29 116,  5 Nov  1 17:21 /dev/snd/controlC0
crw-rw 1 root   29 116,  2 Nov  1 17:21 /dev/snd/controlC1
crw-rw 1 root   29 116, 10 Nov  1 17:21 /dev/snd/controlC2
crw-rw 1 root   29 116,  9 Nov  1 17:21 /dev/snd/hwC0D0
crw-rw 1 root   29 116, 13 Nov  1 17:21 /dev/snd/hwC2D0
crw-rw 1 root   29 116,  6 Nov  1 17:21 /dev/snd/pcmC0D3p
crw-rw 1 root   29 116,  7 Nov  1 17:21 /dev/snd/pcmC0D7p
crw-rw 1 root   29 116,  8 Nov  1 17:21 /dev/snd/pcmC0D8p
crw-rw 1 root   29 116,  4 Nov  1 17:21 /dev/snd/pcmC1D0c
crw-rw 1 root   29 116,  3 Nov  1 17:27 /dev/snd/pcmC1D0p
crw-rw 1 root   29 116, 11 Nov  1 17:21 /dev/snd/pcmC2D3p
crw-rw 1 root   29 116, 12 Nov  1 17:21 /dev/snd/pcmC2D7p
crw-rw 1 root   29 116,  1 Nov  1 17:21 /dev/snd/seq
crw-rw 1 root   29 116, 33 Nov  1 17:21 /dev/snd/timer

/dev/snd/by-id:
total 0
drwxr-xr-x 2 root root  60 Nov  1 17:21 .
drwxr-xr-x 4 root root 360 Nov  1 17:21 ..
lrwxrwxrwx 1 root root  12 Nov  1 17:21 usb-126c_4.1_amplifier-00 ->
../controlC1

/dev/snd/by-path:
total 0
drwxr-xr-x 2 root root 100 Nov  1 17:21 .
drwxr-xr-x 4 root root 360 Nov  1 17:21 ..
lrwxrwxrwx 1 root root  12 Nov  1 17:21 pci-:00:03.0 -> ../controlC0
lrwxrwxrwx 1 root root  12 Nov  1 17:21 pci-:00:14.0-usb-0:5:1.0
-> ../controlC1
lrwxrwxrwx 1 root root  12 Nov  1 17:21 pci-:01:00.1 -> ../controlC2
___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

[lxc-users] not able to run glxdemo from inside lxc container

2016-11-01 Thread manik sheeri
I have created lxc container of our custom toolchain that has many
packages. Related to graphics, I have installed nvidia 367.27 driver using
the nvidia installer inside this container(called mk7icontainer)

The nvidia driver libraries/binaries are installed at path
/usr/share/nvidia path
inside this container.

I have also installed mesa installed in path /usr inside container.

I compiled the glxdemo source code using the command as:

gcc -g glxdemo.c -Wl,--rpath-link,/usr/share/nvidia/lib
-Wl,-rpath,/usr/share/nvidia/lib \
-Wl,--rpath-link,/usr/share/nvidia/lib/tls
-Wl,-rpath,/usr/share/nvidia/lib/tls \
-Wl,--rpath-link,/usr/share/nvidia/lib/vdpau
-Wl,-rpath,/usr/share/nvidia/lib/vdpau \
-Wl,--rpath-link,/usr/share/nvidia/lib/xorg/modules
-Wl,-rpath,/usr/share/nvidia/lib/xorg/modules \
-Wl,--rpath-link,/usr/share/nvidia/lib/xorg/modules/drivers
-Wl,-rpath,/usr/share/nvidia/lib/xorg/modules/drivers \
-Wl,--rpath-link,/usr/share/nvidia/lib/xorg/modules/extensions
-Wl,-rpath,/usr/share/nvidia/lib/xorg/modules/extensions -lX11 -lGL
-lGLU -lglut -lm -o glxdemo


Inside the container, I have

DISPLAY=":0"
XAUTHORITY=/root/.Xauthority

I am starting the bash in the container using below command:

sudo lxc-attach -n mk7icontainer --clear-env  -- /usr/bin/bash

My host machine is running Ubuntu 16.0.4 and I installed the same nvidia
367.27 driver using its installer. It is running fine. I can even run
glxdemo on host machine without any issues.

However, when I try to run glxdemo inside the container ( compiled using
above mentioned command), I get the following error:

X Error of failed request:  BadValue (integer parameter out of range
for operation)
Major opcode of failed request:  154 (GLX)
Minor opcode of failed request:  3 (X_GLXCreateContext)
Value in failed request:  0x0
Serial number of failed request:  24
Current serial number in output stream:  25

anyone got any idea what is wrong here?



Source code for glxdemo is :

#include 
#include 
#include 
#include 
static void redraw( Display *dpy, Window w )
{
   printf("Redraw event\n");
   glClear( GL_COLOR_BUFFER_BIT );

   glColor3f( 1.0, 1.0, 0.0 );
   glRectf( -0.8, -0.8, 0.8, 0.8 );
   glXSwapBuffers( dpy, w );
}

static void resize( unsigned int width, unsigned int height )
{
   printf("Resize event\n");
   glViewport( 0, 0, width, height );
   glMatrixMode( GL_PROJECTION );
   glLoadIdentity();
   glOrtho( -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 );
}

static Window make_rgb_db_window( Display *dpy,
  unsigned int width, unsigned int height )
{
   int attrib[] = { GLX_RGBA,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
GLX_DOUBLEBUFFER,
None };
   int scrnum;
   XSetWindowAttributes attr;
   unsigned long mask;
   Window root;
   Window win;
   GLXContext ctx;
   XVisualInfo *visinfo;

   scrnum = DefaultScreen( dpy );
   root = RootWindow( dpy, scrnum );

   visinfo = glXChooseVisual( dpy, scrnum, attrib );
   if (!visinfo) {
  printf("Error: couldn't get an RGB, Double-buffered visual\n");
  exit(1);
   }

   /* window attributes */
   attr.background_pixel = 0;
   attr.border_pixel = 0;
   attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
   attr.event_mask = StructureNotifyMask | ExposureMask;
   mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;

   win = XCreateWindow( dpy, root, 0, 0, width, height,
0, visinfo->depth, InputOutput,
visinfo->visual, mask,  );

   printf("\n XCreateWindow successfull \n");
   ctx = glXCreateContext( dpy, visinfo, NULL, True );
   if (!ctx) {
  printf("Error: glXCreateContext failed\n");
  exit(1);
   }

printf("\n glXCreateContext successfull \n");

   glXMakeCurrent( dpy, win, ctx );

   return win;
}

static void event_loop( Display *dpy )
{
   XEvent event;

   while (1) {
  XNextEvent( dpy,  );

  switch (event.type) {
 case Expose:
redraw( dpy, event.xany.window );
break;
 case ConfigureNotify:
resize( event.xconfigure.width, event.xconfigure.height );
break;
  }
   }
}

int main( int argc, char *argv[] )
{
   Display *dpy;
   Window win;

   dpy = XOpenDisplay(NULL);
if(!dpy)
{
printf("\nError in XOpenDisplay\n");
}
printf("\nXOpenDisplay successfull\n");

   win = make_rgb_db_window( dpy, 300, 300 );

   printf("\nmake_rgb_db_window successfull \n");
   glShadeModel( GL_FLAT );
   glClearColor( 0.5, 0.5, 0.5, 1.0 );

   XMapWindow( dpy, win );

   event_loop( dpy );
   return 0;
}
___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

[lxc-users] Custom lxc container hangs in lxc-console

2016-10-11 Thread manik sheeri
I am trying to run my LFS (Linux from scratch) inside a container. I
created LFS from its stable version book and using that as a rootfs for my
container.

I created the LFS rootfs at /home/manik/toolchain/lfs . I am using this as
a rootfs source for my container. I will copy the directories inside my
container rootfs from this location.

Below is the template that I created from busybox template of lxc package.I
named this tempalate as lxc-lfs and copied into the directory
/usr/share/lxc/templates

#!/bin/bash

LXC_MAPPED_UID=
LXC_MAPPED_GID=

# Make sure the usual locations are in PATH
export PATH=$PATH:/usr/sbin:/usr/bin:/sbin:/bin

am_in_userns() {
[ -e /proc/self/uid_map ] || { echo no; return; }
[ "$(wc -l /proc/self/uid_map | awk '{ print $1 }')" -eq 1 ] || {
echo yes; return; }
line=$(awk '{ print $1 " " $2 " " $3 }' /proc/self/uid_map)
[ "$line" = "0 0 4294967295" ] && { echo no; return; }
echo yes
}

configure_lfs() {
rootfs=$1
name=$2
lfsroot=$3
res=0

tree=( \
bin \
boot \
dev \
etc \
home \
lib \
media \
mnt \
opt \
proc \
root \
run \
sbin \
srv \
sys \
tmp \
usr \
var )


for d in ${tree[@]}
do
mkdir -p $rootfs/$d
cp -r --preserve $lfsroot/$d/. $rootfs/$d
done

pushd $rootfs/dev > /dev/null || return 1

mknod -m 666 tty c 5 0   || res=1
mknod -m 666 console c 5 1   || res=1
mknod -m 666 tty0 c 4 0  || res=1
mknod -m 666 tty1 c 4 0  || res=1
mknod -m 666 tty5 c 4 0  || res=1
mknod -m 600 ram0 b 1 0  || res=1
mknod -m 666 null c 1 3  || res=1
mknod -m 666 zero c 1 5  || res=1
mknod -m 666 urandom c 1 9   || res=1

mkdir pts || res=1

popd > /dev/null

cat <> $rootfs/etc/init.d/rcS
#!/bin/sh
/bin/syslogd
/bin/mount -a
EOF

# executable
chmod 744 $rootfs/etc/init.d/rcS || res=1

# launch rcS first then make a console available
# and propose a shell on the tty, the last one is
# not needed
cat <> $rootfs/etc/inittab
::sysinit:/etc/init.d/rcS
tty1::respawn:/sbin/agetty -L tty1 115200 vt100
console::askfirst:/bin/sh
EOF
# writable and readable for other
chmod 644 $rootfs/etc/inittab || res=1

# /etc/fstab must exist for "mount -a"
touch $rootfs/etc/fstab || res=1

return $res
}

copy_configuration() {

path=$1
rootfs=$2
name=$3

grep -q "^lxc.rootfs" $path/config 2>/dev/null || echo "lxc.rootfs
= $rootfs" >> $path/config
cat <> $path/config
lxc.haltsignal = SIGUSR1
lxc.rebootsignal = SIGTERM
lxc.utsname = $name
lxc.tty = 1
lxc.pts = 1
lxc.cap.drop = sys_module mac_admin mac_override sys_time

# When using LXC with apparmor, uncomment the next line to run unconfined:
#lxc.aa_profile = unconfined

lxc.mount.auto = cgroup:mixed proc:mixed sys:mixed
lxc.mount.entry = shm /dev/shm tmpfs defaults 0 0
EOF

echo "lxc.mount.entry = /sys/kernel/security sys/kernel/security none
ro,bind,optional 0 0" >>$path/config
return 0
}

in_userns=0
[ $(am_in_userns) = "yes" ] && in_userns=1

usage()
{
cat < -n|--name=
--lfsroot=[Mandatory option]
EOF
return 0
}


options=$(getopt -o hp:n: -l help,rootfs:,path:,name:,lfsroot: -- "$@")
if [ $? -ne 0 ]; then
usage $(basename $0)
exit 1
fi
eval set -- "$options"

while true
do
case "$1" in
-h|--help)  usage $0 && exit 0;;
-p|--path)  path=$2; shift 2;;
--rootfs)   rootfs=$2; shift 2;;
--lfsroot)  lfsroot=$2; shift 2;;
-n|--name)  name=$2; shift 2;;
--) shift 1; break ;;
   *)  break ;;
esac
done

if [ -z "$lfsroot" ]; then
echo "--lfsroot argument is required."
exit 1
fi

if [ "$(id -u)" != "0" ]; then
echo "This script should be run as 'root'"
exit 1
fi

if [ -z "$path" ]; then
echo "'path' parameter is required"
exit 1
fi

# detect rootfs
config="$path/config"
rootfs="$path/rootfs"

configure_lfs $rootfs $name $lfsroot
if [ $? -ne 0 ]; then
echo "failed to configure LFS's rootfs"
exit 1
fi

copy_configuration $path $rootfs $name
if [ $? -ne 0 ]; then
echo "failed to write lfs-lxc configuration file"
exit 1
fi

I used the below command to create my container:

sudo lxc-create -t lfs -n lfs-lxc-container --lxcpath=/home/manik/toolchain

I can successfully use the following command:

sudo lxc-attach -n lfs-lxc-container --lxcpath=/home/manik/toolchain

I get root bash prompt which is understandable as the man pages for
lxc-attach says to run the shell of the user if no specific command is
given.

However, lxc-console command hangs. I am triggering the command like:

sudo lxc-console -n lfs-lxc-container --lxcpath=/home/manik/toolchain

Using the above lxc-attach since I get the bash prompt, I executed the
command:

bash-4.3# ps -efa
UIDPID  PPID  C STIME TTY  TIME CMD
root 1 0  0 22:37 ?00:00:00 init boot
root29 0  0 23:27 ?00:00:00 /bin/bash
root3029  0 23:27 ?00:00:00 ps -efa

Looks like getty is not working/running.

Anyone got any idea ? I am 

[lxc-users] How to create my own container rootfs

2016-10-05 Thread manik sheeri
Hi,

We have a gaming application that up until now we were running on Old Suse
distribution with our custom toolchain.
We are planning to migrate to Ubuntu for development
distribution/environment.
Also, we are planning to run our games in lxc container.

I was able to run our games with Ubuntu lxc-template i.e. privileged lxc
container created from lxc-ubuntu template.

Now, I want to build our custom toolchain and create the rootfs from that
custom toolchain and then run that container.

I would like to know how to create this rootfs with my custom toolchain.

The idea is to enable our gaming studios to download our toolchain
container and run games inside it.

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

Re: [lxc-users] slow game graphics in lxc container

2016-09-23 Thread manik sheeri
I got it fixed. First, we have to make sure that the user inside lxc container
belongs to the group video. To do this, do the following: ( assuming user
is named ubuntu )

sudo usermod -a -G video ubuntu

Then, add the following in the container config file i.e.
/var/lib/lxc/mk7i_container/config. My container name is mk7i_container.

#Video DRI
lxc.cgroup.devices.allow = c 226:* rwm

##/dev/dri mounts
lxc.mount.entry = /dev/dri dev/dri none bind,optional,create=dir

Now, restart the container. And the graphics should work fine.


>
> -- Forwarded message --
> From: manik sheeri <sheeri185adi...@gmail.com>
> To: lxc-users@lists.linuxcontainers.org
> Cc:
> Date: Thu, 22 Sep 2016 14:53:59 -0700
> Subject: [lxc-users] slow game graphics in lxc container
> I have a privileged `lxc` container running on Ubuntu 16.0.4 LTS.
>
> I have noticed that the graphics of our game are very sluggish in
> container compared to when running on host directly.
>
> Could anyone point a reference as to what could be the cause ?
>
> So I ran `glxgears` application inside the container. Though the
> application ran fine but I saw the following info + errors on console:
>
> libGL error: failed to open drm device: Permission denied
> libGL error: failed to load driver: nouveau
> 4057 frames in 5.0 seconds = 811.356 FPS
> 4238 frames in 5.0 seconds = 847.557 FPS
> 4251 frames in 5.0 seconds = 850.081 FPS
> 4254 frames in 5.0 seconds = 850.743 FPS
> 4253 frames in 5.0 seconds = 850.431 FPS
> 4255 frames in 5.0 seconds = 850.949 FPS
> 4253 frames in 5.0 seconds = 850.450 FPS
> 4254 frames in 5.0 seconds = 850.733 FPS
> 4250 frames in 5.0 seconds = 849.960 FPS
> 4247 frames in 5.0 seconds = 849.254 FPS
> 4246 frames in 5.0 seconds = 849.129 FPS
>
>
> ___
> 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

[lxc-users] slow game graphics in lxc container

2016-09-22 Thread manik sheeri
I have a privileged `lxc` container running on Ubuntu 16.0.4 LTS.

I have noticed that the graphics of our game are very sluggish in container
compared to when running on host directly.

Could anyone point a reference as to what could be the cause ?

So I ran `glxgears` application inside the container. Though the
application ran fine but I saw the following info + errors on console:

libGL error: failed to open drm device: Permission denied
libGL error: failed to load driver: nouveau
4057 frames in 5.0 seconds = 811.356 FPS
4238 frames in 5.0 seconds = 847.557 FPS
4251 frames in 5.0 seconds = 850.081 FPS
4254 frames in 5.0 seconds = 850.743 FPS
4253 frames in 5.0 seconds = 850.431 FPS
4255 frames in 5.0 seconds = 850.949 FPS
4253 frames in 5.0 seconds = 850.450 FPS
4254 frames in 5.0 seconds = 850.733 FPS
4250 frames in 5.0 seconds = 849.960 FPS
4247 frames in 5.0 seconds = 849.254 FPS
4246 frames in 5.0 seconds = 849.129 FPS
___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

[lxc-users] can't run “glxgears” in root on lxc 2.0 container

2016-09-21 Thread manik sheeri
Hi,

Pardon me if the syntax of the email is incorrect. I am a newbie here.
Hope to learn from you experts.

I am facing some issues running glxgears app in root mode on lxc2.0
privileged container.

I am running lxc2.0 container(privileged) on Ubuntu 16.0.4LTS 32-bit.

Inside the container I installed `mesa-utils` that has the `glxgears` app.

my container config file `/var/lib/lxc/mk7i_container/config` is:

 Template used to create this container:
/usr/share/lxc/templates/lxc-download
# Parameters passed to the template: --no-validate
# For additional config options, please look at lxc.container.conf(5)

# Uncomment the following line to support nesting containers:
#lxc.include = /usr/share/lxc/config/nesting.conf
# (Be aware this has security implications)


# Distribution configuration
lxc.include = /usr/share/lxc/config/ubuntu.common.conf
lxc.arch = x86

lxc.cgroup.devices.allow = c 1:1 rwm

lxc.cgroup.devices.allow = c 130:* rwm
lxc.cgroup.devices.allow = c 124:* rwm
lxc.cgroup.devices.allow = c 122:* rwm
lxc.cgroup.devices.allow = c 123:* rwm
lxc.cgroup.devices.allow = c 126:* rwm
lxc.cgroup.devices.allow = c 127:0 rwm
lxc.cgroup.devices.allow = c 120:0 rwm

# Container specific configuration
lxc.rootfs = /var/lib/lxc/mk7i_container/rootfs
lxc.rootfs.backend = dir
lxc.utsname = mk7i_container

# Network configuration
lxc.network.type = veth
lxc.network.link = lxcbr0
lxc.network.flags = up
lxc.network.hwaddr = 00:16:3e:c8:fd:1e

#mounts for XServer DISPLAY
lxc.mount.entry = /dev/dri dev/dri 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


To log in into the container as user 'Ubuntu', I am using the following
command:

sudo lxc-console -n mk7i_container

After login, I set the `DISPLAY` env variable as:

export DISPLAY=":0.0"

And run `glxgears` and it runs fine. I can see the Xwindow with gears
moving in it.

However, after that I enter root mode via `sudo su` command.
And try to run glxgears, but I get the following error:

No protocol specified
Error: couldn't open display :0.0

Not sure why this error is coming. If user `ubuntu` runs x apps fine , I
expected root to do the same.

Anyone know what's wrong here ?


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

[lxc-users] not able to read-write to eeprom inside lxc container

2016-09-20 Thread manik sheeri
Hi,

I am using lxc container. and I have an eeprom on my hardware board
connected via i2c adaptor.
my gaming application uses this eeprom to store some settings.

In my sysfs, the eeprom nodes are:

/sys/devices/platform/ocores-i2c.0/i2c-23/23-0054/eeprom
/sys/devices/platform/ocores-i2c.0/i2c-23/23-0056/eeprom

Since the sysfs is dynamic, so I created a sym link to these eeproms at :

/dev/kmcwire/eeprom0 ->
/sys/devices/platform/ocores-i2c.0/i2c-23/23-0054/eeprom
/dev/kmcwire/eeprom1 ->
/sys/devices/platform/ocores-i2c.0/i2c-23/23-0056/eeprom

now, in my host I used to read/write to nodes "/dev/kmcwire/eeprom*"

Inside the container, I am not able to do that. I get 'Permission Denied'
error.

In my config file, I made some changes:

*/usr/share/lxc/config/common.conf*
I changed "lxc.mount.auto = cgroup:mixed proc:mixed sys:mixed" to
"lxc.mount.auto = cgroup:mixed proc:mixed *sys:rw*" to mount sysfs in
read-write mode.

*/var/lib/lxc/my_container/config*
I added the line "lxc.mount.entry = /dev/kmcwire dev/kmcwire none
bind,optional,create=dir"

Can anyone help me point out the issue here ?
___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users