Skip to Content.
Sympa Menu

sm-discuss - Re: [SM-Discuss] boot from usb key

sm-discuss AT lists.ibiblio.org

Subject: Public SourceMage Discussion List

List archive

Chronological Thread  
  • From: Karsten Behrmann <BearPerson AT gmx.net>
  • To: sm-discuss AT lists.ibiblio.org
  • Subject: Re: [SM-Discuss] boot from usb key
  • Date: Tue, 12 Feb 2008 21:38:45 +0100

Hi there,

(see the end of the mail for what to try)

> My root device is actually /dev/sda2. So I downloaded the latest ISO and
> tried to boot from my usb key (3 partitions) without any other drives.
> And here's the results :
>
> bash-3.2# boot-from /dev/sda2
> bash-3.2# exit
> Attempting to boot from /dev/sda2
> [timing] Unable to identify CD ROM format
> mount: wrong fs type, bad option bad superblock on /dev/sda2, missing
> codepage or other error
> Unable to mount /dev/sda2 as iso9660, retrying with type auto
> [timing] EXT2-fs warning : mounting unchecked fs, running e2fsck is
> recommended

Good. Up to here everything is as intended. It tried mounting as a
cdrom filesystem, noticed it didn't work, and tried letting mount
guess.

> mount: /dev/sda2 already mounted or /mnt/cdrom/mnt/cdrom busy

This is a bug. We should have used a different kind of mount there,
I suppose. It worked with read-only filesystems, but it seems it
fails on things like ext2fs.

> Setting up writeable /dev for the udevness
> /mnt/cdrom/bin/cp cannot stat 'dev' : No such file or directory
> Setting up /tmp for install
> /mnt/cdrom/bin/cp cannot stat 'tmp' : No such file or directory
> [...]
> umount: /mnt/cdrom/mnt/cdrom : not mounted

Those errors are simply a direct result of the mount error.

> Running /sbin/init
> mount: devfs has wrong device number or fs type devfs not supported

This one too, interestingly.

> /sbin/init: line 149: dev/console: No such file or directory
> Trning to find the SMGL CD automatically
>
> [...]
> bash-3.2#

> AFAIK, the mount doesn't seem to go smoothly. When I type mount at the
> bash prompt, I get :
> rootfs on / type roots
> /dev/root on /initrd type ext2
> /dev/sda2 on / type ext2
> tmpfs on /dev type tmpfs
[...]

Actually, what didn't go smoothly is the initrd trying to make /dev
and some other places writeable. It needs to mount a tmpfs and copy
in some data when it's a real CD, because the installer needs to
write to them.
What it's too dumb to notice is that those places already are writeable.

There's a rather surprisingly easy (and somewhat hackish) fix:

mount the usb key somewhere and remove /etc/sourcemage_version from
the filesystem on it.
(don't forget to unmount it, your "unchecked fs" warning means the
kernel thinks the filesystem wasn't properly unmounted)

You'll still have to do that boot-from thing, but then it should
actually boot somewhat properly.

[for the curious: the initrd version on that ISO detects if the
filesystem you want to boot is the smgl ISO by checking for that file.
If it finds it, it mounts a bunch of tmpfs's and tries to populate them.
If not, it assumes you're trying to boot your installed system after
trashing your bootloader and doesn't do anything. As it's already
writeable as an ext2fs on an usb stick, it _should_ work :)
- so what breaks? We do a second mount of the ISO to copy the contents
of /etc and pals into their tmpfs mounts. Unfortunately, it seems you
can mount an isofs twice, but not an ext2fs.]

Hope this works!

So Far,
Karsten "BearPerson" Behrmann

p.s.:
the current devel branch is smarter when it comes to this. For one
thing, the initrd isn't responsible for setting stuff up read-write,
so you can tell your bootloader to just boot "install root=/dev/sda2"
directly. For another thing, I _think_ I made the initscript smart
enough to do nothing when things are already writeable. Also, it
doesn't depend on any exotic double mounts ;)

Attachment: signature.asc
Description: PGP signature




Archive powered by MHonArc 2.6.24.

Top of Page