1. April 2022

How to develop for ESP32-C3 with Rust on macOS with Lima using Dev Container in VS Code

Lima is a solution for macOS for managing Linux VM on macOS which plays well with Dev Containers. It has several advantages over Docker Desktop for macOS or Podman.

Let’s see how it can be used for the development of software for embedded hardware like ESP32-C3 using source code from Ferrous Systems training:

git clone https://github.com/ferrous-systems/espressif-trainings.git

Install Lima and Docker-CLI:

brew install lima docker

Create Linux VM with Dockerd (following instructions from Kevin O’Brien – Utilizing Docker CLI without Docker Desktop):

curl https://raw.githubusercontent.com/lima-vm/lima/master/examples/docker.yaml -O
limactl start ./docker.yaml
limactl shell docker
sudo systemctl enable ssh.service

There is one important tweak in the Lima configuration. It’s necessary to enable write operation otherwise, the workspace mounted from VS Code is read-only. Open file ~/.lima/docker/lima.yaml and add writable flag to desired folder:

- location: "~"
  writable: true

Restart Lima to apply changes.

limactl stop docker
limactl start docker

Create context for Docker-CLI to connect to dockerd running in the VM:

docker context create lima --docker "host=unix://${HOME}/.lima/docker/sock/docker.sock"
docker context use lima

Open VS Code with the installed Remote Container plugin and click Re-Open in Container:

cd espressif-trainings
code .

Open terminal in VS Code and build the example:

cd intro/hardware-check
cp cfg.toml.example cfg.toml
cargo build

Flashing of the resulting file could be done by espflash and mounting the device to Lima or using a tool like Adafruit WebSerial ESPTool. The file for flashing is located in the directory target/release.

5. December 2019

Helm 3.x fails with Error: must either provide a name or specify –generate-name

If you follow tutorials on using Helm, it might happen that they’re outdated, because they’re targeting Helm 2.x.

Following command for install will fail with error:

helm install -n aks-georgik-rocks aks-georgik-rocks-chart
Error: must either provide a name or specify --generate-name

The fix is simple. The syntax for helm 3.x is following:

helm install [NAME] [CHART] [flags]

Just remove -n. The command will look like this:

helm install aks-georgik-rocks aks-georgik-rocks-chart

11. June 2019

How to start D-Bus in Docker container

Many Linux applications require D-Bus which is not running by default in Docker containers.

When you attempt to start the application you might get the following error:

D-Bus library appears to be incorrectly set up; failed to read machine uuid: Failed to open "/var/lib/dbus/machine-id": No such file or directory
See the manual page for dbus-uuidgen to correct this issue.
  D-Bus not built with -rdynamic so unable to print a backtrace

First of all you need to generate missing machine-id by command:

dbus-uuidgen > /var/lib/dbus/machine-id

The application will be able to start even when the daemon is not running.

To start the D-Bus daemon inside the container you need to run following command on Ubuntu, Centos 7, Centos 8:

mkdir -p /var/run/dbus
dbus-daemon --config-file=/usr/share/dbus-1/system.conf --print-address

Command on Centos 6:

dbus-daemon --config-file=/etc/dbus-1/system.conf --print-address

Now the daemon is running and your application should be able to start. The output should look like this:


3. May 2019

How to install Fluxbox on Centos in Docker

Repositories which are referenced in the base image of Centos does not contain any package with lightweight X window manager like Fluxbox. If you try to install it, you’ll end up with the following error:

Warning: No matches found for: fluxbox
No matches found

It’s sufficient to add EPEL (Extra Packages for Enterprise Linux) repository:

yum --enablerepo=extras install epel-release

Let’s test this whole setup on Docker image. We will install also TigerVNC server to view the Fluxbox UI:

docker run -p 5901:5901 -it centos /bin/bash
yum -y --enablerepo=extras install epel-release
yum install -y fluxbox tigervnc-server xterm
mkdir -p ~/.vnc
echo "fluxbox &"> ~/.vnc/xstartup
chmod u+x ~/.vnc/xstartup

Now connect by your VNC client (e.g. RealVNC) to localhost:5901. The result should look like this:

30. April 2019

How to run Fedora GUI in Docker – just 6 commands

Docker is great for experimenting and testing server an applications. But what about GUI? How is it possible to run application which requires GUI in Docker container?

There are several ways how to access GUI application from the container. E.g. using ssh tunnel with X-Forwarding. The downside of this approach is speed and responsiveness of UI.

Much better responsiveness has TigerVNC server with VNC client.

Let’s pull and run Fedora image. We will also open a port 5901 where we can connect with VNC client:

docker run -p 5901:5901 -it fedora /bin/bash

Now install some basic applications. We will use TigerVNC server to serve the UI. Then we will use Fluxbox as a window manager because it’s small and versatile. We will need also xterm to invoke our commands.

yum -y install fluxbox tigervnc-server xterm

In a classic desktop installation of Fedora we’re using Display manager which allows to type user’s login. This is not necessary for Docker and instead of starting XServer we will launch TigerVNC server which will launch Fluxbox for us.

Write following configuration to ~/.vnc/xtasrtup:

mkdir -p ~/.vnc
echo "fluxbox &"> ~/.vnc/xstartup
chmod u+x ~/.vnc/xstartup

Now we can start the VNC server:


It will prompt you for a password for protecting the connection. Just enter a password of your choice.

The server will automatically bind to 5901.

Now let’s start VNC Client on the host machine (I recommend RealVNC, because it’s fast and easy to use) and connect it to localhost:5901.

Here is the result:

If you need to invoke context menu in Fluxbox just right click with mouse.

You can stop TigerVNC server by command:

vncserver -kill :1