Skip to content

Commit 6948c1f

Browse files
committed
Package hint
1 parent a9da8b7 commit 6948c1f

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/hypervisor/qemu/process.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func (p *ProcessManager) GetBinaryPath(paths *paths.Paths, version string) (stri
137137
return path, nil
138138
}
139139

140-
return "", fmt.Errorf("%s not found; install QEMU on your system", binaryName)
140+
return "", fmt.Errorf("%s not found; install with: %s", binaryName, qemuInstallHint())
141141
}
142142

143143
// qemuBinaryName returns the QEMU binary name for the host architecture.
@@ -152,6 +152,18 @@ func qemuBinaryName() (string, error) {
152152
}
153153
}
154154

155+
// qemuInstallHint returns package installation hints for the current architecture.
156+
func qemuInstallHint() string {
157+
switch runtime.GOARCH {
158+
case "amd64":
159+
return "apt install qemu-system-x86 (Debian/Ubuntu) or dnf install qemu-system-x86-core (Fedora)"
160+
case "arm64":
161+
return "apt install qemu-system-arm (Debian/Ubuntu) or dnf install qemu-system-aarch64-core (Fedora)"
162+
default:
163+
return "install QEMU for your platform"
164+
}
165+
}
166+
155167
// isSocketInUse checks if a Unix socket is actively being used
156168
func isSocketInUse(socketPath string) bool {
157169
conn, err := net.DialTimeout("unix", socketPath, 100*time.Millisecond)

0 commit comments

Comments
 (0)