[systemd-devel] Calculating Web page loads accurately with systemd-nspawn's network-veth & Xorg

Lennart Poettering lennart at poettering.net
Tue Aug 25 01:37:22 PDT 2015


On Tue, 25.08.15 10:09, Kai Hendry (hendry at webconverger.com) wrote:

> On Mon, 24 Aug 2015, at 08:05 PM, Lennart Poettering wrote:
> > I'd be careful with things like this... You invoke firefox as PID 1
> > then. On UNIX PID 1 is special, it needs to reap foreign children and
> > needs to handle signals differently, thus taking arbitrary processes
> > and running them like this is problematic.
> 
> Then the typical usage from the systemd-nspawn man page:
> 
> systemd-nspawn [OPTIONS...] [COMMAND
> 
> Is a bit flawed, no?
> 
> Not sure what you are suggesting I should do instead. Run as -b and boot
> into systemd first? That is annoying since then I need to login, setup
> DISPLAY env again (not sure why) and then manually run firefox. Wish it
> was one step! :)
> 
> http://s.natalian.org/2015-08-25/1440468175_856x1036.png

Well, the focus for nspawn is clearly on virtualizing full OS
userspaces, including an init system. I'd probably use "-b" and then
use "systemd-run -M ... --setenv=DISPLAY=..." to connect to it.

In systemd git you could even use "machinectl shell --setenv=... ...".

> That said running with -n doesn't seem to work without -b since
> systemd-networkd needs to setup the container's networking, no ?

Yeah, with "-n" it's the ob of the code in the container to do network
setup. That can be done with networkd, but any other networking logic
should be fine too, including a script that just invokes "ip"...

> 
> sudo systemd-nspawn --setenv=DISPLAY=:0 \
>                --setenv=XAUTHORITY=~/.Xauthority \
>                --bind-ro=$HOME/.Xauthority:/root/.Xauthority \
>                --bind=/tmp/.X11-unix \
>                -D ~/containers/firefox \
>                -n  firefox # doesn't work since systemd-networkd isn't
>                being run IIUC
> 


Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list