HybridDevTools/d3nver

denver init fails when Virtualbox is not properly installed

Opened this issue · 1 comments

Hi,

Denver crashes on 'denver init' (when Virtualbox kernel module are not loaded)

$ ./denver init
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
denver/pkg/providers.(*Virtualbox).isVMPresent(0xc00017e0b0, 0xc0001b2000, 0x14a, 0x3)
	/home/olivier/dev/d3nver/src/pkg/providers/virtualbox.go:371 +0x25d
denver/pkg/providers.(*Virtualbox).checkIfRunning(0xc00017e0b0, 0xc00016473b, 0xefde20, 0xc000133af8)
	/home/olivier/dev/d3nver/src/pkg/providers/virtualbox.go:349 +0xcc
denver/pkg/providers.(*Probe).probe(0xc000162dc0, 0xb31dc0, 0xc00017e0b0, 0x0, 0x0)
	/home/olivier/dev/d3nver/src/pkg/providers/probe.go:60 +0xaa
denver/pkg/providers.(*Probe).Start(0xc000162dc0, 0xb31dc0, 0xc00017e0b0, 0xa, 0xc000133bc8)
	/home/olivier/dev/d3nver/src/pkg/providers/probe.go:30 +0x68
denver/cmd/root.(*Denver).initProbe(...)
	/home/olivier/dev/d3nver/src/cmd/root/root.go:190
denver/cmd/root.(*Denver).addBootstrapFunc.func4(0x0, 0x0)
	/home/olivier/dev/d3nver/src/cmd/root/root.go:211 +0xa9
denver/cmd/root.(*Denver).Execute.func1(0xc000166280, 0xf16648, 0x0, 0x0, 0x0, 0x0)
	/home/olivier/dev/d3nver/src/cmd/root/root.go:86 +0x6e
github.com/spf13/cobra.(*Command).execute(0xc000166280, 0xf16648, 0x0, 0x0, 0xc000166280, 0xf16648)
	/home/olivier/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:805 +0x56b
github.com/spf13/cobra.(*Command).ExecuteC(0xc000166000, 0xc000146130, 0x1, 0x1)
	/home/olivier/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:914 +0x2fb
github.com/spf13/cobra.(*Command).Execute(...)
	/home/olivier/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:864
denver/cmd/root.(*Denver).Execute(0xc00015e000, 0xa74790)
	/home/olivier/dev/d3nver/src/cmd/root/root.go:93 +0x37c
main.main()

This may be related to VBoxManage output parsing :

VBoxManage list runningvms
WARNING: The vboxdrv kernel module is not loaded. Either there is no module
         available for the current kernel (5.3.1-arch1-1-ARCH) or it failed to
         load. Please recompile the kernel module and install it by

           sudo /sbin/vboxconfig

         You will not be able to start VMs until this problem is fixed.

Solved by loading Virtualbox modules 'sudo modprobe vboxdrv" and running again "denver init"

Hi @ofauchon and thank you for your report.
This is a known issue and yes, for now, you have to make sure that the provider (Virtualbox) is properly installed and working and that the vboxmanage command is in the path (this concerns Windows).
There are more checks to be done to avoid that kind of issue, this will be addressed through a "pre-flight check" test at runtime with proper error messages.