My Raspberry Pi 3 setup instructions and notes

Raspberry Pi 3 Setup

The steps I took get my Raspberry Pi 3 up and running.

Upgrade Jessie

Run the following commands to upgrade Jessie to Pixel, which includes Chromium with hardware video support:

sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install -y rpi-chromium-mods
sudo apt-get install -y python-sense-emu python3-sense-emu
sudo apt-get install -y python-sense-emu-doc realvnc-vnc-viewer

Change Password

Run the following command, then enter the current password and a new password twice to confirm:


Setup SSH

Launch the Raspbery Config:

sudo raspi-config

Go to 9 Advanced Options then A4 SSH and choose <Enable>.

Open the /etc/ssh/sshd_config file and add the following:

PermitRootLogin no
ClientAliveInterval 30
ClientAliveCountMax 5

Then restart the SSH service:

sudo service ssh restart

Disable Automatic Desktop Login

Run the configuration command:

sudo raspi-config

Go to 3 Boot Options then B3 Desktop and choose <Ok>.

Setup Display

Ensure the display works nicely over HDMI:

sudo nano /etc/boot.txt

Add the following lines to the bottom of the file:


In order to disable HDMI CEC you also need to drop a config file on the recovery partition:

sudo su
mount /dev/mmcblk0p1 /mnt
echo hdmi_ignore_cec_init=1 >> /mnt/config.txt
umount /mnt

Now reboot the system:

sudo reboot

Install Kodi

Update repositories and install Kodi packages:

sudo apt-get update
sudo apt-get install kodi

Create a Kodi shortcut on the desktop that boots in standalone mode (avoids blackscreen on exit):

touch ~/Desktop/kodi-standalone.desktop
nano ~/Desktop/kodi-standalone.desktop

Add the following contents to the file:

[Desktop Entry]
GenericName=Media Center
Comment=Manage and view your media

Install FAT32, ExFAT and NTFS File System Support

Install the following packages:

sudo apt-get install exfat-fuse exfat-utils ntfs-3g

Mount NAS

Ensure the CFIS packages are installed:

sudo apt-get install cifs-utils

Create a credentials file for the username and password:

touch ~/.smbcredentials
nano ~/.smbcredentials

Add the following contents, replacing the username and password:


Change the permissions of the credentials file:

chmod 600 ~/.smbcredentials

Make a directory to mount the NAS to:

sudo mkdir /media/NAS

Test you can mount the NAS manually:

sudo mount -t cifs //192.168.0.x/NAS /media/NAS -o credentials=~/.smbcredentials,vers=1.0

Any mounting problems can be found by checking the logs:

tail -f  /var/log/kern.log

You can find out your users UID and GID with these commands:

id -u username
id -g username

Alternatively you can just use your username and group instead.

Now update the /etc/fstab file to auto mount the NAS as read-only:

//192.168.0.x/NAS /media/NAS cifs credentials=/home/username/.smbcredentials,_netdev,x-systemd.automount,iocharset=utf8,sec=ntlm,ro 0 0

Or for full read and write add this to the /etc/fstab instead:

//192.168.0.x/NAS /media/NAS cifs credentials=/home/username/.smbcredentials,_netdev,x-systemd.automount,iocharset=utf8,sec=ntlm,rw 0 0

Note: Update the lines above with your own NAS IP address, mount directory, username, UID and GID accordingly. For devices running older versions of Samba you may need to add ,vers=1.0 after ro or rw above.

Now run this to mount the NAS:

sudo mount -a

Create a handy symlink to the NAS on the desktop:

sudo ln -s /media/NAS ~/Desktop/NAS

Mount USB Drive

Find the UUID of the USB drive:

sudo blkid
ls -l /dev/disk/by-uuid/

The output should look something like the following. Note the UUID value:

/dev/sda1: LABEL="USB DRIVE" UUID="1234-5678" TYPE="exfat" PARTUUID="ffffffff-01"

Make a directory to mount the USB drive to:

sudo mkdir /media/USB-Drive

Test mounting the drive manually to make sure it works:

sudo mount -t exfat -o uid=pi,gid=pi UUID=1234-5678 /media/USB-Drive

Now add the following to the /etc/fstab to auto mount the USB drive:

UUID=1234-5678 /media/USB-Drive exfat defaults,nofail,uid=1000,gid=1000,dmask=000,fmask=111 0 0

Note: Update the line above with your own UUID, mount directory, file system, UID and GID accordingly.

Now run this to mount the USB drive:

sudo mount -a

Create a handy symlink to the USB drive on the desktop:

sudo ln -s /media/USB-Drive ~/Desktop/USB-Drive

To repair an exFAT drive on Windows run the following command:

chkdsk.exe /F Z:

Note: Replace Z: with the relevant drive letter.

Create EXT4 Drive

You can format a partition as EXT4:

mkfs.ext4 /path/to/mount -L YourLabel

You can also change the drive label afterwards:

e2label /path/to/mount YourLabel

And you can easily mount it in the /etc/fstab as follows:

UUID=1234-5678 /media/USB-Drive ext4 defaults,auto 0 0

Backup NAS to USB Drive

First, create a directory to store the backup logs in:

mkdir ~/Backups

Then create an rsync ignore file, this will exclude unneccesary Windows and macOS files from being backed up:

touch ~/Backups/rsync_excludes.txt

And add the following contents:

Desktop DB
Desktop DF
Network Trash Folder
System Volume Information
Temporary Items

Do a dry run (the -n flag) to ensure the correct files are being backed up:

rsync -rtvun --exclude-from="$HOME/Backups/rsync_excludes.txt" /media/NAS/ /media/USB-Drive/

Next, create a script to handle the backups:

touch Backups/

With the following contents:


BACKUP_LOG="$BACKUP_DIR/nas_backups_`date +'%Y-%m-%d'`.txt"

/usr/bin/rsync -rtvu --log-file="$BACKUP_LOG" --exclude-from="$BACKUP_EXCLUDES" --delete-after /media/NAS/ /media/USB-Drive/
find $BACKUP_DIR/nas_backups_*.txt -mtime +$BACKUP_LOG_DAYS -exec rm {} \;

Once you're happy it works you can add it to your user's crontab:

crontab -e

Add the following contents to it to run it every night at 1am:


0 1 * * * $HOME/Backups/

You can add the --exclude option to exclude a specific pattern of files or directories, and the --delete-after option to ensure files deleted from the target are also removed from the destination.

You can see the last backup log by viewing the file contents:

cat ~/Logs/nas_backups_YYYY-MM-DD.txt

You can see what environment variables are available in the cron environment by adding the following to your crontab (you'll need to add whatver * * * * * you want):

env >> $HOME/Backups/cron_env.txt

You can also ensure any macOS hidden "dotfiles" are deleted by create a script:

chmod +x

And then adding the following contents to it:

find /media/NAS -not -path "*ExcludeDirectory*" -iname ".*" -type f -exec rm -rf {} \;

Note: The filesystem must be writeable for this to work.

You can also add this to the crontab:

0 1 * * * $HOME/Backups/

Setup Steam Controller

The following instructions should allow you to use the Steam Controller wirelessly.

Download and install the Steam Controller Python drivers:

cd ~/
git clone
cd steamcontroller
sudo pip install libusb1
sudo python3.4 install

Now create the file rules file:

sudo touch /lib/udev/rules.d/99-steam-controller-perms.rules
sudo nano /lib/udev/rules.d/99-steam-controller-perms.rules

Then add the following to it:

# This rule is needed for basic functionality of the controller in
# Steam and keyboard/mouse emulation
SUBSYSTEM=="usb", ATTRS{idVendor}=="28de", MODE="0666"

# This rule is necessary for gamepad emulation; make sure you
# replace 'pgriffais' with the username of the user that runs Steam
KERNEL=="uinput", MODE="0660", GROUP="group", OPTIONS+="static_node=uinput"

Note: Replace group with the group of user (e.g. pi).

Now reload udev:

sudo udevadm control --reload

Start the driver and your controller should work: start

To start the driver automatically at the desktop create the file:

touch ~/.config/autostart/Steam-Controller.desktop
nano ~/.config/autostart/Steam-Controller.desktop

Add the following contents to the file:

[Desktop Entry] start

You can also install an on-screen keyboard:

sudo apt-get install florence

And then create a shortcut to it on the desktop:

touch ~/Desktop/keyboard.desktop

Then add the following contents to the file:

[Desktop Entry]

Install Steam Link

sudo apt update
sudo apt install steamlink

Install Docker

curl -fsSL | sh

Install Pi Hole

curl -sSL | bash

Install DNS over HTTPS

Follow Pi Hole's official instructions:

Install Useful Packages

sudo apt-get install tree screen tmux


You can see the icons available for desktop shortcuts in /usr/share/pixmaps/