containers / podman-desktop-extension-bootc

Support for bootable OS containers (bootc) and generating disk images
Apache License 2.0
406 stars 14 forks source link

feat: use native podman build for linux #684

Closed cdrage closed 1 month ago

cdrage commented 1 month ago

feat: use native podman build for linux

What does this PR do?

Screenshot / video of UI

Screenshot from 2024-07-30 11-57-31 Screenshot from 2024-07-30 12-00-01

What issues does this PR fix or reference?

Closes https://github.com/containers/podman-desktop-extension-bootc/issues/623

How to test this PR?

  1. Try on Linux (Fedora 40 or above)
  2. Go to build and it should ask for credentials after a few moments of building
  3. Successful image build

Signed-off-by: Charlie Drage charlie@charliedrage.com

cdrage commented 1 month ago

@deboer-tim @benoitf

Before reviewing there was a lengthy discussion on the issue regarding why we need to run sudo podman run commands on the CLI.

The main reasoning being that:

This is a short-term solution until podman-bootc CLI is developed more / krun support is in, or when bootc-image-builder supports krun itself.

This PR will unblock the currently broken (and cumbersome) Linux support by solving issue https://github.com/osbuild/bootc-image-builder/issues/540 as well as removing the podman machine restriction which has been causing issues for users (specifically users running Fedora Silverblue).

See referenced issues and discussions:

cdrage commented 1 month ago

~Update: Fixing a test, but otherwise ready for review 👍~ Fixed!

cdrage commented 1 month ago

Tested on fedora 40. Works as expected, it requested the sudo authentification, that I provided and was able to complete the build with success.

image

Small concern, the output I had to delete the disk.raw using sudo rm as the file could not be deleted otherwise.

Thank you so much for testing and happy it works as well on your side.

Having to delete with sudo rm will be solved with: https://github.com/containers/podman-desktop-extension-bootc/pull/695 so that you can remove after without having to run sudo.

Your testing made me realize that's why they added that feature haha! I was wondering why it wasn't working on macOS or Windows.

cgwalters commented 1 month ago

This is a short-term solution until podman-bootc CLI is developed more / krun support is in,

But wouldn't it make more sense to help with that?

cdrage commented 1 month ago

This is a short-term solution until podman-bootc CLI is developed more / krun support is in,

But wouldn't it make more sense to help with that?

I investigated and tried a few different ways, including pulling the podman-bootc project and seeing what I could do in Go, but hit a bit of a wall fighting /proc issues getting it working. I started working on using a custom kernel / custom filesystem as per the comment here: https://github.com/containers/podman-bootc/issues/9#issuecomment-2239530598 but then ran into time constraints while deep diving through linux kernel documentation.

I also opened up https://github.com/osbuild/bootc-image-builder/issues/569 to see if we could even get it working via non-root.

The solution in this PR mimics the exact CLI commands which are being ran currently by https://github.com/osbuild/bootc-image-builder so it's been quite reliable testing it the past week.

When https://github.com/containers/podman-bootc/issues/9 is complete we can integrate that into the podman desktop bootc extension?