lima icon indicating copy to clipboard operation
lima copied to clipboard

lima+X11

Open satmandu opened this issue 4 years ago • 12 comments

Is it possible short of the vsock work being completed to easily tunnel X11 connections over ssh from the lima VM to Xquartz?

Obviously connected to https://github.com/lima-vm/lima/issues/2

satmandu avatar Aug 07 '21 04:08 satmandu

qemu still doesn't support vsock for macOS hosts, so the current solution is to run ssh -X localhost:PORT.

AkihiroSuda avatar Aug 07 '21 04:08 AkihiroSuda

hmmm.

 limactl list
NAME       STATUS     SSH                ARCH      DIR
default    Running    127.0.0.1:60022    x86_64    /Users...

ssh -X localhost:60022
ssh: Could not resolve hostname localhost:60022: nodename nor servname provided, or not known

ssh -X localhost:60022
ssh: Could not resolve hostname localhost:60022: nodename nor servname provided, or not known

Do I need to enable a separate address which can be connected to via ssh?

Would it make sense to have a flag/option such that limactl start automatically starts a background connection with ssh -X localhost:PORT so that running things via, for instance, lima xterm just works?

satmandu avatar Aug 07 '21 04:08 satmandu

Sorry I meant ssh -X -p 60022 localhost

AkihiroSuda avatar Aug 07 '21 04:08 AkihiroSuda

Ah yes this is described on the front page... ssh -X -p 60022 -i ~/.lima/_config/user -o NoHostAuthenticationForLocalhost=yes 127.0.0.1 worked for me.

satmandu avatar Aug 07 '21 04:08 satmandu

Screen Shot 2021-08-07 at 12 35 35 AM

``NO_AT_BRIDGE=1 LC_ALL="en_US.UTF-8" dbus-launch gnome-terminal``` let me get gnome-terminal working from inside lima!

satmandu avatar Aug 07 '21 04:08 satmandu

In case anyone failed to make libreoffice work on Fedora, please try:

dnf install dbus-x11

and it may solve your problem.

VitoVan avatar Nov 02 '21 12:11 VitoVan

@VitoVan does that mean , I will be able to open LibreOffice in a window with proper GUI? If that so, could you pls list out the steps to follow, I am pretty new to this. Thank you.

gautam-dev-maker avatar Jan 24 '22 07:01 gautam-dev-maker

@VitoVan does that mean , I will be able to open LibreOffice in a window with proper GUI? If that so, could you pls list out the steps to follow, I am pretty new to this. Thank you.

It's X11 Forwarding like any other regular Linux.

If you are using Fedora with Lima, then you can:

sudo dnf install libreoffice
sudo dnf install dbus-x11

and on your macOS, open your Terminal and:

ssh -X -p 60022 -o NoHostAuthenticationForLocalhost=yes -i ~/.lima/_config/user localhost libreoffice

Make sure you got XQuartz installed on your macOS.

I don't know what you mean by proper GUI, but it is X11 in macOS (XQuatz) and it's usable albeit not so native.

VitoVan avatar Jan 24 '22 09:01 VitoVan

@VitoVan does that mean , I will be able to open LibreOffice in a window with proper GUI? If that so, could you pls list out the steps to follow, I am pretty new to this. Thank you.

It's X11 Forwarding like any other regular Linux.

If you are using Fedora with Lima, then you can:

sudo dnf install libreoffice
sudo dnf install dbus-x11

and on your macOS, open your Terminal and:

ssh -X -p 60022 -o NoHostAuthenticationForLocalhost=yes -i ~/.lima/_config/user localhost libreoffice

Make sure you got XQuartz installed on your macOS.

I don't know what you mean by proper GUI, but it is X11 in macOS (XQuatz) and it's usable albeit not so native.

I want to open the Gedit text editor with proper window and UI which doesn't seem to happen when I run gedit command in terminal, instead I get this error

Unable to init server: Could not connect: Connection refused

(gedit:3625): Gtk-WARNING **: 16:55:17.647: cannot open display:

btw I am using Ubuntu

gautam-dev-maker avatar Jan 24 '22 16:01 gautam-dev-maker

@gautam-dev-maker I tried Lima Ubuntu on macOS, and it worked:

image

Check the screenshot to see if it helps.

VitoVan avatar Jan 26 '22 11:01 VitoVan

Thanks for the detailed steps @VitoVan, It works fine now. xQuartz is really good.

gautam-dev-maker avatar Jan 26 '22 19:01 gautam-dev-maker

It is very slow for me, like a few seconds to update when a tab changes. Any thoughts ?

CaelumF avatar Feb 16 '22 15:02 CaelumF

I was recently having trouble getting Fedora to forward any X11 app through xQuartz, (it would always throw X11 forwarding request failed when running limactl shell fedora), but the following commands fixed the issue, hopes this helps others!

limactl shell fedora
sudo dnf install xauth -y
touch ~/.Xauthority
exit

# Open XQuartz
limactl shell fedora

# Install and run whatever X11 app you'd like! For example, xeyes:
sudo dnf install xeyes -y
xeyes

MicahBird avatar Jul 26 '23 21:07 MicahBird