Martin T
2011-Jan-29 01:33 UTC
[syslinux] 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.php/HowTos#How_to_Create_a_Bootable_USB:_For_Linux I took following steps: 1) made sure that usb_storage.ko kernel module is loaded root at martin-desktop:~# lsmod | grep -i storage usb_storage 39585 1 root at martin-desktop:~# 2) inserted USB flash drive root at 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) root at 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 at martin-desktop:~# 4) made partition table to MBR of /dev/sdb root at 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 at martin-desktop:~# root at 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 at martin-desktop:~# 5) set FAT32 partition to /dev/sdb1 root at 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 at martin-desktop:~# 6) copied MBR code area root at 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 at martin-desktop:~# 7) mount USB flash drive and download Ubuntu 8.04 root at martin-desktop:~# mount /dev/sdb1 /media/ -t vfat root at 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 at 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 at martin-desktop:~# 8) mount Ubuntu .iso as a loop device to /mnt root at martin-desktop:~# mount -o loop -t iso9660 /media/ubuntu-8.04.4-desktop-i386.iso /mnt/ root at martin-desktop:~# 9) copy vmlinuz and initrd to flash drive root at martin-desktop:~# cp /mnt/casper/initrd.gz /mnt/casper/vmlinuz /media/ root at 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 at martin-desktop:~# 10) create /media/syslinux.cfg file root at martin-desktop:~# printf "default vmlinuz\nappend initrd=initrd.gz\n" > /media/syslinux.cfg root at martin-desktop:~# 11) umount /mnt(.iso loop device) and /media(USB flash drive) root at martin-desktop:~# umount /mnt/ && umount /media/ root at martin-desktop:~# 12) install syslinux to /dev/sdb1 root at martin-desktop:~# syslinux -s /dev/sdb1 root at martin-desktop:~# 13) mount /dev/sdb1 once more in order to be sure, that all the necessary files are on the flash drive root at martin-desktop:~# mount /dev/sdb1 /media/ -t vfat root at 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 at martin-desktop:~# umount /media/ root at 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: "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 :) regards, Martin
Gene Cumm
2011-Jan-29 03:29 UTC
[syslinux] How to make a bootable USB flash drive manually?
On Fri, Jan 28, 2011 at 20:33, Martin T <m4rtntns at gmail.com> wrote:> 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.php/HowTos#How_to_Create_a_Bootable_USB:_For_Linux1) Are you looking to boot Ubuntu Live from your USB drive as opposed to burning the ISO to a CD and booting the CD? I believe UNetBootIn ( http://unetbootin.sourceforge.net/ ) would provide an easier way to accomplish this. I've used this several times for creating bootable USB flash drives. 2) Any reason to not use the current release (10.10) or current LTS release (10.04.1)?> I took following steps: > > 1) made sure that usb_storage.ko kernel module is loaded> 2) inserted USB flash drive> 3) zero-filled my 8GB Sony flash drive(/dev/sdb)A little extreme but everyone has their habits. I like using "conv=notrunc" consistently with dd as I work with disk image files that could otherwise be truncated undesirably.> 4) made partition table to MBR of /dev/sdb> 5) set FAT32 partition to /dev/sdb1> 6) copied MBR code area> 7) mount USB flash drive and download Ubuntu 8.04 > > root at martin-desktop:~# mount /dev/sdb1 /media/ -t vfat> root at 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.isoIt is normally suggested (just as good habit; not related to your issues) to verify your download, ie check md5, sha1, sha256 and/or a cryptographic signature. Ubuntu provides MD5SUMS, SHA1SUMS and SHA256SUMS along with a .gpg signature file that allows you to even verify the authenticity of the checksum files.> 8) mount Ubuntu .iso as a loop device to /mnt> 9) copy vmlinuz and initrd to flash drive> root at 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> 10) create /media/syslinux.cfg file > > root at martin-desktop:~# printf "default vmlinuz\nappend > initrd=initrd.gz\n" > /media/syslinux.cfg> 11) umount /mnt(.iso loop device) and /media(USB flash drive)> 12) install syslinux to /dev/sdb1 > > root at martin-desktop:~# syslinux -s /dev/sdb1Must be a 3.xx variant. Distribution packages are convenient but upstream is a lot more up to date and ready to go (pre-compiled) for most. (See also http://syslinux.zytor.com/wiki/index.php/Common_Problems#Official_Binaries )> 13) mount /dev/sdb1 once more in order to be sure, that all the > necessary files are on the flash driveDefinitely a good habit as it shows that something desirable probably happened. If you're really paranoid, perform the normal umount/eject procedures, wait a few seconds after last visible activity (prompt returns, GUI acknowledges, and flash drive activity light blinks) then physically remove the drive then re-insert it and mount it.> 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: > > "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 :)The behavior you're seeing is that it doesn't know where else to go from there. All it has is a kernel and basic initrd. It hasn't been instructed where to go to continue on. Again, I'd suggest UNetBootIn, unless you're prepared to do everything it does but on your own (probably a bit of work). -- -Gene
Gert Hulselmans
2011-Jan-29 12:12 UTC
[syslinux] How to make a bootable USB flash drive manually?
Martin T wrote:> 10) create /media/syslinux.cfg file > > root at martin-desktop:~# printf "default vmlinuz\nappend > initrd=initrd.gz\n" > /media/syslinux.cfg > root at martin-desktop:~# >Your syslinux.cfg file is wrong when you want to do boot from the ISO. Use this: =======================================DEFAULT ubuntu LABEL ubuntu LINUX /vmlinuz INITRD /initrd.gz APPEND boot=casper iso-scan/filename=/ubuntu-8.04.4-desktop-i386.iso ======================================= - Gert Hulselmans