I am using Ubuntu Mate:
$ echo $DESKTOP_SESSION; cat /etc/issue; uname -a;
mate
Ubuntu 20.04.4 LTS \n \l
Linux mypc 5.4.0-104-generic #118-Ubuntu SMP Wed Mar 2 19:02:41 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
After learning that, for instance, gnome-terminal cannot be trivially started from a network namespace due to D-Bus from ip netns exec cannot start ONLY mate-terminal and gnome-terminal? , I tried opening Libreoffice in a namespace terminal/bash session.
Unfortunately, when I try to run
$ loffice
... from the namespace bash session, there are no error messages in terminal, and no window starts.
So, I saw Connect with D-Bus in a network namespace and I installed netns-exec - in hope that it would help me run loffice from inside a ip namespace bash session.
First, a test; I have my "namespace" session (called MYNS) running in a terminal.
With netns-exec-dbus and xeyes - from both a host shell/session, or a network namespace shell/session, this command:
$ netns-exec-dbus MYNS /usr/bin/xeyes
... starts a window, works seemingly fine.
Then, with netns-exec-dbus and gnome-terminal: on a "host" terminal, I try the following:
$ netns-exec-dbus MYNS /usr/bin/gnome-terminal
# Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-aAUQfMZ7a0: Connection refused
This actually does start a gnome-terminal window, but bash inside that gnome-terminal shows ipconfig of the host, not the namespace (so that bash does not run in the namespace, as intended).
If I try to call the same command from the namespace, I get:
$ netns-exec-dbus MYNS /usr/bin/gnome-terminal
# Unable to connect to dbus: Could not connect: Connection refused
# Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-aAUQfMZ7a0: Connection refused
# Error constructing proxy for org.gnome.Terminal:/org/gnome/Terminal/Factory0:Could not connect: Connection refused
... and there is no window started whasoever.
Now, let me try the same with LibreOffice - this command from host terminal/bash session:
$ echo $DISPLAY
:0
$ netns-exec-dbus MYNS /usr/bin/loffice
/usr/lib/libreoffice/program/soffice.bin X11 error: Can't open display: :0
Set DISPLAY environment variable, use -display option
or check permissions of your X-Server
(See "man X" resp. "man xhost" for details)
... unfortunately does not start a window.
The same command from a network namespace bash session:
$ echo $DISPLAY
:0
$ netns-exec-dbus MYNS /usr/bin/loffice
... basically locks; loffice indeed started, since even the host terminal reports:
$ pgrep -fl loffice
7757 netns-exec-dbus
7760 loffice
... however, there are no (error) messages anywhere, and no window.
In other words, loffice seemingly is even trickier to get running (so it shows a window, and can actually be used) from a network namespace, than DBus GUI applications like gnome-terminal are.
So, how can I get loffice to start - like, with a window, so it can be used (not just as an entry in process list) - from (or into) a network namespace shell session?
(also seemingly related: Access display from network namespace )