# Start xfce inside Xvfb in headless jail and show it via VNC



## kr0m (May 27, 2022)

Hello, i am trying to get Xorg working wiht xfce in a headless jail, the idea is to connect to a VNC server for displaying xfce.
I have installed the following software: `pkg install xorg xorg-vfbserver xfce x11vnc`
Enabled dbus, im not sure if it is mandatory:

```
sysrc dbus_enable="YES"
service dbus start
```

With my regular user I generate a VNC password:

```
su axon -l
x11vnc -storepasswd
```
I write a xinitrc file:

```
vi .xinitrc
export LANG=es_ES.UTF-8
export LC_ALL=es_ES.UTF-8


setxkbmap es
exec ck-launch-session dbus-launch --sh-syntax --exit-with-session startxfce4
```
Then I start Xvfb server in a console:

```
Xvfb :0
```
And in another console try to start xfce:

```
startx
```
But it seems to crash:

```
xauth:  file /home/axon/.serverauth.82409 does not exist

/usr/local/bin/X: Only console users are allowed to run the X server
xinit: giving up
xinit: unable to connect to X server: Bad file descriptor
xinit: server error
```
The next step would be start the VNC server when startx problem is solved:
`x11vnc -usepw -display :0`

But if xfce is not able to start, i cant continue, what could be wrong with my configuration?
I think that the steps are correct:

- Start fake xorg server
- Start WM inside fake xorg
- Start VNC server to show WM of the fake xorg

Is it correct?


----------



## kr0m (May 27, 2022)

I have progressed some, i installed slim and starting xvfb,  slim service and VNC i can connect to Slim output;

```
pkg install slim
sysrc slim_enable="YES"
service slim start
```


```
Xvfb :0
x11vnc -usepw -display :0
```


----------



## kr0m (May 27, 2022)

But when i login i get:


> slim: get_x11_device: cannot get XFree86_VT


I have checked:


> ls -la /usr/local/share/xsessions/
> total 18
> drwxr-xr-x   2 root  wheel     3 May 27 10:46 .
> drwxr-xr-x  83 root  wheel    83 May 27 13:37 ..
> -rw-r--r--   1 root  wheel  6832 Apr 26 12:27 xfce.desktop



Which seems ok to me.


----------



## kr0m (May 27, 2022)

I have checked slim configuration:


> grep login_cmd /usr/local/etc/slim.conf|grep -v '#'
> login_cmd           exec /bin/sh - ~/.xinitrc %session


It seems it executes my .xinitrc file and %session:


> grep Exec /usr/local/share/xsessions/xfce.desktop
> Exec=startxfce4


Only to be sure that .xinitrc is executed i modify it in that way:


> cat .xinitrc
> date > /tmp/debug


Then i start xvfb in one console:


> Xvfb :0



Start Slim in another console:


> service slim start



Start VNC in another console:


> x11vnc -usepw -display :0



I login vía VNC that shows Slim login, but debug file is not created:


> ls -la /tmp/debug
> ls: /tmp/debug: No such file or directory


It seems that .xinitrc file is not executed after all.
Any idea?


----------



## kr0m (May 27, 2022)

I have tried modifying slim command:


> login_cmd           exec /usr/bin/id > /tmp/debug2


But without success, i think login_cmd is never executed


----------

