dunfell wic rootfs source issue

Laszlo Sitzer


I am facing an issue with wic when attempting to populate a partition
using the rootfs.py source plugin. Not that this problem only occurs
when some directories are excluded from the rootfs and placed on other

The symptom I face is that when copyhardlinktree() from path.py is
executed, it runs this
find|tar|tar command where the last tar (the one that extracts the
archived rootfs) fails with a permission error when attempting to
change the rootfs directory owner to UID 0.

I am running dunfell (on commit 0839888394a6e42e96f9f0d201376eb38bc79b24).

So far, for the purpose of debugging, I have split the find|tar|tar
into two commands.
One that creates and archive in the working directory and the other
one that extracts it.
Then I prepended strace to the 2nd tar and saved the output to a
logfile. There I could see the following.

fchownat(4, "/home/lazlo/Workspace/<long-long-path>/tmp.wic.2p9azuzz/rootfs3",
0, 0, 0) = -1 EPERM (Operation not permitted)
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
write(2, "tar: ", 5tar: ) = 5
write(2, ".: Cannot change ownership to ui"..., 42.: Cannot change
ownership to uid 0, gid 0) = 42
write(2, ": Operation not permitted", 25: Operation not permitted) = 25
write(2, "\n", 1
) = 1
write(2, "tar: ", 5tar: ) = 5
write(2, "Exiting with failure status due "..., 50Exiting with failure
status due to previous errors) = 50
write(2, "\n", 1
) = 1
Someone suggested to me I should look into pseudo and its relation to
this issue but currently I feel a bit lost.

For reference, here is the .wks file I use.

bootloader --ptable gpt
part /boot --source rawcopy --sourceparams="file=oshine-efi.img"
--ondisk "mmcblk1" --label EFI --active --align 2048

part --source rawcopy
--fixed-size 1024 --ondisk mmcblk1 --fstype=ext4 --label recovery
--align 2048

part / --source rootfs --fixed-size 8192 --ondisk mmcblk1
--fstype=ext4 --label rootfs --align 2048 --exclude-path home/
--exclude-path ni/
part swap --size 512 --ondisk mmcblk1 --label swap1 --fstype=swap

part /home --source rootfs --rootfs-dir
/home/lazlo/Workspace/<long-long-path>/rootfs/home --fixed-size 1024
--ondisk mmcblk1 --fstype=ext4 --label home --align 2048

part /ni --source rootfs --rootfs-dir
/home/lazlo/Workspace/<long-long-path>/rootfs/ni --fixed-size 15360
--ondisk mmcblk1 --fstype=ext4 --label ni --align 2048
I would be grateful for suggestions where to continue further debugging.