Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sun 22 Sep 2019, 14:40
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
How to boot puppy from a USB flash drive with Grub
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [4 Posts]  
Author Message
bodiless

Joined: 12 Dec 2008
Posts: 5

PostPosted: Wed 17 Dec 2008, 09:13    Post subject:  How to boot puppy from a USB flash drive with Grub
Subject description: Solution if you need comboformat and large sfs files
 

Introduction
Recently I wanted to use Puppy 4.0 together with the openoffice suite on my new Thinkpad x61s. This laptop doesn't have a cd drive so I needed to install puppy on a usb flash drive. However, among the different option found in the universal installer my BIOS would only recognize the comboformat option. This option creates one small 124MB partition and one larger with the remaining space. The problem was, that the approx. 200MB openoffice.sfs file would not fit on the 124MB partition and resizing the two partitions with gparted did not help either. The solution that worked for me was to first make the usb bootable with grub, then add the necessary puppy and sfs files and finally instruct grub how to boot puppy.

So this how to is meant to help people who need to use and have already used the comboformat option but want the additional functionality of extra sfs files.

I wrote this how to summarizing in fact this threat and this blog entry on how to create a bootable usb flash drive.

1. Prerequisite
You will need a USB flash drive (I used a 1GB drive), a computer running linux with grub and some knowledge of the Linux command line. The technique is not considered for complete "newbies" since the tools used are not without risk for other partitions and OSes that you may have on your PC if you are not understanding what you are doing.

Therefore be careful, be sure you understand what you're doing, and use at your own risk.

2. Using the ComboFoarmat option of the Universal Installer and resizing with gparted

If you have already used the comboformat option the df -h command will give you this output:
Code:
df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sdb2             816M  840K  816M   1% /media/disk
/dev/sdb4             125M  117M  8.0M  94% /media/disk-1

The sdb4 partition is where the puppy and the sfs files go. As said above, I tried to increase the sdb4 partition from 124 to 500MB with gparted. Gparted exited with an error and as you can see below, the only difference was that some space disappeared and most importantly, the sdb4 partition remained almost full.
Code:
df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sdb2             197M  432K  196M   1% /media/disk-1
/dev/sdb4             125M  117M  8.0M  94% /media/disk

3. Repartition the drive, format it to FAT16 and install Grub
To do this you need a computer running linux with GRUB. I guess the same could be achieved with the older boot manager lilo but I have never used lilo so don't know very much about it.

First we must find how the USB drive is identified. So, right after plugging the drive in a linux computer I run "dmesg".
Code:
dmesg | tail
[ 5251.002101]  sdb: sdb2 sdb4
[ 5251.032106] sd 4:0:0:0: [sdb] Attached SCSI removable disk

So the drive was identified as sdb. Next I used fdisk to delete the two partitions that were created with the comboformat installer and create one large with the total of 1GB.
Code:
fdisk /dev/sdb

This command will start fdisk on the drive

The following commands were used:
Code:
p (to see the the 2 partitions and partition numbers)
d (to delete one partition)
2 (to delete partition /dev/sdb2)
d (to delete the other partition)
n (to create a new partition)
p (to create a primary partition)
1 (to be the first partition)
enter (for default first cylinder value)
enter (for default last cylinder value)
t (to change partition id)
6 (to make it a FAT16)
w (to write the new changes to disk)
p (to see the new partition just created)

The new partition on the drive should look now like this:
Code:
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         954      976880    6  FAT16

Next I went ahead to make the file system with "mkfs". I am not sure why this was necessary but I guess it has something to do with the new partition table and the MBR of the drive which obviously have been destroyed with my previous attempts to format it.
Code:
mkfs.vfat /dev/sdb1

Then I installed Grub on it.
Code:
grub-install /dev/sdb

This command didn't work for me so i tried:
Code:
grub-install --recheck /dev/sdb

This went ok. The output was:
Code:
(hd0)   /dev/sda
(hd1)   /dev/sdb

Write down the output as we will need it later when configuring grub.

After installing grub we need to copy some files. I created a /media/usb directory, mounted the drive, created a boot directory (named /boot) in the drive and copied over the necessary grub files.
Code:
mkdir /media/usb/
mount /dev/sdb1 /media/usb/
mkdir -p /media/usb/boot/
cp -r /boot/grub/ /media/usb/boot/

Remember from above that our drive was identified by grub as "(hd1) /dev/sdb"? We use this to make the drive bootable with:
Code:
grub
grub>root (hd1,0)
grub>setup (hd1)
quit

Now the drive should be bootable!

4. Install puppy on the drive
All you need is to copy the files included in the iso to the flash drive. I downloaded the puppy iso file and mounted it under /mnt/iso/:
Code:
mount -o loop puppy-4.1.2-k2.6.25.16-seamonkey.iso /mnt/iso/

Then I copied the puppy files into the boot directory of the drive:
Code:
cp -r /mnt/iso/* /media/usb/boot/

Finally I downloaded the openoffice-2.4.1.sfs file, renamed it to openoffice-2.4.1_400.sfs (same extension as the pup_400.sfs from the iso) and placed it into the flash drive (outside of the /boot directory).
Code:
cp openoffice-2.4.1_400.sfs /media/usb/

5. Instruct grub where to find puppy

Last step was to edit the menu.lst file which is found in the /boot/grub directory of the flash drive.

I made it look like this:

Code:
default      0
timeout      5
color cyan/blue white/blue
title      Puppy Linux 400, kernel 2.6.21.7
root      (hd0,0)
kernel      /boot/vmlinuz root=(hd0,0) ro quiet
initrd      /boot/initrd.gz

That's it. I rebooted and happy puppy!
6. Troubleshooting
I tried the above with two different flash drives. With one of them, after passing the grub screen I was dropped out to a console with the following error:
Code:
pup_400.sfs not found. Dropping out to initial-ramdisk console...
/bin/sh: can't access tty1 job control turned off

If you get this type:
Code:
. /init

(be careful, that's dot, space, slash, init). After this it booted ok.

Last edited by bodiless on Tue 26 Jan 2010, 09:52; edited 1 time in total
Back to top
View user's profile Send private message 
Evil20071


Joined: 07 Jun 2008
Posts: 490
Location: Piedmont, SC,.United States

PostPosted: Thu 18 Dec 2008, 01:13    Post subject:  

Would this also work out if I am installing puppy on an external USB hard drive?
_________________
TotalElectronics.us
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger 
ICQ Number 
bodiless

Joined: 12 Dec 2008
Posts: 5

PostPosted: Thu 18 Dec 2008, 03:26    Post subject:  

To be honest I have never done it but I see no reason why it shouldn't.
Back to top
View user's profile Send private message 
rcrsn51


Joined: 05 Sep 2006
Posts: 12639
Location: Stratford, Ontario

PostPosted: Thu 18 Dec 2008, 17:40    Post subject:  

You can definitely set up an external USB hard drive using GRUB. But there may be a catch. In older versions, Puppy does not distinguish between an actual USB hard drive and a flash drive. So it launches using PUPMODE=13 instead of 12. This means that Puppy runs in all-in-memory mode and may ignore any available swap. I haven't checked to see if this bug has been fixed in the latest version.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [4 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0963s ][ Queries: 11 (0.0228s) ][ GZIP on ]