-2

On Ubuntu 18.04.5 LTS (GNU/Linux 4.15.0-122-generic x86_64):

$ apt install x11-apps
$ xvfb-run -e x11.log --listen-tcp --server-num=76 --server-arg="-screen 0 1920x1080x24" --auth-file=/tmp/Xauthority nohup xclock > app.log 2>&1 < /dev/null &
$ xdpyinfo -display :76
No protocol specified
xdpyinfo:  unable to open display ":76".
Jingguo Yao
  • 7,320
  • 6
  • 50
  • 63

1 Answers1

-1

It turns out that xvfb-run is running normally. The cause is that xdpyinfo needs XAUTHORITY to be set.

$ export XAUTHORITY=/tmp/Xauthority
$ xdpyinfo -display :76
name of display:    :76
version number:    11.0
vendor string:    The X.Org Foundation
vendor release number:    11906000
X.Org version: 1.19.6
maximum request size:  16777212 bytes
motion buffer size:  256
bitmap unit, bit order, padding:    32, LSBFirst, 32
image byte order:    LSBFirst
number of supported pixmap formats:    6
...

If auth-file option is omitted, an X authority file would be created.

$ xvfb-run -e x11.log --listen-tcp --server-num=76 --server-arg="-screen 0 1920x1080x24" nohup xclock > app.log 2>&1 < /dev/null &
$ ps aux | grep xv
root      9942  0.0  0.0   4636  1748 pts/4    S    12:02   0:00 /bin/sh /usr/bin/xvfb-run -e x11.log --listen-tcp --server-num=76 --server-arg=-screen 0 1920x1080x24 nohup xclock
root      9953  0.0  0.1 2575492 46548 pts/4   Sl   12:02   0:00 Xvfb :76 -screen 0 1920x1080x24 -auth /tmp/xvfb-run.3fxij9/Xauthority
$ export XAUTHORITY=/tmp/xvfb-run.3fxij9/Xauthority
$ xdpyinfo -display :76
name of display:    :76
version number:    11.0
vendor string:    The X.Org Foundation
vendor release number:    11906000
X.Org version: 1.19.6
maximum request size:  16777212 bytes
motion buffer size:  256
bitmap unit, bit order, padding:    32, LSBFirst, 32
image byte order:    LSBFirst
number of supported pixmap formats:    6
...
Jingguo Yao
  • 7,320
  • 6
  • 50
  • 63