Sunday, January 11, 2009

Stupid Linux Tricks : Create Puppy USB Stick without a CD-ROM

These past two days I have been experimenting with Puppy and entertaining the thought of using it as a primary OS for a "kiosk" machine that belongs to a buddy of mine. I downloaded it and went right to work trying to find a way to put the ISO onto a USB stick, but all the instructions I found lead to burning a CD-ROM first. Well I didn't want to do that. For one, I was trying to work off of my eee PC which obviously has no CD-ROM. Secondly, this is a disc I would never use again. And I have a LOT of discs stored away like that.

Not really finding any good answers online, I opted to experiment using an old trick that I have used for various Ubuntu releases.

Step #1 - Download puppy.
It doesn't matter which one. If you want something flashy, try the famed MacPup release. You will end up with an ISO image.

Step #2 - Mount the ISO.
Open up a Terminal and browse to the directory where the ISO file is located. First create a directory for the ISO to mount to: "sudo mkdir /mnt/iso". Then: "sudo mount -o loop nameofisofile.iso /mnt/iso".

Step #3 - Copy everything to the USB stick.
Go ahead and insert your USB stick now. It should be partitioned and formatted as a FAT file system. You should do this in Linux, since there is quite a difference in the way that Linux creates a Windows file system! Also make sure that when you create your partition (probably using fdisk) that you mark it as bootable. Now, simply copy everything from /mnt/iso to /media/disk (or whatever your USB stick is mounted as).

Step #4 - Syslinux your USB stick
Don't have syslinux? Do a: "sudo apt-get install syslinux" if you are running an Ubuntu/Debian release. Or if you are doing this from Windows, you can use the Win32 equivalent. Just do a "syslinux /dev/sdc1" where sdc1 is your USB stick. Make sure you know what your drive name is. Do a "dmesg" in terminal if you are unsure.

Step #5 - Perform magic.
If there is indeed a "trick" to doing all this, here it is. The trick is to go into your USB stick and rename isolinux.cfg to syslinux.cfg. Now it will boot, and you can install Puppy FROM a USB stick.

This will not likely help you install from a USB stick TO a USB stick. It will also probably not help you install from a USB stick to an SD card or similar removable storage. The reason being that grub will have different drive labels from the time you are installing, to the time you try to boot with your new OS. While I have been successful in repairing a broken system that is in this predicament, I would never try to walk someone through the process. If you should end up in that situation, do yourself a favor and find someone who has an external CD/DVD drive. It will save you hours of hair pulling.