Creating a New RasPi PABLO SD Card Image
Maintained by: mikerb@mit.edu Get PDF
src: project-pavlab/mtasc/mt_pablo_build
1 Building a New RasPi Image Overview
1.1 Two Types of PABLOS - One SD Card Image
1.2 PABLO Unique Identifiers
1.3 Getting the latest Rasbian OS on a new SD boot card
1.4 Log onto Pi and Get initial packages
1.5 Log onto Pi, Set up a new student2680 user
1.6 System config (MIT preferences)
1 Building a New RasPi Image Overview
Modifications to the Raspberry PI computers in the PABLO boxes are mostly handled by automated scripts that pull down software updates and configuration changes upon reboot. For PABLOS in an MTASC cluster, updates happen automatically upon reboot, and for PABLOS used in Herons or other projects, the updates are initiated by the user logged into the PABLO.
Occasionally changes need to be applied to the RasPi image that cannot be carried out through automated scripts. Examples include (a) upgrading the current Raspbian (a.k.a. PiOS) release, (b) updating packages, or (c) mods to the system configuration in /etc for example.
In these circumstances, we either (1) identify one of the PABLO Pis as master, apply the changes, or (2) create a new master image from scratch, customized to the PavLab configuration. In either case, the master is then cloned with a disk cloner and the SD cards on all the other PABLOS are physically replaced. The former may happen once or twice per year, the latter happens once every year or two.
This document covers the creation of a new master image from scratch.
1.1 Two Types of PABLOS - One SD Card Image [top]
PABLO boxes are used in one of two primary ways in our lab. As a backseat computer in one of our Heron robots, or as a node in an MTASC cluster. The SD card image is the same in both use cases.
1.2 PABLO Unique Identifiers [top]
It is worth restating that PABLOS in MTASC clusters have unique identifier names. For example mts01, mts02, mts50 in a 50-node MTASC cluster. These names refer to both the label on the outside of the box, and the machine name shown on the command-line prompt when logged in. The unique identifier is tied to the Pi board itself, namely the MAC address of the Ethernet card. Inside the pablo-common tree, there is script get_vnames.sh which checks the MAC address and assigns the name.
We mention that here to be clear that it does not matter which SD card goes in which machine. Initially they should all have exactly identical SD card images. Even after operation for some period, any SD card can be switched into any other PABLO.
1.3 Getting the latest Rasbian OS on a new SD boot card [top]
(1) Find a 32G MicroSD card and MicroSD card reader and insert into your computer (2) Go to the Raspberry PI website and follow instructions for using the \var{"Raspberry Pi Imager"} tool. (3) Use the tool. When prompted make student2680 user. (4) Unmount the SD card and plug it into the PI with a monitor/keyboard.
1.4 Log onto Pi and Get initial packages [top]
Note: This is done initially with a monitor and keyboard.
$ apt-get --assume-yes install emacs wget members cmake \ subversion screen ncdu watch git If will be using with a USB blinkstick (MIT yes for sure): $ sudo apt-get install python3-pip (probably already have) $ sudo pip install blinkstick $ sudo blinkstick --add-udev-rule Further blinkstick note: Running blinkstick the first time produced an error: /usr/bin/env: 'python3\r' : No such file or directory This apparently was due to the python script (/usr/local/bin/blinkstick is actually a python script) having the wrong line endings. Described here. https://forums.raspberrypi.com/viewtopic.php?t=180848 The fix: $ cd /usr/local/bin $ tr -d '\r' <blinkstick >new_blinkstick $ mv blinkstick old_blinkstick $ mv new_blinkstick blinkstick May also need to change this file to be executable
1.5 Log onto Pi, Set up a new student2680 user [top]
$ sudo groupadd student2680 $ sudo useradd -g users -G student2680 -s /bin/bash -d /home/student2680 student2680 $ cd /home; sudo mkdir student2680 $ cd /home; sudo chgrp -R student2680 student2680 $ cd /home; sudo chown -R student2680 student2680 $ sudo passwd student2680 $ sudo usermod -G dialout,sudo student2680 username=pi, passwd=pavlab2012
1.6 System config (MIT preferences) [top]
(1) Security Edit /etc/hosts.deny and add the below lines: # MIT PABLO Setting ALL: PARANOID (2) Security Edit /etc/hosts.allow and add the below lines: # MIT ALL: 128.30.*.*, 128.31.*.*, 18.38.*.* # Local subnet ALL: 192.168.*.*, 10.1.*.*, 10.42.*.*, # localhost ALL: 127.0.0.1 (3) Change host name from RasPi to PABLO In /etc/hosts add the following line (rm the raspberry pi line) 127.0.1.1 PABLO In /etc/hostname, set the one line to: PABLO (4) Allow ssh access In /etc/ssh/sshd_config, add the following line: AllowUsers student2680 near/at the bottom Then restart ssh: $ sudo /etc/init.d/ssh restart
(5) SSH Keys Add ssh key to allow incoming connections Add ssh key to allow data dumps to oceanai (6) Make sure ssh is started upon boot $ sudo systemctl enable ssh (7) Make symlink from /sbin/ifconfig to /usr/bin/ifconfig Reason: when ipaddr_info.sh runs this within pHostInfoV2, it does not have permission to run things in /sbin/. (8) Configure eth0 to have a fall-back IP address. Edit the file /etc/dhcpcd.conf Uncomment the below lines typically at the end of the file: -------------------------------------- # It is possible to fall back to a static IP if DHCP fails: # define static profile profile static_eth0 static ip_address=192.168.2.24/24 static routers=192.168.2.1 static domain_name_servers=192.168.2.1 # fallback to static profile on eth0 interface eth0 fallback static_eth0 --------------------------------------
(9) Allow student2680 user to execute poweroff, reboot and shutdown without needing to provide credentials. Edit the /etc/sudoers file. $ sudo visudo /etc/sudoers Add the line: student2680 ALL=(ALL) NOPASSWD: /sbin/poweroff, /sbin/reboot, /sbin/shutdown Note: To execute say shutdown, the user student2680 still needs to type $ sudo shutdown -h now, but won't be prompted for password Note: Normally remote shutdown will come from within pablo_common/bin/pablo_halt.sh https://askubuntu.com/questions/168879/shutdown-from-terminal-without-entering-password
Page built from LaTeX source using texwiki, developed at MIT. Errata to issues@moos-ivp.org. Get PDF