Difference between revisions of "Hardware: Raspberry Pi - Dashboard (Kiosk)"

From Luky-Wiki
Jump to: navigation, search
((optional) Migrate system to subvolume)
((optional) Migrate system to subvolume)
Line 176: Line 176:
 
mount /btrfs
 
mount /btrfs
 
</pre>
 
</pre>
 
 
  
 
Create subvolume by using snapshot feature:
 
Create subvolume by using snapshot feature:

Revision as of 20:33, 3 May 2016

Do You have spare RPi and big monitor / TV ? If yes then let's try to build dashboard. There are several ways how to get "data" on screen. Most common is to use browser to do all rendering and remote connections. This article describe configuration using browser. Browser needs X11 subsystem and there are several ways how to start X11 + browser. I selected two most common options.

Base OS

I recommend Rasbian installed using unattended installer. Keyboard is not necessary to perform installation and re-instillation. This article describe re-installation but with small modification you can use it also as initial installation. Raspbian UA installer can be obtained from release page or homepage.

Step 1

Cleanup /boot and replace it with UA installer.

cd /root
wget https://github.com/debian-pi/raspbian-ua-netinst/releases/download/v1.0.8.1/raspbian-ua-netinst-v1.0.8.1.zip

cd /boot
rm -rf *

unzip /root/raspbian-ua-netinst-v1.0.8.1.zip

Step 2

Configure root file system type and hostname / domain.

Invoke editor:

vi /boot/installer-config.txt

Insert following lines:

hostname=RPi-hostname
domainname=localhost.localdomain
rootpw=root
rootfstype=btrfs

Alter hostname/domainname to fit your installation. Root password stay visible in this configuration file after installation. I recommend do leave it as is here and change it later.

Step 3

Start installation:

cd /
umount /boot

reboot -f

For more details review Raspbian UA installer documentation. After installation log-in using ssh and user: root / password: root"

OS configuration

Initial config

UA installer install only minimum packages and configuration files. It is necessary to "customize" system upon first log-in.

Locales:

dpkg-reconfigure locales
en_GB.UTF-8...
en_US.UTF-8...
sk_SK.UTF-8...

Timezone:

dpkg-reconfigure tzdata
Europe/Bratislava

root password:

passwd

Base packages installation

Minimum set of tools:

apt-get install raspi-config btrfs-tools apt-utils

Note: separate installation of "apt-utils" will speed up later installation of packages

System tools (may help to diagnose problems later):

apt-get install screen htop nload git-core traceroute mc ddrescue rsync vim pydf lsof psmisc unzip util-linux collectl

HDMI port configuration

I highly recommend to disable overscan and properly configure connected TV / Monitor. It is necessary to switch TV aspect to "1:1", "Just", "16:9", "PC" or other mode (depending on vendor) to get 1:1 pixel mapping. Screen may be blurry without this configuration.

Overscan can be disabled by editing /boot/config.txt. Add following line:

disable_overscan=1

It may be neccesary to tweak it a bit more (depending on age of TV). Check RPiconfig for more details. Configuration is loaded on next reboot.

Network Time

If You don't like default NTP configuration and/or RPi can't be auto-configured for example via DHCP then configure NTP manually. Here is example how to do this configuration:

NTP daemon should be installed but to be sure:

apt-get install ntp

Then edit /etc/ntp.conf. I am using following configuration:

# Name of the servers ntpd should sync with

server ntp-server1
server ntp-server2

# local failback in case of network failure
server 127.127.1.0

# you should not need to modify the following paths
driftfile	/var/lib/ntp/ntp.drift
logfile		/var/log/ntp.log

# restriction config 
restrict default			nomodify notrap nopeer noquery
restrict 127.0.0.1			nomodify notrap nopeer

# EOF

Note: replace ntp-server1 and ntp-server2 with local ntp servers

Restart NTP to load new configuration:

/etc/init.d/ntp restart

Verify configuration using following command. It may take some time before NTP protocol settle down.

ntpq -p

Root Password + accounts

If You don't changed root password yet, then I recommend to do it now:

passwd root

Add user account(s):

useradd -m lukas
passwd lukas

Replace "lukas" with your preferred name :o)

Add dashboard user:

useradd -m dashboard

(optional) Migrate system to subvolume

One of great benefit of BTRFS is snapshots. It is necessary to have system in subvolume in order to utilize all its features. Here is step by step guide how to migrate system into subvolume.

Configure boot subvolume. Edit /boot/cmdline.txt and add following to end of line:

rootflags=subvol=system

Edit /etc/fstab and modify definition for / to looks like:

/dev/mmcblk0p2	/ 	btrfs 	noatime,subvol=system	0 0

Add entry point for btrfs system. Edit /etc/fstab and add following line:

/dev/mmcblk0p2	/btrfs 	btrfs 	noatime,subvolid=0	0 0

Create mountpoint and try to mount btrfs entry point:

mkdir /btrfs
chmod 0 /btrfs
mount /btrfs

Create subvolume by using snapshot feature:

btrfs sub snap / /system

Create file that indicate successful boot from subvolume and reboot system:

touch /system/boot_ok.txt

shutdown -r now

Browser started using display manager

Required packages

Configuration

Testing

Browser started using init

Required packages

Configuration

Testing

Synthetic F5 (reload)

Dashboard source posibilities

Watchdog

snapshot

backup ?