Skip to content

Fix setting uid=0 gid=0 in archive

Kristian Klausen requested to merge github/fork/arkdchst/master into master

Created by: arkdchst

Setting uid and gid in bsdtar (step 2) gave no effect, so it's moved to step 1. Now all uids and gids are setting to zero. So created archive is user-independent. Step 2 just adds files from archive from stdin, but doesn't set any metadata to them. Before that if you ran mkinitcpio as non-root user, uid and gid of each file from archive were set to your non-zero uid and non-zero gid.

This bug caused a following problem: If you create initramfs with non-root user and try to boot with it, you will get

mount: /proc: must be superuser to use mount.
mount: /sys: must be superuser to use mount.
mount: /dev: must be superuser to use mount.
mount: /run: must be superuser to use mount.

because all files in your initrd environment have non-zero uid and gid.

Merge request reports