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
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.
- In the VirtualBox menu, click on Machine -> Take Snapshot
- Give the Snapshot a meaningful name, like “Fresh Linux Mint Installation”
- Add additional information in the Snapshot Description field if required.
- Click “OK”.
- 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
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
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.
- Verify that it shows as “Powered Off.” In the VirtualBox Manager, select the machine if it is not already selected.
- Click on “Snapshots” in the upper right-hand corner.
- 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)
- Right-click on “Fresh Linux Mint Installation” and click on “Restore Snapshot” to make that snapshot the current image.
- 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.
- 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)
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
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
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:
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)
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)
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)
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.
- You should return to a screen that looks like the above.
- Check the box to “auto-mount”
- Check the box to “Make Permanent”
- Then click “OK”.
Shared folders (3)
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
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
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.