Prepare the SD Card.
I am going to use the latest being Buster desktop only. Download from raspberrypi.org verify and write to the SD card;
// Verify the download then Unzip to access the img file. #shasum -a 256 ~/Downloads/2020-08-20-raspios-buster-armhf.zip 9d658abe6d97f86320e5a0288df17e6fcdd8776311cc320899719aa805106c52 /Users/allen/Downloads/2020-08-20-raspios-buster-armhf.zip
// Verify the SD card; #diskutil list // Unmount it; #diskutil unmountDisk /dev/disk3 // copy the image across; #sudo dd bs=1m if=~/Downloads/2020-08-20-raspios-buster-armhf-lite.img of=/dev/disk3
Setup the SD card to boot headless.
You can connect the device to USB keyboard and a HDMI screen to continue the install but prefer to run headless. Easy to do just need to create a couple of files.mount the flashed SD card locally.
The Pi4 has a ehternet port so no need to create wpa_supplicant.conf for WiFi however will need to create a file to enable SSH.
// Mount the SD card and create file in /boot/ called ssh #touch /Volumes/boot/ssh
Note:Raspberry Pi Imager v1.6 has menu which is hidden away press CTRL + SHIFT + X and set advanced options including SSH, WIFI local ans so on.
Once done unmount the SD card, place in the PI and boot. The device will pickup an IP address via DHCP. So check the router to find the IP address or use
using pi as the username and raspberry as your password.
To set the hostname to something more meaningful, two files need to be edited. Replace “raspberrypi” in each file with the new hostname;
$ sudo nano /etc/hostname
$ sudo nano /etc/hosts
also ensure the SD card is fully sized by running;
select ‘Advanced -> A1 Expand Filesystems. Then reboot.
Update the install
# cat /etc/os-release # sudo apt update # sudo apt dist-upgrade -y # sudo apt clean
Create new user to replace PI and assign to relevant groups. I’ll use adduser. useradd is native binary compiled with the system. But, adduser is a perl script which uses useradd binary in back-end. adduser is more user friendly and interactive than its back-end useradd . There’s no difference in features provided.
Add this new user into the following UNIX groups:
# sudo usermod -a -G adm,dialout,cdrom,sudo,audio,video,plugdev,games,users,input,netdev,spi,i2c,gpio,lpadmin allen
and as in private network, add ssh key from notebook:
ssh-copy-id -i ~/.ssh/id_rsa.pub allen@enyo
Headless VncServer Configuration
If you need to configure accessing the pi with osx’s Screen need to setup on Pi from termional first. Not a lot to do just enable and set password;
# sudo raspi-config > Interface Options > VNC > Enable. Reboot.
Generate the password you wish to use in screen with vncpasswd -service
# sudo vncpasswd -service
Create and edit the following file here: /etc/vnc/config.d/common.custom and enter the following config:
Restart the vnc service:
sudo systemctl restart vncserver-x11-serviced
Other parameters you can use with VncServer configs are described here: https://www.realvnc.com/en/connect/docs/server-parameter-ref.html
Create Temp filesystems
Temp FS to save SD wear. tmpfs only uses the memory actually used for files (virtual memory), so if you have 10MB of files in /tmp only 10MB of memory would be used (plus a fixed overhead for each tmpfs filesystem of about 100k). Given the Pi4 as 4G memory
Add the following to /etc/fstab then reboot;
tmpfs /var/tmp tmpfs nodev,nosuid,size=256M 0 0 tmpfs /tmp tmpfs nodev,nosuid,size=1024M 0 0
sudo apt install cockpit
I have encountered issues with loosing network after installing cockpit. You can remove any package and its configurations with the –purge parameter of apt, e.g.
sudo apt autoremove cockpit --purge
However, I believe the issue is because of network manager conflict with networkd . Probably brought in with cockpit-networkmanager package. Try removing and purging that one first.
Renew IP Lease
The -r flag explicitly releases the current lease, and once the lease has been released, the client exits. For example, open terminal application and type the command:
Now obtain fresh IP address using DHCP on Linux;
SDR using RTL2838
Setup the RTL2838 device. I use the USB 2.0 port because I had problems with the USB 3.0 port from time to time. Install the RTL Drivers from latest source;
sudo apt-get remove rtl-sdr git clone https://github.com/osmocom/rtl-sdr.git sudo apt install build-essential cmake usbutils libusb-1.0-0-dev cd rtl-sdr mkdir build cd build cmake -DINSTALL_UDEV_RULES=ON -DDETACH_KERNEL_DRIVER=ON ../ sudo make install sudo ldconfig
Check the modules config;
sudo nano /etc/modprobe.d/rtlsdr-blacklist.conf checking for; blacklist dvb_usb_rtl28xxu blacklist rtl2832 blacklist rtl2830 blacklist dvb_usb_rtl2832u blacklist dvb_usb_v2 blacklist dvb_core
then reboot. Check all went as expected;
Now download, build and install gQRX;
sudo apt-get update sudo apt-get install -y cmake gnuradio-dev gr-osmosdr qt5-default libqt5svg5-dev libpulse-dev git clone https://github.com/gqrx-sdr/gqrx.git cd gqrx mkdir build cd build cmake .. make -j4 sudo make install
to calculate the FFT (*) and optimized for the system on which it runs. This will take some time(20 minutes), but will improve graphics performance.(https://hamprojects.files.wordpress.com/2020/09/rpi-part-3-v1.2.pdf)
To enable HF (500 kHz – 28.8 MHz) – In gQRX the device string would be
Setup RTL as APRS iGate using – https://qso365.co.uk/2018/04/updated-guide-to-setting-up-an-aprs-rx-only-igate-using-a-raspberry-pi-rtl-sdr-dongle-and-a-pre-built-image/
Disable WiFi and/or BT
Open the config.txt file with nano:
sudo nano /boot/config.txt
Find the following line:
# Additional overlays and parameters are documented /boot/overlays/README
This will allow control of the Raspberry Pi and connected devices via API and Web.
sudo wget http://sourceforge.net/projects/webiopi/files/WebIOPi-0.7.1.tar.gz sudo tar xvzf WebIOPi-0.7.1.tar.gz cd WebIOPi-0.7.1
and then the patch.
sudo wget https://raw.githubusercontent.com/doublebind/raspi/master/webiopi-pi2bplus.patch sudo patch -p1 -i webiopi-pi2bplus.patch
then install the software
Start WebIOPi by running the command:
sudo /etc/init.d/webiopi start
If you want WebIOPi to start automatically on boot, run:
sudo update-rc.d webiopi defaults
change the default password. Well this is not connected to the internet but least you can do is change the default password.
then setup as a service.
$ cd /etc/systemd/system/ $ sudo wget https://raw.githubusercontent.com/doublebind/raspi/master/webiopi.service $ sudo systemctl start webiopi $ sudo systemctl enable webiopi
Once WebIOPi is up and running, you can point your browser to http://yourraspberryIP:8000
Starting scripts as services.
/etc/systemd/system$ cat sensors.service [Unit] Description=Sensors After=network.target StartLimitIntervalSec=500 StartLimitBurst=5 [Service] Restart=on-failure RestartSec=5s Type=forking User=root ExecStart=/home/allen/sensors.sh [Install] WantedBy=multi-user.target cat /home/allen/sensors.sh !/bin/bash nohup /usr/bin/python3 /home/allen/sensors/post_MS340.py & >> /tmp/MS340.log 2>&1 nohup /usr/bin/python3 /home/allen/sensors/post_AS3935.py & >> /tmp/AS3935.log 2>&1 systemctl enable sensors.service systemctl start sensors systemctl status sensors