Running Puppy Linux inside OS X

puppyscreenshot_20071008.jpg

Sometimes it's nice to have a secure and familiar OS that you can use from any machine. Puppy Linux is just that: a really lightweight, CD-based Linux distribution, designed for maximum portability. If you're using a PC, you simply boot and run Puppy Linux from a CD, storing your settings and changes to a file on your hard disk or flash drive. What's awesome is that it's so compact, you can fit an emulator, the CD ISO, and the save state files all on a flash disk or SD Card, making it one tiny little OS package that you can carry in your pocket.

Using Q, the OS X port of the QEMU virtual machine, you can create a small footprint, virtual Puppy Linux box that will run under OS X and fit on a flash drive. In addition to its portability, this is one of the easiest ways to get Linux running on your mac.

You could have a little portable Linux box running on your Mac in a half hour. So let's get started.

Download Puppy ISO and Install Q

  • Go to the Puppy Linux download page and get the latest ISO (currently 3.0) - Link
  • The latest Q version and documentation is here - Link
  • Grab the latest stable build, and copy the Q app to your Applications folder


Make a New Guest (Virtual) PC

puppy2_20071008.jpg


puppy3_20071008.jpg

  • Run Q, then click Guest PC -> New Guest PC
  • Call it Puppy Linux (or whatever), and select Q Standard Guest as the OS type/
  • Under general, unselect "set clock to host time".
  • In the Hardware tab, set your RAM size to 256MB, pick the Soundblaster if you need audio (it eats a lot of CPU, so leave it out if you have a slow machine).
  • Make a hard disk image that's appropriate for your storage device. I'm making a 1GB file that I can put on an SDCard. You probably don't need anything near that much, since Puppy only stores save data there and promarily runs from the ISO. The qcow format will start out small, and grow to the file size you specify.
  • Under CDROM, select the Puppy Linux ISO that you downloaded.
  • Make sure to select Boot from CD-ROM. Puppy is set up to boot from CD and store saved settings to disk.

Start the Puppy Linux Install

puppy1_20071008.jpg


When you've finished updating the settings, click the little play icon to start booting from the ISO image. You'll see the normal start-up stuff, and it'll ask you a couple questions before booting X Windows.

Note: choose the XVesa server as your X server. The Xorg server didn't seem to work for me and I had to restart the virtual machine.

puppy4_20071008.jpg


puppy5_20071008.jpg

Once X Windows loads, you'll get to choose your video resolution. There weren't any widescreen resolutions enabled by default, so I'm using 1024x768, which fits in a decent sized window.


Network Setup

puppy6_20071008.jpg

puppy7_20071008.jpg

You'll also want to set up your network connection at this point. Just click on the connect icon, select the eth0, and set it up to use DHCP.

Format the Virtual Hard Disk

This is the only really technical step. Inside the virtual machine, Puppy can't see your real harddisk or thumbdrive. Instead, we've created a virtual disk image that the emulator is able to see. At this point it's just a raw drive that hasn't been partitioned or formatted, so we'll be making a ext3 partition on it. This will house all of Puppy's save state information and is updated every time you shut down the Linux OS.

puppy8_20071008.jpg

puppy9_20071008.jpg

Click the console icon on the Puppy desktop to get a terminal window. Then use fdisk and mkfs.ext3 to partition and format the virtual disk. Your virtual disk will show up as /dev/hda. Refer to the images to see the details, but the cheat sheet is below.

# fdisk /dev/hda
n
p
1
return
return
w

# mkfs.ext3 /dev/hda1


puppy10_20071008.jpg


Finally, exit the console, and click on the drives icon. Select the /dev/hda1 disk you just made. It will now be mounted and available within Puppy.

Tell Puppy to Save to the New Virtual Disk

puppy11_20071008.jpg

puppy12_20071008.jpg

puppy13_20071008.jpg


Reboot the OS from the Puppy menu and you'll be prompted to save your session. Choose the hda1 disk you made, and choose a save size that's smaller than the full disk size.


puppy15_20071008.jpg


After you've chosen your save options, you'll also be asked to copy some of the data from the CD ISO to this drive. Puppy doesn't know you're using a disk-based ISO instead of a CD, so it normally caches this stuff in RAM. To save a little RAM, choose "Yes" to copy this to your virtual disk. Puppy will treat this like a normal file and you'll save some extra RAM and have a faster startup.

Puppy should then reboot with your saved settings intact. If Puppy stalls during boot saying it's loading from the hard disk, you need to go back and make sure your settings are configured to boot from the CD ISO.

Put your Puppy on a Flash Drive

You may want to copy the Q application binary, Puppy ISO, and virtual machine files over to your flash drive. This will let you run your private OS on any mac you happen to be on. You'll need a little space. The Q virtual machine is about 25MB. The Puppy ISO is about 100MB, and your virtual machine files will grow to the size of the hard disk you created. Depending on how big of a drive you make, you should be able to squeeze everything on a 256-512MB drive quite easily.

Do the following:

  • Copy Q.app from the Applications folder to your flash drive
  • Copy the Puppy ISO to your drive
  • You'll find the virtual machine state file (.QVM) in your Documents/QEMU folder. Copy that one too.

My SD Card drive is pretty slow, so an alternative is to put the Q binary and the ISO image on a CD. Doing this will shorten your boot time, as well as the time to load any applications from the ISO image.

Update the .QVM Package's CD Path

However you set things up, you'll need to edit your virtual machine config and adjust the settings to point to the new location of the ISO. This is most easily done by editing the configuration.plist file inside the .QVM package.

Just right click the .QVM file on your flash disk, and click "Show Package Contents." Open the configuration.plist file in TextEdit or Property List Editor and look for the long string that contains the parameters for the virtual machine. If you adjust it so that it contains "-cdrom puppy-3.00-seamonkey.iso" instead of a full file path, you can move the ISO file right inside the QVM package and have a self contained package that contains both the ISO and hard disk image.

You can now hop on any computer, run Q.app from the flash disk, and then drag the .QVM file to the Q icon on the taskbar. Your private little Linux box will boot right up! For bonus points, drop a Windows and Linux QEMU executable on the drive too. You should be able to boot your same Linux virtual machine on all three platforms. How slick is that?

Other Resources:
Lifehacker's Taking Puppy Linux for a Walk - Link
Puppy Linux downloads and community forum - Link
Q (QEMU for OS X)- Link
QEMU open source processor emulator - Link

Posted by Jason Striegel | Oct 8, 2007 08:56 PM
Linux, Mac, Virtualization | Permalink | Comments (5) Bookmark and Share

Recent Entries

Comments

Newest comments listed first.

Posted by: wayn3 on October 9, 2007 at 5:11 AM

I'm avoiding Puppy Linux for the following reason:
http://www.oreillynet.com/linux/blog/2007/10/a_death_threat_from_a_puppy_li.html?CMP=OTC-0O724Z062301&ATT=A+Death+Threat+From+A+Puppy+Linux+Supporter

The info in this article would be good for trying out other distros.


Posted by: jason_striegel on October 9, 2007 at 7:28 AM

Yikes! It's a drag to hear that happened.

As wayn3 mentioned, you can use the bulk of these instructions to install another distro if you desire. Damn Smal Linux and SLAX both have really good reputations.

DSL - Link
SLAX - Link

Too bad passionate users aren't always more motivated to wrangle code than to run around threatening people.


Posted by: buzban on November 8, 2007 at 11:05 AM

great article, thank you. just enough detail, and great visuals to help me through the process. very cool!


Posted by: byoung on January 27, 2008 at 5:29 PM

thanks this really helped me figure out how to save my configurations and files on guest Slax using Mac OSX as host :)


Posted by: Anonymous on April 10, 2008 at 5:31 PM

The "Export Guest PC to Flash Drive" will make a standalone application that will just run the .qvm file. So you dont have to copy the files. It can only run the virtual machine that was exported though.


Leave a comment



Bloggers

Welcome to the Hacks Blog!

Brian Jepson.Brian Jepson


Jason Striegel.Jason Striegel


Philip Torrone.Phillip Torrone



See all of the books in the Hacks Series!
Advertise here.

Recent Posts

www.flickr.com
photos in Hacks More photos in Hacks