LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-28-2011, 07:39 PM   #1
m4rtin
Member
 
Registered: Sep 2007
Posts: 261

Rep: Reputation: 16
How to make a bootable USB flash drive manually?


I would like to boot Ubuntu 8.04 i386 from my USB flash drive. I was guided by this tutorial: http://syslinux.zytor.com/wiki/index...USB:_For_Linux

I took following steps:

1) made sure that usb_storage.ko kernel module is loaded

Code:
root@martin-desktop:~# lsmod | grep -i storage
usb_storage            39585  1 
root@martin-desktop:~#

2) inserted USB flash drive

Code:
root@martin-desktop:~# tail -n0 -f /var/log/messages
Jan 29 01:43:23 martin-desktop kernel: [440650.637531] usb 2-2: new high speed USB device using ehci_hcd and address 8
Jan 29 01:43:23 martin-desktop kernel: [440650.776107] usb 2-2: configuration #1 chosen from 1 choice
Jan 29 01:43:23 martin-desktop kernel: [440650.776563] scsi10 : SCSI emulation for USB Mass Storage devices
Jan 29 01:43:28 martin-desktop kernel: [440655.778667] scsi 10:0:0:0: Direct-Access     Sony     Storage Media    0100 PQ: 0 ANSI: 0 CCS
Jan 29 01:43:28 martin-desktop kernel: [440655.781298] sd 10:0:0:0: Attached scsi generic sg2 type 0
Jan 29 01:43:28 martin-desktop kernel: [440655.784029] sd 10:0:0:0: [sdb] 15857664 512-byte logical blocks: (8.11 GB/7.56 GiB)
Jan 29 01:43:28 martin-desktop kernel: [440655.785083] sd 10:0:0:0: [sdb] Write Protect is off
Jan 29 01:43:28 martin-desktop kernel: [440655.789147]  sdb: sdb1
Jan 29 01:43:28 martin-desktop kernel: [440655.856407] sd 10:0:0:0: [sdb] Attached SCSI removable disk

3) zero-filled my 8GB Sony flash drive(/dev/sdb)

Code:
root@martin-desktop:~# dd if=/dev/zero of=/dev/sdb bs=10M
dd: writing `/dev/sdb': No space left on device
775+0 records in
774+0 records out
8119123968 bytes (8.1 GB) copied, 1295.99 s, 6.3 MB/s
root@martin-desktop:~#

4) made partition table to MBR of /dev/sdb

Code:
root@martin-desktop:~# printf "0,1024,b,*\n0,0\n0,0\n0,0\n;\n" | sfdisk -uM /dev/sdb
Checking that no-one is using this disk right now ...
OK

Disk /dev/sdb: 1023 cylinders, 250 heads, 62 sectors/track

sfdisk: ERROR: sector 0 does not have an msdos signature
 /dev/sdb: unrecognized partition table type
Old situation:
No partitions found
New situation:
Units = mebibytes of 1048576 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start   End    MiB    #blocks   Id  System
/dev/sdb1   *     0+  1029-  1030-   1053999+   b  W95 FAT32
/dev/sdb2         0      -      0          0    0  Empty
/dev/sdb3         0      -      0          0    0  Empty
/dev/sdb4         0      -      0          0    0  Empty
Successfully wrote the new partition table

Re-reading the partition table ...

If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)
root@martin-desktop:~#
Code:
root@martin-desktop:~# fdisk -l /dev/sdb

Disk /dev/sdb: 8119 MB, 8119123968 bytes
250 heads, 62 sectors/track, 1023 cylinders
Units = cylinders of 15500 * 512 = 7936000 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1         136     1053999+   b  W95 FAT32
root@martin-desktop:~#

5) set FAT32 partition to /dev/sdb1

Code:
root@martin-desktop:~# mkdosfs -F 32 -n ubuntu -v /dev/sdb1
mkdosfs 3.0.7 (24 Dec 2009)
/dev/sdb1 has 250 heads and 62 sectors per track,
logical sector size is 512,
using 0xf8 media descriptor, with 2107998 sectors;
file system has 2 32-bit FATs and 8 sectors per cluster.
FAT size is 2055 sectors, and provides 262982 clusters.
Volume ID is c17d6cc8, volume label ubuntu     .
root@martin-desktop:~#

6) copied MBR code area

Code:
root@martin-desktop:~# dd conv=notrunc bs=440 count=1 if=/usr/lib/syslinux/mbr.bin of=/dev/sdb
0+1 records in
0+1 records out
404 bytes (404 B) copied, 0.0178841 s, 22.6 kB/s
root@martin-desktop:~#

7) mount USB flash drive and download Ubuntu 8.04

Code:
root@martin-desktop:~# mount /dev/sdb1 /media/ -t vfat
root@martin-desktop:~# pushd /media/ && wget http://releases.ubuntu.com/hardy/ubuntu-8.04.4-desktop-i386.iso && popd
/media ~
--2011-01-29 02:32:59--  http://releases.ubuntu.com/hardy/ubuntu-8.04.4-desktop-i386.iso
Resolving releases.ubuntu.com... 91.189.88.32, 2620:0:dc0:1800:214:4fff:fe7d:1b9, 2001:6b0:e:2018::1337, ...
Connecting to releases.ubuntu.com|91.189.88.32|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 733945856 (700M) [application/x-iso9660-image]
Saving to: `ubuntu-8.04.4-desktop-i386.iso'

100%[=====================================================================================================================================================================>] 733,945,856 1.20M/s   in 10m 9s  

2011-01-29 02:43:08 (1.15 MB/s) - `ubuntu-8.04.4-desktop-i386.iso' saved [733945856/733945856]

~
root@martin-desktop:~# ls -lsh /media/
total 700M
700M -rwxr-xr-x 1 root root 700M 2010-01-21 12:19 ubuntu-8.04.4-desktop-i386.iso
root@martin-desktop:~#

8) mount Ubuntu .iso as a loop device to /mnt

Code:
root@martin-desktop:~# mount -o loop -t iso9660 /media/ubuntu-8.04.4-desktop-i386.iso /mnt/
root@martin-desktop:~#

9) copy vmlinuz and initrd to flash drive

Code:
root@martin-desktop:~# cp /mnt/casper/initrd.gz /mnt/casper/vmlinuz /media/
root@martin-desktop:~# ls -lh /media/
total 710M
-rwxr-xr-x 1 root root 7.5M 2011-01-29 03:11 initrd.gz
-rwxr-xr-x 1 root root 700M 2010-01-21 12:19 ubuntu-8.04.4-desktop-i386.iso
-rwxr-xr-x 1 root root 1.9M 2011-01-29 03:11 vmlinuz
root@martin-desktop:~#

10) create /media/syslinux.cfg file

Code:
root@martin-desktop:~# printf "default vmlinuz\nappend initrd=initrd.gz\n" > /media/syslinux.cfg
root@martin-desktop:~#

11) umount /mnt(.iso loop device) and /media(USB flash drive)

Code:
root@martin-desktop:~# umount /mnt/ && umount /media/
root@martin-desktop:~#

12) install syslinux to /dev/sdb1
Code:
root@martin-desktop:~# syslinux -s /dev/sdb1 
root@martin-desktop:~#

13) mount /dev/sdb1 once more in order to be sure, that all the necessary files are on the flash drive

Code:
root@martin-desktop:~# mount /dev/sdb1 /media/ -t vfat
root@martin-desktop:~# ls -lh /media/
total 710M
-rwxr-xr-x 1 root root 7.5M 2011-01-29 03:11 initrd.gz
-r-xr-xr-x 1 root root  15K 2011-01-29 03:17 ldlinux.sys
-rwxr-xr-x 1 root root   40 2011-01-29 03:14 syslinux.cfg
-rwxr-xr-x 1 root root 700M 2010-01-21 12:19 ubuntu-8.04.4-desktop-i386.iso
-rwxr-xr-x 1 root root 1.9M 2011-01-29 03:11 vmlinuz
root@martin-desktop:~# umount /media/
root@martin-desktop:~#

When I set "USB flash drive" as a first bootable device in BIOS, I get SYSLINUX "boot:" prompt and it loads both "vmlinuz" and "initrd.gz", but finally I end up in BusyBox prompt and following message:
Quote:
"Check root= bootarg cat /proc/cmdline or missing
modules, devices: cat /proc/modules ls /dev
ALERT! does not exist. Dropping to a shell!"
Last boot message which I see is "Attached scsi generic sg2 type 0".


Any suggestions, what might cause such behavior? Did I miss anything while preparing USB flash drive? Let me know if additional information is needed. All longer explanations are most welcome

PS please don't suggest unetbootin and similar utilities as I would like to accomplish this manually
 
Old 01-28-2011, 07:58 PM   #2
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
I can not help you but can offer a different tutorial


ubuntu usb key


There are 2 pages and you have to hunt for the page 2 link. It's steps seem different from yours. I am in the process of trying to do one myself.
 
Old 01-28-2011, 10:18 PM   #3
tiredofbilkyyaforallican
Member
 
Registered: Aug 2010
Location: 3rd rock from the sun
Distribution: LMDE/Peppermint/Mint 9,&10/along with a few others
Posts: 152

Rep: Reputation: 22
Personally I use unetbootin.I find it works flawlessly providing you have a good flash drive no need to get into troublesome headaches when everything is done for you ( just load and go so to speak).This is what I use to run Puppy on netbooks and the public library computers here
 
Old 01-29-2011, 04:47 AM   #4
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
Quote:
Originally Posted by tiredofbilkyyaforallican View Post
Personally I use unetbootin.I find it works flawlessly providing you have a good flash drive no need to get into troublesome headaches when everything is done for you ( just load and go so to speak).
I have been there, done that and also used the ubuntu start disc method, just trying to learn more.
 
Old 01-29-2011, 06:57 AM   #5
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
This is all quite easy and you may be over-thinking it.

You need to extract the whole iso to a folder; rename isolinux folder to syslinux, rename isolinux.cfg to syslinux.cfg, move all the folders (.disk, casper, preseed, syslinux, etc) to your usb.

open the syslinux.cfg with a text editor and add this to the append line
"cdrom-detect/try-usb=true"

install syslinux, note that only a Ubuntu syslinux will work, Ubuntu hacked their own versions of syslinux for 8.04/9.04/9.10 and you will get an error or not load if using wrong version

For 9.04 and up you dont need the "cdrom-detect/try-usb=true", just for 8.04

If you want to manually create a persistent partition or file see here
https://help.ubuntu.com/community/LiveCD/Persistence
 
Old 02-01-2011, 06:05 AM   #6
AimeeTaylor
LQ Newbie
 
Registered: Feb 2011
Posts: 1

Rep: Reputation: 0
The ubuntu start disk method definitely worked the best for me, doesn't take that long either!
 
Old 02-01-2011, 04:05 PM   #7
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,129

Rep: Reputation: 3639Reputation: 3639Reputation: 3639Reputation: 3639Reputation: 3639Reputation: 3639Reputation: 3639Reputation: 3639Reputation: 3639Reputation: 3639Reputation: 3639
Welcome AimeeTaylor.

A similar how-to for that. http://www.pendrivelinux.com/ubuntu-...usb-installer/

Last edited by jefro; 02-01-2011 at 04:08 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Make bootable usb Flash drive hunzak Linux - Newbie 5 10-11-2010 01:42 PM
How to make USB Flash drive bootable in Centos sols2008 Linux - Server 3 09-09-2010 12:48 PM
Can't make bootable USB flash drive sheine Linux - Software 12 04-30-2009 03:32 PM
how do you make a bootable flash drive for Vista install? hedpe General 3 04-08-2007 03:28 PM
Make a bootable Flash drive with Sandisk loninappleton Linux - Hardware 2 02-06-2006 03:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration