-
Notifications
You must be signed in to change notification settings - Fork 635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lima's X11 forwarding breaks after a MacBook goes to sleep #2099
Comments
We need a way to restore the SSH connections after sleep, both for the host but also for the guest: |
Idle thought: This might be overkill, but perhaps Lima could allow connecting to the guest via https://www.wireguard.com/install/ if Wireguard is installed on the host. I'm more familiar with the simpler but non-free Tailscale, so I don't know just how tricky this would be; it would likely have other applications as well. https://github.com/linuxserver/docker-wireguard could be useful to look at as an example. |
Was this intended to be posted in another place? |
I was thinking that if the This is based on my experience with Tailscale (which is commercial but freemium). Installing tailscale in the VM and using it for ssh should be smoother workaround for the problem, but I haven't double-checked yet. |
I have been having the exact same problem for months. Is there any update? |
same issue here. it looks like the SSH sever in vm died after host wakeup sometime. restarting works for me but quite annoying. when stop the vm, it complains there's no
|
It actually seems to me that this is an X11-specific issue, and not an issue with the SSH connection itself, at least for me. If I use Am I misunderstanding something? |
Another interesting option for working around this is https://github.com/Xpra-org/xpra or the (seemingly less mature) https://github.com/wayland-transpositor/wprs. I'll leave another comment if I actually test them. Update: No luck so far, Xpra crashes on startup on Mac OS Sonoma (Apple Silicon), Xpra-org/xpra#4017 (comment). Seems to be some sort of GTK issue. WPRS doesn't seem to support Mac OS at all. |
Historically there was NX for this type of set up, not sure if anyone uses it since it stopped being Open Source |
NX doesn't seem to have any binaries for Apple Silicon, the best I can find is https://downloads.nomachine.com/download/?id=7. That might work via Rosetta, but it makes me suspicious that they haven't updated their site since Apple Silicon appeared in the world. They DO ship binaries for ARM Linux, so maybe the part inside Lima would work. Since they are close-source, other people cannot try to compile better binaries. To me, NX sounds very similar to VNC or RPD (https://github.com/neutrinolabs/xrdp). Both seem to have good Mac OS clients and open-source Linux clients. They have a couple of disadvantages: unlike X11 forwarding with XQuartz and unlike Xpra, they show an entire Linux desktop in one window, and every remote app lives in that one window. Also, I found both hard to configure inside Lima (though I'm sure it's possible with enough effort). |
Since recently, I had to install |
I also think that the original issue I complained of forwarding breaking on sleep has become much less prevalent lately. I am not sure whether this is the case just for QEMU or for both QEMU and Apple Virtualization, but I think at least the latter doesn't have this issue. I haven't tested it enough to be sure. (I ended up not using graphical apps much inside lima so far. I mainly wanted it for Meld, which used to be quite difficult to install on a Mac, but then I found some ways of running Meld on a Mac that were easier than dealing with this issue. These days, I'd recommend https://formulae.brew.sh/cask/dehesselle-meld, though https://formulae.brew.sh/cask/dehesselle-meld#default is still an option). |
Summary
I'm trying to get Lima to work with XQuartz to run graphical applications. It mostly just works, except when my MacBook goes to sleep and wakes up again. After that, applications inside Lima can no longer seem to connect to X11 with messages like:
Cc: #151, #877
My setup
I'm using Sonoma 14.2.1 on an M2 Apple silicon MacBook Pro. I installed XQuartz from its website, it reports
XQuartz 2.8.5 (xorg-server 21.1.6)
. I'm running a Debian container. I added the following lines tolimactl edit
config file:I also ran
sudo apt install xterm
in the container.Here is some more sysinfo:
This is a QEMU VM.
VM config (`lima.yaml`)
However, I also checked that this affects a VZ VM based on the "default" template in exactly the same way.
The problem
If I have XQuartz running,
limactl shell debian xterm
works fine at first. However, if I close the lid of the computer and reopen it an hour later, it no longer works. The error message is what I quoted before:xterm: Xt error: Can't open display: localhost:12.0
.Interestingly, the
xterm
I ran before closing the lid still runs and responds to new input after the lid is reopened. However, I cannot start new graphical applications from it either.Workaround
Restarting the VM fixes the problem. I haven't yet found a better workaround, please let me know if you know one!
The text was updated successfully, but these errors were encountered: