Description
Moved from https://bugzilla.kernel.org/show_bug.cgi?id=206803 :
"
When generating a btrfs image on a file using mkfs.btrfs the ownership of the root dir is always the root user.
This is problematic when automatically generating a system image as an ordinary user using for instance yocto.
There are tools like udisksctl that allow ordinary users to mount the image on /media/username/uuid.
But if the ordinary user want to take a snaphot to send/receive the system image to a remote (IIoT) device that is not allowed.
The only way is to chmod /media/username/uuid which requires root privileges,w hich in turn requires f.i. bitbake to run as sudo.
This blocks the ability to send system image updates OTA (over the air), a nice advantage of btrfs over f.i. ext.
We could use a command line switch to make the current user own the root.
There is no security penalty in this, as the generated image can always be copied to a machine that would allow the user root access (container?), but that would be cumbersome to automate.
An option like mke2fs -E root_owner would be exactly what is needed.
"