Open afbjorklund opened 2 years ago
Unfortunately none of the mentioned x11docker methods work with nerdctl backend.
Then again, it did say that it was experimental (it tries to use both --rm
and -d
)
Container backends:
By default x11docker tries to run docker. To change the default --backend=docker to another one like --backend=podman, create a default file for --preset. Recommended for rootful container backend: docker or podman Recommended for rootless container backend: podman Only podman allows option --home in rootless mode yet. Only podman provides useful file ownerships with option --share in rootless mode yet. --backend=nerdctl is experimental yet. It supports rootful and rootless mode. nerdctl is in heavy development stage.
Guess it is back to running as root and privileged and mounting sockets and stuff.
In addition to the QEMU displays (gtk/sdl/cocoa), it is also possible to use a VNC display (#1003)
It can be even be accessed in a browser using noVNC, if there is no local X11 server or VNC client.
An app I'm running uses GLFW (an openGL library) and crashes with error
Glfw Error 65543: GLX: Failed to create context: BadValue (integer parameter out of range for operation)
This seems to be a graphics driver issue, with the typical solution involving updating drivers. How should I approach this from within lima? I am running on a macbook air M2 chip. I'm able to open basic windows using xquartz from lima
I'd like to share my experience of trying to get this to work. Perhaps this will be helpful to writing documentation.
I tried getting Lima to work with X11 forwarding. It took me embarrassingly long to realize that I need to run limactl edit
and add the following to the YAML:
ssh:
forwardX11: true
This was very effective, I can now run lima xterm
and it works.
Unfortunately, I ran into they annoying issue https://github.com/lima-vm/lima/issues/2099, but it's not a complete showstopper. However, it's enough of a problem that I'm not sure this capability of Lima is ready to be advertised to the world.
(Before finding the YAML file, I tried various versions of ssh -X -F /Users/ilyagr/.lima/default/ssh.config lima-default
which did not work at all. At first I thought this can be solved by the likes of xhost +
, but I now think ssh did not even try to establish forwarding for some reason. I'm not sure why.)
I also tried to set up VNC by adding
video:
display: vnc
to my config. This was not successful; I can connect to the machine and open the display, but the display simply says "Display output is not active" on a black screen.
This is on a QEMU VM, IIUC there is no chance of this working on a VZ VM.
I tried sudo apt install gnome
and restarting the VM; it didn't help. I am not too familiar with this aspect of Linux system administration, so I gave up.
I also briefly tried to use xrdp
with Microsoft Remote Desktop client for Mac OS. I couldn't immediately figure out how to configure xrdp
so that I can log in to the correct user account that Lima sets up to not have a password. In other words, I got to its login screen and no further. I may try this again.
Thank you for making Lima! :)
Adding my experience here. I prefer to run GUI apps in Lima via X11 forwarding, as described by @ilyagr ("Attempt 1") in the previous comment.
However, in my case (running Ubuntu in Lima), apps like Chromium and Firefox weren't running, and failing with errors like:
Missing X server or $DISPLAY
or
X11 connection rejected because of wrong authentication.
Error: cannot open display: localhost:10.0
Which is weird, because setting up an X11 connection and $DISPLAY env var is exactly what forwardX11: true
in lima.yaml
is supposed to do.
After some troubleshooting, it turns out this issue occurs because Ubuntu now distributes Chromium and Firefox as Snap packages. The issue and fix are described in this StackExchange post:
The workaround is to simply do:
export XAUTHORITY=$HOME/.Xauthority
before running the remote X11 application.
This fixed the problem for me, and I've added that line to a .profile
file in my home dir so that I don't need to set the XAUTHORITY
var by hand every time.
Hopefully this provides enough information to help others with similar problems running Snap-packaged apps in Lima!
Description
Currently lima has information on how to run a command-line application.
Either using the
nerdctl.lima
wrapper, or starting it from thelima
shell.But there is no example on how to run a GUI app, for instance over X11 ?
This can be done both in the QEMU display, or remotely over SSH shell.
1) Typical local qemu DISPLAY:
:0
(fromstartx
)2) Typical remote host DISPLAY:
localhost:10.0
(fromssh -X
)Both approaches require some setup of the VM, and some added docs.
See discussion:
Boot2Docker X11:
Preferrably, this should link to more generic documentation for containers.
For instance, accessing the applications with
x11docker --backend=nerdctl
.The VM doesn't have so many "secrets" to leak, but the host X11 (alt 2) might
There is lots of detailed info available at: https://github.com/mviereck/x11docker
This command (x11docker) provides improved security, over the more naive approach:
https://github.com/mviereck/x11docker/wiki/Short-setups-to-provide-X-display-to-container