pop-os / system76-firmware

System76 Firmware Tool and Daemon
GNU General Public License v3.0
74 stars 28 forks source link

Invalid cross-device link (os error 18) #120

Closed orangecms closed 11 months ago

orangecms commented 11 months ago

Using the CLI command schedule, I get this error:

system76-firmware: failed to schedule: failed to move /boot/efiMG6RBk to /efi/boot/system76-firmware-update: Invalid cross-device link (os error 18)

I found this to be the final fs::rename failing, and others had this issue with Rust before.

Investigating; PR to follow (I hope :))

orangecms commented 11 months ago

Notes:

I commted out the cleanup to keep the temp dir. A manual mv works.

The rename is across file systems as the error suggests; /boot/efi/ is the ESP mount point

orangecms commented 11 months ago

Okay sooo...

My simple suggestion is to create the temp dir also within the EFI dir to avoid moving across file systems. Otherwise, it might be necessary to implement some sort of transaction stuff etc.. Or am I just missing something? WDYT?

0ZeroFive5 commented 11 months ago

I have the exact same issue, both when trying to schedule the update through the CLI and through the settings UI. I'm on a darp8 if that's relevant at all.

crawfxrd commented 11 months ago

My simple suggestion is to create the temp dir also within the EFI dir to avoid moving across file systems.

That's what with_prefix_in (previously new_in) does.

crawfxrd commented 11 months ago

I got the order wrong:

tempfile::TempDir::with_prefix_in(efi_dir, "system76-firmware-update")

Should be:

tempfile::TempDir::with_prefix_in("system76-firmware-update", efi_dir)
orangecms commented 11 months ago

Ah, and I was already confused what that would do or why it didn't work. :)