Skip to content

VirtualBox driver, for legacy compatibility and portability #1287

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
afbjorklund opened this issue Jan 7, 2023 · 5 comments
Closed

VirtualBox driver, for legacy compatibility and portability #1287

afbjorklund opened this issue Jan 7, 2023 · 5 comments

Comments

@afbjorklund
Copy link
Member

afbjorklund commented Jan 7, 2023

Description

Once upon a time, there was something called Docker Machine and it was running on VirtualBox.

It did have some other drivers, like qemu, but the virtualbox driver was the portable and default...

Now that Lima has a driver framework, it could be useful to have a "vbox" driver next to the "qemu" ?

It does support features like host networking and shared folders, that QEMU is still struggling with.


Pros: might run on more platforms, such as legacy releases or other operating systems

Cons: only supports Intel images, no support for COW images (resulting in larger files)

But the biggest advantage is having another driver that also works on non-Mac hosts.

And it can help to improve the driver API, if testing with more different implementations ?

@afbjorklund
Copy link
Member Author

afbjorklund commented Jan 7, 2023

Here is the initial PR:

NAME    STATUS     SSH                VMTYPE    ARCH      CPUS    MEMORY    DISK      DIR
vbox    Running    127.0.0.1:36191    vbox      x86_64    2       2GiB      100GiB    ~/.lima/vbox

The host networking and shared folders are not yet implemented, and might require loading a kernel module.

@afbjorklund
Copy link
Member Author

Regarding ARM Macs (M1), there is a beta version out for VirtualBox 7.0 but it only runs Intel images:

https://forums.virtualbox.org/viewtopic.php?f=8&t=107344

So it is not anticipated that this driver will ever be useful for newer Macs, fortunately those have Vz ?

@afbjorklund
Copy link
Member Author

afbjorklund commented Mar 26, 2023

We need a "delete" callback in Lima, in order to clean up the VirtualBox registry after stopping the VM

	CreateDisk() error

	Start(_ context.Context) (chan error, error)

	Stop(_ context.Context) error

	Register(_ context.Context) error

	Unregister(_ context.Context) error

It will be part of pkg/stop, like how "CreateDisk" is part of pkg/start. Maybe it should be called Unregister ?

@afbjorklund
Copy link
Member Author

afbjorklund commented Mar 26, 2023

The additional disk was hardcoded to /dev/vdb, so that broke when it was using /dev/sdb (SATA)

Disk /dev/sda: 100 GiB, 107374182400 bytes, 209715200 sectors
Disk model: VBOX HARDDISK   
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 089874F4-B779-47D7-93FE-9363737526EB

Device      Start       End   Sectors  Size Type
/dev/sda1  227328 209715166 209487839 99.9G Linux filesystem
/dev/sda14   2048     10239      8192    4M BIOS boot
/dev/sda15  10240    227327    217088  106M EFI System

Partition table entries are not in disk order.


Disk /dev/sdb: 50 GiB, 53687091200 bytes, 104857600 sectors
Disk model: VBOX HARDDISK   
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 3698C6D1-6EFE-9D42-A692-06339D7F2FC9

Device     Start       End   Sectors Size Type
/dev/sdb1   2048 104857566 104855519  50G Linux filesystem

Added a hardcoded parameter for it, but it should probably be talking to the driver...

@afbjorklund
Copy link
Member Author

@afbjorklund afbjorklund closed this as not planned Won't fix, can't repro, duplicate, stale Mar 23, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant