Monday, February 25, 2008

I am Fedora, and so can you!

by Max Spevack

Fresh, free, and featherweight: the all-new Fedora 8 on a USB key.

I am writing this article on a Windows laptop borrowed from a friend. But fear not, dear reader, for I have not abandoned my free software principles. For while the hard disk of this laptop contains the Windows operating system, I have used a USB key as the boot device, and the laptop is currently running Fedora 8, codenamed “Werewolf.”

When I am finished, I can unplug the USB key, power off the machine, and hand the laptop back to its owner. I’ll have my entire distro in my pocket, and when the laptop’s rightful owner powers it back on, the computer will behave as always.

The following walkthrough will enable you to run Fedora 8 from a USB key.

0. Prerequisites

In order to complete this walkthrough, you need:

  • a computer with Fedora 7 or Fedora 8 installed on it.
  • root access on that computer.
  • basic command-line knowledge.

1. Acquire a USB key

The basic desktop version of Fedora 8 will fit on a 1 GB USB key. The “developer” version of Fedora 8 will require a 2 GB USB key. Pretty much any brand of USB key should work. I use the PNY Attache ones — they work well and can be found for a relatively cheap price.

2. Acquire a Live image

The Fedora Project releases both live and installable images of the Fedora distribution. In order to run off of a USB key, you need one of the live images — this means that the entire distribution is loaded into the computer’s memory and runs without touching the hard disk at all.

Download a live image or create your own if you are particularly adventurous!

3. Install livecd-tools

On your current Fedora machine, install the livecd-tools package, either via the graphical
add/remove software application or by using yum directly on the command line. Note that this step requires you to have root access!

su -c 'yum install livecd-tools'

4. Figure out where your USB key is mounted

Plug in your USB key and the system should automatically mount it for you. All you need to do is make a note of the device name that was chosen when you plugged the USB key in. To do so, open up a terminal and run the following command:

df -h

Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
35G 6.8G 26G 21% /
/dev/sda1 99M 19M 76M 20% /boot
tmpfs 501M 12K 501M 1% /dev/shm
/dev/sdb1 2.0G 0 2.0G 0% /media/disk

In this case, the bottom line is the one that is important–you’ll want to find the line that is correct for your system, and remember the first part. /dev/sdb1 will be used for the rest of this article. You should use whatever result is displayed for your machine.

5. Copy the image onto the USB key

Now you have everything you need — the livecd-tools package is installed, the image that you want to use has been built or downloaded, and your USB key is plugged into the computer. All that is left to do is run one more command: livecd-iso-to-disk. The command’s name is pretty self-explanatory. The first argument is path to the live image, and the second command is the location of the USB key, which you discovered in the previous step. Note that this command requires root access!

su -c 'livecd-iso-to-disk /path/to/Fedora-8-Live-i686.iso /dev/sdb1'

Verifying image...
Fedora-8-Live-i686.iso: 17d675e98a44754d41ba0d93f485ffa3
Fragment sums: 7dba468e8adf87c776ae4a15a871426ba74dba1187adb2a6807c1e124a34
Fragment count: 20
Percent complete: 100.0% Fragment[20/20] -> OK
100.0
The media check is complete, the result is: PASS.

It is OK to use this media.
Copying live image to USB stick
Updating boot config file
Installing boot loader
USB stick set up as live image!

6. Reboot

Reboot your computer, and when the BIOS starts up, make sure you tell it to boot off of the USB key and not the hard disk. Usually the screen will flash a message that says something like “press F12 to bring up boot device list”. On some machines, you have to press the DEL key instead.

That’s it. Wait for the machine to finish booting and at the login screen click on “Fedora Live” and you are automatically logged in (or just wait 60 seconds for the automatic login to trigger).

Remember!

The USB key that you have just configured only contains the operating system. It does not store any of your personal data on it. I recommend that you carry around a second USB key for saving data. Most laptops have more than one USB slot, so it is easy to plug them both in. Boot off of the first key, and then before you shut down the computer, save all of the stuff you worked on to the second key.

Run Ubuntu 7.10 from Windows


This tutorial explains How To Run Ubuntu 7.10 from a portable USB device or from a folder within Windows. As noted before, the advantage to using Qemu hardware emulation as opposed to a native USB boot is that you can to plug your USB stick or portable hard drive into any available Windows PC and run a completely separate Linux operating system without rebooting the Windows Host PC. In addition, by utilizing the casper persistent feature, you can save your personal settings and changes back to the img located in the installation directory and then restore those saved settings on each boot.

Using this tutorial, Ubuntu 7.10 can be run from within Windows 98, NT, 2000, XP or Vista without rebooting. Ubuntu 7.10 runs from it's own directory either on a portable USB device or directly from a folder on your Windows computer.

This is a great way to learn Linux without actually creating a partition and installing. There are quite a few Linux instructors who actually teach Linux to their students via this approach because it does not require local installation.

Qemu Portable Ubuntu 7.10 essentials:

  • Portable device with 1GB+ free space (2+GB recommended)
  • A Windows Host computer
  • Ubuntu 7.10 ISO
  • QPU710.exe

Portable Ubuntu 7.10 creation process:

  1. Create a folder named QPU710 on your portable device or on your Windows Desktop
  2. Download the QPU710.exe and run, extracting it's contents to the QPU710 directory
  3. Download the Ubuntu 7.10.iso and move it to the QPU710 directory
  4. Click the QPU710.bat file to start Ubuntu
  5. At the boot menu, press F6 to enter a custom boot option. Type persistent at the end of the boot string: add persistent to the boot options
  6. Ubuntu 7.10 should continue to boot… and save most of your settings as you work. To restore these saved settings on the next boot, simply press F6 and add persistent again.

Qemu commands:

Click within the Qemu Window to use the Ubuntu desktop

Press Ctrl+Alt to switch to and from the Host desktop

Press Ctrl+Alt+F to toggle full screen on or off

Press Ctrl+Alt+2 to switch to the Qemu Monitor (and type help for command list)

Press Ctrl+Alt+1 to switch from Qemu Monitor back to Linux

WARNING: When shutting down the Ubuntu 7.10 environment, at the prompt to remove the disk, simply press enter and wait until the progress bar has finished. It is then safe to press Ctrl+Alt and close the Window. "If you don't wait, you may corrupt your persistent image


Run Ubuntu from Windows via a portable USB Hard drive


The following tutorial explains how to easily run a "full installation of Ubuntu" directly from a Windows PC without the need to reboot. Our example is run from a portable USB Hard drive that we can take with us anywhere. Through emulation, Ubuntu can be run from the portable device using a host Windows 98, NT, XP, 2000 or Vista computer to launch the emulator. This enables the user to run Ubuntu and Windows simultaneously. Were using Qemu hardware emulation software with the Kqemu accelerator to accomplish this.

Necessities:

  • Computer (running Windows)
  • USB Hard-Drive (at least 3GB of free space)
  • Ubuntu ISO
  • UQemu.exe (contains Qemu, Kqemu and a special batch file)

The Portable Qemu Ubuntu Creation Process:

  1. Create a folder named PQUbuntu on your portable USB hard drive
  2. Download and extract the files from the UQemu.exe to your PQUbuntu folder
  3. Download the latest Ubuntu ISO and move it to the PQUbuntu folder
  4. Double click the create-n-run.bat (Once presented with the Ubuntu launcher, select the first option to start or install Ubuntu)
  5. Click install from the Ubuntu desktop and continue through the installation process. Proceed to install to hda -3.2GB Qemu Harddisk (the install will take some time "20-60 minutes")
  6. Once installation has completed, select the option to restart. Then close the Qemu window once Ubuntu has shutdown
  7. Now, simply click the Ubuntu.bat file whenever you wish to run Ubuntu from the USB device

Performance Notes:

You can edit the -m value in the Ubuntu.bat file to use up to half of your system memory ( However, I don't recommend using more than 512MB) QEMU currently limits the max guest ram size to 2047 MB

Other important tips:

Use Ctrl+Alt+f to toggle between window and full screen mode

Use Ctrl+Alt+Esc to move from Ubuntu to Windows

Update 9/24/07: Kqemu now works from Windows Vista

No comments: