Fun with rpi-connect

To begin at the beginning…

It all started when I read a news item saying RealVNC was going to change its terms and conditions unilaterally, so that home users would be limited to connecting to three computers. I was using it to view and control anything up to fifteen computers.

Panic set in. I began to research other free VNC implementations. Then it was pointed out to me that it was only remote access over the internet that would be affected. I hadn’t been doing that at all. It seemed all the Pi’s on my network would be unaffected. To ensure things would not get changed, I set RealVNC to NOT update automatically on all of them.

During my researches, I heard that a Pi running Wayland instead of X-Windows could be remotely accessed just like VNC, using rpi-connect, and decided that would be interesting to do, anyway. So I needed to update a machine to run the Bookworm version of RaspberryPi OS, which does use Wayland. I have only one Pi 4 at present, and did the thing they tell you never to do – I attempted an in-place upgrade. It ever so nearly worked. But it wouldn’t run rpi-connect. So, I pulled the Pi to bits, took its SSD off the Waveshare adapter it uses, and burned a fresh copy of Bookworm. Once it was all re-assembled, the Pi booted up normally, and rpi-connect was usable. Well, there was the small matter of going online and associating the Pi, whose name is Marvin, with my RaspberryPi ID. Which I have.

Here is a screenshot of my Linux Mint box, with VNC Connect at the top left, a VNC session into the street camera at the bottom left, another remote session on a Pi, at the middle left, and a remote session on Marvin…

Ideas for the next step…

Firstly, it seemed like a good idea to verify that I did indeed have remote access. I turned off wi-fi on my phone, and used Chrome to access the Raspberry Pi sign in page, which was fine. And on connecting to Marvin, I got this…

So, remote access definitely works. I don’t think I will be using my phone for the job, but one of my tablets, or even the Chromebook should work just fine.

The next thing was to write something to enable Marvin to monitor WeatherPi, which has an occasional problem with its greenhouse temperature sensor, that results in the weather monitoring and upload program crashing. I used the Python Paramiko library, and made a program (cobbled together from earlier versions) that checks the weather station every five minutes. If the machine itself is down, it sends a message to my phone, using Pushover. If the machine is up, it checks whether the weather program is running, and attempts to restart it otherwise. I added starting this program to the other programs Marvin runs at startup, which is done by this bash script –

#!/bin/bash
lxterminal --title "UnicornHD" -e 'python3 Programs/unicorn_server.py && read x' &
sleep 2
lxterminal --title "Fan HAT" -e 'python3 Programs/fan65.py && read x' &
sleep 2
lxterminal --title "Weather Station" -e 'python3 Programs/WeatherMonitor.py && read x' &
sleep 10

That was unnecessary!

Somewhere online, while I was trying to get the remote monitoring to work, I found a way to make a python program keep going. Using a bash shell script to run the program like this means that if the program does stop, it will immediately be run again, until the terminal it was run in is closed.

while : ; do
    now=$(date)
    echo $now >> restart.log
    python3 /home/pi/program-to-run.py
    sleep 10
done

This does not work with programs using Pi cameras, when the camera crashes. I wonder if there is a camera resetting utility available, as rebooting is not possible inside this script! I wonder if libcamera can do a reset of the camera? Must have a look…

This is virtually amazing!

I’ve been wanting to change my main PC from Windows to Linux for ages, but held back because there are a few applications on it that I found didn’t have a Linux equivalent, such as the old version of OneNote that I like, and the Canon photographic utilities for my DSLR camera. The OneNote version is the one that just works on the local machine, rather than the newer one that insists on putting things “in the cloud”. I want my data here, not somewhere I am unable to control, and might get disconnected from. I have a strong dislike of dual booting systems, from back when they used to be a real pig to work with, and kept going wrong…

A lot of people have told me, “Oh, you can run your Windows software under Linux, using Wine”. There’s something wrong with me, as I never could get any of those programs to work in Wine. I think I prefer wine to Wine…

What I needed, clearly, was to keep a virtual copy of the PC, and run it on the Linux machine. And it turns out you can…

A while back, I had moved as much data as I could from C: to my 4 Terabyte D: drive, planning to keep the programs that used the data on the boot SSD.

First, I used VMware’s useful converter program, to make a virtual machine from the PC’s SSD. For some reason, VirtualBox isn’t yet able to do this. I’m more used to VirtualBox, which seems to have better support than VMware, so I fed VMware’s resulting virtual PC into a converter that outputs a VirtualBox machine.

Having saved that very carefully, in more than one place, I installed Linux Mint Cinnamon on a brand new SSD on the PC, and started the fun of getting used to it. It’s really good these days, and “just works”. I put VirtualBox and RealVNC on Mint, and found that my saved virtual Windows 10 computer ran just fine.

Well, actually not the first time, it didn’t. Reverting to Windows 10 was easy, because it was on the old SSD, and I was able to fix the things I had forgotten to do. There is a snag here, in that each time I return to Linux, the Data drive gets changed to a read only file system. There’s a simple fix for that snafu, that I will mention when I remember what it is.

Now, normally, I use a Chromebook around the house, to access the PC and all the little Raspberry Pi computers I run. Mrs Walrus seems to prefer to have me where she can see me, or maybe she likes my company, and I do an awful lot on what used to be her Chromebook. I was already using the Chrome browser on the Chromebook to do remote access to the Windows PC. To my absolute delight, when I fired that up, it connected to the virtualised PC on the Linux machine. When software is good, it can be very good indeed!

Soon, I must get the Chromebook to remote directly into Linux Mint as well. Mint is just fine using RealVNC Connect to work the Pi computers, so now I have more than one way to access them.

End of Part 1…