Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

LXC - X pass-through

374 views
Skip to first unread message

Peter Chant

unread,
Jan 2, 2017, 4:57:47 AM1/2/17
to
I'm trying to get X to pass through from an lxc container. Slack 14.2
host and container. Has anyone had any luck?

In my container config I've added:
#Pete, fox X
#lxc.cgroup.devices.allow = c 226:0 rwm
#lxc.cgroup.devices.allow = c 226:64 rwm
#lxc.cgroup.devices.allow = c 226:128 rwm
#lxc.cgroup.devices.allow = c 29:0 rwm
lxc.mount.entry = tmpfs tmp tmpfs defaults
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.mount.entry = /dev/tty0 dev/tty0 none bind,optional,create=file
#lxc.mount.entry = /dev/tty10 dev/tty10 none bind,optional,create=file

(note the line wrap is not in the config file and the commented out bits
that I've tried but did not help)

root@slackx:/etc/rc.d# X

X.Org X Server 1.18.3
Release Date: 2016-04-04
X Protocol Version 11, Revision 0
Build Operating System: Slackware 14.2 Slackware Linux Project
Current Operating System: Linux slackx 4.8.5 #1 SMP Sun Oct 30 11:30:27
GMT 2016 x86_64
Kernel command line: auto BOOT_IMAGE=Main_14.2 ro root=802
root=/dev/sda2 rootflags=subvol=_r_sl14.2
Build Date: 15 April 2016 11:05:21AM

Current version of pixman: 0.34.0
Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Mon Jan 2 09:51:48 2017
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
(EE)
Fatal server error:
(EE) parse_vt_settings: Cannot open /dev/tty0 (No such file or directory)
(EE)
(EE)
Please consult the The X.Org Foundation support
at http://wiki.x.org
for help.
(EE) Please also check the log file at "/var/log/Xorg.0.log" for
additional information.
(EE)
(EE) Server terminated with error (1). Closing log file.
root@slackx:/etc/rc.d#

There is no more useful information in the log file.

. . . .
Looking in /dev I get this:
root@slackx:/etc/rc.d# ls -al /dev
total 0
drwxr-xr-x 5 root root 480 Jan 2 09:45 ./
drwxr-xr-x 1 root root 150 Jan 2 09:45 ../
c--x--x--x 1 root tty 136, 0 Jan 2 09:45 console
drwxr-xr-x 2 root root 100 Dec 27 15:41 dri/
lrwxrwxrwx 1 root root 13 Jan 2 09:45 fd -> /proc/self/fd/
crw-rw-rw- 1 root root 1, 7 Jan 2 09:45 full
prw------- 1 root root 0 Jan 2 09:45 initctl|
srw-rw-rw- 1 root root 0 Jan 2 09:45 log=
crw-rw-rw- 1 root root 1, 3 Jan 2 09:45 null
lrwxrwxrwx 1 root root 13 Jan 2 09:45 ptmx -> /dev/pts/ptmx
drwxr-xr-x 2 root root 0 Jan 2 09:45 pts/
crw-rw-rw- 1 root root 1, 8 Jan 2 09:45 random
drwxr-xr-x 3 root root 240 Dec 27 15:41 snd/
lrwxrwxrwx 1 root root 15 Jan 2 09:45 stderr -> /proc/self/fd/2
lrwxrwxrwx 1 root root 15 Jan 2 09:45 stdin -> /proc/self/fd/0
lrwxrwxrwx 1 root root 15 Jan 2 09:45 stdout -> /proc/self/fd/1
crw-rw-rw- 1 root root 5, 0 Jan 2 09:45 tty
crw--w---- 1 root tty 136, 0 Jan 2 09:53 tty1
crw--w---- 1 root tty 136, 1 Jan 2 09:45 tty2
crw--w---- 1 root tty 136, 2 Jan 2 09:45 tty3
crw--w---- 1 root tty 136, 3 Jan 2 09:45 tty4
crw-rw-rw- 1 root root 1, 9 Jan 2 09:45 urandom
crw-rw----+ 1 root video 81, 0 Dec 31 20:07 video0
crw-rw-rw- 1 root root 1, 5 Jan 2 09:45 zero


I've tried creating devices with mknod but that fails. I tried creating
/dev/tty0 with the following in the config file:
lxc.mount.entry = /dev/tty0 dev/tty0 none bind,optional,create=file

But that does not work.

Has anyone had any luck doing this?

I have similar messages with both slack and ubuntu as guests.
Motivation is to run X on distros in containers at native speed.


Pete



Aragorn

unread,
Jan 2, 2017, 5:19:42 AM1/2/17
to
On Monday 02 January 2017 10:58, Peter Chant conveyed the following to
alt.os.linux.slackware...

> I'm trying to get X to pass through from an lxc container. Slack 14.2
> host and container. Has anyone had any luck?
>
> [...]
>
> I've tried creating devices with mknod but that fails. I tried
> creating /dev/tty0 with the following in the config file:
> lxc.mount.entry = /dev/tty0 dev/tty0 none bind,optional,create=file
>
> But that does not work.
>
> Has anyone had any luck doing this?
>
> I have similar messages with both slack and ubuntu as guests.
> Motivation is to run X on distros in containers at native speed.

I could of course be wrong, but to the best of my knowledge, it is not
possible to pass through any kind of direct hardware access to a
container ─ neither with LXC, nor with OpenVZ, vServer or any other type
of container technology.

The only thing of which I know that it works ─ sort of, because there
are several caveats ─ is if you use full virtualization instead, by way
of Xen, kvm + qemu, or a similar technology. And in that case ─ this
goes without saying ─ the hardware should have an IOMMU, and it should
be enabled in the BIOS/UEFI.

The above doesn't mean that it wouldn't be possible to run X11 inside a
container, but you would not be able to capture its video output, given
that it doesn't have any actual hardware to send it to. The kernel does
not allow for that, for security and stability reasons.

Another aspect is also that the Linux console ─ read: the console built
into the kernel itself ─ is not multiplexed. This is something I myself
have only recently been looking into, so the information is still fresh
in my memory.

There have been two initiatives at creating a multiplexed Linux console
which would run in userspace ─ one was a standalone project and the
other one was part of systemd ─ but in both cases any further
development was halted about two years ago.

What you /could/ attempt to do ─ albeit that it's not going to be easy ─
is set up a container as an LTSP server for thin clients. That /should/
work, because each thin client will be running its own local X server,
and the X clients ─ read: the desktop environment and/or the
applications ─ would be running on the server (and inside the
container), with their respective video output displayed on the screen
of the thin clients.

--
= Aragorn =

Peter Chant

unread,
Jan 2, 2017, 6:15:38 AM1/2/17
to
On 01/02/2017 10:19 AM, Aragorn wrote:

> I could of course be wrong, but to the best of my knowledge, it is not
> possible to pass through any kind of direct hardware access to a
> container ─ neither with LXC, nor with OpenVZ, vServer or any other type
> of container technology.
>

It seems possible on other distributions, e.g. Arch:
https://wiki.archlinux.org/index.php/Linux_Containers#Xorg_program_considerations_.28optional.29


> The only thing of which I know that it works ─ sort of, because there
> are several caveats ─ is if you use full virtualization instead, by way
> of Xen, kvm + qemu, or a similar technology. And in that case ─ this
> goes without saying ─ the hardware should have an IOMMU, and it should
> be enabled in the BIOS/UEFI.

I've tried virtualbox before and the virtual machines seem sluggish on
my hardware. It not just the usual IT its a bit slow, tough, deal with
it issue, but the mouse pointer and response when clicking is laggy
which makes the whole experience unpleasant.

I've tried x2go with no luck (it seems to have issues). Getting pass
through of my video hardware would be ideal and better than trying to
fix lesser also broken alternatives.

Pete

Vincent Batts

unread,
Feb 2, 2017, 6:03:58 AM2/2/17
to
Peter Chant <pe...@petezilla.co.uk> Wrote in message:
It's been a long time since trying this and I stopped because it
was so rough. Even docker has to be coerced for X.
Have you tried flatpak? I've put a build up on slackbuilds.org
It is a container tool for desktop applications as a limited user,
which sounds like what you're looking for.
--


----Android NewsGroup Reader----
http://usenet.sinaapp.com/

Peter Chant

unread,
Feb 2, 2017, 5:29:07 PM2/2/17
to
On 02/02/2017 11:03 AM, Vincent Batts wrote:

> It's been a long time since trying this and I stopped because it
> was so rough. Even docker has to be coerced for X.
> Have you tried flatpak? I've put a build up on slackbuilds.org
> It is a container tool for desktop applications as a limited user,
> which sounds like what you're looking for.
>

Actually it is not what I was looking for. What I was doing was trying
to try out other distros without dual booting / messing up my main
slackware config / filling the place with extra PCs and monitors.

However, interesting application, worth a look. Tried installing &
running it both as my regular user and root and got the same problem
with several applications:

Can't mount proc on /newroot/proc: Operation not permitted


* * *

root@phoenix:~# flatpak install --from
https://www.daitauha.fr/static/flatpak/picard.flatpakref
Installing: org.musicbrainz.Picard/x86_64/stable
Updating: org.freedesktop.Platform/x86_64/1.4 from gnome
No updates.
Updating: org.freedesktop.Platform.Locale/x86_64/1.4 from gnome
No updates.
Installing: org.musicbrainz.Picard/x86_64/stable from
org.musicbrainz.Picard-origin

1 delta parts, 11 loose fetched; 19675 KiB transferred in 2 seconds


Installing: org.musicbrainz.Picard.Locale/x86_64/stable from
org.musicbrainz.Picard-origin




5 metadata, 1 content objects fetched; 5 KiB transferred in 0 seconds


root@phoenix:~# flatpak run org.musicbrainz.Picard


Can't mount proc on /newroot/proc: Operation not permitted


root@phoenix:~#





0 new messages