3. Running Linux Mint on Virtualbox: (1) enabling snapshots and (2) shared folders

This is the third lesson on installing Linux Mint inside of VirtualBox running on OSX. You should read lesson 1 and lesson 2 first. Thanks!

Let’s add in a couple of convenience features. First, we’re going to take a snapshot of the machine, so that we have a known good state to come back to in case we make a mistake when we are configuring new software or doing other things to the machine.

Next, we’re going to create a shared folder that will allow you to easily exchange data files between your physical host machine and your virtual machine.

Create a snapshot for recovery purposes

media_1402931334852.png

Snapshots are superficially very easy to use. However, there are complexities that we will not cover in this brief tutorial. I encourage you to read through the relevant sections in the manual, starting at “1.10 Snapshots” for more detail. Here’s how to take a snapshot of the current state of the virtual machine, when the machine is running. Snapshots can also be created when the machine is shut off.

  1. In the VirtualBox menu, click on Machine -> Take Snapshot
  2. Give the Snapshot a meaningful name, like “Fresh Linux Mint Installation”
  3. Add additional information in the Snapshot Description field if required.
  4. Click “OK”.
  5. Creating the snapshot only takes a few seconds.

Now that you have a snapshot, run the software updater to update Linux Mint to the most current version

media_1402931588097.png

In the lower right-hand corner, next to the time, there is a blue shield. This is the icon for the Linux Mint Updater. Click on it.
It looks like the updater itself needs updating!
Click “Install Updates”
This will cause Mint to update all Level 1 packages, like the mintupdate package.
Once Mint Update is updated, you will see a revised list of 200 (at least on my machine) recommended updates.
The update process will run for 5-10 minutes and you will be prompted to agree to changes in some configuration files. Click as appropriate to accept the recommended action.
Click Install Updates and wait for all of the packages to be updated.
Once the machine is completely updated, the shield icon will minimize to the lower right-hand corner of the screen and will display a green checkmark.

 

Reverting to a saved snapshot after something goes horribly wrong

media_1402932430940.png

Assume that you didn’t want all those updates that you just applied. Because you created a snapshot, you can roll back to the pre-update state in just a few steps. First, shut down the running virtual machine.

  1. Verify that it shows as “Powered Off.” In the VirtualBox Manager, select the machine if it is not already selected.
  2. Click on “Snapshots” in the upper right-hand corner.
  3. Note that it shows “Current State” as “changed”. This means that there are changes from the last snapshot, which is shown above it.

Reverting to a saved snapshot (step 2)

media_1402932683290.png
  1. Right-click on “Fresh Linux Mint Installation” and click on “Restore Snapshot” to make that snapshot the current image.
  2. Virtualbox tries to help you out by offering to create a snapshot of the current state, so that you don’t lose it when you restore to the earlier one.
  3. If your machine is broken, you don’t want the current state saved as a snapshot. If you think you might want the current state, then leave the box checked and click “Restore.”

Post-reversion example (step 3)

media_1402932893670.png

I left the create snapshot box checked and then named the snapshot “After Updates”.
As a result, I have restored the “Fresh” Linux Mint as the current state, but I could choose the after update state and I could use it also.
This may be a bit confusing and it’s certainly worth visiting the documentation on this one; however, it is a very useful feature.
Let’s reboot to the “Fresh” install just to verify that my updates were reverted.

Confirmed: all updates have been reverted

media_1402933062851.png

When we return to Mint, we see that no updates have been applied and that the mintupdate tool itself still needs to be updated.
This shows that we have completed reverted our changes.
This is a powerful and useful feature. It’s worth playing around with now, while you are not really risking much if you run into problems.

Exchanging data between your virtual and physical machines: drag-n-drop, clipboard, shared folders

media_1403025723284.png

There are various ways to get data back and forth to your virtual machine. There are two features that you can enable immediately that may help you exchange data:
(1) Drag-n-drop
(2) clipboard

To turn on Drag-n-drop, click on Devices > Drag’n’Drop > Bidirectional. Drag’n’drop is a very new feature. Currently, it only works if your guests are Windows or Linux and regardless of the choice you made above, it only works from host to guest. So you can drag files from your Mac or Windows machine to your Linux machine but not the other direction. That may not really help us too much.

Drag-n-drop, clipboard, shared folders (2)

media_1403025870843.png

To enable the shared clipboard, you follow a similar procedure.
Click on Devices > Shared Clipboard > Bidirectional.

This feature has been around much longer and works as expected. You should be able to cut and paste text from your Mac or PC to the virtual machine and vice versa.

Shared folders (1)

media_1403026075839.png

In order to more seamlessly move files back and forth (at least until Drag’n’Drop is improved), the best option is to set up a shared folder. This folder can than be used to share data between the host machine and the guest machine. Here’s how this works:

Create a folder on your host desktop called “mintshare.” Of course, the folder could be located anywhere on your host computer.
Now click on Machine > Settings in your Virtual Machine and choose Shared Folders.
On the right-hand upper side of the window, click on the folder icon with the green plus sign.
This will take you to a file browser.

 

Shared folders (2)

media_1403026249306.png

After clicking on the plus folder icon, you’ll need to choose “other” in the first dialog that appears.
It will then take you to a file browser dialog.
Navigate to the folder you want to share and choose it.

  1. You should return to a screen that looks like the above.
  2. Check the box to “auto-mount”
  3. Check the box to “Make Permanent”
  4. Then click “OK”.

Shared folders (3)

media_1403026408989.png

You should see a screen that looks similar to this one. It shows that “mintshare” is a Machine Folder and that it will be auto-mounted at bootup and that you will have “Full” access (read/write) access to it.
Click “OK” again.

Shared folders (4) – fixing a small glitch

media_1403027844505.png

There is actually a small error in the configuration which doesn’t permit you to see the folder. Let’s fix that. (And thank you to the user on the forum who documented their solution.

Once we’ve fixed it, we’ll create a shortcut on the desktop that will make it easier to work with the shared folder.

Open a terminal window on the guest, either by clicking on the terminal icon in the lower left-hand corner, or by using the Ctrl-Option/Alt-T keyboard shortcut. Type in the following:
sudo gpasswd -a <username> vboxsf and hit Enter. You’ll need to replace “<username>” with your user name. Once you’ve entered that, close the terminal and restart the guest machine. The issue is that your user was not added to the correct security group to be able to access the new shared folder. You just fixed that with the commands that you typed at the command line. You now have to reboot in order for those changes to take effect.

After the machine has rebooted, log in again.
Now, let’s create a shortcut on the desktop to the shared folder.
Click on the file folder icon in the lower left-hand corner.
This will bring up the file explorer. It’s somewhat similar to what you would see on the Mac or in Windows.
In the file explorer, click on “File System” on the left.
Then click on the “media” folder in the right-hand window displaying file folders.

Shared folders (5) – fixing a small glitch

media_1403028059259.png

In the media folder, drag the shared folder (which has been given the name “sf_mintshare”, if you followed my earlier naming suggestion) to the desktop.
You will see a “+” indicating that you are making a copy of the folder on the desktop.
Once you are done you will now have a shortcut to the shared folder on the desktop. You can use this folder to transfer files back and forth between your host and guest machines.

Whoops! I made a mistake with the above. It made a copy, and NOT a link or shortcut. For whatever reason, the file manager in Linux Mint doesn’t allow us to make a link to the shared folder, so you will need to do that on the command line.

First, delete the copied folder that was made by mistake if you followed my earlier instructions. You can right-click on it and move it to the trash. Now, start up the terminal again. Type this in (assuming you used the same naming that I used before):

ln -s /media/sf_mintshare ~/Desktop/sf_mintshare and hit the Enter key.

This mysterious incantation creates a symbolic link from /media/sf_mintshare to new folder on your desktop entitled sf_mintshare. Once you’re all done, you should see a folder with a shortcut icon on the desktop that is a link or shortcut to the /media/sf_mintshare folder.

Clear as mud? Ask in the comments.

Advertisements

4 thoughts on “3. Running Linux Mint on Virtualbox: (1) enabling snapshots and (2) shared folders

  1. Stavros says:

    Dear Ben,

    Allow me to send you “two thumbs up” from here in Switzerland. Truly, I have never seen such a clear tutorial and I could install Linux Mint on my Mac without a problem. Thank you!

    At last, I will be able to show a little bit off in front of my IT and other biostatisticians colleagues, ha ha ha.

    All the best on your side,

    Stavros

  2. Quinn says:

    Ben,

    Instead of using a terminal window to manually create the desktop link to /media/sf_mintlinux, I found a post doing a Google search that said to hold Ctrl + Shift keys, then drag the sf_mintlinux folder to the desktop. Worked for me. The one caveat being, this method may not work with all desktop managers. I’m running Mint 17.3 in Virtual Box, on a Windows 7 host.

    Thanks, Great tutorial!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s