Using a Raspberry Pi 4 as a daily driver

During the Covid lockdown, I have challenged myself to use a Raspberry Pi 4 as a daily driver computer and so far, it has lived up to the task.

The Pi 4 is using Raspberry Pi OS (formerly ‘Raspbian’) running off of an SSD. I have a DAC/ADC, CD-RW, external SD card reader, and several other accessories connected to it using a powered USB hub. This hub is connected to and taking full advantage of the USB 3.0 capabilities. The case it’s housed in has full HDMI ports and spreads the connections out in the back, so there’s no cables going in at all angles. I created a guide so you can build and of course, customize your own system.

I take a great deal of satisfaction knowing that I’m using a very inexpensive computer to do all of my tasks, even audio/video editing and CAD/3D modeling! There’s even a section telling you how to run Retropie on top of Raspberry Pi OS for all of your video gaming needs. Please check out the guide. There are plenty of great tips and tricks for using a Raspberry Pi 4 as a PC.  If you see anything I missed or any issues, leave a comment and I’ll make additions/corrections.

Telegram messenger CLI for Raspberry Pi OS

Telegram Messenger App Review - YouTube

Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.

Telegram Messenger CLI for Raspberry Pi OS

This guide likely works for other linux distros besides Raspberry Pi OS. It’s a tricky little bugger to install but rewarding nonetheless.

If you want to go the GUI route:

Telegram Desktop for Raspberry Pi

sudo apt install snapd
sudo snap install telegram-desktop

Message me!

Install Spotify Connect on your Raspberry Pi with ‘raspotify” on Raspberry Pi OS

Setting up Spotify Connect on the Raspberry Pi

First update your Pi’s OS:

sudo apt update
sudo apt upgrade

Install ‘curl’ and ‘apt-transport-https’

sudo apt install -y apt-transport-https curl

Add the raspotify repository and the GPG key:

curl -sSL | sudo apt-key add -v - 
echo 'deb raspotify main' | sudo tee /etc/apt/sources.list.d/raspotify.list

Install ‘raspotify’:

sudo apt update
sudo apt install raspotify

You should now be able to go into the Spotify app on your phone or tablet and select your pi from the device choices.


You can change your Pi’s device name and the bit rate of the stream by editing the configuration file:

sudo nano /etc/default/raspotify

Look for the device name and bitrate strings and make any desired edits. Then save and restart the raspotify service:

sudo systemctl daemon-reload
sudo systemctl restart raspotify

raspotify – no sound even though phone is connected to Pi

Source for further investigation:

Use aplay -l to see devices. Sample output:

pi@lab9:~ $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: b1 [bcm2835 HDMI 1], device 0: bcm2835 HDMI 1 [bcm2835 HDMI 1]
  Subdevices: 3/4
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3

card 1: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
  Subdevices: 4/4
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3

card 2: sndrpihifiberry [snd_rpi_hifiberry_dacplusadc], device 0: HiFiBerry DAC+ADC HiFi multicodec-0 [HiFiBerry DAC+ADC HiFi multicodec-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Edit the raspotify configuration:

sudo nano /lib/systemd/system/raspotify.service

Find the “ExecStart” line and add the device.
In this case (example above), desired device is sndrpihifiberry.
Card is 2 and Device is 0. Use “–device hw:2,0” in configuration.

ExecStart=/usr/bin/librespot --name ${DEVICE_NAME} $BACKEND_ARGS --bitrate ${BITRATE} $CACHE_ARGS $VOLUME_ARGS $OPTIONS --device hw:2,0

Restart the service:

sudo systemctl daemon-reload
sudo systemctl restart raspotify


Unrar multiple files + file name spaces in the terminal

First, when dealing with the spaces in a file name while using the terminal, you can use a back-slash before the space.


File name with spaces.txt

For the terminal:

File\ name\ with\ spaces.txt

Sometimes we run across a downloaded file online that was created by utilizing the winrar multiple-file feature to make a huge file downloadable. A good example would be an ISO image that is more than 1GB in size. The rar program can break up the file into smaller pieces. Example:

and so on

To unrar multiple files into one, first install the unrar program in linux. In this case, I’m assuming you are using Ubuntu or any Debian-based distribution (like Raspbian):

sudo apt install unrar-free
sudo apt install unrar

Then use the unrar command to unrar. Remember to use the \ before any spaces.

unrar x -e bigiso.part01.rar

This should build the large file back up into its uncompressed state.

Private VPN on Ubuntu Server or Raspberry Pi

I can run my own VPN that becomes an encrypted, point-to-point connection from anywhere? Say what? Relatively safe and secure using public wifi?

Yes, it’s true. You can setup PiVPN on your Ubuntu Server or Raspberry Pi device. There are three components to this: PiVPN running on the server, the UFW firewall configuration, and the mobile device app.

First, install PiVPN

curl -L | bash

Most of the suggested configuration options should be applicable.

Once PiVPN is installed, you will need to add a user.

pivpn -a

Give it a profile name and password. The file will be saved in a folder in your home directory called ‘ovpn’. You will want to save that to a flash drive and then import to your phone/tablet. I used FTP. There are many other ways to do this, but the flash drive method is most secure.

Configure UFW

sudo ufw allow 1194/udp
sudo ufw allow OpenSSH

Ask UFW to generate a list to make sure there are no double entries and delete them! Those double entries can mess up the PiVPN’s ability to connect.

sudo ufw status numbered

sudo ufw delete x ("x" is the double entry)

Now, download “OpenVPN” app in your smartphone app store. It’s free. Then open the app and choose the third option, “OVPN Profile”.

Add the ovpn file you generated on your server. You can choose the “save private key password” if you would like. I use this because my phone has a fingerprint security feature. Once you connect, you will be connected to your home network from anywhere! Perfect security for pubic wifi.





Clone a Hard Drive using Ubuntu Live CD

I have a hard drive-duplicator device. It works great if you two of the same drive. But I’ve had issues transferring from an SSD to a regular hard drive (and vice versa).

I looked into buying the EaseUS Disk Copy program (only works in Windows) but now they want a subscription? Hell no to that. So here we are, looking to Ubuntu for our solution!

EDIT: I used the following method to duplicate my Ubuntu Server backup and the copied disk booted into grub (no boot loader). All things considered, one of those duplicators found easily on ebay and Amazon are the best bet. They are much faster and more accurate. For the error I did get using the physical drive duplicator, it was easy to fix. I booted with an Ubuntu Desktop Live USB and used the Disks program to repair. No issues after that. The model I have is a Sabrent EC-HD2B and I have to say it’s pretty nice.

I found a great guide to duplicating hard drives using an Ubuntu Live CD/USB.
Balena Etcher will help you write the Ubuntu Live ISO to a USB disk.

Once you run the Ubuntu Live disk, open a terminal.

Plug in your first drive (the one that you want to copy).

sudo fdisk –l

Take note of what fdisk reports for this drive. It is likely /dev/sda

Now, plug in your second drive (the one you want to overwrite).
Run ‘sudo fdisk –l’ again.
fdisk will likely report this drive as /dev/sda.

Do not confuse the two drives. Here’s a sample statement that will allow your computer to copy the first drive to the second. Replace the drive names as necessary. In this example, sda is the source and sdb is the target:

sudo dd if=/dev/sda of=/dev/sdb

This process can take several hours. Do not turn your machine off until you see a report in your terminal that the process is complete. In my case, it took over 24 hours to copy a 1TB drive with a Mac Mini (Mid 2012)!

Example output when done:

1953525167+0 records in
1953525167+0 records out
1000204885504 bytes (1.0 TB, 932 GiB) copied, 102499 s, 9.8 MB/s

Commodore 64 (Vic 20, Pet, etc) emulator from Raspberry Pi Raspbian

I can confirm this install method (source) worked with a Raspberry Pi 4 using Raspbian Buster.
Compiles Vice and installs into /usr/local/bin. Initial launch reports a sound issue. If you go into settings (F12), there’s a sound configuration you can change to “Alsa”.

# get dependencies – this may take a long time and ~ 1.5 GB
sudo apt install autoconf automake build-essential byacc dos2unix flex libavcodec-dev libavformat-dev libgtk2.0-cil-dev libgtkglext1-dev libmp3lame-dev libmpg123-dev libpcap-dev libpulse-dev libreadline-dev libswscale-dev libvte-dev libxaw7-dev subversion texi2html texinfo yasm libgtk3.0-cil-dev xa65 libsdl2-dev
mkdir -p src
cd src
svn checkout trunk
cd trunk/vice
make -j4
sudo make install

Gaming on the Raspberian Stretch Desktop

It really surprises me that there isn’t a Raspberry Pi gaming scene. I’m not talking about emulation. I’m talking about games that run native on the Pi in Raspbian. Old machines like the Atari 2600, Colecovision, ZX Spectrum and the Commodore 64 have an embarrassing wealth of new games coming out all the time. The Vic 20 still gets releases for God’s sake! So where is the love when it comes to our tiny Pi friend, which is much, much more capable?

Here’s a small list of games you can run on the Stretch Desktop. There are more but these seem to be the most popular. Let me know if you have any favorites you want added to the list!

For the 3D games, a Raspberry Pi 3 B+ is highly recommended!

Battleball – a 3D Tank arcade
sudo apt-get install battleball

Flare – Diablo-like RPG
sudo apt-get install flare-game

Freesweep – a console based Minesweeper
sudo apt-get install freesweep

Funny Boat – funny arcade game
sudo apt-get install funnyboat

Gnome Nibbles – a snake game
sudo apt-get install gnome-nibbles

Quake 3
-> Setup:
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install quake3
game-data-packager quake3 -i

Minecraft Pi edition 

Open Arena – open source version of Quake with different maps
sudo apt-get install openarena

OpenTTD – based upon Transport Tycoon Deluxe sudo apt-get install openttd

TINT – a Tetris game
sudo apt-get install tint

Manually Install RetroPie over Raspbian Stretch

If you are enjoying a full or lite install of Raspbian on your Raspberry Pi, you can also manually install RetroPie rather than work off of a RetroPie SD image.

It’s advisable to first tell your Pi to boot into console mode at boot. 

pi@raspberry:~$ sudo raspi-config
Choose (3) Boot Options
B1 Desktop/CLI
B2 Console Autologin (optionally, you could select B1 to log in)

Install RetroPie manually

Start by updating your system:

pi@raspberry:~$sudo apt-get update && sudo apt-get upgrade

Verify your local settings for a smooth installation.

pi@raspberry:~$sudo update-locale LC_ALL="en_US.UTF-8"

Now we install the packages needed by the installation script:

pi@raspberry:~$ sudo apt-get install git lsb-release 

Download the RetroPie setup script using git. If you don’t have git installed:

pi@raspberry:~$sudo apt install git-all


pi@raspberry:~$ cd
pi@raspberry:~$ git clone --depth=1 

Now run the script:

pi@raspberry:~$ cd RetroPie-Setup
pi@raspberry:~$ chmod +x
pi@raspberry:~$ sudo ./

The installation dialog appears:

Choose the basic install and then optional packages, settings and drivers. Once you are done, reboot and launch with:

pi@raspberry:~$ emulationstation