Xfce desktop-less XFCE - keyboard issue

I need to have a setup, where when the computer starts, it goes into X server and opens an session with two VirtualBox VMs running. I want to avoid the user starting anything else. Eventually, I hacked a crude rc.d script to start X at boot that does this:

Code:
exec su -l user -c startx

The user's .xinitrc looks like this

Code:
#!/bin/sh

while true; do
VirtualBoxVM --startvm "FreeBSD Internet"
sleep 10
done &

while true;do
VirtualBoxVM --startvm "FreeBSD Internal"
sleep 10
done &

/usr/local/bin/xfce4-panel --sm-client-disable &
exec /usr/local/bin/xfwm4 ---sm-client-disable


Now, it all works "fine", until we get to the keyboard in the virtual machines. The VM host key (right-ctrl) does not work and in the VMs the keyboard gets some rather weird mapping, with the center up arrow being Print, for example.

The strange thing is that it all works properly, if I
- use xdm and login as that user (with the same content of .xsession)
- run an xfce4-terminal from .xinitrc and start the VMs from there
- have an full xfce desktop (but can't figure out how to remove the menus and lock it properly)
- and most weird of all.. if I quit the VMs, which makes them start again .. and this time everything works as it should.

There is probably some timing issue here, but I can't quite figure out what it is and how to address it.
Hardware is some Lenovo ThinkCentre PC, running FreeBSD 13.1-STABLE and it loads i915kms via drm-kmod. Had to recompile the drm-kmod pieces for the STABLE kernel as otherwise it would crash upon loading the module.

It appears I am missing something fairly obvious...
 
Alain De Vos the script is putting the while true loops into the background, so the script continues.

I'm guessing that when the VMs start they don't have the keymapping from X since that may come the window manager. Your statement about stopping the VMs, they restart and it works is evidence towards this.

danbi you say it works fine if you use xdm and login as that user. Why not set it to autologin that user? That way everything should be set up.

I would also create a couple of scripts that have your loops to start the VMs and then set them as "autostarts" in xfce.
That would make your .xsession/.xinitrc file to be just the exec command of xfce.
 
The keyboard mapping initialisation might come from some other X client, because xdm does not have anything to do with xfce and yet any session that starts from it works properly. I have experimented to run the same commands in the .xinitrc that are in the various xdm scripts, without any result. It might be the xdm login application itself that does the magic.. or just the waiting.. This is what I am trying to figure out. Unfortunately, xdm cannot auto login, as far as I am aware.

Unless I can properly lock the xfce desktop, which is one way to solve this, I do not want to run any more of it except the window manager and the panel. I could end up using different window manager and panel, just had those handy. But again, the keyboard mapping is a X thing. I could load "proper" keymap but in this age FreeBSD (and X) try to do much of this stuff "automagically" via evdev so I try to stay in their way as much as possible.
 
I am pretty confident pam has some kind of autologin feature.
Then in the appropriate login/profile for you shell
Code:
[ -x /usr/local/bin/startx ] && exec startx
Maybe use setxkbmap to fix the keyboard issue?

I agree with mer. You should have a scipt to launch the vms, also test for pids in your infinite loop before launching the vms.
 
Back
Top