-
Notifications
You must be signed in to change notification settings - Fork 148
composefs-backend: Check for /var symlink before creating to fix issue with bootc switch on other distros. #1735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…e with bootc switch on other distros. Coauthored-by: Tulip Blossom <[email protected]> Signed-off-by: Kyle Gospodnetich <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request aims to fix an issue where creating a symlink for /var fails if it already exists. The proposed change checks for the existence of the path before creating the symlink. However, the use of Path::exists() is problematic as it follows symlinks and returns false for broken symlinks, which would cause the code to attempt to create the symlink again and fail. I've suggested a more robust way to handle this by attempting the operation and ignoring the AlreadyExists error, which also avoids a potential race condition.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: Kyle Gospodnetich <[email protected]>
|
The issue here seems to be that switch is somehow outputting the same verity for two images? Or was the switch cancelled after the /var symlink was created? In the latter case I think we'd need to remove the state dir and recreate it. The former case feels unlikely. A reproducible example would be great |
Any image at https://github.com/bootcrew/ will reproduce this (I recommend https://github.com/bootcrew/debian-bootc), the issue is that the /var link already exists when this is fired off from what I can tell. To reproduce it, boot one of their images and then attempt to bootc switch to the actual ghcr.io link. It will silently fail, and then on reboot you'll be brought to the original image. |
So we build the image locally and then switch to the remote image? If there are no differences between the images, then they will both output the same verity, for which we already have the state dir. But, in your screenshot I can see the images have different verity... Anyway, this is an issue, and simply checking for |
|
One solution I had in mind for this is to just update the |
If you've got a concept for how to fix this the proper way I am happy to test it against this as much as you need. Images could differ from local build and the ghcr remote just based on timing and what changes upstream, so this isn't just a need to change origin. |
Fixes issue with bootc switch on Debian, Arch, and other distros.
Previous behavior would error out with:
error: Composefs Switching: Writing composefs state: Failed to create symlink /var: File exists (os error 17)Here's proof of functionality:

Coauthored-by: Tulip Blossom [email protected] @tulilirockz