ARCHIVE: Australian Ham Radio Discussion Forum ( AHRDF )

Full Version: my not so Raspberry PI adventure
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,
  well as Raspberry PI's are in short supply I have had to move up in the world to a slightly bigger box, heralded by the arrival of a INTEL NUC for a new project.

Okay so I have the hardware, Intel NUC with an I5 8th generation processer and 8GB of RAM...   256 GB of M.2 solid state storage.

What now, well its linux of course as this will be going hopefully away to a far flung corner of VK to sit in a small cabinet and run all day...  no Windows updates for me :-)

This will be a slow journal of the build of the system, I have chosen to use the linux distro called Linux Mint.  Only as I have used it a few times at work to build up some school related work stations.  Within the Mint family there a few flavours of the desktop experience, I have opted for the lower spec Xfce desktop as apposed to the top of the line 'Cinnamon' desktop or the middle 'Mate' desktop.

Once you have your O/S installed (too hard to cover here) the first challenge was WSJT-X, which was really easy to do.. Open the software manager and search for WSJT-X and you get a few entries, be sure to chose the one that gives you version 2.54 of WSJT-X as there are some old packages out there in the Linux land.

I plugged up my IC-7100 after the install of WSJT-X had concluded and found I had some new sound devices already showing up, the wonders of modern Linux distros, did not even need to install a sound manager, wow I could get used to this.  BUT my serial port was a different story, seems my user account does not have permissions to access the serial ports ... Arrghh..

Doctor Google to the rescue, access to serial ports on linux distros that are serious about security rely on the user being a member of the right security group called 'dialout' and of course my account was not..

A good description of the problem is shown here: https://websistent.com/fix-serial-port-p...ors-linux/

In a terminal windows its : $ sudo usermod -a -G dialout <yourusername>

in may case thats: $ sudo usermod -a -G dialout vk5pj

now you need to log out  / login to pickup group memberships but I decided it was time for a reboot.  After logging in WSJT-X was hap[y to talk to the radio over the serial port, chalk up an early win.

Next it will be grid tracker, VNC and minor tools..
When you say serial port, I assume that the port is USB?
Hi Colin,
yes USB based serial ports,, I guess old habits die hard when it come to the names of things.. When you plug in the USB cable from most modern radios, they create one or more "COM ports" inside the OS, WSJT-X and its derivatives still ask for a serial port value when setting up, so I tend to keep the naming the same so I do not jump from one description to another, helps in my head anyway :-)

Getting VNC to go on a full sized linux distro still has me stumped, I guess the simplicity of the pre-packed VNC server on PI O/S has spoilt me.
I was just curious. I seem to come across many recently produced articles and designs that are based on or use serial com ports.

Even one in the current AR. Although that seems to be 'just in case' or 'because I could' addition.
Hello,
 well 48 hours on and I must admit I was going to give up on the install of VNC under linux.  Why of why is it soo hard, seems to be a common thing for lots of people, so I knew I was not alone.


but for something different lets skip to installing JTDX, (will come back to VNC in a while) unlike WSJT-X its not in the software library and you have to download installer files.

Firstly go to the sourceforge web site and get the needed HAMLIB install. HAMLIB

Then from the same site get the JTDX install file: JTDX

You must install the HAMLIB one first so it meets the dependencies of JTDX, in the file explorer of Linux you can right click on the file in your 'Downloads' folder and tell it to open in the INSTALLER.

Once these two are installed you will have JTDX available too. The main reason I wanted JTDX was its improved rig control features where the rig can be powered off and on as needed, there is no sense leaving it on if no one is connected to the remote system.
Okay here is VNC, it is not going to be pretty and at one point I was ready to blow linux away and install Win 10 in its place, yep the air around me was B-L-U-E with nasty words.

After a great deal of searching and failure I found this forum post...  YES an answer on a forum, who would have thought that. Cool

While his english syntax is not that great the actual code you need to run is all outlined here: VNC Install  So just in case his posting disappears, I will try and transfer the steps to here. This is all done in a terminal window (Console view)

Install the basic VNC software:
Code:
sudo apt-get install tigervnc-scraping-server

Update the packages
Code:
sudo update-alternatives --config x0vncserver

Start the VNC server for the first time
Code:
x0vncserver -SecurityTypes=none

At this point you can connect to the computer via VNC without a password if you want to try it now.

In the terminal use Ctrl C to kill the VNC server so you can proceed


Set the VNC password

Code:
vncpasswd

this will prompt you for a password to access this linux system when you connect over VNC, when it asks for a View-Only password say no.


Start the VNC server again BUT now requiring a password (getting closer)

Code:
x0vncserver -PasswordFile=/home/<user>/.vnc/passwd

now where in the line it shows <user> this is the username of the account you used to login, in my case its is vk5pj
or   $ x0vncserver -PasswordFile=/home/vk5pj/.vnc/passwd

This will now have the VNC server running as an interactive process from that console window, not exactly handy as you have to be logged in an remember to run it.... 

Next step is to make it run as a service under Linux...   now this required the help from yet another Forum...  what are the chances of that, sorry Doug.

GITHUB Answer

On this page, it shows the steps on how to create the needed files and commands to get the vnc server to run as a service under linux, phew.

Firstly you need to create a script file, Create a file with path /usr/local/bin/x0vnc.sh

Edit this file with a text editor and paste this code, be sure to replace 'vk5pj' with the linux username your using.

Code:
#! /bin/bash

# Export an environment variable of the Display Manager
export XAUTHORITY="/var/run/lightdm/root/:0"

# Start VNC server for :0 display in background
## Set path to binary file
VNC_BIN=/usr/bin/x0vncserver

## Set parameters
#PARAMS="-display :0 -SecurityTypes None"
PARAMS="-display :0 -passwordfile /home/vk5pj/.vnc/passwd"
if [[ -f /etc/vnc.conf ]];
then
    ## Launch VNC server
    ($VNC_BIN $PARAMS) &
else
    ## Add parameters
    PARAMS+=" --I-KNOW-THIS-IS-INSECURE"
    
    ## Launch VNC server
    $VNC_BIN $PARAMS
fi

# Provide clean exit code for the service
exit 0

This is the script that is going to be referenced in the service startup config that follows

Create a file with path /etc/systemd/system/x0vncserver.service
edit it with a text editor and past in this code.

Code:
[Unit]
Description=Remote desktop service (VNC) for :0 display

# Require start of
Requires=display-manager.service

# Wait for
After=network-online.target
After=display-manager.service

[Service]
Type=forking

# Set environment
Environment=HOME=/root

# Start command
ExecStart=/usr/local/bin/x0vnc.sh

# Restart service after session log out
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target

now we can test the script but first we need to declare it as an executable file

Code:
sudo chmod +x /usr/local/bin/x0vnc.sh

Launch the script

Code:
sudo /usr/local/bin/x0vnc.sh


Try to connect via VNC. you will need a password.

Now lets make this all into a service with the help of the systemd unit

Code:
sudo systemctl daemon-reload

sudo systemctl start x0vncserver.service

sudo systemctl status x0vncserver.service

Enable autostart at boot up.

Code:
sudo systemctl enable x0vncserver.service

yes I know that's a lot of steps to make VNC work and a smarter person that I could probably script that but as I only need to do it once what is the point  Angel

I doubt many if any will want to duplicate this but found forums are a handy place to document your own work even if very few follow the same path,
The next step...

as VNC does not handle the login screen on Linux (buggar) I have to get my system to auto login after a restart, so it can cope with power outages or planned reboots..  this was way simpler than I thought and all done through the GUI..

LINK-1

LINK-2

The two links above give 2 different version of the same story, though it best just in case one of them goes away...

So now I am nearly finished, just have to now schedule a weekly reboot of the system to allow all the system logs to do their clean-ups and not grow out of proportion.  I could probably get away without this but seemed like a good thing to have in place just in case..

So for scheduling events Linux has a utility called crontab

to edit the events that run as the root user (the bloke who has all the clout) you need to edit the crontab file referenced by root.

Code:
sudo crontab -e

This will ask you to select an editor, nano is a great choice, not the file only vaguely explains the formatting so the example below I found in another forum post (gosh) might help.

# m h dom mon dow command

# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * command to be executed
# * * * * * command --arg1 --arg2 file1 file2 2>&1

so to reboot on a Sunday at 5 30 we would put in this line

Code:
30 5 * * 7 /sbin/reboot

hit Ctrl X to exit,  this should see the system reboot at 5:30 am system time on the 7th day of the week (Mon=1, Tue=2 etc)
Okay Last posting on this mostly boring thread,


I want WSJT-X to auto-start after reboot, so there must be a simple way right?  it turns out there is a utility on the desktop menu called 'sessions and startup' and if you open that and then go to the 'Application Autostart' you can chose to add a new item using the + key at the bottom.

It will want you to give it a name, make it some thing help full for when you need to find it later, you can optionally give it a description and then it wants a command and what triggers it to start. The default is 'on login' which is fine to leave set.

now for my system and how WSJT-X got installed the command to start it looks rather convoluted and was found by right clicking on the WSJT-X icon on the menu and selecting the 'edit application' option.  I will not include mine as your install method may vary and giving my info may only confuse things.

Here is the staus Quo.

Linux Mint 20 with the Xfce desktop is installed,
Connectivity via VNC that needs a password is working;
connected my Icom 7100 over a USB interface without any extra drivers needed
WSJT-X and JTDX is installed and tested on air;
System auto logins;
system Auto restarts daily currently, will move that out to weekly once it all proves itself

Now its time to see how it all works before any thought of relocation to a far flung DX QTH.
epilogue,

cannot set a screen size value for a connection when no monitor is detected, end up with 1024x768 resolution and poor performance over VNC connection. Answer seems t be a dummy HDMI plug that fools the PC into thinking it has a monitor connected, have ordered one to test with, sadly if this does not work I think its time to WIPE the disk and go the Windows 10/11 install and suffer the indignation of Windows Updates.
Hi peter,
Just looking at your config and I see that you haven't specified the geometry of the virtual display created by vncserver. The default is 1024.768 as you have found.

You need something like this in your startup file...

ExecStart=/usr/sbin/runuser -l vncuser -c "/usr/bin/vncserver %i -geometry 1280x720"

This is from a Centos system but you get the idea.

If after you have solved that and you still have performance issues, you might consider using SPICE instead. Google "spice server raspberry pi" for more info.

cheers

Tim
Peter

I had a similar video issue when I was running a pair of Debian web servers and didn't want a monitor permanently connected - I was using VNC software to maintain them. 
At that stage it was a VGA rather than HDMI form but it was easy enough to dummy up a couple of DB9 plugs with some resistors soldered to the relevant pins.  I still have those 'dummies' somewhere but can't put my hands on them at the moment to get the resistor values or pin placement.

If you already have an unused HDMI -> VGA adapter cable, you might be able to do something similar at DB9 pinout level.  It would be a shame to go to Win10/11 for that sort of project !

I will search harder if you cannot find dummy VGA plug info elsewhere.

Doug
Hello Tim,
have tried all sorts of variations on the start settings for geometry but I have also noted that if no video display is detected that the performance of VNC is utterly intolerable. it behaves like a 56K dialup over the local LAN but as soon as it detects a local display it kicks into overdrive. From my searching this is quite common and many threads in forums make mention of making dummy VGA plugs.. my dummy HDMI I guess will just be the next step along.

Had no problem at all doing headless on the PI as it uses an pre-packaged free copy of VNC connect which you have to otherwise pay for on mainstream distro's... I tell ya windows 10 is looking liker it has a chance Big Grin
Hi Doug,
yes seems like I have the same problem, have purchased two of these dummy HDMI plugs from Core Electronics (shameless plug) to see how it works out under linux Mint.. for these sort of things to be available commonly for sale, there must be a market for them so the headless VNC thing is common. I also tried the NoMachine remote desktop and it went to that crazy low resolution and slow operation like VNC so it makes me think there is something maybe at a lower driver level going on that is common no matter what. I was going to try Teamviewer again but their cost to purchase is still to high for an experimenter.
I guess here is where it comes to a stop for a while. the dummy HDMI plug from Core Electronics, a distributor for Adafruit was a great success, the VNC session came up on 1920x1080 at first boot and I was able to select any number of alternative screen resolutions but above all the performance of the VNC session is snappy and a joy to use. Will put that one down to experience..

the URL for the plug is: http://adafru.it/4247