diff --git a/pkg/drivers/vfkit/vfkit.go b/pkg/drivers/vfkit/vfkit.go index e37408ba06..9c7e4fb551 100644 --- a/pkg/drivers/vfkit/vfkit.go +++ b/pkg/drivers/vfkit/vfkit.go @@ -53,10 +53,12 @@ import ( ) const ( - isoFilename = "boot2docker.iso" - pidFileName = "vfkit.pid" - sockFilename = "vfkit.sock" - defaultSSHUser = "docker" + isoFilename = "boot2docker.iso" + pidFileName = "vfkit.pid" + sockFilename = "vfkit.sock" + serialFileName = "serial.log" + efiVarsFileName = "vfkit.efivars" + defaultSSHUser = "docker" ) // Driver is the machine driver for vfkit (Virtualization.framework) @@ -67,7 +69,6 @@ type Driver struct { DiskSize int CPU int Memory int - Cmdline string ExtraDisks int Network string // "", "nat", "vmnet-shared" MACAddress string // For network=nat, network="" @@ -189,12 +190,6 @@ func (d *Driver) Create() error { if err := b2dutils.CopyIsoToMachineDir(d.Boot2DockerURL, d.MachineName); err != nil { return err } - isoPath := d.ResolveStorePath(isoFilename) - - log.Info("Extracting Kernel...") - if err := d.extractKernel(isoPath); err != nil { - return err - } log.Info("Creating SSH key...") if err := ssh.GenerateSSHKey(d.sshKeyPath()); err != nil { @@ -256,9 +251,10 @@ func (d *Driver) startVfkit(socketPath string) error { "--memory", fmt.Sprintf("%d", d.Memory), "--cpus", fmt.Sprintf("%d", d.CPU), "--restful-uri", fmt.Sprintf("unix://%s", d.sockfilePath())) - var isoPath = filepath.Join(machineDir, isoFilename) + + efiVarsPath := d.ResolveStorePath(efiVarsFileName) startCmd = append(startCmd, - "--device", fmt.Sprintf("virtio-blk,path=%s", isoPath)) + "--bootloader", fmt.Sprintf("efi,variable-store=%s,create", efiVarsPath)) if socketPath != "" { // The guest will be able to access other guests in the vmnet network. @@ -273,20 +269,21 @@ func (d *Driver) startVfkit(socketPath string) error { startCmd = append(startCmd, "--device", "virtio-rng") + var isoPath = filepath.Join(machineDir, isoFilename) startCmd = append(startCmd, - "--kernel", d.ResolveStorePath("bzimage")) + "--device", fmt.Sprintf("virtio-blk,path=%s", isoPath)) + startCmd = append(startCmd, - "--kernel-cmdline", d.Cmdline) - startCmd = append(startCmd, - "--initrd", d.ResolveStorePath("initrd")) + "--device", fmt.Sprintf("virtio-blk,path=%s", d.diskPath())) for i := 0; i < d.ExtraDisks; i++ { startCmd = append(startCmd, "--device", fmt.Sprintf("virtio-blk,path=%s", pkgdrivers.ExtraDiskPath(d.BaseDriver, i))) } + serialPath := d.ResolveStorePath(serialFileName) startCmd = append(startCmd, - "--device", fmt.Sprintf("virtio-blk,path=%s", d.diskPath())) + "--device", fmt.Sprintf("virtio-serial,logFilePath=%s", serialPath)) log.Debugf("executing: vfkit %s", strings.Join(startCmd, " ")) os.Remove(d.sockfilePath()) @@ -410,22 +407,6 @@ func (d *Driver) Restart() error { return d.Start() } -func (d *Driver) extractKernel(isoPath string) error { - for _, f := range []struct { - pathInIso string - destPath string - }{ - {"/boot/bzimage", "bzimage"}, - {"/boot/initrd", "initrd"}, - } { - fullDestPath := d.ResolveStorePath(f.destPath) - if err := pkgdrivers.ExtractFile(isoPath, f.pathInIso, fullDestPath); err != nil { - return err - } - } - return nil -} - func (d *Driver) killVfkit() error { if err := d.SetVFKitState("HardStop"); err != nil { // Typically fails with EOF due to https://github.com/crc-org/vfkit/issues/277. diff --git a/pkg/minikube/registry/drvs/vfkit/vfkit.go b/pkg/minikube/registry/drvs/vfkit/vfkit.go index b6fe05fd70..06e7693547 100644 --- a/pkg/minikube/registry/drvs/vfkit/vfkit.go +++ b/pkg/minikube/registry/drvs/vfkit/vfkit.go @@ -98,7 +98,6 @@ func configure(cfg config.ClusterConfig, n config.Node) (interface{}, error) { DiskSize: cfg.DiskSize, Memory: cfg.Memory, CPU: cfg.CPUs, - Cmdline: "", ExtraDisks: cfg.ExtraDisks, Network: cfg.Network, MACAddress: mac, diff --git a/site/content/en/docs/drivers/vfkit.md b/site/content/en/docs/drivers/vfkit.md index 14a6b00114..a99aee8246 100644 --- a/site/content/en/docs/drivers/vfkit.md +++ b/site/content/en/docs/drivers/vfkit.md @@ -11,6 +11,11 @@ aliases: macOS virtualization, optimized for lightweight virtual machines and container deployment. +## Requirements + +- Requires macOS 13 or later. +- Requires minikube version 1.36.0 or later. + ## Networking The vfkit driver has two networking options: `nat` and `vmnet-shared`. @@ -25,8 +30,6 @@ installation instructions bellow. ### Requirements -- Requires macOS 10.15 or later -- Requires minikube version 1.36.0 or later. - Requires [vmnet-helper](https://github.com/nirs/vmnet-helper). ### Install vment-helper @@ -94,13 +97,10 @@ Run `minikube start --driver vfkit --alsologtostderr -v=7` to debug crashes ### Upgrade VFKit -New updates to macOS often require an updated vfkit driver. To upgrade: - -* If Podman Desktop is installed, it also bundles `vfkit` -* If you have Brew Package Manager, run: `brew upgrade vfkit` -* As a final alternative, you install the latest VFKit from [GitHub](https://github.com/crc-org/vfkit/releases) -* To check your current version, run: `vfkit -v` -* If the version didn't change after upgrading verify the correct VFKit is in the path. run: `which vfkit` +```shell +brew update +brew upgrade vfkit +``` ### Troubleshooting the vmnet-shared network