AutoStarting QLCplus in DietPi in Headless X session with VNC

This is a place for sharing with the community the results you achieved with QLC+, as a sort of use case collection.
You can share photos, videos, personal hardware/software projects, interesting HOWTO that might help other users to achieve great results.
Post Reply
MDAR
Posts: 21
Joined: Sat Jan 25, 2020 11:32 am
Real Name: Stuart Hanlon

Hello all

I've been able to start QLCPlus as part of the start up routine with LXE desktop on www.DietPi.com, with an old Samsung N150 64 bit Netbook, including all the startup options, but I was looking for a less intensive payload on the CPU.

I even tried to run VNC of some kind so that I can remotely view the desktop, which kind of worked, until I realised that there were two desktops each with a VNC connection and their own copy of QLCPlus.

So in the end, I took inspiration from Massimo's Raspberry Pi project (which I happily paid for) and I knuckled down to working out how to get xinit to start QLCplus on an Odroid C4.

(I removed all desktop managers and VNC software)

It was actually a lot easier than I had anticipated.

All I had to do was confirm that QLCPlus worked on the platform (which I had by using the LXE desktop), then edit the /DietPi/dietpi.txt config file to add the file I wanted to load, by adding this last line

Code: Select all

#-------------------------------------------------------------------------------------------------------
# D I E T - P I
# QLCplus autostart options
# ----------------------------------------------------------------------------------------------------

SOFTWARE_QLCPLUS_AUTOSTART=/opt/qlc_startup.qxw

and add the following to the /var/lib/dietpi/dietpi-autostart/custom.sh file

Code: Select all

echo Start an X session with qlcplus
echo -------------------------------------------
echo --

echo Assuming that this entry is in /DietPi/dietpi.txt
echo SOFTWARE_QLCPLUS_AUTOSTART=/opt/qlc_startup.qxw
echo -----------------------------------------------

FILE=$(grep -m1 '^[[:blank:]]*SOFTWARE_QLCPLUS_AUTOSTART=' /DietPi/dietpi.txt | sed 's/^[^=]*=//')


echo Startup file from dietpi.txt $FILE


# Create startup options for QLCplus

QLC_OPTS="-m -w -f -c 400,500,40,50 -p -o "$FILE


echo QLC_OPTS $QLC_OPTS

# Find the exact path to QLCplus
FP_QLCPLUS=$(command -v qlcplus)

echo Attempting command ----   xinit $FP_QLCPLUS  $QLC_OPTS

# --- Just comment out this last line if you don't want to load QLCplus

xinit $FP_QLCPLUS $QLC_OPTS
I hope this helps someone.

All I'd like to be able to do now is create some kind of VNC connection to the Xinit session so I can remotely edit the setup, rather than just run it via the web interface
Last edited by MDAR on Thu Dec 15, 2022 12:33 pm, edited 4 times in total.
MDAR
Posts: 21
Joined: Sat Jan 25, 2020 11:32 am
Real Name: Stuart Hanlon

It's taken some serious research and a lot of dead ends, but I've now managed to --

Start QLCplus in a stand alone X session, with a web interface

AND

Start a VNC server that shares out the Display that QLCplus is running on (not a virtual display)

As normal, it was a lot easier than all the things I had tried at first.

The process is

Code: Select all

sudo apt-get install tigervnc-common tigervnc-scraping-server tigervnc-tools

mkdir -p ~/.vnc

vncpasswd
(Follow on screen prompts for setting the password)

Then add / amend these lines to what is mentioned above into /var/lib/dietpi/dietpi-autostart/custom.sh

Code: Select all

xinit $FP_QLCPLUS $QLC_OPTS &
sleep 60
x0vncserver -passwordfile ~/.vnc/passwd -display :0 -localhost no &


Thanks to information in this post

www.howtoforge.com/tutorial/how-to-star ... h-tigervnc


My next step is to get this working on an ODroid C2 without a display

Again, any tips on how to get QLCplus working on an ODroid C2 without a connected monitor would be very welcomed.


(For the sake of £5, I might just plug a dummy HDMI plug in and save myself a headache)
Last edited by MDAR on Mon Dec 18, 2023 5:00 pm, edited 2 times in total.
User avatar
GGGss
Posts: 3073
Joined: Mon Sep 12, 2016 7:15 pm
Location: Belgium
Real Name: Fredje Gallon

For what I know, a dummy HDMI plug will be needed... (underlying problem with GFX-implementation).
Unless someone states otherwise, that is.
All electric machines work on smoke... when the smoke escapes... they don't work anymore
MDAR
Posts: 21
Joined: Sat Jan 25, 2020 11:32 am
Real Name: Stuart Hanlon

I am sure there must be a way to set a fixed / dummy setting for the HDMI output, but for £5 I just can't be bothered chasing that.

So with a Dummy HDMI plug in place and having got QLCPlus running well with a monitor attached.

I'm happy to report that this service file works too.

(Assuming that you edit it so that it calls the startup script.)

( Update Dec 2022, I have added an AutoRestart section, because I found that sometimes... it will crash out for no good reason. As I control via sACN, as soon as the app restores it goes back to what it was last doing. One day I'll work out why it crashes)

Code: Select all

#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it 
# under the terms of the GNU Lesser General Public License as published 
# by the Free Software Foundation; either version 2.1 of the License, or 
# (at your option) any later version. This unit gets pulled 
# automatically into multi-user.target by systemd-rc-local-generator if 
# /etc/rc.local is executable.


[Unit]
Description=QLCplus - with VNC in an Xinit session"
After=network.target
After=network-online.target


[Service]
User=root
Type=forking
ExecStart=/bin/bash -c "sh /opt/start-qlcplus.sh"
	ExecStartPost=/bin/bash -c "/bin/touch /var/log/qlcplus.log"
	ExecStartPost=/bin/bash -c "/bin/echo QLCplus Started $(date) started with PID >> /var/log/qlcplus.log" 
	ExecStartPost=/bin/bash -c "/bin/pidof qlcplus >> /var/log/qlcplus.log"
ExecStop=/bin/kill $MAINPID 
RemainAfterExit=no
StandardOutput=journal+console 
StandardError=journal+console

RestartSec=5
Restart=on-failure

[Install]

WantedBy=multi-user.target
Last edited by MDAR on Sat Dec 10, 2022 11:50 am, edited 1 time in total.
MDAR
Posts: 21
Joined: Sat Jan 25, 2020 11:32 am
Real Name: Stuart Hanlon

It would seem there has been an update to the VNC tigervnc-scraping-server

By default it now only allows Loopback sessions. (IE only from the Localhost)

To enable network wide access, add this at the end of the line

Code: Select all

-localhost no
to make

Code: Select all

x0vncserver -passwordfile ~/.vnc/passwd -display :0  -localhost no &
MDAR
Posts: 21
Joined: Sat Jan 25, 2020 11:32 am
Real Name: Stuart Hanlon

Tiny update


I've had a few issues with various machines over the years, where VNC was "unable to fully resolve hostname"

This weekend I discovered it was the simplest fix and caused by a stupid oversight.


What it means is

The hostname as defined in

`/etc/hostname`
Was not mentioned in
`/etc/hosts`


By simply ensuring that (for example)

`/etc/hostname` only had "QLCplus"

And there was at least a line in `/etc/hosts` that reads "127.0.0.1 QLCplus"

Everything works perfectly.
MDAR
Posts: 21
Joined: Sat Jan 25, 2020 11:32 am
Real Name: Stuart Hanlon

If anyone is reading this


I have a .deb file available for QLCplus on an Arm64 machine, tested against an Odroid C4

I'll create a new topic and mention it here.

https://www.mdar.co.uk/dl/qlcplus/QLCplus_arm64_DEB.zip
Post Reply