{"record":{"id":"1fe51244f58256ef","repo":"abiosoft/colima","slug":"error-extracting-vmnet-archive-w","errorCode":null,"errorMessage":"error extracting vmnet archive: %w","messagePattern":"error extracting vmnet archive: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"daemon/process/vmnet/deps.go","lineNumber":78,"sourceCode":"\tif err != nil {\n\t\treturn fmt.Errorf(\"error creating temp file: %w\", err)\n\t}\n\tif _, err := f.Write(gz); err != nil {\n\t\treturn fmt.Errorf(\"error writing temp file: %w\", err)\n\t}\n\t_ = f.Close() // not a fatal error\n\n\tdefer func() {\n\t\t_ = os.Remove(f.Name())\n\t}()\n\n\t// extract tar to desired location\n\tdir := optDir\n\tif err := host.RunInteractive(\"sudo\", \"mkdir\", \"-p\", dir); err != nil {\n\t\treturn fmt.Errorf(\"error preparing colima privileged dir: %w\", err)\n\t}\n\tif err := host.RunInteractive(\"sudo\", \"sh\", \"-c\", fmt.Sprintf(\"cd %s && tar xfz %s 2>/dev/null\", dir, f.Name())); err != nil {\n\t\treturn fmt.Errorf(\"error extracting vmnet archive: %w\", err)\n\t}\n\n\treturn nil\n}\n\nvar _ process.Dependency = vmnetRunDir{}\n\ntype vmnetRunDir struct{}\n\n// Install implements Dependency\nfunc (v vmnetRunDir) Install(host environment.HostActions) error {\n\treturn host.RunInteractive(\"sudo\", \"mkdir\", \"-p\", runDir())\n}\n\n// Installed implements Dependency\nfunc (v vmnetRunDir) Installed() bool {\n\tstat, err := os.Stat(runDir())\n\treturn err == nil && stat.IsDir()","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/daemon/process/vmnet/deps.go#L60-L96","documentation":"Thrown when the extraction of the embedded socket_vmnet tarball into /opt/colima fails. The code runs `sudo sh -c 'cd /opt/colima && tar xfz /tmp/vmnet.tar.gz 2>/dev/null'` via host.RunInteractive; stderr of tar is discarded, so any tar failure (corrupt temp file, disk full, bad archive) or a cancelled/failed sudo invocation surfaces only as this wrapped exit error.","triggerScenarios":"vmnetFile.Install() runs (vmnet binaries missing at /opt/colima/bin/socket_vmnet*) and: the temp file written earlier is corrupt/truncated; /opt/colima disk is full; tar exits non-zero (unsupported format, permissions); the sudo prompt is declined; sudo fails in a non-TTY environment.","commonSituations":"Disk-full macOS machines; interrupted first run that left a partial state; running `colima start` over ssh without TTY so sudo fails; antivirus/corporate tooling tampering with /opt writes; odd tar behavior on very old macOS versions.","solutions":["Free disk space and retry `colima start` (install is re-attempted since binaries are missing)","Clear partial state: `sudo rm -rf /opt/colima` then retry so the archive is re-extracted cleanly","Run in an interactive Terminal so the sudo password prompt works","Manually verify extraction works: `sudo tar tvf /tmp/<vmnet.tar.gz>` after reproducing, or check the embedded asset exists in your colima build","If it persists, report the corruption — the `2>/dev/null` hides tar's message, so try the tar command by hand"],"exampleFix":"# before\n# failed start leaves partial /opt/colima; subsequent starts keep failing\n# after\nsudo rm -rf /opt/colima\ncolima start   # reinstalls socket_vmnet from the embedded tarball","handlingStrategy":"retry","validationCode":"// Verify the embedded asset and temp-dir writability before install\nfunc preflightVmnetInstall(arch string) error {\n    if _, err := embedded.Read(\"network/vmnet_\" + arch + \".tar.gz\"); err != nil {\n        return err\n    }\n    f, err := os.CreateTemp(\"\", \"vmnet.tar.gz\")\n    if err != nil {\n        return err // /tmp unwritable/full — extraction would fail too\n    }\n    _ = f.Close()\n    _ = os.Remove(f.Name())\n    return nil\n}","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"error extracting vmnet archive\") {\n    // extraction already retried fresh each start; if it fails twice, reset state\n    if resetErr := exec.Command(\"sudo\", \"rm\", \"-rf\", \"/opt/colima\").Run(); resetErr == nil {\n        return fmt.Errorf(\"vmnet install failed; /opt/colima reset, retry colima start: %w\", err)\n    }\n    return err\n}","preventionTips":["Keep free disk space on the root volume (/tmp and /opt)","Don't interrupt the first `colima start`; let installs finish","If a start fails mid-install, run `sudo rm -rf /opt/colima` before the next attempt","Remember tar stderr is hidden (2>/dev/null): reproduce manually to see the real reason"],"tags":["colima","vmnet","tar","sudo","macos","installation"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}