I have playing with WSL2 (Ubuntu 24.04) and toying with idea maybe it can become my primary linux dev environment and replace the cumbersome vmware player setup. One hiccup I had yesterday was that I could not ssh into wsl2. And apparently even with powerful AI agent (Gemini in this case) I couldn’t get it resolved until this morning.
The Laptop
It is running Windows 11 Home Edition. As a result hyper-V is based solution is not available, specifically the bridged networking mode is not availabe.
Android Cuttlefish has made a lot of progress since last time I have messed with them (about 5, 6 years ago!) For example, arm64 host is now supported. WebRTC is finally working. However, certain things are still pretty hideous. Docs are scattered around. Info are hard to find. Simply running a CVD instance locally for dev purpose is very troublesome.
So I took some time and cooked a docker container that satisfy my heart. It basically wrap around cvd host tools and create a single CVD instance inside a container. All the plumbing is in place to make it easy and quick to run. I call it cuttlefish-host-container.
Below is a straight copy of the README.md file from the github project page.
cuttlefish-host-container
Docker container that runs Android cuttlefish emulators for x86_64, arm64, riscv64 guests
Background
I simply wanted to run RISC-V AOSP via cuttlefish on my laptop, and the journey wasn’t smooth.
I just realized today that the default docker.io package from Ubuntu is seriously limited, compared with the one provided by Docker Inc with their docker-ce (community edition).
For example, with the following Dockerfile, the Ubuntu’s version of docker would build all intermediate stages, including test-stage, while with Docker Engine packages from docker-ce the test-stage will be skipped (which is more desirable).
# syntax=docker/dockerfile:1
FROM alpine:latest AS build-stage
RUN echo "Installing build tools..."
RUN mkdir /app
RUN touch /app/artifact.txt
FROM alpine:latest AS test-stage
RUN echo "Running tests..."
# This stage is only run if explicitly targeted
FROM alpine:latest AS production
COPY --from=build-stage /app/artifact.txt /app/artifact.txt
CMD ["cat", "/app/artifact.txt"]
To properly installed the docker.io and its companion packages, just follow this page. The output for running the above Dockerfile will look like below with docker-ce packages.
I9-13900H has 6 performance cores with up to 5.4GHz freqency and 8 efficient cores with up to 4.1GHz frequency. Additionally the performance cores can be configured in BIOS to enable hyperthreading (SMT), which essentially doubles the CPU core count for P-cores. When SMT is enabled, the total number of CPU cores is 20 from OS perspective.
Ubuntu supports 3 power mode: performance, balanced and power saver.
SMT does not change single core performance (expected) and add a little (2%-10%) to multi-core performance.
Multi-processor scaling is not very efficient, because multi-core score is usually about 3x-5x of single core score, while there are 6 performance core and 8 efficient cores in the system.
Ubuntu achieve various power modes by capping maximum CPU frequencies.
I need to install the latest gcc on an old ARM64 board, which runs Debian 11 Bullseye. Straightforward of running “sudo apt install g++-14” won’t find the package. And Internet search does not lead to a simple answer either. There deserves a post.
Alpine Linux is a popular choice for building docker. Since v3.17, leveldb version is bumped from v1.22 to v1.23, where the new version disabled rtti, which caused many packages to break, including popular python module, plyvel. I encountered this problem when building electrumX docker image. Googling around I realize this is a popular problem and there are no easy and obvious solutions.
I decided to simply build apk files for leveldb v1.22 against the latest alpine linux, which is 3.20 today.
Check out aports at alpine version v3.16, (host) git clone –depth=1 https://gitlab.alpinelinux.org/alpine/aports -b 3.16-stable aports-3.16
Copy over leveldb APKBUILD file over to the latest 3.20 aports, (host) cp -a aports-3.16/main/leveldb aports/main/
go back to alpine-dev container and build the package files
(alpine-dev) cd ~/aports/main/leveldb
(alpine-dev) abuild -r
The file APK files are located under ~/packages/main/x86_64. For convenience, I have include those two files below. Of course, you should strip the “.bin” suffix before using them. I had to add the suffix to work around wordpress restrictions. Please refer to this docker file to see how these files are used in a real case.
I was running UmbrelOS on Raspberry Pi, with an external 2TB SSD disk. The machine is obviously under powered and started to show weakness. So I decided to migrate to a Lenovo mini-PC, M710q.
I need to re-use the same the SSD disk because M710q doesn’t have enough storage by itself (500GB). Ideally I can keep all the blockchain data and setup, so that I don’t have re-sync everything and re-setup everything.
While this may sound like a common question, I did not find many answers on the internet. The closest one is this one. However, UmbrelOS is currently at v1.x. A lot of don’t apply anymore.
Below is how I did it.
Prepare SSD disk
Upgrade Raspberry Pi to the latest UmbrelOS v1.1.
Shut it down via Umbrel Settings and unplug SSD disk.
cd /home/umbrel; mv umbrel umbrel.bak; ln -s /mnt/umbrel-ssd/umbrel umbrel
sudo systemctl start umbrel
It will take a long to re-start umbrel since it will fetch various containers etc. But it will use the same blockchain and other app-specific settings you had before on SSD disk. After a couple of coffee time, you will be all set!