Setting up a Raspberry Pi 3

Robert Andresen Blog, PC and apps, Reviews, Tutorials Leave a Comment

My last Pi’s was one of the first ones (2x USB) from around 2012/13. I just bought the new Pi 3, but not all was straight forward…

First of all, the filesystem is limited to 3,5 GB of my 16GB SD Card – after creating it with the Win32 Disk Imager and the default Raspbian image. “df -h” shows that the OS takes 100% of the space, making it very unstable.

I will use this post as notes to my self and help to others who is playing around with the Pi ūüôā I will update the post as I find new things.

 

I’m not sure what I am going to use it for at this moment, but I have some ideas:

  • Public display / Digital signage
  • Retropi (Gaming console)
  • Testing with some smarthome gadgets
  • Ubiquiti controller

 

Rasbian

raspbian

Config

Extend the filesystem to use the whole SD card

Open terminal
sudo raspi-config
Select option 1 (Expand Filesystem)
Reboot

Install Google Chrome (Chromium 49)

Source: https://www.raspberrypi.org/forums/viewtopic.php?t=121195

wget -qO – http://bintray.com/user/downloadSubjectPublicKey?username=bintray | sudo apt-key add –
echo “deb http://dl.bintray.com/kusti8/chromium-rpi jessie main” | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get install chromium-browser rpi-youtube -y

Use the whole screen

Don’t know why, but Raspbian has a default overscan (probably to create better support for weird monitors?)

To make Raspbian fill the whole screen, you have to edit the /boot/config.txt file, and you need to be root/sudo user.

sudo vi /boot/config.txt

Make sure disable_overscan is set to 1, and there is no # in front of the line.

Need to find solutions for

  • Black screen / powersaver

Bugs

Here are some bugs or weird behavior I have encountered so far, with a solution if I have found any.

Wireless network – Sometimes the wireless network just disappears. All networks are just gone and I need to restart to connect again.

Solution: N/A

 

Ubuntu Mate 15.10.3 (and some 16.04  testing)

ubuntu-mate

First impression of the Mate is really good. You get a Wizard at the first boot to select timezone, keyboard layout, etc. – saving you the time of looking for it, like in Raspbian.

The colors, gui and about everything looks better with the Ubuntu Mate. It’s certainly a better OS for desktop use. It also comes with Firefox as default browser, that hasn’t crashed one time in my testing yet – in opposite of Epiphany that can’t stay up for more than a couple of minutes a time.

 

Update 27.04.2016
Ubuntu Mate 15.10.3 vs 16.04

After testing the new release of 16.04, I’m not impressed. The GUI feels a bit slower and the Pi freezes often. Maybe I need to do some testing with another Pi or powersupply – or just try to re-install the OS.

It also important to know that the 16.04 has just been out for å couple of days, so there will probably be a lot of bugs.

 

Config

Use the whole screen

Edit the /boot/config.txt as described for Raspbian above.

Powersaver / Screensaver

Navigate to “System” at the top, then on Preferences, Look and Feel, Screensaver.

There you can configure as you want. Remember to also check the Power Management -button.

Resize the disk

Update 27.04.2016: Ubuntu Mate 16.04 expands memorycard by default, so there is no rush to expand it. My root partition had 7,2 GB of my 16GB card, and uses only 50% of it.
I tried following this video first, but couldn’t find Gparted after installation, so I followed this guide instead:¬†http://linux.softpedia.com/…-expand-the-filesystem-of-ubuntu-mate-for-raspberry-pi-2-497557.shtml.

Also described here: https://ubuntu-mate.org/raspberry-pi/

sudo fdisk /dev/mmcblk0

Then, in the fdisk program, you must press the d, 2, n, p, 2, Enter, Enter, and w key, in this exact same order, pressing the Enter key after each one. After that, reboot the Ubuntu MATE operating system, open the Terminal app again and run the following command.

sudo resize2fs /dev/mmcblk0p2

Firefox cannot resolve .local DNS on network

More info: http://www.lowlevelmanager.com/2011/09/fix-linux-dns-issues-with-local.html

Open /etc/avahi/avahi-daemon.conf as administrator.
Edit domain-name settings from local to alocal – either uncomment or add a new line like:
[server]
domain-name=alocal

Open /etc/nsswitch.conf and replace the line
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
with
hosts: files dns

Autostart Firefox webpage in fullscreen

Most of the forum threads I have found only points to some kind of kiosk plugin for Firefox, but I was just interested in a clean “open webpage in fullscreen” from the commandline. The only solution I found was a “keyboard” script with xdotools.

Install xdotools
sudo apt-get install xdotools

Create a shell-script

Create a file some place and name it something, like firefox_autostart.sh.
This is my file:

#!/bin/bash
firefox http://mywebpage.no &    #Set your own URL
sleep 8
xdotool key F11

The sleep is just to create some time¬†(in seconds) between¬†the commands. You can play around with the sleep-time as you want, but too little space will create unwanted behavior – like if you don’t put sleep after Firefox command, my terminal (where I ran the script from) got in fullscreen, instead of Firefox.

Tip: You can also add something like xdotool key F5, to refresh the page after going to fullscreen.

Autostart .sh script on startup/login

System -> Preferences -> Personal -> Startup Applications

Click Add
Create a name, like “Firefox_autostart
Write a command or browse the script-file.
Click Save

Restart to check if it works.

I added a sleep¬†20¬†before Firefox starts, just to get some breathing room on the startup, and I changed the sleep 8 before F11-key, as 8 seconds didn’t go so well.

Rotate monitor/display 90 degrees

I wanted to test the Raspberry on a vertical aligned 23″ touch monitor from Acer – so I needed to rotate the image 90 degrees. The display settings in GUI wasn’t much help as it didn’t allow me to configure a thing.

I had to solve this by edit the /boot/config.txt, scroll/search, find and set display_rotate=1.
1 is a value for 90 degrees. The values and degrees are described in the config-file. Restart after editing the file.

The touch worked out-of-the-box for the Acer monitor, but the X and Y axes for the touch was not correct after I rotated the display.

Rotate touch/mouse -input for 90 degrees Touch monitor

Source: https://www.raspberrypi.org/forums/viewtopic.php?f=108&t=120793

To fix the X and Y axes for the touch input after I rotated the display, I had to use xinput tool.

sudo apt-get install xinput
xinput –list

This will give you a list of your input devices (mouse and keyboard) and ID for each device. Mine was Virtual core pointer -> Advanced Silicon S.A CoolTouch (TM) System with ID=7.

I had to flip the axes both ways (up/down and sides).

xinput set-prop 7 ‘Evdev Axes Swap’ 1
xinput set-prop 7 ‘Evdev Axis Inversion’ 0 1

The 7 was the ID of my monitor. If your touch goes the wrong way, you just need to switch the 0 1 to 1 0 at the end.

Looks like it doesn’t support multitouch yet, so I still have to figure out that part –¬†I only mark the text in a webpage if I try to scroll it by touch.

 

Bugs

Javascript not working in Firefox

I tried to install a Kiosk addon at first. Looks like the addon disabled javascript on my Firefox-userprofile for some reason.

Solution:
Go til about:config in the URL field.
Search for “javascript”
If Javascript is disabled => Right click with the mouse and click Toggle.