ostree icon indicating copy to clipboard operation
ostree copied to clipboard

Preparing final bootloader swap: symlinkat: Operation not permitted

Open goldyfruit opened this issue 3 years ago • 6 comments

Hi,

I'm trying to build a custom rootfs for my Raspberry Pi 4B 64-bit using multistrap and deploy it via ostree admin deploy via a HTTP OSTree repository.

The build works fine (even If I think I missed few things) but when I try to deploy the tree on my RPi I got this error:

sudo ostree admin deploy --os=debian rpi/debian/stable/arm64 -vvv
OT: Preparing transaction in repository 0x5597508000
OT: Pushing lock non-blocking with timeout 30
OT: Creating repo lock table
OT: Opening repo lock file
OT: Push lock: state=unlocked, depth=0
OT: Locking repo shared
OT: Using new tmpdir staging-ae7ca82b-90f5-4160-8194-987727f46a5a-xyZ6ls
OT: Committing transaction in repository 0x5597508000
OT: txn commit staging-ae7ca82b-90f5-4160-8194-987727f46a5a-xyZ6ls
OT: Popping lock non-blocking with timeout 30
OT: Pop lock: state=shared, depth=1
OT: Unlocking repo
OT: boot is ro: no
OT: Using bootloader: (none)
OT: Free lock: state=unlocked, depth=0
OT: Closing repo lock file
OT: Free lock table
error: Preparing final bootloader swap: symlinkat: Operation not permitted

The problem is that /boot partition is vfat and symlinks cannot be created on this filesystem and during the ostree admin deploy I think /boot/ostree try to be created.

I tried to follow the information from @starnight provided in this issue https://github.com/ostreedev/ostree/issues/2223 (I opened) but I'm kind of stuck.

Any idea?

goldyfruit avatar Nov 03 '21 23:11 goldyfruit

The more I search for a solution the more I think it's related to my rootfs. What will be the "best" tool/solution to build rootfs based on Debian for Raspberry Pi?

goldyfruit avatar Nov 04 '21 02:11 goldyfruit

The problem is that /boot partition is vfat and symlinks cannot be created on this filesystem and during the ostree admin deploy I think /boot/ostree try to be created.

Yes! "vfat does not support link" is the key point.

Endless OS has two partitions on RPi 4B's SD card.

SD card

  • boot partition (FAT)
    • A folder has RPi firmware files, config files and u-boot (u-boot will find the boot.scr in the rootfs system partition's /boot/ by enumerating partitions)
  • rootfs system partition (ext4)
    • /boot/ (not the boot partition)
      • boot.scr (u-boot script)
      • ostree/
        • the OSTree layer/snapshot ...
      • uEnv.txt
      • ...
    • /dev/
    • /etc/
    • /lib/
    • /ostree/
    • /sys/
    • /sysroot/
    • /usr/
    • ...

For this case in Endless OS, OSTree only plays things in the rootfs system partition, and does not touch the things in the boot partition.

starnight avatar Nov 04 '21 05:11 starnight

@starnight Thanks for the information, this is exactly what I'm trying to achieve with all this information in mind. How can I prevent ostree admin deploy to write in /boot?

Then I think it has something to do with the way I initialize OSTtree on the client.

ostree admin init-fs /

Does it seems correct for you or do I need to replace / by a different directory?

goldyfruit avatar Nov 04 '21 11:11 goldyfruit

Did you ever find a good solution @goldyfruit? Looks like there's some work around this here: https://github.com/ostreedev/ostree/pull/1967

GrabbenD avatar Aug 29 '23 14:08 GrabbenD

Did you ever find a good solution @goldyfruit? Looks like there's some work around this here: https://github.com/ostreedev/ostree/pull/1967

No I didn't.

goldyfruit avatar Aug 29 '23 15:08 goldyfruit

Gnome managed to get Raspberry Pi 4 to work with help of U-Boot as demonstrated here: https://gitlab.gnome.org/rmader/gnome-build-meta/-/blob/gnome-43/elements/boards/raspberrypi-4/image.bst

They're also setting up a QEMU VM which skips bootloader creation altogether and instead they just copy over relevant files to /boot (which seems to be useful for oneshot setup but you'd have to tweak it to get atomic updates to work properly if I've understood it correctly): https://gitlab.gnome.org/rmader/gnome-build-meta/-/blob/gnome-43/elements/vm/image.bst

GrabbenD avatar Sep 04 '23 10:09 GrabbenD