Begin writing copy to sd section.
This commit is contained in:
144
readme.org
144
readme.org
@ -34,6 +34,7 @@ raspberry pis.
|
|||||||
documentation to support a control plane of more than one machine.
|
documentation to support a control plane of more than one machine.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
** Boot media
|
** Boot media
|
||||||
|
|
||||||
This guide requires each Raspberry Pi to have a removable SD card or
|
This guide requires each Raspberry Pi to have a removable SD card or
|
||||||
@ -87,86 +88,87 @@ raspberry pis.
|
|||||||
Checking file is now present
|
Checking file is now present
|
||||||
-rw-rw-rw- 1 james james 60299545 Aug 12 08:35 raspberrypi-ua-netinst-v2.4.0.zip
|
-rw-rw-rw- 1 james james 60299545 Aug 12 08:35 raspberrypi-ua-netinst-v2.4.0.zip
|
||||||
Extracting the zip file
|
Extracting the zip file
|
||||||
|
drwxrwxrwx 1 james james 4096 Dec 24 19:35 installer
|
||||||
|
-rw-rw-rw- 1 james james 1351 Dec 24 18:02 installer-config.txt
|
||||||
#+end_example
|
#+end_example
|
||||||
|
|
||||||
|
|
||||||
** Apply custom configuration
|
** Apply custom configuration
|
||||||
|
|
||||||
Our next step after downloading the
|
Our next step after downloading the latest release is to apply our own
|
||||||
|
installation configuration using a simple txt file.
|
||||||
|
|
||||||
|
There is great documentation online howing what configuration options are
|
||||||
|
available [[https://github.com/malignus/raspberrypi-ua-netinst/blob/master/doc/INSTALL_CUSTOM.md][here]].
|
||||||
|
|
||||||
|
For our purposes we just over-write the file downloaded and extracted in
|
||||||
|
the previous step with one we have prepared earlier :)
|
||||||
|
|
||||||
|
#+NAME: Overwrite installer configuration file
|
||||||
|
#+begin_src shell :results output code verbatim replace :wrap example
|
||||||
|
echo Display wordcount of original file for comparison
|
||||||
|
wc installer/raspberrypi-ua-netinst/config/installer-config.txt
|
||||||
|
|
||||||
|
echo Overwriting /installer/raspberrypi-ua-netinst/config/installer-config.txt
|
||||||
|
cp installer-config.txt /installer/raspberrypi-ua-netinst/config/
|
||||||
|
|
||||||
|
echo Display wordcount of file after copy to validate update
|
||||||
|
wc installer/raspberrypi-ua-netinst/config/installer-config.txt
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
#+RESULTS: Overwrite installer configuration file
|
||||||
|
#+begin_example
|
||||||
|
Display wordcount of original file for comparison
|
||||||
|
33 64 1351 installer/raspberrypi-ua-netinst/config/installer-config.txt
|
||||||
|
Overwriting /installer/raspberrypi-ua-netinst/config/installer-config.txt
|
||||||
|
Display wordcount of file after copy to validate update
|
||||||
|
33 64 1351 installer/raspberrypi-ua-netinst/config/installer-config.txt
|
||||||
|
#+end_example
|
||||||
|
|
||||||
|
|
||||||
|
* Step 2 - Copy the install media to sd card
|
||||||
|
|
||||||
|
Our next step is to copy the contents of the ~installer/~ folder
|
||||||
|
to a *FAT32* formatted SD Card.
|
||||||
|
|
||||||
|
Unfortunately this is currently a windows step as my dev environment
|
||||||
|
is a Windows 10 laptop with Debian via Windows Subsystem for Linux
|
||||||
|
which does not support ~lsblk~ or other disk management commands.
|
||||||
|
|
||||||
|
Our first step is to insert the SD Card and ensure it is formatted
|
||||||
|
correctly as ~FAT32~. To do that we need to know the number of the
|
||||||
|
disk we want to format, we can find that via powershell.
|
||||||
|
|
||||||
|
#+NAME: Get disks via windows powershell
|
||||||
|
#+begin_src shell :results output code verbatim replace :wrap example
|
||||||
|
echo Retrieving disk list via powershell
|
||||||
|
powershell.exe -nologo
|
||||||
|
get-disk | select Number, FriendlyName, Size
|
||||||
|
exit
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
#+RESULTS: Get disks via windows powershell
|
||||||
|
#+begin_example
|
||||||
|
Retrieving disk list via powershell
|
||||||
|
|
||||||
|
PS get-disk | select Number, FriendlyName, Size
|
||||||
|
Number FriendlyName Size
|
||||||
|
------ ------------ ----
|
||||||
|
1 Realtek PCIE Card Reader 31104958464
|
||||||
|
0 SAMSUNG MZVLB256HAHQ-000H1 256060514304
|
||||||
|
|
||||||
|
#+end_example
|
||||||
|
|
||||||
* Step 2 - Write the image file to removable media
|
|
||||||
|
Once we know the number of the disk we want to format we can proceed.
|
||||||
|
In the example above I have a 32GB SD Card which shows as number ~1~.
|
||||||
|
|
||||||
Our next step is to write the downloaded image file to our removable
|
Our next step is to again user powershell, this time to format the sd.
|
||||||
media. This step needs to be repeated for each raspberry pi in the
|
|
||||||
cluster.
|
|
||||||
|
|
||||||
*Note:* As my development environment is based on [[https://docs.microsoft.com/en-us/windows/wsl/about][wsl]] I need to use
|
#+NAME: Format the sd card
|
||||||
a third party tool to write the image. If you are on a standard linux
|
#+begin_src shell :results output code verbatim replace
|
||||||
distribution you can use the ~dd~ utility to write the image.
|
|
||||||
|
|
||||||
The image writing utility I use is [[https://www.balena.io/etcher/][balena etcher]]. After downloading
|
|
||||||
the latest version:
|
|
||||||
- Insert your removable media.
|
|
||||||
- Select the image file you downloaded earlier.
|
|
||||||
- Select your removable media and start writing the image.
|
|
||||||
|
|
||||||
|
|
||||||
* Step 3 - Enable ssh at startup
|
|
||||||
|
|
||||||
As our cluster will be headless, i.e. have no screen keyboard or mouse
|
|
||||||
plugged in we need to ensure ssh is configured from boot so that we can
|
|
||||||
remotely connect.
|
|
||||||
|
|
||||||
To do this we just need to add an empty file named ~ssh~ to our newly
|
|
||||||
created sd card
|
|
||||||
|
|
||||||
#+NAME: Mount newly formatted sd card
|
|
||||||
#+BEGIN_SRC shell
|
|
||||||
sudo mkdir /media/sdcard
|
|
||||||
sudo mount /dev/[SDCARD] /media/sdcard -o umask=000
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
|
|
||||||
#+NAME: Create the blank ssh file in the boot directory
|
|
||||||
#+BEGIN_SRC shell
|
|
||||||
sudo touch /media/sdcard/ssh
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
|
|
||||||
* Step 4 - Enable wifi at startup
|
|
||||||
|
|
||||||
For this guide we are running our cluser wirelessly. To ensure we can
|
|
||||||
access our pi's once they boot we need to ensure they boot with a wifi
|
|
||||||
configuration that will connect to our desired network.
|
|
||||||
|
|
||||||
To achieve this we need to set a configuration for the [[https://en.wikipedia.org/wiki/Wpa_supplicant][wpa_supplicant]]
|
|
||||||
application that our raspberry pi's use for managing wireless.
|
|
||||||
|
|
||||||
For security reasons I don't store wireless access point details here.
|
|
||||||
Instead they are retrieved at runtime of the code block using the
|
|
||||||
[[https://bitwarden.com/][bitwarden]] command line utility.
|
|
||||||
|
|
||||||
#+NAME: Write the wireless configuration file
|
|
||||||
#+BEGIN_SRC shell
|
|
||||||
export WIRELESS_SSID=`bw get username wifi`
|
|
||||||
export WIRELESS_PASS=`bw get password wifi`
|
|
||||||
cat > /media/sdcard/wpa_supplicant.conf << EOF
|
|
||||||
country=nz
|
|
||||||
update_config=1
|
|
||||||
ctrl_interface=/var/run/wpa_supplicant
|
|
||||||
|
|
||||||
network={
|
|
||||||
scan_ssid=1
|
|
||||||
ssid=$WIRELESS_SSID
|
|
||||||
psk=$WIRELESS_PASS
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
After writing the file we will use ~cat~ to verify the details.
|
|
||||||
If all details are correct you can unmount and remove the media.
|
|
||||||
|
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user