I am using Ubuntu Mate:

$ echo $DESKTOP_SESSION; cat /etc/issue; uname -a;
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

$ 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

$ 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 )

  • 1
    The firejail utility handles a lot of things under the hood, and might deal itself with proxying dbus communication (not tested). packages.debian.org/stable/all/firejail-profiles/filelist
    – A.B
    Mar 18, 2022 at 8:03
  • Thanks @A.B. - just looked at firejail; looks easy enough at first, but typically I start a network namespace session, then I mount some directories there (which is not visible from the host, which I like - but that also demands that I run loffice from within the network namespace), then I work with those directories. Unfortunately, if I start a bash/gnome-terminal session from firejail, I cannot use sudo, so I cannot mount inside the network namespace session.
    – sdaau
    Mar 18, 2022 at 8:22
  • Possibly related: unix.stackexchange.com/questions/391193/…
    – sdaau
    Mar 18, 2022 at 8:34


You must log in to answer this question.

Browse other questions tagged .