Alpine 3.23 mkimage.sh: ERROR: –usermode not allowed as root

Recently I decided to upgrade a custom Alpine ISO generator that I run to the latest version of Alpine Linux, 3.23. The task is fairly easy, but required some special attention, because the first ISO build attempt failed:

sh aports/scripts/mkimage.sh --tag "test-3.23-0.1" --outdir /export --arch x86_64 --repository https://dl-cdn.alpinelinux.org/alpine/v3.23/main --repository https://dl-cdn.alpinelinux.org/alpine/v3.23/community --profile myprofile
ERROR: --usermode not allowed as root

After some research I found that this is related to the updated version of apk, the package manager used in Alpine Linux. Version 3.x of apk brings a fair amount of new features and some slightly breaking changes such as this one.

Digging into mkimage.sh I found that apk is called there like

/ # apk --arch x86_64 --root /tmp/ add --initdb --no-chown
ERROR: --usermode not allowed as root

Which fails due to the –no-chown flag not existing anymore. The error message was misleading, which led me on a 30 minute ride through the inner workings of apk only to find that the simple removal of the removed parameter was enough to get my ISO build process kickstarted:

/ # apk --arch x86_64 --root /tmp/ add --initdb
OK: 0 B in 0 packages

I filed an issue in the Alpine Linux GitLab, because as of now, I am unuse if this is the right way to approach the issue. People more knowledgable in the topic should check it out.

Leave a Reply

Your email address will not be published. Required fields are marked *