Building a Live Kubuntu Flash Drive, with Persistence
*** The topics of this thread have been reorganized 8 February 2009 ***
*** The following TOC applies now ***
*** It includes the major how-to posts originally posted by me in this thread ***
TABLE of CONTENTS
First post--this post
Kubuntu 8.10 Intrepid Ibex KDE 4 ** Major Edit on 12-26-08 **
Live Flash Drive with Persistence - - - Complete & Simplified
(using GRUB as the bootloader; no Syslinux)
includes:
-- Using iso files to get Kubuntu and GRUB (without burning a live CD)
-- Working in GUI or CLI
-- Cloning your finished flash drive
Reply #1: usb-creator program (8.04 & 8.10)
This package automatically creates a Live persistent Kubuntu flash drive.
Starts with your Kubuntu iso downloaded file.
> Thanks to toad for bringing this to our attention.
Reply #3: History – Sequence of past how-to's
----- Building a Live Kubuntu Flash Drive for Gutsy 7.10
It is not persistent. It uses GRUB to chainload Syslinux.
Though dated, some of you may find it useful or interesting:
It shows how to boot (by chainloading) Syslinux, and has some good command-line techniques.
----- Live Kubuntu 7.10 + Live Ubuntu 7.10 on a 2GB flash drive
It is not persistent.. It uses GRUB to chainload Syslinux.
----- Live Kubuntu 7.10 flash drive WITH PERSISTENCE
using GRUB all the way (i.e., no chainload to Syslinux)
----- Kubuntu HH 8.04 on Live Persistent Flash Drive
using GRUB (no Syslinux)
Bug fix: It addresses a well-known bug at the time
“[hardy] livecd: keyword "persistent" results in busybox and (initramfs)”
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Kubuntu 8.10 Intrepid Ibex KDE 4 ** Major Edit on 12-26-08 **
Live Flash Drive with Persistence - - - Complete & Simplified
(using GRUB as the bootloader)
includes:
-- Using iso files to get Kubuntu and GRUB (without burning a live CD)
-- Working in GUI or CLI
-- Cloning your finished flash drive
-- Persistence means that your (personal) user configuration settings and data are saved to the flash drive and thus are available next time you run your LIVE Kubuntu from the flash drive. Nothing is written to any other drives in your system (unless you do so intentionally).
-- BIOS: Your BIOS must support "Boot from USB.”
-- Flash Drive: 2 GB (or larger)
You may be able to do this--tightly perhaps--with a 1 GB flash drive.
-- CAUTION Device naming!!!
The example here uses a flash drive that is seen as /dev/sdc in Kubuntu and as hd2 in GRUB.
>>> Yours may be different! See Step 1.
Choices: Working with live CDs and Working at GUI or CLI.
> You need Live Kubuntu CD files. Two choices:
Get them from a burned Live Kubuntu CD.
Get them from the downloaded iso file (without burning a CD).
> You need GRUB files to put on the flash drive. Three choices:
Get them from your regular Kubuntu operating system /boot/grub directory.
Get them from a Live CD that has them (like Super Grub Disk).
Get them from a downloaded iso file (without burning a CD).
> You can do this work in GUI or CLI (at Konsole) or combinations thereof.
We'll assume you are working in your regular Kubuntu operating system.
(Actually, you could also do this work from any Live Linux CD.)
GUI: Working with root privileges (working “as root”)
Open Konqueror (Dolphin) as root:
kdesudo konqueror
kdesudo dolphin
Syslinux, tech note: If you use Syslinux, not GRUB, then you'll be able to get those files from the Kubuntu Live CD or iso. GRUB files you have to fetch from elsewhere.
First, preparation:
-- Get what you need ready -- Read the list of Choices above, decide how you wish to do it, and get what you need ready to go.
-- Now, boot into your regular Kubuntu operating system, where you will do this work.
STEP 1 Flash drive Prepare the flash drive: partition, format, boot flag, two labels
Very Important:
Mounting the flash drive: /dev/sdc1 mounted as /media/kubuntu810
If you have trouble mounting the flash drive in GUI, see the first Troubleshooting note at the end.
=> We will assume that partition 1 of the flash drive is /dev/sdc1 mounted as /media/kubuntu810. Thus, the directory kubuntu810 exists (or has been created) in the /media directory.
Find out what your flash drive is named. Plug in your flash drive to a USB port on your PC.
Open K > Applications > System > Terminal (Konsole)
Type these commands:
sudo fdisk -lu
sudo grub
grub> geometry (hd<Press the Tab key now>
Then you can do:
grub>geometry (hd0)
grub>geometry (hd1)
grub>geometry (hd2), etc.
Study this output. Example: In my system, the flash drive is sdc = hd2.
Partition and format the flash drive. The end result should be this:
Partition 1, for Kubuntu: sdc1, ext3, 850 MB, set boot flag, set label: kubuntu810
Partition 2, for the “persistence partition,” sdc2, ext3, 1 GB, set label: casper-rw
>>> Wear-out? If you are concerned about flash drive wear-out, you may format the partitions ext2 rather than ext3. I have no hard empirical evidence on wear-out, either way. => google it.
To be done, as follows:
Two choices: Use GParted Live CD; or do the work in Kubuntu 8.10: install gparted using K > Applications > System > Package Manager (Adept)).
In GParted:
Highlight a partition, Partition (tab at top), Flags > Boot, and Label > [type the label].
Casper-rw: The casper-rw partition is important. It's the label you need so your Live Kubuntu flash drive recognizes the persistent partition as the one to use to save your data/settings/configurations.
Labels from GParted Live CD
Use a newer version: gparted-livecd-0.39-13.iso, 11/28/08 or later
Labels at Konsole--Another way to set Labels:
sudo e2label /dev/sdc1 kubuntu810
sudo e2label /dev/sdc2 casper-rw
STEP 2 GRUB work -- do this any way you want:
(1) Install GRUB files to kubuntu810 in a directory called /boot/grub;
(2) Install GRUB to the MBR of the flash drive;
(3) Build the boot menu /boot/grub/menu.lst (in kubuntu810).
(1) Install GRUB files to kubuntu810 in a directory called /boot/grub.
Three choices:
Get GRUB files from your regular Kubuntu operating system /boot/grub directory; or from a Live CD that has them (like Super Grub Disk); or from a downloaded iso file (without burning a CD). For each choice, you may do the work in GUI (Konqueror/Dolphin) or CLI (Konsole).
> Get GRUB files from your regular Kubuntu operating system /boot/grub directory.
GUI:
First, create /boot in kubuntu810: In your regular Kubuntu OS, open your file manager as root, open the partition kubuntu810, create a new folder called boot (right-click in an open area, Create New Folder, and give it the name boot).
In your file manager (still open as root), navigate to your regular Kubuntu OS /boot directory, open boot, right-click on the folder called grub, Copy [to] (CAUTION: Use Copy; do NOT use Move!!!). Then browse to and select the partition kubuntu810 of the flash drive, then to the directory /boot (that you just created), and select the boot directory (Here). So now you have set up /boot/grub on partition 1 (= kubuntu810) of the flash drive. (You may keep your file manager open.)
Next: proceed to (2) Install (setup) GRUB to the MBR of the flash drive.
CLI:
sudo mkdir /media/kubuntu810/boot
sudo cp -r /boot/grub /media/kubuntu810/boot
That will build /media/kubuntu810/boot/grub (and containing all the files in grub).
Next: proceed to (2) Install (setup) GRUB to the MBR of the flash drive.
> Get GRUB files from a Live CD that has them (like Super Grub Disk--SGD).
Let's assume you use a SGD live CD. Put the SGD CD in the CD tray, wait for Kubuntu to recognize it, then Open it. The GRUB files are at /boot/grub on the CD. Assume the CD is mounted as /media/cdrom0.
GUI:
Open Konqueror/Dolphin as root, create /boot/grub on partition 1 (= kubuntu810) of the flash drive, copy the grub directory & files from /media/cdrom0/boot/grub into /media/kubuntu810/boot/.
Next: proceed to (2) Install (setup) GRUB to the MBR of the flash drive.
CLI:
sudo mkdir /media/kubuntu810/boot
sudo cp -r /media/cdrom0/boot/grub /media/kubuntu810/boot
Next: proceed to (2) Install (setup) GRUB to the MBR of the flash drive.
> Get GRUB files from a downloaded iso file (without burning a CD).
We will use a quick download (4.4 MB) of Super Grub Disk -- The CD ROM 0.9774 from here:
http://forjamari.linex.org/frs/?group_id=61
We download super_grub_disk_0.9774.iso to the Desktop folder, then mount it as follows:
sudo mkdir /media/SGDfiles
sudo mount -t iso9660 -o loop /home/mike/Desktop/super_grub_disk_0.9774.iso /media/SGDfiles
cd /media/SGDfiles
ls
and you will see a boot directory;
cd boot
and you will see a grub directory
cd grub
and you will see the grub files.
Copy the GRUB files from SGD iso file /boot/grub into the flash drive partition /media/kubuntu810/boot/grub.
Two choices:
GUI:
Open Konqueror/Dolphin as root, create /boot/grub on partition 1 (= /media/kubuntu810) of the flash drive, copy the grub files from /media/SGDfiles/boot/grub into /media/kubuntu810/boot/grub.
Next: proceed to (2) Install (setup) GRUB to the MBR of the flash drive.
CLI:
sudo mkdir /media/kubuntu810/boot
sudo cp -r /media/SGDfiles/boot/grub /media/kubuntu810/boot
That will build /media/kubuntu810/boot/grub.
Next: proceed to (2) Install (setup) GRUB to the MBR of the flash drive.
(2) Install (setup) GRUB to the MBR of the flash drive.
Open Konsole, type sudo grub, at the GRUB prompt type these commands:
grub> root (hd2,0) # CAUTION: Use YOUR device name instead of hd2!!!
grub> setup (hd2) # CAUTION: Use YOUR device name instead of hd2!!!
grub> quit
$exit
This sets up GRUB in the MBR of the flash drive using the GRUB files in partition 1 of the flash drive.
(3) Build the boot menu, /boot/grub/menu.lst.
With your file manager open as root, in the flash drive partition 1 (/media/kubuntu810) open /boot/grub/menu.lst.
Delete everything in menu.lst; type or copy exactly the following into your menu.lst.
# Kubuntu 8.10 Live Flash Drive GRUB boot menu.
# Includes Persistent option, and other Live options, including Install.
#
timeout = 5 # you can make it any number of seconds
default = 0 # Makes the Persistent option the default OS to boot
title Kubuntu 8.10 LIVE Persistent
root (hd0,0)
kernel /casper/vmlinuz boot=casper ramdisk_size=1048576 root=/dev/ram rw quiet splash persistent
initrd /casper/initrd.gz
title Kubuntu 8.10 LIVE -- Start or Install
root (hd0,0)
kernel /casper/vmlinuz boot=casper ramdisk_size=1048576 root=/dev/ram rw quiet splash
initrd /casper/initrd.gz
title Safe Graphics mode -- xforcevesa
root (hd0,0)
kernel /casper/vmlinuz boot=casper xforcevesa ramdisk_size=1048576 root=/dev/ram rw
initrd /casper/initrd.gz
title Install with driver update CD -- driver updates
root (hd0,0)
kernel /casper/vmlinuz boot=casper ramdisk_size=1048576 root=/dev/ram rw debian-installer/driver-update=true quiet splash --
initrd /casper/initrd.gz
title OEM install (for manufacturers)
root (hd0,0)
kernel /casper/vmlinuz boot=casper ramdisk_size=1048576 root=/dev/ram rw oem-config/enable=true quiet splash --
initrd /casper/initrd.gz
title Check CD for defects
root (hd0,0)
kernel /casper/vmlinuz boot=casper integrity-check quiet splash --
initrd /casper/initrd.gz
title Memtest
root (hd0,0)
kernel /install/mt86plus
title Re-boot the PC
reboot
# End of menu.lst
Finish with File > Save, File > Quit.
You may keep your file manager open.
>>>LIVE Kubuntu 8.10 As you can see from the menu.lst, when using this flash drive, you have the option of running it without the persistent capability; that is, you can run it as a straight Live Kubuntu 8.10 OS and it will not save anything to casper-rw. You can use it that way to install Kubuntu 8.10 to an internal/external hard drive or to another USB flash drive, or ....
Cloning your flash drive: Another option is simply to clone your flash drive--see the brief how-to at the end of this post.
STEP 3 Copy the Live Kubuntu files into the first partition (kubuntu810) of the flash drive.
Two choices:
Two choices: Get Live Kubuntu files from your Live Kubuntu CD; or from the downloaded iso file (without burning a CD).
> Get Live Kubuntu files from your Live Kubuntu CD
GUI:
Insert your Kubuntu Live CD into the PC, wait for it to be recognized.
With your file manager open as root, navigate to the CD, open it to see the folders and files on the CD, click View > Show hidden files, Edit > Select All, Edit > Copy [to], browse and navigate to the flash drive partition /media/kubuntu810, highlight the partition kubuntu810, and accept that choice (Here/OK).
Next: proceed to Step 4: You are done, test it.
CLI:
Assume the CD is mounted as /media/cdrom0.
sudo cp -RT /media/cdrom0/ /media/kubuntu810
That copies the CD files to the first partition of the flash drive. See Technical Note.
(It copies the contents of the CD, NOT the folder called cdrom0.
The -RT option ensures that the copy is recursive and all HIDDEN files AND folders are copied, including hidden files and folders.)
Next: proceed to Step 4: You are done, test it.
Technical Note
Another way at CLI is:
shopt -s dotglob
sudo cp -r /media/cdrom0/* /media/kubuntu810
=> This ensures that the * includes all HIDDEN folders and files.
Or, simply include the line
shopt -s dotglob
in your file ~/.bashrc.
> Get Live Kubuntu files from the downloaded iso file (without burning a CD)
Suppose you downloaded the Live Kubuntu CD files and the iso file name is: kubuntu-8.10-desktop-i386.iso and suppose it's in the Desktop folder: /home/mike/Desktop/ kubuntu-8.10-desktop-i386.iso. Mount this iso as follows:
mkdir /media/CDfiles
sudo mount -t iso9660 -o loop /home/mike/Desktop/kubuntu-8.10-desktop-i386.iso /media/CDfiles
You can change directories (cd /media/CDfiles) and list (ls -a) the files to see what's there.
Now, you have two choices:
GUI:
Open Konqueror/Dolphin as root, navigate to the /media/CDfiles, View > Show hidden files, and copy all the Kubuntu files from /media/CDfiles into /media/kubuntu810
Next: proceed to Step 4: You are done, test it.
CLI:
sudo cp -RT /media/CDfiles/ /media/kubuntu810
That copies the CD files to the first partition of the flash drive. See Technical Note.
(It copies the contents of the CD, NOT the folder called CDfiles.
The -RT option ensures that the copy is recursive and all HIDDEN files AND folders are copied, including hidden files and folders.)
Next: proceed to Step 4: You are done, test it.
Technical Note
Another way at CLI is:
shopt -s dotglob
sudo cp -r /media/CDfiles/* /media/kubuntu810
=> This ensures that the * includes all HIDDEN folders and files.
Or, simply include the line
shopt -s dotglob
in your file ~/.bashrc.
STEP 4 You are done!
Remove CDs (right-click > eject) and unmount (command: “umount”) the flash drive:
sudo umount /dev/sdc1 /media/kubuntu810
(Just in case casper-rw is mounted, too, do: sudo umount /dev/sdc2)
Re-boot your PC to test it.
Upon re-booting, you may have to enter BIOS to ensure it is set to boot from the USB flash drive.
TESTING PERSISTENCE
In your live persistent session, save things and configure things and re-boot to see if they are saved/configured. Examples: Create a widget; create test files saved to /home and Desktop; browse with Konqueror and add a bookmark; set up Konsole on the Panel (right-click on Konsole to do so); install something in your flash drive (e.g., gparted, or Firefox, or Thunderbird); and so on. Then, later,
back in your regular Kubuntu, connect your flash drive, open the casper-rw partition, and have a look at it. You'll see all the many files that are saved there.
= = = = = = = = = =
WHAT TO EXPECT
My experience has been very good thus far. As the expression goes YMMV--Your Mileage May Vary! Some things may work perfectly, some may not work at all (e.g., the clock setting on mine is not persistent). Be patient!
BACK-UPs Remember, if you wish, while in a Live Kubuntu session, you may backup any of your work to a second data flash drive connected to your PC; or mount an internal/external hard drive and save data to a folder there.
= = = = = = = = = =
Troubleshooting Tips
----- If you get a Busybox prompt, it may be because you did not copy HIDDEN folders from the Live Kubuntu CD or the downloaded iso file; specifically, /.disk .
----- Mounting the flash drive partition sdc1 (= kubuntu810) using Konsole at CLI.
To mount the first flash drive partition kubuntu810 at CLI:
Make a mount point, then mount the flash drive partition on it:
sudo mkdir /media/kubuntu810
sudo mount /dev/sdc1 /media/kubuntu810
----- See the first post of this thread for notes and tips on the following:
Technical note about USB drive shifting; GUI Logistics & tips; Buggy-ness in BIOS & Kubuntu.
----- Slow to start up:
Flashing cursor “-” upper left after re-booting using the Live flash drive: be patient, it may take from 30 seconds to 2 minutes before you see the message “Starting up...” On mine, after the Kubuntu progress bar finished, I saw the KDE 4.1 screen briefly, then the screen went blank for quite some time (1-2 minutes). Then, everything was OK--the Desktop came up. On the second and third re-boots, though, things went faster, smoother, and generally better (I'm not sure why that would be true unless casper-rw config/settings help us out there).
----- Black screen after the Kubuntu progress bar completes but you expect to see the Desktop loaded: It could be an X/kde/kdm display manager thing. Try simply pressing the space bar or moving the
mouse, and wait a few seconds.
----- Your menu.lst doesn't seem to work when you select an entry from the boot menu you see on your screen after re-booting, or you get GRUB Error 15 or some such. Go into your regular Kubuntu, access the flash drive, open menu.lst as root, and try re-typing by hand the boot entry (i.e., do not copy it).
----- Is the Live CD good? For example, download the Kubuntu Live CD: kubuntu-8.10-desktop-i386.iso. Make sure it is good: Burn the Live CD using K3b. Check the md5sum; run the CD, select “Check CD for defects,” then test run the Live CD.
----- When all else fails, you can always re-boot (even by a manual re-boot by pressing the Reset button on your PC).
----- WHEN ALL ELSE REALLY FAILS Hey, it's part of the game: Do it again! If you are having strange, insurmountable problems, you may reformat the casper-rw partition and start over, and/or re-do the entire project. When you get into this work, you'll find it doesn't really take very long from start to finish, perhaps just 10-20 minutes.
----- Wearout: Flash drive wearout.
If you are concerned about that, you may format the flash drive (both partitions) as ext2 rather than ext3. To learn more about it, see my notes elsewhere on this forum (search for wearout) and google search it.
= = = = = = = = = =
Cloning your bootable flash drive
Cloning a (bootable) Kubuntu 8.10 Live persistent USB flash drive.
Caution: Use YOUR own device names; sdc & sdd are used for example only.
Source:
sdc 2 GB flash drive, ext3, (GRUB-bootable) Live Persistent Kubuntu 8.10
Two ext3 partitions: sdc1 = kubuntu810, sdc2 = casper-rw (the persistent partition)
Target:
sdd 2 GB flash drive, FAT32, empty
Here it is:
dd if=/dev/sdc of=/dev/sdd bs=4096 conv=notrunc,noerror
492671+1 records in
492671+1 records out
2017984000 bytes (2.0 GB) copied, 425.104 seconds, 4.7 MB/s
The dd copies everything--including GRUB bootloader, MBR, the two source partitions, and the ext3 formatted filesystems. Your clone is ready to boot.
(See the Reference below: dd Command)
= = = = = = = = = =
THANKS to the following for their tips, suggestions, corrections:
JohanLingen
Kubicle
References
-- How To Make GRUB Thumb Drive (and the posts under that thread)
http://kubuntuforums.net/forums/inde...opic=3081748.0
-- How To GRUB Methods - Toolkit
http://kubuntuforums.net/forums/inde...opic=3081671.0
--dd Command (see Reply #1 for cloning & other applications)
http://kubuntuforums.net/forums/inde...opic=3090824.0
-- GParted: http://gparted.sourceforge.net/
-- GParted how-to: http://www.howtoforge.com/partitioning_with_gparted
-- Tuxfiles: http://www.tuxfiles.org/
(permissions, ownership, commands, file and folders, Linux file system, mounting, and more)
Commands at Konsole: Beginners
http://kubuntuforums.net/forums/inde...opic=3091607.0
(permissions/ownership for flash drives: see Reply #1)
*** The topics of this thread have been reorganized 8 February 2009 ***
*** The following TOC applies now ***
*** It includes the major how-to posts originally posted by me in this thread ***
TABLE of CONTENTS
First post--this post
Kubuntu 8.10 Intrepid Ibex KDE 4 ** Major Edit on 12-26-08 **
Live Flash Drive with Persistence - - - Complete & Simplified
(using GRUB as the bootloader; no Syslinux)
includes:
-- Using iso files to get Kubuntu and GRUB (without burning a live CD)
-- Working in GUI or CLI
-- Cloning your finished flash drive
Reply #1: usb-creator program (8.04 & 8.10)
This package automatically creates a Live persistent Kubuntu flash drive.
Starts with your Kubuntu iso downloaded file.
> Thanks to toad for bringing this to our attention.
Reply #3: History – Sequence of past how-to's
----- Building a Live Kubuntu Flash Drive for Gutsy 7.10
It is not persistent. It uses GRUB to chainload Syslinux.
Though dated, some of you may find it useful or interesting:
It shows how to boot (by chainloading) Syslinux, and has some good command-line techniques.
----- Live Kubuntu 7.10 + Live Ubuntu 7.10 on a 2GB flash drive
It is not persistent.. It uses GRUB to chainload Syslinux.
----- Live Kubuntu 7.10 flash drive WITH PERSISTENCE
using GRUB all the way (i.e., no chainload to Syslinux)
----- Kubuntu HH 8.04 on Live Persistent Flash Drive
using GRUB (no Syslinux)
Bug fix: It addresses a well-known bug at the time
“[hardy] livecd: keyword "persistent" results in busybox and (initramfs)”
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Kubuntu 8.10 Intrepid Ibex KDE 4 ** Major Edit on 12-26-08 **
Live Flash Drive with Persistence - - - Complete & Simplified
(using GRUB as the bootloader)
includes:
-- Using iso files to get Kubuntu and GRUB (without burning a live CD)
-- Working in GUI or CLI
-- Cloning your finished flash drive
-- Persistence means that your (personal) user configuration settings and data are saved to the flash drive and thus are available next time you run your LIVE Kubuntu from the flash drive. Nothing is written to any other drives in your system (unless you do so intentionally).
-- BIOS: Your BIOS must support "Boot from USB.”
-- Flash Drive: 2 GB (or larger)
You may be able to do this--tightly perhaps--with a 1 GB flash drive.
-- CAUTION Device naming!!!
The example here uses a flash drive that is seen as /dev/sdc in Kubuntu and as hd2 in GRUB.
>>> Yours may be different! See Step 1.
Choices: Working with live CDs and Working at GUI or CLI.
> You need Live Kubuntu CD files. Two choices:
Get them from a burned Live Kubuntu CD.
Get them from the downloaded iso file (without burning a CD).
> You need GRUB files to put on the flash drive. Three choices:
Get them from your regular Kubuntu operating system /boot/grub directory.
Get them from a Live CD that has them (like Super Grub Disk).
Get them from a downloaded iso file (without burning a CD).
> You can do this work in GUI or CLI (at Konsole) or combinations thereof.
We'll assume you are working in your regular Kubuntu operating system.
(Actually, you could also do this work from any Live Linux CD.)
GUI: Working with root privileges (working “as root”)
Open Konqueror (Dolphin) as root:
kdesudo konqueror
kdesudo dolphin
Syslinux, tech note: If you use Syslinux, not GRUB, then you'll be able to get those files from the Kubuntu Live CD or iso. GRUB files you have to fetch from elsewhere.
First, preparation:
-- Get what you need ready -- Read the list of Choices above, decide how you wish to do it, and get what you need ready to go.
-- Now, boot into your regular Kubuntu operating system, where you will do this work.
STEP 1 Flash drive Prepare the flash drive: partition, format, boot flag, two labels
Very Important:
Mounting the flash drive: /dev/sdc1 mounted as /media/kubuntu810
If you have trouble mounting the flash drive in GUI, see the first Troubleshooting note at the end.
=> We will assume that partition 1 of the flash drive is /dev/sdc1 mounted as /media/kubuntu810. Thus, the directory kubuntu810 exists (or has been created) in the /media directory.
Find out what your flash drive is named. Plug in your flash drive to a USB port on your PC.
Open K > Applications > System > Terminal (Konsole)
Type these commands:
sudo fdisk -lu
sudo grub
grub> geometry (hd<Press the Tab key now>
Then you can do:
grub>geometry (hd0)
grub>geometry (hd1)
grub>geometry (hd2), etc.
Study this output. Example: In my system, the flash drive is sdc = hd2.
Partition and format the flash drive. The end result should be this:
Partition 1, for Kubuntu: sdc1, ext3, 850 MB, set boot flag, set label: kubuntu810
Partition 2, for the “persistence partition,” sdc2, ext3, 1 GB, set label: casper-rw
>>> Wear-out? If you are concerned about flash drive wear-out, you may format the partitions ext2 rather than ext3. I have no hard empirical evidence on wear-out, either way. => google it.
To be done, as follows:
Two choices: Use GParted Live CD; or do the work in Kubuntu 8.10: install gparted using K > Applications > System > Package Manager (Adept)).
In GParted:
Highlight a partition, Partition (tab at top), Flags > Boot, and Label > [type the label].
Casper-rw: The casper-rw partition is important. It's the label you need so your Live Kubuntu flash drive recognizes the persistent partition as the one to use to save your data/settings/configurations.
Labels from GParted Live CD
Use a newer version: gparted-livecd-0.39-13.iso, 11/28/08 or later
Labels at Konsole--Another way to set Labels:
sudo e2label /dev/sdc1 kubuntu810
sudo e2label /dev/sdc2 casper-rw
STEP 2 GRUB work -- do this any way you want:
(1) Install GRUB files to kubuntu810 in a directory called /boot/grub;
(2) Install GRUB to the MBR of the flash drive;
(3) Build the boot menu /boot/grub/menu.lst (in kubuntu810).
(1) Install GRUB files to kubuntu810 in a directory called /boot/grub.
Three choices:
Get GRUB files from your regular Kubuntu operating system /boot/grub directory; or from a Live CD that has them (like Super Grub Disk); or from a downloaded iso file (without burning a CD). For each choice, you may do the work in GUI (Konqueror/Dolphin) or CLI (Konsole).
> Get GRUB files from your regular Kubuntu operating system /boot/grub directory.
GUI:
First, create /boot in kubuntu810: In your regular Kubuntu OS, open your file manager as root, open the partition kubuntu810, create a new folder called boot (right-click in an open area, Create New Folder, and give it the name boot).
In your file manager (still open as root), navigate to your regular Kubuntu OS /boot directory, open boot, right-click on the folder called grub, Copy [to] (CAUTION: Use Copy; do NOT use Move!!!). Then browse to and select the partition kubuntu810 of the flash drive, then to the directory /boot (that you just created), and select the boot directory (Here). So now you have set up /boot/grub on partition 1 (= kubuntu810) of the flash drive. (You may keep your file manager open.)
Next: proceed to (2) Install (setup) GRUB to the MBR of the flash drive.
CLI:
sudo mkdir /media/kubuntu810/boot
sudo cp -r /boot/grub /media/kubuntu810/boot
That will build /media/kubuntu810/boot/grub (and containing all the files in grub).
Next: proceed to (2) Install (setup) GRUB to the MBR of the flash drive.
> Get GRUB files from a Live CD that has them (like Super Grub Disk--SGD).
Let's assume you use a SGD live CD. Put the SGD CD in the CD tray, wait for Kubuntu to recognize it, then Open it. The GRUB files are at /boot/grub on the CD. Assume the CD is mounted as /media/cdrom0.
GUI:
Open Konqueror/Dolphin as root, create /boot/grub on partition 1 (= kubuntu810) of the flash drive, copy the grub directory & files from /media/cdrom0/boot/grub into /media/kubuntu810/boot/.
Next: proceed to (2) Install (setup) GRUB to the MBR of the flash drive.
CLI:
sudo mkdir /media/kubuntu810/boot
sudo cp -r /media/cdrom0/boot/grub /media/kubuntu810/boot
Next: proceed to (2) Install (setup) GRUB to the MBR of the flash drive.
> Get GRUB files from a downloaded iso file (without burning a CD).
We will use a quick download (4.4 MB) of Super Grub Disk -- The CD ROM 0.9774 from here:
http://forjamari.linex.org/frs/?group_id=61
We download super_grub_disk_0.9774.iso to the Desktop folder, then mount it as follows:
sudo mkdir /media/SGDfiles
sudo mount -t iso9660 -o loop /home/mike/Desktop/super_grub_disk_0.9774.iso /media/SGDfiles
cd /media/SGDfiles
ls
and you will see a boot directory;
cd boot
and you will see a grub directory
cd grub
and you will see the grub files.
Copy the GRUB files from SGD iso file /boot/grub into the flash drive partition /media/kubuntu810/boot/grub.
Two choices:
GUI:
Open Konqueror/Dolphin as root, create /boot/grub on partition 1 (= /media/kubuntu810) of the flash drive, copy the grub files from /media/SGDfiles/boot/grub into /media/kubuntu810/boot/grub.
Next: proceed to (2) Install (setup) GRUB to the MBR of the flash drive.
CLI:
sudo mkdir /media/kubuntu810/boot
sudo cp -r /media/SGDfiles/boot/grub /media/kubuntu810/boot
That will build /media/kubuntu810/boot/grub.
Next: proceed to (2) Install (setup) GRUB to the MBR of the flash drive.
(2) Install (setup) GRUB to the MBR of the flash drive.
Open Konsole, type sudo grub, at the GRUB prompt type these commands:
grub> root (hd2,0) # CAUTION: Use YOUR device name instead of hd2!!!
grub> setup (hd2) # CAUTION: Use YOUR device name instead of hd2!!!
grub> quit
$exit
This sets up GRUB in the MBR of the flash drive using the GRUB files in partition 1 of the flash drive.
(3) Build the boot menu, /boot/grub/menu.lst.
With your file manager open as root, in the flash drive partition 1 (/media/kubuntu810) open /boot/grub/menu.lst.
Delete everything in menu.lst; type or copy exactly the following into your menu.lst.
# Kubuntu 8.10 Live Flash Drive GRUB boot menu.
# Includes Persistent option, and other Live options, including Install.
#
timeout = 5 # you can make it any number of seconds
default = 0 # Makes the Persistent option the default OS to boot
title Kubuntu 8.10 LIVE Persistent
root (hd0,0)
kernel /casper/vmlinuz boot=casper ramdisk_size=1048576 root=/dev/ram rw quiet splash persistent
initrd /casper/initrd.gz
title Kubuntu 8.10 LIVE -- Start or Install
root (hd0,0)
kernel /casper/vmlinuz boot=casper ramdisk_size=1048576 root=/dev/ram rw quiet splash
initrd /casper/initrd.gz
title Safe Graphics mode -- xforcevesa
root (hd0,0)
kernel /casper/vmlinuz boot=casper xforcevesa ramdisk_size=1048576 root=/dev/ram rw
initrd /casper/initrd.gz
title Install with driver update CD -- driver updates
root (hd0,0)
kernel /casper/vmlinuz boot=casper ramdisk_size=1048576 root=/dev/ram rw debian-installer/driver-update=true quiet splash --
initrd /casper/initrd.gz
title OEM install (for manufacturers)
root (hd0,0)
kernel /casper/vmlinuz boot=casper ramdisk_size=1048576 root=/dev/ram rw oem-config/enable=true quiet splash --
initrd /casper/initrd.gz
title Check CD for defects
root (hd0,0)
kernel /casper/vmlinuz boot=casper integrity-check quiet splash --
initrd /casper/initrd.gz
title Memtest
root (hd0,0)
kernel /install/mt86plus
title Re-boot the PC
reboot
# End of menu.lst
Finish with File > Save, File > Quit.
You may keep your file manager open.
>>>LIVE Kubuntu 8.10 As you can see from the menu.lst, when using this flash drive, you have the option of running it without the persistent capability; that is, you can run it as a straight Live Kubuntu 8.10 OS and it will not save anything to casper-rw. You can use it that way to install Kubuntu 8.10 to an internal/external hard drive or to another USB flash drive, or ....
Cloning your flash drive: Another option is simply to clone your flash drive--see the brief how-to at the end of this post.
STEP 3 Copy the Live Kubuntu files into the first partition (kubuntu810) of the flash drive.
Two choices:
Two choices: Get Live Kubuntu files from your Live Kubuntu CD; or from the downloaded iso file (without burning a CD).
> Get Live Kubuntu files from your Live Kubuntu CD
GUI:
Insert your Kubuntu Live CD into the PC, wait for it to be recognized.
With your file manager open as root, navigate to the CD, open it to see the folders and files on the CD, click View > Show hidden files, Edit > Select All, Edit > Copy [to], browse and navigate to the flash drive partition /media/kubuntu810, highlight the partition kubuntu810, and accept that choice (Here/OK).
Next: proceed to Step 4: You are done, test it.
CLI:
Assume the CD is mounted as /media/cdrom0.
sudo cp -RT /media/cdrom0/ /media/kubuntu810
That copies the CD files to the first partition of the flash drive. See Technical Note.
(It copies the contents of the CD, NOT the folder called cdrom0.
The -RT option ensures that the copy is recursive and all HIDDEN files AND folders are copied, including hidden files and folders.)
Next: proceed to Step 4: You are done, test it.
Technical Note
Another way at CLI is:
shopt -s dotglob
sudo cp -r /media/cdrom0/* /media/kubuntu810
=> This ensures that the * includes all HIDDEN folders and files.
Or, simply include the line
shopt -s dotglob
in your file ~/.bashrc.
> Get Live Kubuntu files from the downloaded iso file (without burning a CD)
Suppose you downloaded the Live Kubuntu CD files and the iso file name is: kubuntu-8.10-desktop-i386.iso and suppose it's in the Desktop folder: /home/mike/Desktop/ kubuntu-8.10-desktop-i386.iso. Mount this iso as follows:
mkdir /media/CDfiles
sudo mount -t iso9660 -o loop /home/mike/Desktop/kubuntu-8.10-desktop-i386.iso /media/CDfiles
You can change directories (cd /media/CDfiles) and list (ls -a) the files to see what's there.
Now, you have two choices:
GUI:
Open Konqueror/Dolphin as root, navigate to the /media/CDfiles, View > Show hidden files, and copy all the Kubuntu files from /media/CDfiles into /media/kubuntu810
Next: proceed to Step 4: You are done, test it.
CLI:
sudo cp -RT /media/CDfiles/ /media/kubuntu810
That copies the CD files to the first partition of the flash drive. See Technical Note.
(It copies the contents of the CD, NOT the folder called CDfiles.
The -RT option ensures that the copy is recursive and all HIDDEN files AND folders are copied, including hidden files and folders.)
Next: proceed to Step 4: You are done, test it.
Technical Note
Another way at CLI is:
shopt -s dotglob
sudo cp -r /media/CDfiles/* /media/kubuntu810
=> This ensures that the * includes all HIDDEN folders and files.
Or, simply include the line
shopt -s dotglob
in your file ~/.bashrc.
STEP 4 You are done!
Remove CDs (right-click > eject) and unmount (command: “umount”) the flash drive:
sudo umount /dev/sdc1 /media/kubuntu810
(Just in case casper-rw is mounted, too, do: sudo umount /dev/sdc2)
Re-boot your PC to test it.
Upon re-booting, you may have to enter BIOS to ensure it is set to boot from the USB flash drive.
TESTING PERSISTENCE
In your live persistent session, save things and configure things and re-boot to see if they are saved/configured. Examples: Create a widget; create test files saved to /home and Desktop; browse with Konqueror and add a bookmark; set up Konsole on the Panel (right-click on Konsole to do so); install something in your flash drive (e.g., gparted, or Firefox, or Thunderbird); and so on. Then, later,
back in your regular Kubuntu, connect your flash drive, open the casper-rw partition, and have a look at it. You'll see all the many files that are saved there.
= = = = = = = = = =
WHAT TO EXPECT
My experience has been very good thus far. As the expression goes YMMV--Your Mileage May Vary! Some things may work perfectly, some may not work at all (e.g., the clock setting on mine is not persistent). Be patient!
BACK-UPs Remember, if you wish, while in a Live Kubuntu session, you may backup any of your work to a second data flash drive connected to your PC; or mount an internal/external hard drive and save data to a folder there.
= = = = = = = = = =
Troubleshooting Tips
----- If you get a Busybox prompt, it may be because you did not copy HIDDEN folders from the Live Kubuntu CD or the downloaded iso file; specifically, /.disk .
----- Mounting the flash drive partition sdc1 (= kubuntu810) using Konsole at CLI.
To mount the first flash drive partition kubuntu810 at CLI:
Make a mount point, then mount the flash drive partition on it:
sudo mkdir /media/kubuntu810
sudo mount /dev/sdc1 /media/kubuntu810
----- See the first post of this thread for notes and tips on the following:
Technical note about USB drive shifting; GUI Logistics & tips; Buggy-ness in BIOS & Kubuntu.
----- Slow to start up:
Flashing cursor “-” upper left after re-booting using the Live flash drive: be patient, it may take from 30 seconds to 2 minutes before you see the message “Starting up...” On mine, after the Kubuntu progress bar finished, I saw the KDE 4.1 screen briefly, then the screen went blank for quite some time (1-2 minutes). Then, everything was OK--the Desktop came up. On the second and third re-boots, though, things went faster, smoother, and generally better (I'm not sure why that would be true unless casper-rw config/settings help us out there).
----- Black screen after the Kubuntu progress bar completes but you expect to see the Desktop loaded: It could be an X/kde/kdm display manager thing. Try simply pressing the space bar or moving the
mouse, and wait a few seconds.
----- Your menu.lst doesn't seem to work when you select an entry from the boot menu you see on your screen after re-booting, or you get GRUB Error 15 or some such. Go into your regular Kubuntu, access the flash drive, open menu.lst as root, and try re-typing by hand the boot entry (i.e., do not copy it).
----- Is the Live CD good? For example, download the Kubuntu Live CD: kubuntu-8.10-desktop-i386.iso. Make sure it is good: Burn the Live CD using K3b. Check the md5sum; run the CD, select “Check CD for defects,” then test run the Live CD.
----- When all else fails, you can always re-boot (even by a manual re-boot by pressing the Reset button on your PC).
----- WHEN ALL ELSE REALLY FAILS Hey, it's part of the game: Do it again! If you are having strange, insurmountable problems, you may reformat the casper-rw partition and start over, and/or re-do the entire project. When you get into this work, you'll find it doesn't really take very long from start to finish, perhaps just 10-20 minutes.
----- Wearout: Flash drive wearout.
If you are concerned about that, you may format the flash drive (both partitions) as ext2 rather than ext3. To learn more about it, see my notes elsewhere on this forum (search for wearout) and google search it.
= = = = = = = = = =
Cloning your bootable flash drive
Cloning a (bootable) Kubuntu 8.10 Live persistent USB flash drive.
Caution: Use YOUR own device names; sdc & sdd are used for example only.
Source:
sdc 2 GB flash drive, ext3, (GRUB-bootable) Live Persistent Kubuntu 8.10
Two ext3 partitions: sdc1 = kubuntu810, sdc2 = casper-rw (the persistent partition)
Target:
sdd 2 GB flash drive, FAT32, empty
Here it is:
dd if=/dev/sdc of=/dev/sdd bs=4096 conv=notrunc,noerror
492671+1 records in
492671+1 records out
2017984000 bytes (2.0 GB) copied, 425.104 seconds, 4.7 MB/s
The dd copies everything--including GRUB bootloader, MBR, the two source partitions, and the ext3 formatted filesystems. Your clone is ready to boot.
(See the Reference below: dd Command)
= = = = = = = = = =
THANKS to the following for their tips, suggestions, corrections:
JohanLingen
Kubicle
References
-- How To Make GRUB Thumb Drive (and the posts under that thread)
http://kubuntuforums.net/forums/inde...opic=3081748.0
-- How To GRUB Methods - Toolkit
http://kubuntuforums.net/forums/inde...opic=3081671.0
--dd Command (see Reply #1 for cloning & other applications)
http://kubuntuforums.net/forums/inde...opic=3090824.0
-- GParted: http://gparted.sourceforge.net/
-- GParted how-to: http://www.howtoforge.com/partitioning_with_gparted
-- Tuxfiles: http://www.tuxfiles.org/
(permissions, ownership, commands, file and folders, Linux file system, mounting, and more)
Commands at Konsole: Beginners
http://kubuntuforums.net/forums/inde...opic=3091607.0
(permissions/ownership for flash drives: see Reply #1)
Comment