Skip to content
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

feat: add launch action to bootable images #83

Closed

Conversation

deboer-tim
Copy link
Contributor

What does this PR do?

Now that we clean up after a successful build, there's no way to launch vfkit on the image. This adds a command to bootable images, which tries to launch vfkit against the last disk image build.

Screenshot / video of UI

Screenshot 2024-01-24 at 11 28 00 AM

What issues does this PR fix or reference?

Fixes part of #18.

How to test this PR?

Launch the action on a bootable container that you haven't built before (it fails), then build an image and retry.

Adds a command to a bootable image, which tries to launch vfkit
against the last disk image build.

Signed-off-by: Tim deBoer <[email protected]>
Copy link
Contributor

@cdrage cdrage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It worked!

Had no issues launching the previous image via vfkit. So all of this LGTM. Thanks for adding it to the image list instead.

Only change is we need to update the package.json as well to remove it from container page.

@@ -18,6 +18,11 @@
"command": "bootc.image.build",
"title": "Build Disk Image",
"when": "ostree.bootable in imageLabelKeys"
},
{
"command": "bootc.vfkit",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jwboyer
Copy link

jwboyer commented Jan 26, 2024

I gave this PR a try because the build container is cleaned up too quickly so there's no opportunity to start it from that screen. I merged it locally with #91 also included. I built a disk image successfully and then tried to launch it and it failed. This is the command it produced:

main ↪️ [bootc-extension] --cpus,2,--memory,2048,--bootloader,efi,variable-store=./efi-variable-store,create,--device,virtio-blk,path=/Users/jboyer/images/jwboyer-eln,--device,virtio-serial,logFilePath=/Users/jboyer/images/vfkit-serial.log,--device,virtio-net,nat,mac=72:20:43:d4:38:62,--device,virtio-rng,--device,virtio-input,keyboard,--device,virtio-input,pointing,--device,virtio-gpu,width=1920,height=1080,--gui

Note the virtio-blk,path specified didn't include the ...../images/disk.raw part.

I looked at the code and it seems like we're passing the selectedFolder into history and not the actual image path. I tried this diff and it at least tried to launch the VM:

diff --git a/src/build-disk-image.ts b/src/build-disk-image.ts
index 0854399..2a2e53b 100644
--- a/src/build-disk-image.ts
+++ b/src/build-disk-image.ts
@@ -88,7 +88,7 @@ export async function buildDiskImage(imageData: unknown, history: History) {
   }
 
   // store this path for later
-  await history.addImageBuild(image.name, selectedType, selectedFolder);
+  await history.addImageBuild(image.name, selectedType, imagePath);
 
   return extensionApi.window.withProgress(
     { location: extensionApi.ProgressLocation.TASK_WIDGET, title: 'Building disk image ' + image.name },

The VM doesn't actually boot, but at least the vfkit invocation is correct.

@jwboyer
Copy link

jwboyer commented Jan 26, 2024

FWIW, here's a screenshot of the VM after the changes mentioned above:

image

and the command that was run:
main ↪️ [bootc-extension] --cpus,2,--memory,2048,--bootloader,efi,variable-store=./efi-variable-store,create,--device,virtio-blk,path=/Users/jboyer/images/jwboyer-eln/image/disk.raw,--device,virtio-serial,logFilePath=/Users/jboyer/images/jwboyer-eln/image/vfkit-serial.log,--device,virtio-net,nat,mac=72:20:43:d4:38:62,--device,virtio-rng,--device,virtio-input,keyboard,--device,virtio-input,pointing,--device,virtio-gpu,width=1920,height=1080,--gui

Not sure if this is an issue with the disk itself, or something with vfkit

@cdrage
Copy link
Contributor

cdrage commented Jan 26, 2024

FWIW, here's a screenshot of the VM after the changes mentioned above:

image and the command that was run: `main ↪️ [bootc-extension] --cpus,2,--memory,2048,--bootloader,efi,variable-store=./efi-variable-store,create,--device,virtio-blk,path=/Users/jboyer/images/jwboyer-eln/image/disk.raw,--device,virtio-serial,logFilePath=/Users/jboyer/images/jwboyer-eln/image/vfkit-serial.log,--device,virtio-net,nat,mac=72:20:43:d4:38:62,--device,virtio-rng,--device,virtio-input,keyboard,--device,virtio-input,pointing,--device,virtio-gpu,width=1920,height=1080,--gui`

Not sure if this is an issue with the disk itself, or something with vfkit

Press enter :)

This unfortunately is an issue with bootc-image-builder at the moment where it is getting "stuck" on the VM load: osbuild/bootc-image-builder#105 and the screen isn't correctly refreshing.

They are at the moment working on improving the kernel parameters / templating the bootc image builder so that it would work correctly.

@jwboyer
Copy link

jwboyer commented Jan 26, 2024

Not sure if this is an issue with the disk itself, or something with vfkit

Press enter :)

I tried that before reporting 😄 Didn't do anything.

This unfortunately is an issue with bootc-image-builder at the moment where it is getting "stuck" on the VM load: osbuild/bootc-image-builder#105 and the screen isn't correctly refreshing.

They are at the moment working on improving the kernel parameters / templating the bootc image builder so that it would work correctly.

OK. I can be patient. Thanks for the pointer.

@deboer-tim
Copy link
Contributor Author

As per comments elsewhere, we would love to provide options to test or run the disk image after building, but vfkit continued to have problems for users, and we have found no stable/open-source/compatible enough alternative. I'm finally withdrawing this PR, and we can follow up with new issues if there's another option.

@deboer-tim deboer-tim closed this Feb 13, 2024
@deboer-tim deboer-tim deleted the image-launch-action branch March 21, 2024 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants