1

I've using/on Windows10 v1903. WSL: GNU bash, version 4.4.20(1)-release (x86_64-pc-linux-gnu). Ubuntu 18.04.3 Inside windows10, I ran bash (ran command prompt as an Admin, then > bash). Inside Bash, I'm logged in as a 'root' user.

And inside the bash, somehow I managed to corrupt my VBox installation. As far as I can remember, it went corrupt only after I installed the Vivid from Trusty. I did these things:

  1. First of all I had installed VBox and Vagrant on/thru Windows GUI. At that time, both things showed working ok not only in Windows GUI, but in Bash terminal also (Virtual box is still working ok in Windows GUI).
  2. Then, just out of curiosity, I ran 'choco install virtualbox' inside bash, which seemed to install both these again. At this step, I seem to remember that status/version of VB and Vagrant was showing ok. I even installed and check nginx there/that time.
  3. Then I installed 'ubuntu/trusty64' image in the bash terminal.
  4. And now I'm able to run Virtual Box under/in the Windows GUI, and in there vagrant machines is also running successfully. But in bash terminal, no virtual box command would work. Though if I installed or uninstalled and installed again, these processes would show completing without any errors. But when calling their status or version, they'd give below given errors.

  5. Even if I ran `choco install virtualbox' command gives this error now: command not found. Though I don't think this would be needed to solve my problem, but I mentioned it lest it relates somehow.

Now, in the bash, if I run, VBoxManage -version command would give the following error:

WARNING: The character device /dev/vboxdrv does not exist.
         Please install the virtualbox-dkms package and the appropriate
         headers, most likely linux-headers-Microsoft.

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

I'd want to repeat, that apt install virtualbox installs without any errors.

I've tried many many different linux commands given on Stack Exchange's diff topics. But nothing is working. Purged, installed again.

On the guidance of one such answer, I ran this command vboxdrv.sh setup, and then I found that 'VBoxDrive.sh' file is not there/missing from root@e6420-ssd:/usr/lib/virtualbox# ls

I'm running the terminal as admin, and inside the bash, also running everything as root.

Final Note: after spending much time on google, I've started feeling that may be I'm fatally wrong here, and I got confused. And that its never possible to install VB inside Windows Bash terminal?!! But then, how come I'm still able to install it without any errors? And how can I run nginx outside WSL (Virtualbox won't run inside Bash and nginx won't run outside bash). I'm watching a course on Nginx and it demands all 3 (VB, Vagrant, Nginx) to be running on the machine for me to practice on.

  • 1
    Hello and welcome to the Unix and Linux stack exchange site! Please review the Help Center for more information on how to best use this site. To get to your question, it is confusing me exactly what you are doing. Are you using Windows or Ubuntu? Is Ubuntu running as a virtualbox guest? Is choco a package manager for Linux or Windows? By running this in Bash do you mean the Bash for Windows git program or Windows subsystem for Linux or WSL? If you are using WSL, is it version 2? Please edit your post to include these details. – kemotep Sep 17 '19 at 13:25
  • I've tried adding all the details asked by you. Sometimes, to make things more and more clear, I tend to rather confuse them. Always trying to learn the art of expressing in better way, in least words. – Bathinda Helper Sep 17 '19 at 13:49
  • Why are you trying to install VirtualBox inside WSL? Why not install directly in Windows 10? – fpmurphy Sep 18 '19 at 1:55
  • Because (I'm afraid) Nginx won't work in Windows. As far as I know, to learn Nginx, I will have to work under Linux subsystem/Environ only. – Bathinda Helper Sep 18 '19 at 2:15
1

based on my googling of vagrant and choco
and also the update of followed.
i assumed the best description of your situation would be

  1. Windows 10 Host with WSL(Windows Subsystem for Linux)
  2. VirtualBox and Vagrant installed via Windows GUI
  3. Ubuntu app from Windows Store(status unknown , i am not familiar with that )
  4. VirtualBox installed via WSL in the Ubuntu app
  5. the PATH env variable of the WSL included Bash was crossed setup by two VirtualBox
  6. the current status of two VirutalBox installation, unknown

it is always easier to install from nothing , versus fix messed up something .

so based on the assumed description above, and the statement about you were setting these 3 things for nginx course.
here are my suggestion:

  1. uninstall your WSL , and the Ubuntu app, remove the remaining directory if necessary, the vagrant and choco should be gone with them.
  2. IN GUI, delete the Ubuntu VM from VirtualBox. reinstall VirtualBox will not clean up the VM, you have to manually delete it.
  3. uninstall VirtualBox and Vagrant via Windows 10 Add/Remove Program
  4. reboot windows 10
  5. install VirtualBox and Vagrant via Windows GUI.
  6. do not install WSL and Ubuntu app.
  7. go on to follow the box instructions for Vagrant CLI Windows, commands are for Windows cmd or powershell, not WSL.
  8. Ubuntu guest box can be obtained from here, look for pre-configured nginx included boxes .

quotes from vagrant
Warning: Advanced Topic! Using Vagrant within the Windows Subsystem for Linux is an advanced topic that only experienced Vagrant users who are reasonably comfortable with Windows, WSL, and Linux should approach.

I am sorry if you are still interested in Vagrant within WSL and Windows Store Ubuntu app , i have no further information.

  • Ok. Thanks. Even without following your advice, it seems you've caught the disease perfectly. I've understood the steps perfectly (thanks to you), I'll report back after doing exactly as you guided. – Bathinda Helper Sep 18 '19 at 2:18
  • No. Unfortunately this solution didn't work. I did exactly you told. First removed the virtual machines from Virtual Box's Windows interface (there was only 1 related to ubuntu). Then removed Virtual Box application. Then removed the Windows Linux Sub System from Win Control Panel (although it didn't occur to me that I should uninstall ubuntu app first from/thru Windows App Store). Then restarted (it took many minutes). Then checked and saw that now (as expected, and correct that) ubuntu app was missing in the apps list (earlier, before uninstalling WSL it was showing, again, as expected). – Bathinda Helper Sep 18 '19 at 4:29
  • Then installed WSL from Control Panel. And then installed Ubuntu 18.04 app from windows store. Then in the bash.exe, installed: app get virtualbox. And now checked/found that it is giving the same error as before: "The character device /dev/vboxdrv does not exist. Pls install virtualbox-dkms package etc...). I don't know, if I should have installed virtualbox (and vagarant also perhaps) only thru Windows and not under bash/ubuntu terminal?! – Bathinda Helper Sep 18 '19 at 4:29
  • you better not rely on the Ubuntu app from windows store, and also install virtualbox in WSL is not encouraged, I would update my answer. – bigdataolddriver Sep 18 '19 at 4:36
  • Then what do you suggest? I have a Windows machines (that I can't change) and I want to follow a training course, which wants me to have a Ubuntu terminal, over which Nginx and Vagrant/virtualbox could be run. – Bathinda Helper Sep 18 '19 at 9:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.