rigadicomando.org

Whatever you can cat

Random Quote

In motion they separate,
in stillness they fuse.

• About Yin and Yang

Secondary links

  • About
  • Contacts
  • Disclaimer

Home Blogs admin's blog

USB Stick GNU/Linux mini howto with Fix for "Boot error" Buggy BIOSes

Submitted by admin on Wed, 2008-03-05 23:50.
  • Debian GNU/Linux OS
  • howto

I was reading some articles around the web about how building your persistent GNU/Linux system on usb stick, I found many howtos but I had problems with my BIOS.

It seems that certain versions of Award BIOS, one of the major BIOS vendor, are Buggy and misbehave with syslinux, to fix this you should give a USB-ZIP drive compatible geometry to the USB Stick. I found this useful info into the documentation inside the syslinux tarball (doc/usbkey.doc).

At this time and on this setup persistency does not work, but the diskless usb stick is still a useful tool also without persitency and if you really need it you can use another usb stick for the persistent filesystem, for doing that you need to patch initrd.gz and to create another filesystem on another device to be flagged casper-rw ... if interested take a look here to patch initrd.gz, here to customize your image and here to flag your casper-rw filesystem.

So let's come back to our project leaving persistency away for now ...
What you need to do is determine your USB Stick head and sectors needed for dealing with the mkdiskimage tool, and you can do this using fdisk, for example on my 2GB USB Stick:

NOTE: Substitute X with your letter, for example mine is "b"; if you don't know, try using something like:

# dmesg |grep -A 3 -B 3 -i usb

Once determined your USB disk device, you can go on with fdisk but be very careful, as you can loose all your data, you've been warned.

# fdisk /dev/sdX

Command (m for help): p

Disk /dev/sdb: 2029 MB, 2029518848 bytes
63 heads, 62 sectors/track, 1014 cylinders
Units = cylinders of 3906 * 512 = 1999872 bytes
Disk identifier: 0x00000000

So my USB Stick has 63 heads and 62 sectors.

After that, run the command mkdiskimage to make the Stick USB-ZIP drive geometry compliant:

mkdiskimage -4 /dev/sdX 0 63 62

"0" is for cylinders auto detection and "-4" is for create /dev/sdb4 as in USB-ZIP disks.

Wait a while as mkdiskimage will FAT16 format your device, on my 2GB it took several minutes.

Then use the loopback device to mount your ISO image, for example /home/fabio/ubuntu-7.10-desktop-i386.iso, so:

# mkdir /mnt/live_cd
# mount -o loop /home/fabio/ubuntu-7.10-desktop-i386.iso /mnt/live_cd

Mount your USB device too:

# mkdir /mnt/usb_disk
# mount /dev/sdb4 /mnt/usb_disk

Copy the files there:

# cd /mnt/live_cd
# cp -rf casper disctree dists install pics pool preseed .disk isolinux/* md5sum.txt README.diskdefines ubuntu.ico casper/vmlinuz casper/initrd.gz install/mt86plus /mnt/usb_disk/

Move isolinux.cfg in syslinux.cfg

# cd /mnt/usb_disk
# mv isolinux.cfg syslinux.cfg

Edit syslinux.cfg to have something like this:

DEFAULT vmlinuz
GFXBOOT bootlogo
GFXBOOT-BACKGROUND 0xB6875A
APPEND  file=/preseed/ubuntu.seed boot=casper initrd=initrd.gz quiet splash --
LABEL persistent
  menu label ^Start Ubuntu in USB persistent mode (saves changes)
  kernel vmlinuz
  append  file=/preseed/ubuntu.seed boot=casper persistent initrd=initrd.gz quiet splash --
LABEL live
  menu label ^Start Ubuntu in Live mode
  kernel vmlinuz
  append  file=/preseed/ubuntu.seed boot=casper initrd=initrd.gz quiet splash --
LABEL xforcevesa
  menu label Start Ubuntu in safe ^graphics mode
  kernel vmlinuz
  append  file=/preseed/ubuntu.seed boot=casper xforcevesa initrd=initrd.gz quiet splash --
LABEL driverupdates
  menu label Install with driver ^update CD
  kernel vmlinuz
  append  file=/preseed/ubuntu.seed boot=casper debian-installer/driver-update=true initrd=initrd.gz quiet splash --
LABEL oem
  menu label ^OEM install (for manufacturers)
  kernel vmlinuz
  append  file=/preseed/ubuntu.seed boot=casper oem-config/enable=true initrd=initrd.gz quiet splash --
LABEL check
  menu label ^Check CD for defects
  kernel vmlinuz
  append  boot=casper integrity-check initrd=initrd.gz quiet splash --
LABEL memtest
  menu label ^Memory test
  kernel /install/mt86plus
  append -
LABEL hd
  menu label ^Boot from first hard disk
  localboot 0x80
  append -
DISPLAY isolinux.txt
TIMEOUT 300
PROMPT 1
F1 f1.txt
F2 f2.txt
F3 f3.txt
F4 f4.txt
F5 f5.txt
F6 f6.txt
F7 f7.txt
F8 f8.txt
F9 f9.txt
F0 f10.txt

Umount and unplug your usb stick, than plug in again, in this way, the kernel will get the right partition id.

Run syslinux on your USB device:

# syslinux -f /dev/sdX4

To try things without reboots you can:

# apt-get install qemu
# qemu /dev/sdb

Probably with qemu things as Xorg will not work, but here it is useful to quickly check the initial boot process without rebooting ... enjoy your USB Stick GNU/Linux! ;)

  • admin's blog
  • Login to post comments

LinkShare  Referral  Prg

CheapOair.com

tags in Arguments

administrivia bash Debian GNU/Linux OS emacs howto perl scripts web
more tags

Navigation

  • Feedback
  • News aggregator

ICT users' rights

  • FSF and Stephen Fry celebrate the GNU Project 25th anniversary
  • Spring 2008 Bulletin available online
  • Submit your nominations for the 2008 Free Software Awards
  • FSF demonstrates iPhone's incompatibility with free software and GPLv3
  • Atheros releases free software wireless driver; no binary blobs
more

High Scalability Architecture

  • Latency is Everywhere and it Costs You Sales - How to Crush it
  • MapReduce framework Disco
  • What CDN would you recommend?
  • SMACKDOWN :: Who are the Open Source Content Management System (CMS) market leaders in 2008?
  • 37signals Architecture
more

Debian Security

  • DSA-1634 wordnet
  • DSA-1633 slash
  • DSA-1632 tiff
  • DSA-1631 libxml2
  • DSA-1630 linux-2.6
more

Drupal Security

  • SA-2008-048 - CCK - Cross site scripting
  • SA-2008-047 - Drupal core - Multiple vulnerabilities
  • SA-2008-046 - Drupal core - Session fixation
  • SA-2008-045 - OpenID - Multiple vulnerabilities
  • SA-2008-044 - Drupal core - Multiple vulnerabilities
more

EFF

  • FBI Withdraws Unconstitutional National Security Letter After ACLU and EFF Challenge
  • EFF and Sheppard Mullin Defend Wikipedia in Defamation Case
  • Congress Must Investigate Electronic Searches at U.S. Borders
  • Betrayed MSN Music Customers Deserve More from Microsoft
  • EFF Report: FBI Slowed Terror Investigation with Improper NSL Request
more

Invent Geek

  • the ion cooler 2.0
  • the ultimate dance pad v1.0
  • thermaltake sponsors inventgeek
  • The Thermaltake MiniFridge Case Mod
  • Inventgeek gets a facelift and a butt tuck
more

 Privacy | Disclaimer | Drupal | Creative Commons

All content on this site is ditributed under Creative Commons License, each individual author is responsible for its own posts.

RoopleTheme