How to do a full install on external USB hdd

How to do things, solutions, recipes, tutorials
Message
Author
User avatar
erikson
Posts: 735
Joined: Wed 27 Feb 2008, 09:22
Location: Ghent, Belgium
Contact:

How to do a full install on external USB hdd

#1 Post by erikson »

---Edit---
Advance warning
(1) Puppy "as is" has been designed to enable running *frugal* installs off usb devices, including usb pendrives and usb hard-disk drives, and is used as such by many Puppians.
(2) Puppy has *not* been designed to run *full* installs off usb devices and, "as is", is not even capable to do so.
(3) This thread documents how I tweaked and patched Puppy to run full off usb nonetheless. However the technique is pretty delicate, well beyond "newbie" level, and (if you make mistakes) not without risk for other partitions and OSes that you may have on your PC. Summary: read the referenced material carefully, be sure you understand what you're doing, and use at your own risk.
---/Edit---

It's an issue that comes back repeatedly on the forum.

Has anybody ever been able to do a Puppy full install onto an external usb hard-disk drive, and to successfully boot it?

Before saying "yes I have", double-check PUPMODE in /etc/rc.d/PUPSTATE --- a full install has PUPMODE=2.
Last edited by erikson on Thu 04 Dec 2008, 14:34, edited 6 times in total.
[size=84][i]If it ain't broke, don't fix it.[/i] --- erikson
hp/compaq nx9030 (1.6GHz/480MB/37.2GB), ADSL, Linksys wireless router
[url]http://www.desonville.net/[/url]
Puppy page: [url]http://www.desonville.net/en/joere.puppy.htm[/url][/size]

User avatar
Béèm
Posts: 11763
Joined: Wed 22 Nov 2006, 00:47
Location: Brussels IBM Thinkpad R40, 256MB, 20GB, WiFi ipw2100. Frugal Lin'N'Win

#2 Post by Béèm »

The last part, booting, is my main problem. But could be due to my Laptop not being able to do so. I get the message 'no operating system found'.
Didn't try however for quite some time.

But if I remember well, there is also the issue that in the early stage, vmlinuz, there is no USB support.
Time savers:
Find packages in a snap and install using Puppy Package Manager (Menu).
[url=http://puppylinux.org/wikka/HomePage]Consult Wikka[/url]
Use peppyy's [url=http://wellminded.com/puppy/pupsearch.html]puppysearch[/url]

mechvent
Posts: 13
Joined: Sun 18 Mar 2007, 00:14

limited success with 3.01

#3 Post by mechvent »

I have been playing with this lately with a 2.5" external drive - usb. First thing I noticed is that on boot up pretty much every time I need to go into the bios and make sure that the external drive is listed first in the hard drive list because on several computers I have noticed that on reboot it defaults back to the internal drive.

I have tried every different permutation of and I seem to be able to boot a few times and then puppy is not able to find the pupsave file on the disk, whether I boot from the hard drive or try from another usb of cd. I even installed grub on an ext 3 and got the same problem after success 3 times.

I am about to try with puppy 4.1 and I will report any success/ failure.

To repeat, though, I am able to get puppy to boot every time, but after a few reboots the pupsave file cannot be found. The main trick was going into the bios on every reboot and making sure the external hard drive was chosen.

davesurrey
Posts: 1198
Joined: Tue 05 Aug 2008, 18:12
Location: UK

#4 Post by davesurrey »

@ mechvent,
The OP is about Full installs. I thought there were no pup_save files in a full install.
As erikson says, check you really are in a PUPMODE=2.
Dave

User avatar
erikson
Posts: 735
Joined: Wed 27 Feb 2008, 09:22
Location: Ghent, Belgium
Contact:

#5 Post by erikson »

Well, at last I did it.

I installed and booted a full-install Puppy off of my external USB hard drive.

Code: Select all

# mount
rootfs on / type rootfs (rw)
/dev/sdb9 on / type ext3 (rw,errors=continue,data=ordered)
none on /proc type proc (rw)
none on /dev/pts type devpts (rw,gid=2,mode=620)
none on /sys type sysfs (rw)
shmfs on /dev/shm type tmpfs (rw,size=117868k)
none on /proc/bus/usb type usbfs (rw)
# 
# cat /etc/rc.d/PUPSTATE
PUPMODE=2
ATADRIVES='sda sdb '
PUP_HOME='/'
# 
Too tired now to explain - maybe later as a how-to.
[size=84][i]If it ain't broke, don't fix it.[/i] --- erikson
hp/compaq nx9030 (1.6GHz/480MB/37.2GB), ADSL, Linksys wireless router
[url]http://www.desonville.net/[/url]
Puppy page: [url]http://www.desonville.net/en/joere.puppy.htm[/url][/size]

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#6 Post by 8-bit »

[quote="erikson"]Well, at last I did it.

I installed and booted a full-install Puppy off of my external USB hard drive.

I did that a while back. It was to a usb drive from a Toshiba Satellite Laptop.
The Toshiba BIOS recognizes the usb drive as just another drive and by changing boot order, I could boot from the USB drive.
Upon removing it, the BIOS, not finding the USB drive would boot to the internal hard drive.
The external drive was partitioned and formated ext2 and no grub either on install.
It had a syslinux file instead.
Anyway, it worked fine.

User avatar
erikson
Posts: 735
Joined: Wed 27 Feb 2008, 09:22
Location: Ghent, Belgium
Contact:

#7 Post by erikson »

8-bit,
The Toshiba BIOS recognizes the usb drive as just another drive and by changing boot order, I could boot from the USB drive. Upon removing it, the BIOS, not finding the USB drive would boot to the internal hard drive.
Okay.
The external drive was partitioned and formated ext2 and no grub either on install. It had a syslinux file instead.
Okay again; syslinux is just another bootloader.

But booting off usb is not the problem, that works just fine (frugal). But are you sure it was a *FULL* install (i.e. with PUPMODE=2) ???

Please post /etc/rc.c/PUPSTATE.
[size=84][i]If it ain't broke, don't fix it.[/i] --- erikson
hp/compaq nx9030 (1.6GHz/480MB/37.2GB), ADSL, Linksys wireless router
[url]http://www.desonville.net/[/url]
Puppy page: [url]http://www.desonville.net/en/joere.puppy.htm[/url][/size]

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#8 Post by 8-bit »

.[/quote] Okay again; syslinux is just another bootloader.

But booting off usb is not the problem, that works just fine (frugal). But are you sure it was a *FULL* install (i.e. with PUPMODE=2) ???

Please post /etc/rc.c/PUPSTATE. [/quote]

Opps (foot in mouth)!
I double checked and since it says I have a pupsave file and Pupstate=13, I guess I will have to try that again.

But for the few that would like to boot from a USB install, the insight here on BIOS support could save a few from the floppy load method.

User avatar
erikson
Posts: 735
Joined: Wed 27 Feb 2008, 09:22
Location: Ghent, Belgium
Contact:

#9 Post by erikson »

In short:

(1) The Puppy Universal Installer, as is, does *not* allow to do a full install on usb devices.

(2) Puppy's vmlinuz, as is, has *no* usb storage drivers (as static compiled-in modules) and thus can't access usb storage devices. (Note that usb storage drivers are included in initrd.gz such that it's possible to boot frugal installs off usb devices.)

It's a double catch-22.

Next posts explain how to overcome these catches.
[size=84][i]If it ain't broke, don't fix it.[/i] --- erikson
hp/compaq nx9030 (1.6GHz/480MB/37.2GB), ADSL, Linksys wireless router
[url]http://www.desonville.net/[/url]
Puppy page: [url]http://www.desonville.net/en/joere.puppy.htm[/url][/size]

User avatar
erikson
Posts: 735
Joined: Wed 27 Feb 2008, 09:22
Location: Ghent, Belgium
Contact:

#10 Post by erikson »

Allowing the Puppy Universal Installer to do a full install on usb storage devices.

This is easily solved by patching /usr/sbin/puppyinstaller.

Locate...

Code: Select all

case $FINALPMEDIA in
 usbflash|usbhd|ideflash|idezip) #removable media, install with syslinux/extlinux
  (fairly long usb/flash/zip section; only frugal)
  ;;
 scsihd|idehd|satahd) #internal media, boot with boot-disk or grub.
  (fairly long hdd section; full or frugal)
  ;;
 idecd|scsicd|usbcd)
  (cd section, not yet implemented)
  ;;
esac
... and modify as follows...

Code: Select all

case $FINALPMEDIA in
 usbflash|usbhd|ideflash|idezip|scsihd|idehd|satahd)
  (fairly long hdd section; full or frugal)
  ;;
 idecd|scsicd|usbcd)
  (cd section, not yet implemented)
  ;;
esac
[size=84][i]If it ain't broke, don't fix it.[/i] --- erikson
hp/compaq nx9030 (1.6GHz/480MB/37.2GB), ADSL, Linksys wireless router
[url]http://www.desonville.net/[/url]
Puppy page: [url]http://www.desonville.net/en/joere.puppy.htm[/url][/size]

User avatar
erikson
Posts: 735
Joined: Wed 27 Feb 2008, 09:22
Location: Ghent, Belgium
Contact:

#11 Post by erikson »

Booting a full install off usb storage device

I'll start with my code.

Code: Select all

#!/bin/sh
#=====================================================================
# Script: init (in initrd-410k25-full-usb.gz)
# (-c) GPL erikson 2008-Oct-25, last rev. 2008-Oct-28
# Some code used and adapted from Puppy Linux (LGPL Barry Kauler)
# Purpose: booting full-install Puppy off usb storage device 
#=====================================================================

#=== usb boot partition (boot hint or default)
[   $pdev1 ] && PDEV1=$pdev1
[ ! $PDEV1 ] && PDEV1=sdb9
PDEV=$(echo $PDEV1 | cut -b1-3)

#---------------------------------------------------------------------
# Functions

ferr() {
 echo "Fatal error: $1" >/dev/console
 echo "Dropping out to initrd console" >/dev/console
 exec /bin/sh 1>/dev/console 2>&1
}

#---------------------------------------------------------------------
# Main code

mount -t proc none /proc
mount -t sysfs none /sys
mount -t rootfs -o remount,rw rootfs /
ln -s /proc/mounts /etc/mtab

USB_ROOT=/dev/$PDEV1
USB_MPNT=/mnt/$PDEV1
mkdir -p $USB_MPNT

#=== Load kernel drivers for usb

echo "Loading kernel drivers needed to access USB drive(s)..." >/dev/console
modprobe usbcore
[ "$(elspci -l | grep '0C0300')" != "" ] && modprobe uhci-hcd
[ "$(elspci -l | grep '0C0310')" != "" ] && modprobe ohci-hcd
[ "$(elspci -l | grep '0C0320')" != "" ] && modprobe ehci-hcd
modprobe usb-storage &		# BK backgrounds this too (why?)

#=== Wait till usb device PDEV is registered
#    takes 6...7 seconds on my laptop

echo "Registering USB storage device(s)..." >/dev/console
TLOG=/tlog ; rm -f $TLOG	# comment out for no logging
i=1 ; imax=15
while [ $i -le $imax ]; do
 ALLDRVS=$(ls -1 /sys/block | egrep "^hd|^sd|^scd|^sr|^mmc")
 [ $TLOG ] && echo "--- pass $i ---" >>$TLOG
 [ $TLOG ] && echo $ALLDRVS >>$TLOG
 [ $TLOG ] && /bin/dmesg | grep "usb-storage:" >>$TLOG
 sleep 1
 [ "$(echo $ALLDRVS | grep $PDEV)" != "" ] && break
 i=$((i+1))
done

#=== Mount the usb boot partition, drop out to console if failing

mount $USB_ROOT $USB_MPNT || ferr "can't mount $USB_ROOT"
[ -f $USB_MPNT/etc/puppyversion ] || ferr "can't find marker file ($USB_MPNT/etc/puppyversion)"

#=== Done - do the switch_root

[ $TLOG ] && cp -af $TLOG $USB_MPNT
sync
umount /sys
umount /proc

echo "Now executing the switch_root..." >/dev/console
exec switch_root $USB_MPNT /sbin/init

#========= end of file ===============================================
Now the rationale.

The following IBM article gives an excellent overview of the issues involved (read it first): Boot Linux from a FireWire device.

As applied to Puppy, full installs use the one-pass boot method (i.e. vmlinuz only), while frugal installs use the two-pass boot method (i.e. vmlinuz plus initrd.gz). The one-pass method can be used if the necessary drivers are built into the kernel *and* if the devices respond timely. In regular Puppy this is the case only for internal hard disk drives.

It's possible to compile the kernel with usb support included (from the sources supplied by Barry). I have done so for testing; unfortunately the recompiled vmlinuz still would not boot a full install off usb, with error message: "Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block (0,0)". This reflects the catch-22 issues mentioned in the article: "There is a timing window within the kernel, which means that often, the kernel will proceed to try to mount the root device before it has had a chance to be properly detected or initialized." On the web there are several patches around to build a kernel that deals with this catch-22, but the ones I found apply to older kernel versions. I did not pursue this road any further.

Now it may come as a big surprise to most Puppians that it's also possible to use a two-pass boot (i.e. with some appropriate initrd.gz) for regular full installs. Note that the ultimate characteristic of a full install is that the boot partition is directly mounted on / (as opposed to a frugal install, that uses filesystems within files pup_xxx.sfs, pup_save.2fs etcetera).

Re initrd two-pass booting, quoting IBM: "In a nutshell, the kernel is booted as normal; but instead of mounting the "real" root file system, a miniature root filesystem is created in RAM, and that is mounted. Any number of arbitrary steps can then be performed in this initial environment before the real root is mounted and we switch to using the real root and destroy the initial RAM disk. This is useful in all sorts of circumstances, but for our purposes we will simply be using our mini environment to rescan the SCSI bus, wait for the external disk to be recognized, then switch to using this as our real root and continue to boot."

So that's what my init code above does - it loads the usb drivers, waits for the usb drive(s) to be registered, mounts and switches root to the boot partition. Nothing more, nothing less (there's no pup_xxx.sfs nor pup_save.2fs involved). Note that the technique of IBM's linuxrc script (namely exiting with exit 0 for further booting) doesn't work with Puppy's vmlinuz (I tested and it fails), so I do a regular switch_root to /sbin/init.

Now the practical steps:
- do a Puppy full install on a fresh usb hdd partition, e.g. using the modified universal installer of previous post (I used Puppy 4.1 kernel 2.6.25.16); this also copies vmlinuz into the /boot subdir of that partition
- take Puppy's initrd.gz, unpack it, replace the init script by the code above, repack into initrd-410k25-full-usb.gz, and place it along with vmlinuz in the same /boot subdir (Later edit: the techniques for unpacking and repacking initrd.gz are documented in Pizzasgood post here).
- edit your grub menu.lst, e.g. (Later edit: if you don't have an installed grub yet, you must install and configure it first; also see comments on grub in further posts)

Code: Select all

# --- pup410k25 FULL (ro, vga=normal) ---
title pup410k25 FULL
root (hd0,8)
kernel /boot/vmlinuz root=/dev/sdb9 pdev1=sdb9 ro vga=normal pmedia=usbhd nosmp
initrd /boot/initrd-410k25-full-usb.gz
Reboot into pup410k25 FULL and enjoy the full install running off usb hard drive.
Last edited by erikson on Fri 14 Nov 2008, 18:06, edited 7 times in total.
[size=84][i]If it ain't broke, don't fix it.[/i] --- erikson
hp/compaq nx9030 (1.6GHz/480MB/37.2GB), ADSL, Linksys wireless router
[url]http://www.desonville.net/[/url]
Puppy page: [url]http://www.desonville.net/en/joere.puppy.htm[/url][/size]

User avatar
erikson
Posts: 735
Joined: Wed 27 Feb 2008, 09:22
Location: Ghent, Belgium
Contact:

#12 Post by erikson »

Additional comments

I have tested full installs of Puppy 4.1 kernel 2.6.25.16 on:
- external usb hard disk drive (Seagate FreeAgent Desktop 500 GB)
- usb flash pendrive (SanDisk U3 Cruzer Micro 2 GB)

Both work. Note that I would not recommend to run a full install off usb flash pendrive (risk of premature wear-out), but I was curious if it would work, and it does.

Herewith the tarred init script (as listed in earlier post) and modified puppyinstaller (as allowing to do full install on usb devices).
Attachments
410k25-full-usb.tar.gz
(19.43 KiB) Downloaded 717 times
[size=84][i]If it ain't broke, don't fix it.[/i] --- erikson
hp/compaq nx9030 (1.6GHz/480MB/37.2GB), ADSL, Linksys wireless router
[url]http://www.desonville.net/[/url]
Puppy page: [url]http://www.desonville.net/en/joere.puppy.htm[/url][/size]

User avatar
erikson
Posts: 735
Joined: Wed 27 Feb 2008, 09:22
Location: Ghent, Belgium
Contact:

#13 Post by erikson »

For booting a full-install, initrd.gz doesn't need everything of the original one.

I removed the superfluous files. Herewith the size of the original initrd.gz (1239 KB) is reduced to just 434 KB for the modified version that suffices to boot the full install.
[size=84][i]If it ain't broke, don't fix it.[/i] --- erikson
hp/compaq nx9030 (1.6GHz/480MB/37.2GB), ADSL, Linksys wireless router
[url]http://www.desonville.net/[/url]
Puppy page: [url]http://www.desonville.net/en/joere.puppy.htm[/url][/size]

User avatar
russoodle
Posts: 707
Joined: Fri 12 Sep 2008, 17:36
Location: Down-Under in South Oz

Re: Full install on external USB hdd..

#14 Post by russoodle »

Thanx for all this, erikson...

I'm pretty much a noob to Linux in general and have no understanding of any OS programming code, so it'll take me a while to assimilate all the info you've kindly provided here and be able to use it, actually knowing what i'm doing :?

I have a couple of flash drives and the odd corrupted or seldom-used winblows drives, which i thought could be better utilised with Puppy, in conjunction with my IBM T40P laptop, so i'm going to save this page for reference purposes.

ATM, my first partition on the single hdd is home to XP with the next primary partition housing Ubuntu 8.04; additionally, there's a 1gb swap partition and another ext3-formatted partition, which i plan to use for various Puplet frugal installs (heaven knows i have enough Puplet iso CDs here!).

Interesting to note the wireless in your siggy-specs...for the life of me, i cannot connect to my network (wired to mac-beast) with any incarnation of Puppy whatsoever, although both XP and Ubuntu do so seamlessly (and wirelessly) after having been configured just once. Ath0 is recognised, i configure the parameters but the resulting dialogue tells me it cannot make a WPA connection. I reconfigured the router with only WEP security but it still didn't play nice, so for the moment i'm alternately sulking/fuming with frustration, because if i could only get online with Puppy, i doubt that either other OS on this machine would get much exercise at all!

Anyway, my apologies, as this thread isn't the place for my wireless connection issues, however i couldn't resist an envious little vent when i noted your sig :wink:

Cheers!

User avatar
Béèm
Posts: 11763
Joined: Wed 22 Nov 2006, 00:47
Location: Brussels IBM Thinkpad R40, 256MB, 20GB, WiFi ipw2100. Frugal Lin'N'Win

#15 Post by Béèm »

Thanks to the reference to PizzasGood post about unpacking/repacking initrd I could go on further.

The boot process of the USB drive did start now, but got a message from EXTLINUX: could not find kernel image Linux
boot:

So I then entered /boot/vmlinuz and boot continued to end at a kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(22,1)

Still something missing on that USB drive?
Time savers:
Find packages in a snap and install using Puppy Package Manager (Menu).
[url=http://puppylinux.org/wikka/HomePage]Consult Wikka[/url]
Use peppyy's [url=http://wellminded.com/puppy/pupsearch.html]puppysearch[/url]

User avatar
Béèm
Posts: 11763
Joined: Wed 22 Nov 2006, 00:47
Location: Brussels IBM Thinkpad R40, 256MB, 20GB, WiFi ipw2100. Frugal Lin'N'Win

#16 Post by Béèm »

Béèm wrote:Thanks to the reference to PizzasGood post about unpacking/repacking initrd I could go on further.

The boot process of the USB drive did start now, but got a message from EXTLINUX: could not find kernel image Linux
boot:

So I then entered /boot/vmlinuz and boot continued to end at a kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(22,1)

Still something missing on that USB drive?
I searched with puppysearch and only some ten hits were found with similar error messages.
One of the tips was to verify if the usbflash drive was set as boot: It was.

The usbflash drive is the only one I boot from, I disabled boot from the HDD0

Now I am unsure how to consider this flash drive now. As (hd0,0) or as (hd1,0)

As the first message (couldn't find a linux kernel) came from extlinux, I am not at the stage of grub yet?

UPDATE
I tried (hd1,0) but to no avail. Same thing.
Time savers:
Find packages in a snap and install using Puppy Package Manager (Menu).
[url=http://puppylinux.org/wikka/HomePage]Consult Wikka[/url]
Use peppyy's [url=http://wellminded.com/puppy/pupsearch.html]puppysearch[/url]

User avatar
erikson
Posts: 735
Joined: Wed 27 Feb 2008, 09:22
Location: Ghent, Belgium
Contact:

#17 Post by erikson »

Béèm,

I assume that your internal hdd is identified as /dev/sda and your usb device as /dev/sdb
I assume that you formatted one (ext2 or ext3) partition on your usb device, /dev/sdb1, and you full-installed to there
I assume that grub is correctly installed onto the MBR of your usb flash (also see my grub.readme below).
I assume that your BIOS is set to boot from usb.
I make no assumptions about partition boot flag, because grub doesn't care about it at all.

If different, please post.

Then you need:

(1) on the full-install usb partition:
- all regular full-install directories
- a directory /mnt/sdb1/boot
- inside that boot directory: original 'vmlinuz' (4.1-k2.6.25.16)
- inside that boot directory: the special full-boot 'initrd.gz'
- inside that boot directory: file 'marker'
- inside that boot directory: a subdirectory grub with the necessary grub files (at least 'stage_1', 'e2fs_stage1_5', 'stage_2', and of course also 'menu.lst')

(2) an entry in your grub 'menu.lst':

Code: Select all

title Puppy 4.1-full on usb
root (hd0,0)
kernel /boot/vmlinuz root=/dev/sdb1 pdev1=sdb1 pmedia=usbflash nosmp
initrd /boot/initrd.gz
Note that root is indeed (hd0,0) when you boot off the usb first partition.
Note that the pdev1 boot hint *must* be specified, otherwise my init script defaults to hard-coded sdb9.

BTW - I have no idea what 'extlinux' is doing on your install, I don't have that. Hereunder I post my grub.readme help file that I always keep handy. It describes the procedure for installing and activating grub into the boot device's MBR. There's no 'catch-22' because, for running this installation procedure, you can perfectly start another grub instance e.g. from live-CD.
File '/mnt/sdax/boot/grub.readme' edited by erikson 2008-Sep-24

Before and after the following procedure, backup MBR by using command (with appropriate device id): 'dd if=/dev/sda of=/path/mbrsave bs=512 count=1' or (preferrably) by running script '/mnt/sda2/MySeagate/%seagatecfgdump'.

Procedure:
1) Set/verify boot flag by running GParted or by typing console command: 'fdisk -l'. Actually grub doesn't care about boot flag; set it on the target grub boot partition "pro forma".
2) Start grub from console.
3) At the 'grub>' prompt, type command: 'find /boot/marker'. GRUB lists all drive(s) and partition(s) where it finds a marker file. Check that the target grub boot partition is listed.
4) While still at the grub prompt, type the three commands below. Be careful *not* to use hd0 by accident; this would put grub on the MBR of the internal hard drive and, for a Windows-formatted drive, would erase the Windows bootloader.
> root (hdx,y) (where hdx,y is a drive/partition reported in step 3)
> setup (hdx) (there should be some messages indicating success)
> quit
5) Edit file '/mntpnt/boot/grub/menu.lst' to match your particular setup.
6) Reboot, enter BIOS setup and change PC boot sequence as necessary.
Note that (hdx,y) for this installation procedure has nothing to do with the root or rootnoverify (hdx,y) settings in menu.lst (i.e. can be different). The former depends on where you boot from for installation and the latter depends on where you boot from for actually running the target.
[size=84][i]If it ain't broke, don't fix it.[/i] --- erikson
hp/compaq nx9030 (1.6GHz/480MB/37.2GB), ADSL, Linksys wireless router
[url]http://www.desonville.net/[/url]
Puppy page: [url]http://www.desonville.net/en/joere.puppy.htm[/url][/size]

User avatar
Béèm
Posts: 11763
Joined: Wed 22 Nov 2006, 00:47
Location: Brussels IBM Thinkpad R40, 256MB, 20GB, WiFi ipw2100. Frugal Lin'N'Win

#18 Post by Béèm »

erikson wrote:Béèm,

I assume that your internal hdd is identified as /dev/sda and your usb device as /dev/sdb
I assume that you formatted one (ext2 or ext3) partition on your usb device, /dev/sdb1, and you full-installed to there
I assume that grub is correctly installed onto the MBR of your usb flash (also see my grub.readme below).
I assume that your BIOS is set to boot from usb.
I make no assumptions about partition boot flag, because grub doesn't care about it at all.

If different, please post.
All this is correct.
ericson wrote:Then you need:

(1) on the full-install usb partition:
- all regular full-install directories
- a directory /mnt/sdb1/boot
- inside that boot directory: original 'vmlinuz' (4.1-k2.6.25.16)
- inside that boot directory: the special full-boot 'initrd.gz'
- inside that boot directory: file 'marker'
- inside that boot directory: a subdirectory grub with the necessary grub files (at least 'stage_1', 'e2fs_stage1_5', 'stage_2', and of course also 'menu.lst')
You instructed to call the initrd.gz initrd-410k25-full-usb.gz as far as I understood the instruction. So that's what I have in /boot. The menu.lst reflect that name as well.
I don't have that file 'marker'. The modified installer didn't generate it.
The rest in /boot/grub is as you described.
ericson wrote:(2) an entry in your grub 'menu.lst':

Code: Select all

title Puppy 4.1-full on usb
root (hd0,0)
kernel /boot/vmlinuz root=/dev/sdb1 pdev1=sdb1 pmedia=usbflash nosmp
initrd /boot/initrd.gz
Note that root is indeed (hd0,0) when you boot off the usb first partition.
Note that the pdev1 boot hint *must* be specified, otherwise my init script defaults to hard-coded sdb9.
I did that.
ericson wrote:BTW - I have no idea what 'extlinux' is doing on your install, I don't have that. Hereunder I post my grub.readme help file that I always keep handy. It describes the procedure for installing and activating grub into the boot device's MBR. There's no 'catch-22' because, for running this installation procedure, you can perfectly start another grub instance e.g. from live-CD.
In the root of the usbflash I had a file extlinux.sys. I thought it came from the modified installer. I had to go to another :wink: PC to get rid of it.
But I still have the message

Code: Select all

EXTLINUX 3.63 2008-04-10 EBIOS Copyright (C) 1004-2008 H. Peter Anvin
as first line.
Followed by: Could not find kernel image: linux.
If this doesn't come from the modified install, maybe it's from my PC's bios as I configured to allow boot from USB. I don't know.
ericson wrote:
File '/mnt/sdax/boot/grub.readme' edited by erikson 2008-Sep-24

Before and after the following procedure, backup MBR by using command (with appropriate device id): 'dd if=/dev/sda of=/path/mbrsave bs=512 count=1' or (preferrably) by running script '/mnt/sda2/MySeagate/%seagatecfgdump'.

Procedure:
1) Set/verify boot flag by running GParted or by typing console command: 'fdisk -l'. Actually grub doesn't care about boot flag; set it on the target grub boot partition "pro forma".
2) Start grub from console.
3) At the 'grub>' prompt, type command: 'find /boot/marker'. GRUB lists all drive(s) and partition(s) where it finds a marker file. Check that the target grub boot partition is listed.
4) While still at the grub prompt, type the three commands below. Be careful *not* to use hd0 by accident; this would put grub on the MBR of the internal hard drive and, for a Windows-formatted drive, would erase the Windows bootloader.
> root (hdx,y) (where hdx,y is a drive/partition reported in step 3)
> setup (hdx) (there should be some messages indicating success)
> quit
5) Edit file '/mntpnt/boot/grub/menu.lst' to match your particular setup.
6) Reboot, enter BIOS setup and change PC boot sequence as necessary.
Note that (hdx,y) for this installation procedure has nothing to do with the root or rootnoverify (hdx,y) settings in menu.lst (i.e. can be different). The former depends on where you boot from for installation and the latter depends on where you boot from for actually running the target.
After executing step 3 I have no marker found, nor at the target usbflash partition nor at the hdd0 partition. The latter seems normal to me as I use Lin'N'win on this windows partition
I am unsure if I have to enter the other commands referenced.
Should I (re)-install grub on the target device?
(nevertheless an interesting exercise)
Time savers:
Find packages in a snap and install using Puppy Package Manager (Menu).
[url=http://puppylinux.org/wikka/HomePage]Consult Wikka[/url]
Use peppyy's [url=http://wellminded.com/puppy/pupsearch.html]puppysearch[/url]

User avatar
Béèm
Posts: 11763
Joined: Wed 22 Nov 2006, 00:47
Location: Brussels IBM Thinkpad R40, 256MB, 20GB, WiFi ipw2100. Frugal Lin'N'Win

#19 Post by Béèm »

The weakest point in the chain very often is the human error. :oops:
When installing grub I took the default, which I thought was the usbflash, but in reality it was the hdd0, so that explains why I had a corrupted MR and couldn't boot from hdd0.

That doesn't explain the extlinux thing.

Anyway I erased the partition and started over again.
This time taken care I installed grub to sdb1.
And yes when booting I got now the grub menu of sdb1.

Remade the special initrd.gz and adapted the menu.lst.
I still didn't had that marker file, but in the package pup2usb I found such a file and put it in /boot.

So crossing fingers I booted from the usbflash and selected the puppy on sdb1
I got an error File system type unknown, partition type 0x7

Error 17: Cannot mount selected partition.

Getting closer, but still something wrong.

UPDATE
Hadn't changed the generated (hd1,0) to (hd0,0)

Now it's working.
In fact this was a preparation to do such an install on an external connected USB HDD.
I tried usbflash, so no much harm could be done.

Now I have to see how this setup fits into the Lin'N'Win setup I already have on this PC.
As the usbflash device is the first in the HDD boot chain, just have it pulled out when booting, will boot from the hdd0, I suppose.

A big thanks to Erikson for finding this method.

The Morning after

Altho I did pay attention this time, I got the dreaded grub error 21 again when trying to boot from hdd0. Did the fdisk /mbr and all's well.
I tested then if I still could boot from the usbflash and it did.
So I conclude there is a flaw in the install grub script.
Altho selecting /dev/sdb to write grub too (MBR) the MBR of sda is affected as well.
I have no idea why.

Funny thing when using the usbflash. This device is represented as a floppy on the desktop.
Time savers:
Find packages in a snap and install using Puppy Package Manager (Menu).
[url=http://puppylinux.org/wikka/HomePage]Consult Wikka[/url]
Use peppyy's [url=http://wellminded.com/puppy/pupsearch.html]puppysearch[/url]

User avatar
erikson
Posts: 735
Joined: Wed 27 Feb 2008, 09:22
Location: Ghent, Belgium
Contact:

#20 Post by erikson »

So you succeeded... congrats!
(And you did check pupstate, I presume)
Béèm wrote:Anyway I erased the partition and started over again. This time taken care I installed grub to sdb1.
Okay. My modified installer script installs full-Puppy, but not grub, you have to do that yourself. I didn't mention that... somehow took it for granted.
I still didn't had that marker file, but in the package pup2usb I found such a file and put it in /boot.
Okay. Actually any file named 'marker' will do, even an empty one. You could create one using touch /mnt/sdb1/boot/marker
Hadn't changed the generated (hd1,0) to (hd0,0). Now it's working.
Very important, that's why I explicitly mentioned that install-time (hdx,y) and boot-time (hdx,y) can be different.
Now I have to see how this setup fits into the Lin'N'Win setup I already have on this PC. As the usbflash device is the first in the HDD boot chain, just have it pulled out when booting, will boot from the hdd0, I suppose.
Yes. But it may be more elegant to leave the usbflash in place and adapt the BIOS boot sequence for booting off hdd.

I assume that lin-n-win has menu-choice capabilities similar to grub; then an entry in your hdd bootloader menu can still refer to Puppy on usb. This time with (hd1,0) because, when starting the boot process off hdd, hdd will be hd0 and usbflash will be hd1. Normally that's the only thing in the Puppy menu entry that's different.

And you can simply switch from hdd-bootlader to usb-bootloader and inversely (both menus allowing to boot Puppy from usb or Win from hdd or whatever else), just by changing the BIOS boot sequence.
So I conclude there is a flaw in the install grub script. Altho selecting /dev/sdb to write grub too (MBR) the MBR of sda is affected as well. I have no idea why.
That's strange. I have experienced no problems with grub install once I had it under my belt.
Funny thing when using the usbflash. This device is represented as a floppy on the desktop.
Yes, for me too.
[size=84][i]If it ain't broke, don't fix it.[/i] --- erikson
hp/compaq nx9030 (1.6GHz/480MB/37.2GB), ADSL, Linksys wireless router
[url]http://www.desonville.net/[/url]
Puppy page: [url]http://www.desonville.net/en/joere.puppy.htm[/url][/size]

Post Reply