Category Archives: HowTo

ubuntu computer running 3 vm's

Running Windows on GNU/Linux

Since my move to GNU/Linux I have had to run proprietary software several times. This is typically because of school projects that require Windows or Mac-only software like SMART Notebook or WebEx.

So what do you do when your GNU/Linux can’t run the application that you need to use?

Solution: Run Windows in a virtual machine.

What’s a virtual machine?

A virtual machine is a separate computer that runs inside your current computer. It runs inside a program on your main operating system called a hypervisor. In my case, I use a program called VirtualBox. It creates a fake environment where you can install another operating system – for me, it is Windows 7 or 8.

Said another way, a virtual machine is a client computer running inside a program on your host computer.

Getting Windows

For short-term Windows use, your best option is to download pre-configured virtual machines from Microsoft’s Modern.ie. Modern.ie is a site that allows web developers to download time-limited (90-days) virtual machines to use for testing websites on Microsoft browsers.

screenshot of Modern.ie website

Microsoft’s Modern.ie website

The virtual machines available on Modern.ie can also be used to test and use any software that runs on Windows.

If you need to run Windows over a longer term you will need to get a legitimate license. Students can check with their campus computer store for free or significantly discounted licenses. Home users can check with companies like Newegg.com for discounted original equipment manufacturer (OEM) versions of Windows which typically cost around $99.

Windows 10 on Newegg.com

Windows 10 on Newegg.com 2016-03-13

I have used virtual machines for:

  • Testing proprietary software for school – SMART Notebook
  • Test installing software to see how it affects the operating system
  • Using proprietary software not available on GNU/Linux like WebEx
  • Logging in to my work terminal server via Remote Desktop

Here is a screenshot of my Ubuntu machine running three virtual machines:

  • Windows 10 VM from Modern.ie
  • Ubuntu 15.10 displaying a remote Windows terminal server instance
  • Windows 8 installation (free from school – yay!)
ubuntu computer running 3 vm's

My Ubuntu computer running 3 virtual machines

More help

Here is a YouTube video by a fellow named Quidsup. He shows you how to install Windows 10 inside VirtualBox.

ZFS: automatic snapshots

ZFS: Setting Up Automatic Snapshots

I considered writing a script to take care of this. Luckily, before I got too far down that rabbit hole, I stumbled upon Bryan Drewery’s zfstools on GitHub.

The zfstools installs a few Ruby (programming language) scripts that make managing automatic ZFS snapshots really easy. While you can customize the snapshot retention, the defaults will probably serve you well.

The default snapshot schedule is to snapshot your selected ZFS datasets:

  • every 15 minutes – keeping the last 4 quarter-hour snapshots
  • every hour – keeping the last 24 hourly snapshots
  • every day – keeping 7 daily snapshots
  • every week – keeping 4 weekly snapshots
  • every month – keeping 12 monthly snapshots

The setup is easy on FreeBSD. It only takes 3 steps:

  1. install the scripts
  2. turn on auto snapshotting
  3. update the /etc/crontab file

Start by installing zfstools from the FreeBSD package system:

$ sudo pkg install zfstools

Then, determine which ZFS datasets to automatically be snapshot. Turn on auto-snapshotting for these ZFS datasets:

$ sudo zfs set com.sun:auto-snapshot=true ZPOOL/DATASET

Where ZPOOL is the name of the zpool and where DATASET is the name of the ZFS dataset that you want to be automatically snapshot.

Next, it is time to update your machine’s /etc/crontab file to run the script. If you have never touched your /etc/crontab file before, take a moment to read the manual page for this magical file:

$ man 5 crontab

Next, copy the 5 crontab lines from https://github.com/bdrewery/zfstools README.md file. Look for the lines that have tons of asterisks – the manual page listed above explains what these asterisks and the rest of the fields represent.

Also, make sure the /etc/crontab PATH line contains the directories where ruby and zfs-auto-snapshot live. On my machine these were:

  • /usr/local/bin/
  • /usr/local/sbin/

You can figure out what yours are by typing:

$ which ruby

and

$ which zfs-auto-snapshot

The PATH line in my /etc/crontab file ended up looking like this:

PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin

Wait for the clock to pass the quarter hour then look for the automatic snapshots:

$ zfs list -t snapshot

You will see automatic snapshots start to pile up.

bash tab completion in tmux on Ubuntu GNU/Linux

I installed tmux on my Ubuntu laptop. I was confused about why tab completion was not working.

Silly me, it turns out that the default shell on tmux is /bin/sh and not the typical Bash (/bin/bash) shell typically used in GNU/Linux.

The simple fix was adding this to my $HOME/.tmux.conf file to ensure subsequent tmux sessions used /bin/bash.

set-option -g default-shell /bin/bash

1Password on Ubuntu Linux 14.10

Edited on July 26, 2015 to include instructions on enabling browser extensions (Thanks, Jonathan!)

If you are as deeply entrenched in the Apple ecosystem as I am you probably survive password hell by using 1Password.

What if you want to play around with Ubuntu Linux? There is no version of 1Password for Linux. There is one neat work-around that I will show you here: you can use Wine, a Windows emulator, to run 1Password on Ubuntu Linux. This will probably work on other *nix systems too.

Watch it!

Check out my screencast on YouTube! to see the installation.

Install notes

Assumptions

This guide assumes the user has:

  • Ubuntu Linux 14.10 64-bit version is installed on a computer or virutal machine
  • beginner-level familiarity of the Linux command line
  • an existing 1Password installation that is being synchronized via Dropbox (not iCloud)
  • 1Password version 4 for Windows is being installed

Overview

  • install Wine
  • Install & configure Dropbox
  • Download 1Password
  • Install 1Password in Wine
  • (NEW) Install browser extensions
  • Run 1Password (NEW) with browser extensions enabled

Install WINE

Open up a Terminal window and type in the following:

sudo apt-get install wine

The Ubuntu package installer will then figure out what dependencies Wine has and it will figure out what needs to be downloaded. It will present you with a summary of what is to be installed and then it will as you if you want to continue. Type in y to continue.

It will then present you with an end user license agreement (EULA) for using Microsoft fonts. Click ok to accept it. Note: you will need to use the Tab key to focus on the <Ok> on this and subsequent dialog screens.

Install and Configure Dropbox

Open the Ubuntu Software Center and search for “Dropbox”.

When it shows up, click on Dropbox, then click on the Install button and enter your password when prompted.

The Ubuntu Software Center will install Dropbox for you. When it is done, close the Software Center window.

Click on the new Dropbox icon in the Launcher. A Dropbox setup window will then open. Enter your account information. At this point you accept the default of syncing everything in your Dropbox account. Alternatively, you can click on the Advanced Settings link to choose specific folders to sync.

Download 1Password

Running 1Password on Ubuntu requires the Windows version. You can grab it at the AgileBits Downloads page.

Click on the Download It Now button.

In the resultant pop-up dialog box, click on the Save File button.

Depending on your browser, you will either get to choose the target download directory or it will go to the default directory.

Install 1Password in WINE

Go to wherever the download is stored now. (In my case, the 1Password installer went to my /home/eduardo/Downloads directory)

cd ~/Downloads

List the contents of the directory and look for the 1Password executable installer. It will be named something like 1Password-4.1.0.530.exe . Your filename will be different than this.

Make sure you use your 1Password filename in the following command.

Use Wine to install 1Password by entering this command:

wine 1Password-4.1.0.530.exe

This will install 1Password in your Wine directory and start the 1Password Windows installer.

Select the default install location. It will say it is installing it to C:\Program Files (x86)\1Password 4 but, in reality, it is installing it to the Wine folder in your home directory.

Next you are given the opportunity to create a Start Menu shortcut. Since you are on Ubuntu, there is not really a start menu. Check the checkbox for Don’t create a Start Menu folder.

Check the checkbox for Create a desktop icon if you want one and click the Next button.

Click on the Install button to begin the installation. Once it has been installed click on the Finish button to exit the installer and get back to the command line.

Run 1Password

The simplest way to run 1Password is to use the Desktop icon. If you chose to install a Desktop icon keep in mind that it will probably not show up until after a reboot of the system.

If you didn’t install a Desktop icon, you can start Dropbox in the command line.

NEW: Install browser extensions by navigating to the AgileBits browser extensions site:
https://agilebits.com/onepassword/extensions

Navigate to your Wine folder. Assuming you chose the default directory when installing 1Password, you should type the following into the command line:

cd ~/.wine/drive_c/Program\ Files\ \(x86\)/1Password\ 4/

Note: unlike in Windows, file and directory names can only be letters, numbers, periods, hyphens, or underscores. Any other character or space must be preceded by a backslash character. This is known as escaping a character.

Run 1Password by typing:

./1Password.exe

This will bring up a Welcome to 1Password dialog box. Click on the I have used 1Password before button. Next navigate to your 1Password keychain in Dropbox.

Enter your 1Password master password. You should now see everything from your 1Password vault.

NEW: Lastly, navigate back to the 1Password application location and look for a file called Agile1pAgent.exe. This app must be running to enable the browser extension(s).

Run it by navigating to the 1Password directory and typing:

wine Agile1pAgent.exe

(Many thanks to Jonathan for providing this guidance in his comment to this post.)

End Notes

If you know of better/easier ways of doing this, please post a comment.

Thanks.