Wachalarm-Monitor/image-setup.md
Jarno Rantanen f0eabbe54d Ensure X will be running on VT8.
For whatever reason, since ubuntu-mate-15.10.3 it defaults to VT7.

Closes #6
2016-04-20 12:06:20 +03:00

3.4 KiB

Image setup

Baseline setup

  1. Flash your SD card (assuming OS X):

    1. Get Ubuntu MATE 15.10.1 and decompress into an .img file
    2. $ diskutil list to check correct device
    3. $ diskutil unmountDisk /dev/disk2 to prepare it for imaging
    4. $ sudo dd bs=1m if=ubuntu-mate-15.10.1-desktop-armhf-raspberry-pi-2.img of=/dev/disk2 (may take up to an hour)
  2. Boot your Raspberry Pi using the SD card

  3. Answer basic questions (timezone, keyboard layout, default user, etc)

    1. Set hostname to chilipie-kiosk
    2. Set username/password to pi:raspberry (or whatever you want)
    3. Log in automatically after boot
  4. At this point you can already SSH onto the Pi and do the rest of the setup remotely

  5. $ sudo visudo and add pi ALL=(ALL) NOPASSWD: ALL to allow sudo without password prompt

  6. Disable MATE's default desktop with $ sudo graphical disable (though later nodm will boot directly to matchbox anyway)

  7. Clean up MATE's desktop cruft with $ rm -rf ~/*

  8. Install some packages we'll need:

    1. $ sudo apt-get update && sudo apt-get install -y vim nodm matchbox-window-manager unclutter mailutils nitrogen jq chromium-browser=45.0.2454.101-0ubuntu1.1201 chromium-codecs-ffmpeg=45.0.2454.101-0ubuntu1.1201
    2. When mailutils prompts about its setup, "local only" is fine
  9. Make sure automatic software updates are disabled, in /etc/apt/apt.conf.d/10periodic:

     APT::Periodic::Unattended-Upgrade "0";
     APT::Periodic::Update-Package-Lists "0";
     APT::Periodic::Download-Upgradeable-Packages "0";
     APT::Periodic::AutocleanInterval "0";
    
  10. In /etc/default/nodm, set:

     NODM_ENABLED=true
     NODM_USER=pi
     NODM_FIRST_VT=8
    
  11. Get default scripts with $ wget "https://github.com/futurice/chilipie-kiosk/archive/master.zip" && unzip master.zip && cp -v $(find chilipie-kiosk-master/home/ -type f) . && rm -rf chilipie-kiosk-master/ master.zip

  12. Put in the example crontab with $ crontab -e:

     # m h  dom mon dow   command
    
     # 0  7 * * 1-5 ~/display-on.sh  # turn display on weekdays at 7 AM
     # 0 19 * * 1-5 ~/display-off.sh # turn display off weekdays at 7 PM
    
  13. Reboot (should land you in Chromium)

  14. Configure Chromium to start from "where you left off", and navigate to https://github.com/futurice/chilipie-kiosk/blob/master/first-boot.md

Optional: WLAN

  1. Check the interface name with $ ifconfig, e.g. wlan0

  2. Append to /etc/network/interfaces:

     allow-hotplug wlan0
     iface wlan0 inet dhcp
     wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
     iface default inet dhcp
    
  3. In /etc/wpa_supplicant/wpa_supplicant.conf:

     network={
         ssid="networkname"
         psk="secretpassword"
     }
    
  4. Reboot

Preparing the image

  1. Disable SSH access (because the default credentials aren't very secure): $ sudo systemctl disable ssh.service
  2. Shut down the Raspberry Pi
  3. Dump the image to disk (assuming OS X):
    1. $ diskutil list to check correct device
    2. $ diskutil unmountDisk /dev/disk2 to prepare it for imaging
    3. $ sudo dd bs=1m count=5120 if=/dev/disk2 of=chilipie-kiosk-$TAG.img (only dump the relevant first 5 GB)
    4. $ openssl sha1 chilipie-kiosk-$TAG.img and include hash in release notes
    5. $ zip chilipie-kiosk-$TAG.zip chilipie-kiosk-$TAG.img