What is Fedora IoT Fedora IoT is a Fedora Edition for Internet of Things. It is one of the current Fedora Project objectives. It can obviously run on ARM (at the moment only the aarch64 architecture) devices like the Raspberry Pi as well on x86_64 machines. It is a Fedora edition based on OSTree, like the former Fedora Atomic Host [link] and the former Fedora Atomic Workstation, now Fedora Silverblue [link]. From a user point of view, OSTree, among other things imply these advantages: Atomic updates: an update to the operating system is performed as a whole, and it is not performed package per package. In addition, if something goes wrong, like a power outage during the update process, the system will reboot with the previous installation in place, without any modification; or if the upgrade introduces some unwanted bug, you will be able to rollback to the previous working image. In the future we will see automatic updates and rollback. Immutable system: the base operating system is read only. This is a great advantage from a security point of view: it is not allowed to put or change the files under certain core directories, for instance a potential malware cannot replace an executable in /usr/bin directory Container oriented. Even though Fedora uses rpm-ostree, with which you can install (overlay) traditional packages to the base operating system, it is an healthy habit leaving the base operating system unaltered and use the containers for actual applications and day-to-day job. For this scope, Fedora IoT ships podman. What is Podman Podman is an utility similar to the docker command line and is designed to create and manage containers. As opposed to Docker, Podman doesn’t need any daemon, making it suitable also for devices with limited resources. With Podman you can start containerized services with systemd unit files, and a bunch of other features. It is also a nice tool to start learning the containers world. Download and install Fedora IoT Even though Fedora IoT images are considered in the very early stages, we should wait Fedora 29 for a more solid release, here you can download the image: https://kojipkgs.fedoraproject.org/compose/iot/latest-Fedora-IoT-28/compose/IoT/ To install the system you can flash the SD card with the dd command, or use the fedora-arm-installer tool. You can find more info on the Fedora wiki https://fedoraproject.org/wiki/InternetOfThings/GettingStarted#Setting_up_a_Physical_Device Remember that you probably have to resize the third partition. Once inserted the SD card in the device, to complete the initial setup you need a serial connection or an hdmi display with a keyboard. The only thing you have to complete is the creation of an user. Once logged in you have to configure the Ethernet connection. For instance nmcli connection add con-name cable ipv4.addresses 192.168.0.10/24 ipv4.gateway 192.168.0.1 connection.autoconnect true ipv4.dns "8.8.8.8,1.1.1.1" type ethernet ifname eth0 ipv4.method manual Or if there is a DHCP nmcli con add type ethernet con-name cable ifname eth0 Two words about the GPIO on Fedora GPIO sysfs interface is deprecated, and in the future upstream kernel will kill it off definitively due to security and other issues. So in Fedora the kernel is already compiled without such flag. As a consequence we don't have the /sys/class/gpio path and many examples you can find around doesn’t work. On the other hand, upstream kernel provides the new character device /dev/gpiochipN To interact with this device we can't use ordinary commands line tools (echo, cat, etc), but you have to go through library and cli tools. Such tools are in the libgpiod-utils package and a corresponding Python library is provided by python3-libgpiod Creating a container with Podman These are the steps: Create a base image with the required packages inside it Create a new container starting from our image Create a file called Dockerfile like this, that instructs podman to build an image based on the latest Fedora image available in the registry, then update the system inside it and install some packages: FROM fedora:latest RUN dnf -y update RUN dnf -y install libgpiod-utils python3-libgpiod Now you can build your base image. sudo podman build --tag fedora:gpiobase -f ./Dockerfile Now you have your “custom” image with all the bits in place. This way we can mess inside the container as far as we want, without having to start from scratch every time with the DNF stuff. sudo podman images REPOSITORY TAG IMAGE ID CREATED SIZE localhost/fedora gpiobase 67a2b2b93b4b 10 minutes ago 488MB docker.io/library/fedora latest c18042d7fac6 2 days ago 300MB Now, you can create a new container where you can actually experiment with the GPIO. You will use the “--device” option that will add the GPIO device to the container. In the Raspberry Pi 3 you are interested in /dev/gpiochip0 sudo podman run -it --name gpioexperiment --device=/dev/gpiochip0 localhost/fedora:gpiobase /bin/bash You are now inside the container. You can exit from the container typing `exit` or CTRL+D From the host system you can list the containers with sudo podman container ls -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 64e661d5d4e8 localhost/fedora:gpiobase /bin/bash 37 seconds ago Exited (0) Less than a second ago gpioexperiment Create a new container sudo podman run -it --name newexperiment --device=/dev/gpiochip0 localhost/fedora:gpiobase /bin/bash And delete it sudo podman rm newexperiment Turn on an LED If you exited from the container, you can start it using. sudo podman start -ia gpioexperiment As stated before, you have to use the CLI tools provided by the libgpiod-utils package. # gpiodetect Will print the GPIO chips list gpiochip0 [pinctrl-bcm2835] (54 lines) To get the list of the lines exposed by a chip # gpioinfo gpiochip0 Please, pay attention here: there is not a correlation between the number of physical pins and the number of lines printed by this command. What you should interested in is the BCM number, as you can see on this site https://pinout.xyz Please don’t play with lines number that doesn’t have a corresponding BCM number! Now let’s connect an LED to the physical pin 40, that is BCM 21. Please remember: short leg of the LED (the negative leg, called the cathode) must be connected to a GND pin of the Raspberry Pi, maybe with a 330 ohm resistor, and the long leg (the anode) connected to the physical pin 40. With this command the LED should light up until you press CTRL+C gpioset --mode=wait gpiochip0 21=1 With this command the LED should be light up for 5 seconds (-b stans for background). gpioset -b -s 5 --mode=time gpiochip0 21=1 Another useful command is gpioget, to get the status of a pin (high or low), that can be useful to play with buttons and switches. Conclusions You can also play with the LEDs using Python (https://github.com/brgl/libgpiod/tree/master/bindings/python/examples). Moreover, inside the container you can use the i2c devices as well. However the aim of this article was an introductory overview of the technologies that Fedora IoT will offer: an OSTree operating system, focused on containers, using an upstream Linux kernel. In addition, Podman is not strictly related to this Fedora edition, but you can install and use it on a regular Fedora installation; and at the end it whort to say that OSTree and Podman are two core components of the compelling new entries in the Fedora Project: Fedora Silverblue and Fedora CoreOS.