Pi stuff

I thought I would try and add a few pages about the Raspberry Pi. In the past I managed to make pages giving details and linking them to a menu. This though has not worked out well this time.

I guess the software has improved a bit, so that particular hack is not possible anymore ?

So I just did them all as posts and linked them together. Hopefully this will work. Or I will suddenly realise that there is a better way of presenting them.

General Raspberry Pi Commands

Add A New User

sudo adduser alice

You will be prompted to create a password.

The new user home directory is at /home/alice/

Add to the sudo group and give sudo permissions:

sudo adduser alice sudo

sudo su: If it runs aok account is in sudo group.

Add user to groups via: Sudo adduser alice adm

Add to the following groups: adm dialout cdrom sudo audio video plugdev games users input netdev gpio i2c spi

Disable wifi & bluetooth

Sudo apt install rfkill:  Sudo rfkill list all

Sudo rfkill block Bluetooth:  Sudo rfkill block wifi

OR Edit config file

Sudo nano /boot/config.txt

# Disable Bluetooth:  Dtoverlay=pi3-disable-bluetooth

#Disable Wi Fi:  Dtoverlay=pi3-disable-wifi

Add Video Codecs

From a command prompt type:

sudo nano /boot/config.txt  –

Add the line: decode_MPG2=XXXXXXX

Where XXXXXX is the code you got when you bought the MPG2 licence from the Raspberry Pi store.

Then CTRL O to save the file then CTRL X to exit.

Check if enabled from the command prompt by typing:

vcgencmd codec_enabled MPG2

vcgencmd codec_enabled WVC1

To shred a file:

Open a command prompt in the directory the file (called test.doc) you want to shred is located.

Type:

shred –u test.doc

The -u can be replaced with the following:

-f: Changes permissions to allow writing if needed

-n=x: Overwrites x times instead of the default (*3)

-s=x: Specifies the number of bytes, x, to shred

-u: Truncates and removes files after overwriting

-v: Shows verbose information about the progress

-x: Do not round file sizes up to the next full block

-z: Adds a final overwrite with zeros to hide shredding

-u: Removes the file after overwriting

Linux Encryption

To create an encrypted usb stick connect to the internet and type the following from a command prompt:

sudo apt install cryptsetup

sudo apt install gparted

To view cryptsetup encryption data type

cryptsetup –help

To encrypt a file with gpg

To encrypt a file called test.doc, open the command prompt in the directory it is located in and type:

gpg –c test.doc

You will then be asked to enter the password you want to use. Twice.

To decrypt the file stay in the directory and type:

gpg test.doc.gpg

Enter your password and you should see the document appear in the folder.

How To Install Kodi

With a Raspberry Pi you can listen to music, watch tv and videos and generally use it as a home entertainment system.

You should be able to do most things with VLC (which comes installed with Raspbian OS). However you can also use other free software such as OSMC, Volumio or Kodi.

I thought I would try Kodi as it is available as an install from the Raspberry Pi repository. Learning to do everthing (and in the right order) involved a fair amount of searching online, but I managed to distil the process down to the following:

I used the following hardware:

Raspberry Pi 3B+ / 16 GB micro SD card / Keyboard / Mouse / Monitor /

Download Raspbian Lite and check the SHA-256 checksum is right. Put the .img file on a micro sd card using software called imager. (Available from the Raspberry Pi website)

Put the card in the RPi 3B+ and connect to a screen a keyboard and mouse and switch it on. It will go through its set-up procedure which should only take a minute or two.

Change the default password and connect to the Pi to the internet. At the command prompt type:

sudo apt update

sudo apt install ufw

sudo ufw enable

Restart the RPi. At the command prompt type:

sudo apt update

sudo apt upgrade

Then type: Y

This should install all the software updates.
Restart the RPi. Then at the command prompt, install the desktop via:

Sudo apt install raspberrypi-ui-mods
Sudo reboot

Open a terminal window and type the following:

Sudo apt install kodi
Reboot

Open a terminal window and type:

Sudo raspi-config

Change the memory split so that the GPU has 256 megabytes
Change the boot options so that the RPi boots to cmd
Open a terminal window and type the following:

crontab –e

Choose the nano option

Add: @reboot kodi –standalone

Crtl O then Crtl X to save and close the file.

You might also like to stop the firewall if not going back on line again by going to a command prompt and type:

sudo ufw disable

Reboot and hey presto Kodi should start up and be available to you.

There is a way to install the RPi Lite OS without the raspberrypi-ui-mods and then install

Kodi and add the dependancies that the Kodi gui needs. It looks a bit complex from what I have read online so I just chose to do it this way.

It seems relatively simple and it works for me. I will try at some point to do it without the Raspberry Pi gui which should free up some more resources.