Archives For VirtualBox

Screen Shot 2016-07-16 at 11.59.36 AM

Oracle released VirtualBox 5.1 last week, and today I downloaded the latest bits and updated my VB installation on my MBP. Right now the MBP is running with OS X Version 10.11.5 (I’ve resisted the urge to install the Sierra beta). I also updated the extensions package as well as the guest additions ISO.

Once VB 5.1 installed, I updated all my existing VM’s guest additions without incident. So far I have Mint 18 (seen above), Fedora 24, CentOS 6, Ubuntu 16.04, and Kali. Kali doesn’t have the guest additions as I want as pristine an environment as possible with those tools.

But this version of VB isn’t without problems.

  1. I can’t seen to install the guest additions in CentOS 7 (based on RHEL 7). I don’t know why but the tools can’t find the kernel headers, even though I installed the full gcc and kernel-devel packages. I suppose I could have dug around and found out why it can’t find the kernel headers, but I have four other working Linux distributions with additions, and I just didn’t feel like putting in the effort. Lazy, I guess.
  2. I tried to install PC-BSD. Initial live media boot and installation went swimmingly. Trying to run after the install (with the MATE, the KDE, desktops) resulted in a panic. After two attempts I gave up. If I need a BSD-like OS I have Mac OS X. And if I want Unix-like, well, I have all these systems around the house, including Arch running on three Raspberry Pi 3s. I have no shortage of OS playgrounds.

Other Software

I decided to try out Microsoft’s Visual Studio Code editor in the Mint VM. I’ve played with it a bit on Windows 10, Ubuntu 16, and my MBP, all directly on hardware and all without incident. But trying to install and run it on my Mint 18 VM didn’t work out so well.

Screen Shot 2016-07-16 at 11.51.43 AM

Screen Shot 2016-07-16 at 11.52.06 AM

I would have loved to have worked with the editor in the Mint 18 VM, but it looks like it’s not to be. I don’t know why the editor has a corrupted interface, but it’s totally unusable in this particular setting. I still have vi and gedit as a consolation.

Upshot

One of the big claims with VM 5.1 is performance improvements. I use it now on my Windows 10 notebook in place of VMware, and on my MBP, and I’ve never thought it was slow. VMs seem to boot rather quickly, and the VMs operate efficiently once up and running. I’m quite happy with the way everything works.

After what I wrote about abandoning Oracle’s Java, and why, you might think my use of VB is a bit hypocritical, and you’d be right; it is. Unfortunately, I’ve found nothing that works as well, especially VMware. And I need a virtualization tool that works on my multiple notebooks, with as many different Linux distributions, as possible. VMware keeps getting worse and worse in that regard. I certainly don’t mind paying for a good software package, and I almost broke down and bought a commercial copy of VMware, but the free player has been so plagued with issues that it’s turned me off buying a license (or licenses, one for Mac and one for Windows). I’ve better things to do with my time than trying to get everything initially working.

I would have liked for PC-BSD to have worked (finally). But it didn’t and I refuse to go forum diving for old and/or cryptic information. Considering the definition of insanity, some might consider my continued attempts at getting FreeBSD/PC-BSD up and running in a VM (which I will do before committing hardware). Fortunately, I wasted no more than about 15 minutes before calling off the latest PC-BSD installation experiment.

Screen Shot 2016-07-04 at 10.17.23 AM

I’ve installed a VM of Linux Mint 18 on my MBP using VirtualBox 5.0.24 on Mac OS X 10.11.5. No muss, no fuss. It just installed. I did it primarily just to see what would happen.

Some points of interest about the setup.

  • Linux Mint 18 came with the VirtualBox Guest Additions pre-installed. That shared folder showed up after installation and first boot. I added the local login to the vboxsf group in order to see the contents of the folder.
  • Linux Mint runs quite well. It should, being based on Ubuntu 16.04 LTS.
  • VirtualBox 5.0.24 is an excellent VM for various contemporary Linux distributions. I don’t run any other operating systems with it, so I can’t speak to them.

Screen Shot 2016-07-04 at 10.18.58 AM

Screen Shot 2016-07-04 at 10.19.24 AM

Screen Shot 2016-07-04 at 10.20.50 AM

I like the dark theme of this version quite a bit. I’m also avoiding installing Java on this VM, choosing instead to install Google’s Go Language. My other language of choice on this VM is C++. I’m going back through my other VMs and removing Java and Java tools (particularly IDEs). I’ve got VIM and gedit for the work I need. And other tools to make sure my code is as robust as possible.

You’re viewing CentOS 7 running in VirtualBox 5.0.16, with a micro SDHC card mounted and in turn viewing the Arch Linux ARM ext4 native Linux filesystem I created for my RP3. When I originally created the RP3 micro SDHC card I used my Ubuntu 15.10 notebook as the workbench. But I’ve been wanting to do similar work using my MBP as the primary tool bench, with an eye towards retiring the native Ubuntu notebook with the MBP due to the Ubuntu notebook’s age, rather than attempting to replace the Ubuntu notebook as I’ve written I originally wanted to do. The biggest hurdle to using the MBP was just reading the native ext4 file system on the MBP, as Max OS X has no native provisions to read Linux file systems. This post is about getting to that point. As time goes along I’ll be doing more than just reading the microSDHC, but reading (and then writing) is the foundational requirement, else this is all a waste of time and resources.

Before I go much farther let me properly attribute this from another post, “Mount SD card in VirtualBox from Mac OS X Host,” written by Brady Holt on 21 July 2014. Please note this was done nearly two years ago. This is an update to his post using contemporary software and with my observations.

Software and hardware I’ll be using:

  • OS X El Capitan, version 10.11.3 running on a MacBook Pro (Retina, 15-inch, Mid 2015)
  • VirtualBox 5.0.16 with Oracle_VM_VirtualBox_Extension_Pack-5.0.16
  • CentOS 7 with all updates as of the date of this post with VBoxGuestAdditions_5.0.16 running as a VM

I’m going to create a Linux VM with VirtualBox and use that to mount and at least read the micro SDHC card with the Arch Linux ARM ext4 file system. I had originally looked for a Mac OS X utility to do this, but eventually gave up as the utilities that claimed they could do that had allegedly stopped working with the release of El Capitan because of System Integrity Protection, or rootless, mode. Far be it from me to disable in El Capitan what is supposed to add additional security to OS X. I’m somewhat surprised that I could get this to work, but I suppose that if, at some point in the future, Apple releases a Mac OS X update that breaks what I’ve built here that I’ll be back to using a separate Linux machine.

The first step is to install VirtualBox and then to install CentOS 7 within a VirtualBox VM. I won’t cover that here, as there are plenty of existing how-tos for that. Just make sure that the Virtual Box Extension Pack is installed and that you’ve downloaded and installed the VBoxGuesAdditions and have built it within the VM. That gets everything prepared both on the OS X host side as well as within the VM.

The next step is to get the overall system prepared to mount the RP3 micro SDHC card within the CentOS 7 VM.

  1. Plug in the microSDHC card into the MBP using the microSDHC adapter. I’m using a Samsung 32GB Evo Plus device. Note that it’s named “NO NAME” on the desktop. This is the MSDOS 100MB boot partition on the microSDHC card.
  2. Go to Launchpad and search for diskutil. Launch diskutil. Select “NO NAME.”

  1. Click the Info button at the top right. Note the device associated with “NO NAME.” It’s the third line down from the top, called “BSD device node.” In my case it’s disk2s1. The device associated with this partition is /dev/disk2. We’ll use this later.

  1. At the top of the utility click the ‘Unmount’ button with your mouse. The button text will then change to ‘Mount.’ Please note you don’t want to eject the device, just unmount.

  1. Now we need to create a VirtualBox VMDK file to point to this device. That’s how we’ll get it to mount inside the Linux VM. Open a terminal and type sudo VBoxManage internalcommands createrawvmdk -filename sd-card.vmdk -rawdisk /dev/disk2 at the prompt. The file will be created where ever you run it, so my advice is to change directory to a location where you want this (or preface the file name with a full path) to create the file. Just remember where you left it.
  2. Change permissions on the microSDHC device and the VMDK file to 777. At the prompt type chmod 777 sd-card.vmdk /dev/disk2. This opens up permissions for the file and card to be used later by the VM
  3. Add sd-card.vmdk to the VM’s storage devices. In VirtualBox, under the CentOS VM, select the Storage dialog, and in the Storage Tree under Controller: SATA click the add device button. You will be prompted to either create a new device or add an existing device. Choose to add existing and add sd-card.vmdk.
  4. Check diskutil one more time and make sure that the microSDHC card is still unmounted. OS X has automount and can silently remount the drive. If it does then you will fail to start the Linux VM.
  5. Once the VM is started bring up Nautilus and note two new ejectable entries for the card, a 103MB entry and a 32GB entry. Click on the 32GB volume. You’ll be prompted by Nautilus to enter root’s password for that VM to view that volume. Once that’s done Nautilus opens into the 32GB volume. You can drag and drop files into and out of the midroSDHC’s 32GB volume. I do this to add content as well as pull log files while developing.

One caveat. If you shut down the VM and then want to bring it back up, you’ll need to unmount the microSDHC card like before and execute chmod 777 /dev/disk# again, or the VM will fail to start due to lack of permissions on the raw device.

I have a constant need to support Linux development. To address that need I’ve turned to virtual machines running on Windows or Mac OS X. For Windows I turn to VMware Player. On Mac OS X I have no practical choice other than VirtualBox from Oracle. In this post I talk about running CentOS 7.2 on VirtualBox 5.0.12.

The screen capture above is from my still-somewhat-new MBP. In order to create the screen shot I moved the mouse away from the VM and chord pressed [Command][Shift][4] and then pressed the space bar to bring up the camera mouse pointer. I then moved the camera back over the VM and clicked the trackpad to take capture.

In this basic example I’ve configured CentOS 7.2 with VBoxGuestAdditions 5.0.12, which you can download here: http://download.virtualbox.org/virtualbox You can download the VirtualBox installation package for your OS as well as the extension pack and guest additions. Note that the guest additions is an ISO that needs to be mounted in the VM before it can be installed inside the VM. You’ll need to install the guest additions if you want seamless mouse movement and sharing of host OS (Mac OS X in this instance) folders for transfer of data between guest and host.

My only big complaint with VirtualBox is networking. If you install with just NAT then the VM can reach outside of the host OS to the outside world and download updates when needed. Unfortunately the VM is unreachable from Mac OS. Any other type of networking attempting to combine both outside connectivity as well as internal is problematic. In particular, if I want to do development requiring network connectivity between my Mac and the guest OS then I can set up networking to do that, but at that point the VM can’t reach the outside world. The only example of what I’m trying to do was a howto for Windows 10 and VirtualBox, but that doesn’t work on my Mac.

The screenshot above shows the shared folders on the host OS. Make sure that the Linux account you’ve created on the VM has vboxsf as one of its groups or you won’t have permissions to see into the shared folders.

When you’re done with the VM just shut it down. If you opt to save the machine state, when you come back up the next time the mouse cursor will disappear when it moves over the VM desktop. Since my MBP has a SSD it’s just as fast for me to restart the VM as it is to save the state and restore, so to keep things as uncomplicated as possible I just turn the VM off when I’m done with a session. That way, the next time it’s powered up I know what the overall state is.

Update 17 January

I wrote about CentOS 7 back in September 2014, back when it was first released. Note that this is well over a year ago. I’d installed it on my notebook for a short period to compare it with Ubuntu and I discovered that it wasn’t quite up to my liking back then. But time and updates march on, and circumstances most definitely change. The changes to CentOS/RHEL as well as changing needs and requirements make that older review a bit OBE (overcome by events). I’m still no fan of the desktop look-and-feel but it’s not a deal-breaking issue, no more than it was over a year ago.