Xaprb

Stay curious!

Archive for the ‘Desktop’ Category

Making auto-resetting VirtualBox machines

without comments

I don’t know if I’ve said this before, but I absolutely love VirtualBox. It makes it so easy to run Windows in the cases where I have to for a client’s silly Windows-only VPN software or something like that. Windows runs better inside VirtualBox than it does on bare hardware.

One of the tricks I use constantly is to set up a bunch of VirtualBox instances with a common (shared) base disk image. You can do this by creating a machine, installing your operating system on it, then throwing away the machine and keeping the resulting disk image. You can then keep this image registered inside VirtualBox, but detached from any actual machines. Then set it immutable so it never changes again:

VBoxManage modifyhd HardDisks/Windows_XP.vdi --type immutable

Substitute the name of your actual disk image file. Now you have a freshly installed Windows image on that file, which can serve as the base for lots and lots of machines. I have one set up with Service Pack 3, all the usual annoyances disabled, etc etc.

Now here comes the magic: you can create special-purpose machines that always revert to the fresh image when you boot them up. Let’s say I want an image with an annoying VPN installed. I will create a new machine, call it Windows_XP_VPN, and select the Windows_XP.vdi file as its disk image. After selecting this disk image, I juts go through all the rest of the settings, finish the wizard, and I have my machine. I boot it up, make some changes, and when I shut it down, all the changes it’s made are stored in a differencing disk image file. It doesn’t touch the base image file; any modifications are made to a copy-on-write image file.

The special characteristic of this differencing image file is that it resets on boot. If I shut down the machine and look at the image files, I’ll see one that’s oh, maybe a couple hundred megabytes. I can have lots of these images sharing the same base image file that usually ends up being multiple gigabytes, so sharing the base image file is a great way to save on disk space. But what happens when I restart this machine, is that the differencing file gets emptied first. If I boot up, save a file on the desktop, and restart, the file is gone. I’m back to the fresh image.

So this isn’t the full solution, actually, because the nasty VPN software I installed isn’t there after restart. I want it to persist. How can I do this? It’s actually pretty simple. I’ll just set the differencing image not to reset at boot:

VBoxManage modifyhd Machines/Windows_XP_VPN/Snapshots/[image file name] --autoreset false

Now this machine will store its state across reboots. However, I actually like Windows machines to reset at boot. If I don’t have them doing that, they eventually fill up with garbage. I want a clean image, with the VPN installed, and every time I start the machine I want that minty-fresh just-installed nasty VPN feeling. How can I do this? It turns out this is also not hard. Instead of turning off autoreset on the image, I just take a snapshot after shutting down. Only the most recent state (which is stored in a differencing image file) will be configured as auto-reset. Snapshots are stored in a snapshot image file that doesn’t get reset. Whatever changes I made before I took a snapshot, are persisted across reboots.

To illustrate this, let’s say I start a fresh machine from my base disk image. Then I install VPN on that, and shut down. If I reboot now, I lose my VPN. But if I take a snapshot, and call it “VPN installed” or something like that, when I restart my VPN is still there. Now I’ll make a folder and put it on the desktop, and reboot again. Presto — the folder is gone, but the VPN is still there.

It’s magic, and it’s the nicest thing ever, especially for Windows. No worries about viruses, no problems installing some junk spyware that some customer thinks is a good screen-sharing tool, whatever. I can trash the machine, shut it down, and when I reboot it, it’s spiffy clean.

And this brings me back to my original point: I love VirtualBox.

Written by Xaprb

August 31st, 2011 at 9:21 am

Posted in Desktop

Tagged with ,

Easy on the eyes: the solarized color theme

with 2 comments

I recently set up the solarized color theme for my terminal emulator. I’ve been meaning to do this for a while, but procrastinated. However, I finally got really frustrated with the colors I get from “ls” sometimes — I use a dark terminal with light fonts, and the directory listings in particular can become invisible, with dark blue on black.

Solarized is much improved. All of the colors work well together and are easy on the eyes. What a relief! Recommended for programmers and system administrators. There are plugins or configuration files for a huge variety of programming environments and programs, including Vim of course.

I use XFCE’s terminal, and I found that there was no terminal configuration file for it in the download. But I found a workaround: just append the colors listed in this file to the end of $HOME/.config/Terminal/terminalrc.

Written by Xaprb

July 28th, 2011 at 8:16 am

Posted in Desktop,GNU/Linux,Sys Admin

Tagged with , ,

How I ended my trial of Gnome 3

with 18 comments

tl;dr version: I like XFCE better than Gnome 3.

I wrote previously about trying out Gnome 3. I’ve been using it for about a month now, and it’s time for me to make a decision about whether to keep using it or revert to Gnome 2. I’m actually on vacation, which ends soon. I need to do this before vacation ends, so I can be fully productive at work.

My ultimate impression of Gnome 3 is that it’s very slick, and makes significant improvements in some ways, but it’s not very usable for my purposes, and has too many self-contradictions. I still have the complaints I listed in my earlier blog post, such as the identity crisis between keyboard and mouse use. It is geared to keyboard control in some ways, but not enough to really work, and at the same time it’s hard to use it with the mouse. For example, it wastes space on items such as huge thick titlebars (what is that for, if not for the mouse to grab?). Yet window borders are only 1 pixel thick, which is very hard to grab with the mouse when I want to resize, and there are no minimize buttons by default. And there is a big black bar across the top of my screen, which contains a lot of useless items I normally hide. At the same time, this bar isn’t configurable and I can’t put the things I actually want onto it, so it simply sits there making part of my screen unusable.

After using Gnome 3 for a while, and trying to customize it to my liking, I gave up a couple of days ago. There are simply too many things that were either designed in a way I don’t like, or don’t work as designed (bugs). At this point, I revisited my reasons for using Gnome. I used to use XFCE, and Fluxbox before that, but I ultimately decided to use Gnome because it was the default, and I want to avoid customizing my environment as much as possible. Gnome had gotten to the point where it was about as good as anything else, for my purposes.

So instead of reverting to Gnome 2, since I’m going to customize my environment anyway, I decided to go back to XFCE instead. And now I’m happy again. It’s simple, usable, functional, attractive, and fast. It’s easy to customize slightly to my taste (e.g. moving the taskbar to the bottom of the screen, Windows style). And Alt-TAB works sanely. And, I get back some of the things I always missed, such as one-click ways to maximize windows vertically or horizontally.

When Fedora 16 comes out I’ll revisit Gnome 3 and see if it has improved, but for now I’m done with my evaluation. I also just set up a new computer for my dad, who’s a Windows user, and installed Fedora 14 with Gnome 2, instead of Fedora 15. I hope the Gnome developers are able to collect and integrate enough feedback to make a groundbreaking Gnome 3 interface that still does what people expect and works the way they work, because that is the key to getting more adoption.

Written by Xaprb

June 28th, 2011 at 10:42 am