Introduction
Photon OS is a VMware initiative to create a lightweight Linux based OS with container support. I have to admit my initial reaction to Photon OS was: “y tho?”
It’s a reasonable reaction. There are MANY Linux based OS options out there already and essentially all of them have container support. The reason for creating Photon OS would seem to be that VMware wants their own rubber-stamped Linux OS as part of an ecosystem under their control.
Photon OS’s redeeming feature is the fact that it’s really lightweight. Not as lightweight as Ubuntu Core though. Photon OS for Raspberry Pi weighs in at 512Mb while Ubuntu Core is 450Mb. Still, given the influence of VMware in virtualization and their (our) inroads into IoT / M2M with Pulse, it’s likely that Photon OS will take off eventually.
Currently the main barrier to widespread adoption of Photon OS is a lack of commercial support. At the moment it is simply available as an unsupported download from GitHub (here). This could change in the future though and in that case we may see it being utilized more broadly and also outside the lab environments it is currently inhabiting.
Note that unlike Raspbian, which is 32bit, Photon OS is a 64bit operating system. That too may be something that’ll help float the boat for some.
Getting started with Photon OS on the Raspberry Pi
First download the image from here: http://dl.bintray.com/vmware/photon/3.0/GA/rpi3/photon-rpi3-3.0-26156e2.tar.xz
Deflate the zx compressed image and save to a micro-SD card:
tar xf photon-rpi3-3.0-26156e2.tar.xz cd rpi3/ sudo dd if=photon-rpi3-3.0-26156e2d.raw of=/dev/mmcblk0 bs=4M;sudo sync
In this example the SD card device is /dev/mmcblk0. This may differ on other systems of course. Please check with “lsblk” or so and please do be careful. Linux / Unix folks don’t refer to dd as “Disk Destroyer” for nothing.
Boot the Raspberry Pi and log in. The default credentials are: root / changeme
DHCP and SSH are both enabled by default and should make it possible to access the Pi across the network if using a wired connection (I haven’t tried though). With a Raspberry Pi it’s likely a wireless connection would be more convenient however. Configuring Wi-Fi is easy and is described in the section that follows.
Photon OS Wi-Fi configuration
There are a few steps to go through for Wi-Fi connectivity but it’s not difficult.
Start the wpa_supplicant service
systemctl start wpa_supplicant@wlan0
Enable the wpa_supplicant service (so it starts with the Pi)
systemctl enable wpa_supplicant@wlan0
Check the service status
systemctl status wpa_supplicant@wlan0
Edit the dhcp settings to get DHCP for wlan0 and not eth0
root@photon-rpi3 [ ~ ]# cat /etc/systemd/network/99-dhcp-en.network [Match] Name=e* [Network] DHCP=yes IPv6AcceptRA=no root@photon-rpi3 [ ~ ]#
Change “Name=e*” to “Name=w*” to capture the wlan0 interface instead of the wired eth0 interface
root@photon-rpi3 [ ~ ]# vi /etc/systemd/network/99-dhcp-en.network
It should now look something like this:
root@photon-rpi3 [ ~ ]# cat /etc/systemd/network/99-dhcp-en.network [Match] Name=w* [Network] DHCP=yes IPv6AcceptRA=no root@photon-rpi3 [ ~ ]#
Restart networking
systemctl restart systemd-networkd
Configuring the wpa supplicant
WordPress changes the “>” signs regardless of what I do. The actual command can be found here for reference: https://pastebin.com/raw/gB5FkuhC
wpa_passphrase yourSSID yourPassword >> /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
reboot
Installing Docker
Photon OS comes in a few different sizes and in the larger ones both Docker and Kubernetes are preinstalled. Not so with the Raspberry Pi version though, so we need to install Docker manually.
Packages are installed with either “yum” or “tdnf”. Docker is available from tdnf so we’ll use that to run the install below.
Refresh the cache but don’t update the packages
We need to refresh the tdnf cache to find the docker package. However, this process can also be used to update all packages. I found that this breaks Wi-Fi. So, if you use Wi-Fi I recommend:
root@photon-rpi3 [ ~ ]# tdnf update Then select "n" to just refresh the cache without updating any packages.
Search for Docker packages
root@photon-rpi3 [ ~ ]# tdnf list | grep docker docker.aarch64 18.06.2-2.ph3 photon-updates docker-doc.aarch64 18.06.2-2.ph3 photon-updates docker.aarch64 18.06.1-2.ph3 photon docker-doc.aarch64 18.06.1-2.ph3 photon ovn-docker.aarch64 2.8.2-3.ph3 photon docker-py.noarch 3.5.0-1.ph3 photon docker-py3.noarch 3.5.0-1.ph3 photon docker-pycreds.noarch 0.3.0-1.ph3 photon docker-pycreds3.noarch 0.3.0-1.ph3 photon root@photon-rpi3 [ ~ ]#
Install Docker
root@photon-rpi3 [ ~ ]# tdnf install docker Installing: libapparmor aarch64 2.13-7.ph3 photon-updates 66.57k 68168 libsepol aarch64 2.8-1.ph3 photon 611.89k 626576 libselinux aarch64 2.8-1.ph3 photon 174.16k 178338 libseccomp aarch64 2.3.3-1.ph3 photon 286.28k 293153 libltdl aarch64 2.4.6-3.ph3 photon 35.53k 36384 device-mapper-libs aarch64 2.02.181-1.ph3 photon 315.39k 322960 docker aarch64 18.06.2-2.ph3 photon-updates 154.39M 161893076 Total installed size: 155.85M 163418655 Is this ok [y/N]:y Downloading: libapparmor 39330 100% libsepol 275180 100% libselinux 84756 100% libseccomp 80091 100% libltdl 24218 100% device-mapper-libs 149078 100% docker 43826910 100% Testing transaction Running transaction Installing/Updating: libsepol-2.8-1.ph3.aarch64 Installing/Updating: libselinux-2.8-1.ph3.aarch64 Installing/Updating: device-mapper-libs-2.02.181-1.ph3.aarch64 Installing/Updating: libltdl-2.4.6-3.ph3.aarch64 Installing/Updating: libseccomp-2.3.3-1.ph3.aarch64 Installing/Updating: libapparmor-2.13-7.ph3.aarch64 Installing/Updating: docker-18.06.2-2.ph3.aarch64 Complete!
Start and Enable the docker service
root@photon-rpi3 [ ~ ]# systemctl start docker root@photon-rpi3 [ ~ ]# systemctl enable docker Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /lib/systemd/system/docker.service. root@photon-rpi3 [ ~ ]#
Verify the Docker installation
root@photon-rpi3 [ ~ ]# docker pull hello-world Using default tag: latest latest: Pulling from library/hello-world 3b4173355427: Pull complete Digest: sha256:2557e3c07ed1e38f26e389462d03ed943586f744621577a99efb77324b0fe535 Status: Downloaded newer image for hello-world:latest
root@photon-rpi3 [ ~ ]# docker run hello-world Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (arm64v8) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/ root@photon-rpi3 [ ~ ]#
That’s all! Photon OS is installed, Wi-Fi configured, Docker installed and verified. Ready to rock.