Graphical session inside systemd-nspawn container
Hello, I am trying to run X from within a systemd-nspawn container - this is something I had set up and was running successfully about three years ago, but something seems to have changed in the meantime and I am not able to recreate this. I created the container and installed X related packages following the wiki article, and was able to boot into my container and create an unprivileged user. The script I am using to boot is (modified from my container of three years ago): xhost +local: sudo systemd-nspawn -b -D /mnt/extra/nspawn-containers/test \ --bind-ro=/tmp/.X11-unix \ --bind=/dev/dri \ --bind=/dev/shm \ --bind=/dev/nvidia0 \ --bind=/dev/nvidiactl \ --bind=/dev/nvidia-modeset \ --setenv=DISPLAY=:0.0 \ xhost - When I try to `startx` from within the container, however, I get this: /usr/lib/Xorg.wrap: Only console users are allowed to run the X server xinit: giving up xinit: unable to connect to X server: Connection refused xinit: server error Couldn't get a file descriptor referring to the console. I am not entirely sure where to go from here. Is there something incomplete in my configuration? Looking up the Xorg.wrap error message, I only find that X will not run on pseudo terminals, but I do not know what to do about this or if this is even the problem. Best regards, e
On Mon, 2024-04-08 at 19:53 +0100, FirstName LastName wrote:
/usr/lib/Xorg.wrap: Only console users are allowed to run the X server
This isn't about systemd-nspawn, but it might help anyway: https://github.com/mviereck/x11docker/issues/391 This is interesting for me, as I have only ever used systemd-nspawn without a graphical session. I'll follow this thread.
On Tue, 9 Apr 2024 at 02:10, Ralf Mardorf <ralf-mardorf@riseup.net> wrote:
This isn't about systemd-nspawn, but it might help anyway: https://github.com/mviereck/x11docker/issues/391
Thank you for the link to that issue, but I tried solutions 2-4 and none of them help (running X as root seems to be a headache not worth getting into right now, and while I didn't have an Xwrapper.config file, creating it with those lines didn't change anything). I am trying Xephyr out now - the wiki says "The downsides are less performance, and the lack of hardware acceleration when using Xephyr", which I'm not particularly happy with so if I can sort out how to share the same X session as the host I would prefer that in the long run.
I am trying to run X from within a systemd-nspawn container - this is something I had set up and was running successfully about three years ago, but something seems to have changed in the meantime and I am not able to recreate this.
I created the container and installed X related packages following the wiki article, and was able to boot into my container and create an unprivileged user. The script I am using to boot is (modified from my container of three years ago):
xhost +local:
Do you want to run a full X server inside the container or just X applications? I'm confused by your use of `xhost +` here. A full server needs to be started on a real console, so that might not be possible at all in a container. But you're passing /tmp/.X11-unix/ and setting DISPLAY, so you might only want to run X apps? In which case you don't need startx. -- damjan
On Tue, 9 Apr 2024 at 20:50, Damjan Georgievski <gdamjan@gmail.com> wrote:
But you're passing /tmp/.X11-unix/ and setting DISPLAY, so you might only want to run X apps? In which case you don't need startx.
-- damjan
Thank you, this was indeed what I was missing. In hindsight, I should have realised this from the wording of the chroot wiki article ("you can start graphical applications from the chroot environment"), but I misread that line entirely.
participants (3)
-
Damjan Georgievski
-
FirstName LastName
-
Ralf Mardorf