Running armstrong-lxde in headless mode

Hi All,

We need to run occasional headless lxde over vnc. I have setup the vnc server. Everything works fine. But by default the lxde desktop runs automatically.

We dont want to run the lxde desktop and X server all the time, Rather it needs to be run on need basis. What I am trying to is :

  1. ssh to virtual console
  2. start X server
  3. start the VNC server
  4. Start lxde session

Step 1,2 and 3 are done. For step 4, if I run “startlxde” then it does not offer me login screen rather it directly runs the lxde session. Can anyone suggest me what should I run to start the log in screen first and then after gui login the lxde session should start.

I have tried so far,
lxsssion
startlxde
x-window-manager
But none of this helped me to achieve my goal.

Hi @xdaco

Could you provide the version of the Hardware (including Carrier Board) and Software of your module?

Best regards,
Jaski

Hi @jaski.tx

I am using som imx7d 1GB emmc v1.1 with our own custom carrier board. The image I am using is Colibri-iMX7-eMMC_LXDE-Image-Tezi_2.8b6 with our own carrier board-specific device tree.

Hi @xdaco

How does your file /etc/lxdm/lxdm.conf look like? Did you remove the line autologin=root?

Instead of running startlxde you can try to run systemctl start lxdm, this should start the login manager (if autologin is not set).

Regards,
Stefan

Hi @stefan_e.tx

Thanks for your reply. I have removed the root autologin from the lxdm.conf
starting lxdm as service gives me a blank screen. The x server is running but no login window. I can still run any GUI program.

When I check systemctl status lxdm , I find no error.

lxdm.service - LXDE Display Manager
Loaded: loaded (/lib/systemd/system/lxdm.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2019-10-17 17:16:27 UTC; 4s ago
 Main PID: 1167 (lxdm-binary)
   CGroup: /system.slice/lxdm.service
   └─1167 /usr/sbin/lxdm-binary

Dear @xdaco

I overlooked this before. Why do you start the x server manually? I would assume if you take our standard BSP2.8 you would have to do the following:

Onetime preparation:

  1. systemctl disable lxdm
  2. Disable autologin

If you ssh to your target you would have to:

systemctl start lxdm
x11vnc # To start the vnc server

Regards,
Stefan

@stefan_e.tx

Thanks for your reply. I am using BSP2.8. I have disabled the lxdm autostart as you said.
But the result is still the same that is no greeter/login screen. appears. The sceen is empty . But I can run GUI application from the ssh terminal. The application appears on the blank screen.

Edit:

I have observed another interesting thing that is if the X is running on display anything other than 0 (in my case DISPLAY=:1), then lxdm does not use the /etc/lxdm/lxdm.conf and it does not launch the greeter and probably this is the reason to display a blank screen.

Here is my log:

DISPLAY=:1

systemctl status lxdm :

lxdm.service - LXDE Display Manager
   Loaded: loaded (/lib/systemd/system/lxdm.service; disabled; vendor preset: enabled)
   Active: active (running) since Sat 2019-10-19 09:52:09 UTC; 3s ago
  Process: 2175 ExecStop=/usr/bin/killall -9 lxsession (code=exited, status=1/FAILURE)
 Main PID: 2598 (lxdm-binary)
   CGroup: /system.slice/lxdm.service
           └─2598 /usr/sbin/lxdm-binary

If I ran the greeter manually by /usr/libexec/lxdm-greeter-gtk , it appears on the screen.

Dear @xdaco

Do you still start X11 manually? The problem is if you start it manually you will have two instances running and one will be on DISPLAY=:0 and the other on DISPLAY=:1. This would also explain why you see a black screen.

What is the output of “ps auxf”? You should have no other X server running than this one:

root       505  0.0  0.5   3620  2656 ?        Ss   07:09   0:00 /usr/sbin/lxdm-binary
root       508  0.3  2.6 113152 13712 tty7     Ssl+ 07:09   0:01  \_ /usr/bin/X -s 0 :0 vt07 -nolisten tcp -novtswitch -auth /var/run/lxdm/lxdm-:0.auth
root       514  3.2  4.0  46664 20852 ?        S    07:09   0:11  \_ /usr/libexec/lxdm-greeter-gtk

Regards,
Stefa

Hi @xdaco

Stefan is not in office this week. He will look into this issue next week when he comes back.

Best regards,
Jaski

Hi @xdaco

I think there is a misunderstanding. DISPLAY 0 does not necessarily have to be on a real display. So if you don’t have any display you can just use DISPLAY 0 and you don’t have to start X11 manually. Or what do I miss?

Try to start with the simplest setup possible and don’t try to start X manually. If you have two X servers running this becomes a mess.

Regards,
Stefan

@stefan_e.tx

First of all, we are using a custom carrier board. The carrier board does not have a display port. All the display PINS have been repurposed as gpio. Due to this default configuration does not work as it looks for DISPLAY 0 and throws error “could not detect display”.

As an alternative, we wanted to use XVFB to create a virtual DISPLAY and run lxdm on this virtual display. We have tried display 0 which always resulted in a black screen as there are two Xserver trying to run on the same display. (the real X server and the virtual X server by XVFB).

I hope I have clarified the scenario.

Best Regards

@stefan.tx

Hi Stefan

Thank you so much for your reply.

Yes, I do start X server manually on DISPLAY=:1. This is a headless setup. I use Xvfb to create an X server on a virtual frame buffer. I don’t have a real display interface as those pins have been repurposed for GPIO. So I belive there should not be an X server running on DISPLAY=:0.

Here is the output of ps auxf after the system is booted up.

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root       197  0.0  0.0      0     0 ?        S    19:42   0:00  \_ [kworker/u4:2]
root       207  0.0  0.0      0     0 ?        S    19:42   0:00  \_ [kworker/1:3]
root       214  0.0  0.0      0     0 ?        S<   19:42   0:00  \_ [kworker/1:1H]
root         1 13.6  0.4   5876  4584 ?        Ss   19:41   0:02 /sbin/init
root       192  2.6  0.4  16532  4416 ?        Ss   19:41   0:00 /lib/systemd/systemd-journald
root       211  2.7  0.3  12900  3468 ?        Ss   19:42   0:00 /lib/systemd/systemd-udevd
systemd+   229  0.5  0.2  14504  3036 ?        Ssl  19:42   0:00 /lib/systemd/systemd-timesyncd
root       309  1.1  0.3   5272  3628 ?        Ss   19:42   0:00 /usr/sbin/ofonod -n
avahi      314  0.5  0.2   3916  2428 ?        Ss   19:42   0:00 avahi-daemon: running [colibri-imx7-emmc.local]
avahi      318  0.0  0.1   3916  1524 ?        S    19:42   0:00  \_ avahi-daemon: chroot helper
message+   317  1.5  0.2   3784  2632 ?        Ss   19:42   0:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
root       329  1.0  0.4   7880  4144 ?        Ss   19:42   0:00 /usr/sbin/connmand -n
root       332  0.0  0.1   2288  1428 ?        Ss   19:42   0:00 /usr/sbin/atd -f
root       351  0.5  0.3   4748  3532 ?        Ss   19:42   0:00 /lib/systemd/systemd-logind
rpc        362  0.0  0.1   3004  1428 ?        Ss   19:42   0:00 /usr/sbin/rpcbind
root       414  0.4  0.1   4168  1152 ?        Ss   19:42   0:00 /lib/systemd/systemd-hostnamed
root       426  0.1  0.3   8228  3588 ?        Ss   19:42   0:00 /usr/sbin/wpa_supplicant -u
systemd+   432  2.7  0.2   4968  2952 ?        Ss   19:42   0:00 /lib/systemd/systemd-networkd
rpcuser    482  0.1  0.2   2708  2104 ?        Ss   19:42   0:00 /usr/sbin/rpc.statd -F
root       485  0.1  0.1   2200  1376 tty1     Ss+  19:42   0:00 /sbin/agetty -o -p -- \u --noclear tty1 linux
root       486  0.1  0.1   2200  1404 ttymxc0  Ss+  19:42   0:00 /sbin/agetty -8 -L ttymxc0 115200 xterm
root       531  1.0  0.3   5852  4104 ?        Ss   19:42   0:00 sshd: root@pts/0
root       538  2.6  0.3   5260  3204 pts/0    Ss   19:42   0:00  \_ -sh
root       542  0.0  0.2   4688  2096 pts/0    R+   19:42   0:00      \_ ps auxf
root       533  1.4  0.3   5480  3748 ?        Ss   19:42   0:00 /lib/systemd/systemd --user
root       534  0.0  0.1   6920  1088 ?        S    19:42   0:00  \_ (sd-pam)

I cant see any X server is running . After I start the x server manually on virtual display 1 and then surring lxdm service , here is the ps auxf output.

  root         1  0.4  0.4  23352  4724 ?        Ss   19:41   0:02 /sbin/init
    root       192  0.0  0.4  24728  4528 ?        Ss   19:41   0:00 /lib/systemd/systemd-journald
    root       211  0.0  0.3  12900  3468 ?        Ss   19:41   0:00 /lib/systemd/systemd-udevd
    systemd+   229  0.0  0.2  14504  3036 ?        Ssl  19:42   0:00 /lib/systemd/systemd-timesyncd
    root       309  0.0  0.3   5272  3628 ?        Ss   19:42   0:00 /usr/sbin/ofonod -n
    avahi      314  0.0  0.2   3916  2428 ?        Ss   19:42   0:00 avahi-daemon: running [colibri-imx7-emmc.local]
    avahi      318  0.0  0.1   3916  1524 ?        S    19:42   0:00  \_ avahi-daemon: chroot helper
    message+   317  0.0  0.2   3784  2632 ?        Ss   19:42   0:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
    root       329  0.0  0.4   7880  4144 ?        Ss   19:42   0:00 /usr/sbin/connmand -n
    root       332  0.0  0.1   2288  1428 ?        Ss   19:42   0:00 /usr/sbin/atd -f
    root       351  0.0  0.3   4748  3532 ?        Ss   19:42   0:00 /lib/systemd/systemd-logind
    rpc        362  0.0  0.1   3004  1428 ?        Ss   19:42   0:00 /usr/sbin/rpcbind
    root       426  0.0  0.3   8228  3588 ?        Ss   19:42   0:00 /usr/sbin/wpa_supplicant -u
    systemd+   432  0.0  0.2   4968  2952 ?        Ss   19:42   0:00 /lib/systemd/systemd-networkd
    rpcuser    482  0.0  0.2   2708  2104 ?        Ss   19:42   0:00 /usr/sbin/rpc.statd -F
    root       485  0.0  0.1   2200  1376 tty1     Ss+  19:42   0:00 /sbin/agetty -o -p -- \u --noclear tty1 linux
    root       486  0.0  0.1   2200  1404 ttymxc0  Ss+  19:42   0:00 /sbin/agetty -8 -L ttymxc0 115200 xterm
    root       531  0.0  0.3   5852  4104 ?        Ss   19:42   0:00 sshd: root@pts/0
    root       538  0.0  0.3   5260  3208 pts/0    Ss   19:42   0:00  \_ -sh
    root       556  0.0  0.2   4688  2096 pts/0    R+   19:49   0:00      \_ ps auxf
    root       533  0.0  0.3   5480  3748 ?        Ss   19:42   0:00 /lib/systemd/systemd --user
    root       534  0.0  0.1   6920  1088 ?        S    19:42   0:00  \_ (sd-pam)
    root       551  0.3  1.2  20164 12560 ?        Ss   19:49   0:00 /usr/bin/Xvfb :1 -screen 0 1024x768x24
    
    And after this , I start the lxdm service. And you can see from ps auxf that lxdm triggers a non functiona X server on DISPLAY=:0.  So I belive the lxdm service is starting an X server on DISPLAY=:0 . 

    root         1  0.4  0.4  23352  4732 ?        Ss   19:41   0:02 /sbin/init
    root       192  0.0  0.4  24728  4528 ?        Ss   19:41   0:00 /lib/systemd/systemd-journald
    root       211  0.0  0.3  12900  3568 ?        Ss   19:41   0:00 /lib/systemd/systemd-udevd
    systemd+   229  0.0  0.2  14504  3036 ?        Ssl  19:42   0:00 /lib/systemd/systemd-timesyncd
    root       309  0.0  0.3   5272  3628 ?        Ss   19:42   0:00 /usr/sbin/ofonod -n
    avahi      314  0.0  0.2   3916  2428 ?        Ss   19:42   0:00 avahi-daemon: running [colibri-imx7-emmc.local]
    avahi      318  0.0  0.1   3916  1524 ?        S    19:42   0:00  \_ avahi-daemon: chroot helper
    message+   317  0.0  0.2   3784  2632 ?        Ss   19:42   0:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
    root       329  0.0  0.4   7880  4144 ?        Ss   19:42   0:00 /usr/sbin/connmand -n
    root       332  0.0  0.1   2288  1428 ?        Ss   19:42   0:00 /usr/sbin/atd -f
    root       351  0.0  0.3   4748  3532 ?        Ss   19:42   0:00 /lib/systemd/systemd-logind
    rpc        362  0.0  0.1   3004  1428 ?        Ss   19:42   0:00 /usr/sbin/rpcbind
    root       426  0.0  0.3   8228  3588 ?        Ss   19:42   0:00 /usr/sbin/wpa_supplicant -u
    systemd+   432  0.0  0.2   4968  2952 ?        Ss   19:42   0:00 /lib/systemd/systemd-networkd
    rpcuser    482  0.0  0.2   2708  2104 ?        Ss   19:42   0:00 /usr/sbin/rpc.statd -F
    root       486  0.0  0.1   2200  1404 ttymxc0  Ss+  19:42   0:00 /sbin/agetty -8 -L ttymxc0 115200 xterm
    root       531  0.0  0.3   5852  4104 ?        Ss   19:42   0:00 sshd: root@pts/0
    root       538  0.0  0.3   5260  3208 pts/0    Ss   19:42   0:00  \_ -sh
    root       564  0.0  0.2   4688  2188 pts/0    R+   19:51   0:00      \_ ps auxf
    root       533  0.0  0.3   5480  3748 ?        Ss   19:42   0:00 /lib/systemd/systemd --user
    root       534  0.0  0.1   6920  1088 ?        S    19:42   0:00  \_ (sd-pam)
    root       551  0.0  1.2  20164 12560 ?        Ss   19:49   0:00 /usr/bin/Xvfb :1 -screen 0 1024x768x24
    root       559  2.5  0.2   3628  2396 ?        Rs   19:51   0:00 /usr/sbin/lxdm-binary
    root       561  1.0  0.0      0     0 ?        Zs   19:51   0:00  \_ [X] <defunct>

So, it seems that the lxdm service itself is triggering an X server on DISPLAY=:0 (which is of course not functional). Therefore if we can modify the lxdm service to start on DISPLAY=:1 without starting another X server, the problem can be solved.

EDIT2:

In ubuntu "/etc/X11/xinit/xserverrc " is the file which launches the real X server. I have achieved my target on ubuntu by editing this file as follows.

#!/bin/sh

#exec /usr/bin/X -nolisten tcp "$@"
exec /usr/bin/Xvfb :0 -screen 0 1024x768x24

But in Toradex open embedded build, I could not find a similar file that launches the real X server before LXDM starts. Can you please point me which file starts the x server in toradex openembedded ?

Edit3:

I have found the entry in lxdm.conf which starts the xserver. I have edited the entry as I did on ubuntu test setup. But now I always , get a defunct xvfb server.

Here is my lxdm.conf

[base]
### uncomment and set autologin username to enable autologin
#autologin=root

### uncomment and set timeout to enable timeout autologin,
## the value should >=5
# timeout=10

## default session or desktop used when no systemwide config
session=/usr/bin/startlxde

## uncomment and set to set numlock on your keyboard
numlock=1

## set this if you don't want to put xauth file at ~/.Xauthority
# xauth_path=/tmp

# not ask password for users who have empty password
skip_password=1

## greeter used to welcome the user
greeter=/usr/libexec/lxdm-greeter-gtk

[server]
## arg used to start xserver, not fully function
arg=/usr/bin/Xvfb :0 -screen 0 1024x768x24
# uncomment this if you really want xserver listen to tcp
# tcp_listen=1
# uncoment this if you want reset the xserver after logou
# reset=1

[display]
## gtk theme used by greeter
gtk_theme=Clearlooks

## background of the greeter
# bg=/usr/share/backgrounds/default.png

## if show bottom pane
bottom_pane=1

## if show language select control
lang=1

## if show keyboard layout select control
keyboard=0

## the theme of greeter
theme=Industrial

[input]

[userlist]
## if disable the user list control at greeter
disable=0

## whitelist user
white=

## blacklist user
black=

Hi @xdaco

Thanks for the clarification.

This is a special use-case which we never tried on our module before. One solution could be to try our new Software Platform named Torizon which will give you similar tools you are using on your desktop. Could you check this?

Best regards,
Jaski

@jaski.tx

I will try Torizon. But Do you/toradex really suggest/promote for soft realtime system? Currently, we are using Armstrong with RT kernel and We are more or less satisfied with the performance.

Hi @xdaco,

I’m not sure if I understand correctly. Are you asking if Torizon is a a recommended platform for soft-real time?

Torizon is still a Linux platform meaning any real-time features is through the real-time Linux patch like how it is with Angstrom. So the performance should more or less be the same across all our real-time Linux offerings.