Skip to content

support merged /usr systems

Caleb Connolly requested to merge calebccff/apk-tools:usrmerge into 2.14-stable

Alpine does not currently follow the /usr merge filesystem layout, however it is possible to create a merged /usr Alpine system by adjusting apk to correctly rewrite symlinks and avoid installing symlinks where the link source and target end up in the same path on a /usr merged system.

Implement special handling when unpacking packages to skip these now redundant symlinks, and adjust others to point to the correct paths.

This patch has been tested with a full-fat GNOME installation: image

I'm targeting the 2.14-stable branch as there doesn't appear to be any kind of timeline on Alpine adopting apk3, and this is a change we are in the process of rolling out in postmarketOS. The additional logic is only used if the rootfs that apk is operating on has /bin as a symlink. For existing Alpine users this should have zero impact.


postmarketOS is adopting the /usr merge layout for a few reasons, systemd being a major factor, but we do believe this is an overall improvement to pmOS and a change that would benefit Alpine too. We have investigated updating the FHS to document this layout (which has been common practise in most major distros for the last decade) however it seems that there is very little interest in this, and it doesn't feel like a useful time investment compared to just implementing it.

See this page for arguments in favour of the /usr merge layout.

Merge request reports