Gentoo Archives: gentoo-amd64

From: Drake Donahue <donahue95@×××××××.net>
To: gentoo-amd64@l.g.o
Subject: Re: [gentoo-amd64] boot Gentoo from USB key
Date: Wed, 30 Apr 2008 18:06:45
Message-Id: 001401c8aaec$8e74c440$0200a8c0@iwillxp333
In Reply to: [gentoo-amd64] boot Gentoo from USB key by Raffaele BELARDI
1 ----- Original Message -----
2 From: "Raffaele BELARDI" <raffaele.belardi@××.com>
3 To: "gentoo-amd64" <gentoo-amd64@l.g.o>
4 Sent: Wednesday, April 30, 2008 2:43 AM
5 Subject: [gentoo-amd64] boot Gentoo from USB key
6
7
8 > In the process of building an amd64 diskless box, I am trying to make a
9 > bootable USB key with no success up to now.
10 >
11 > The first problem I encountered was related to ext2/vfat. I initially
12 > tried to format the key as ext2, but grub refuses to install on it. Even
13 > though I copied the /boot/grub/* directory into the key, and I see it is
14 > there, grub does not see it. The problem does not happen with vfat.
15 >
16 > So I worked around that and created two partitions in the key, a small
17 > vfat for the /boot and a 2Gb ext2 for the /. I copied the stage3 into
18 > the / with no problem. In the /boot I put the kernel image which I am
19 > already using on the same box, for now with discs still connected. All
20 > the modules are compiled in.
21 >
22 > When I boot from the key, grub enters the shell (although I did create
23 > the grub.conf and menu.1st, so I don't understand why it doesn't show
24 > the menu). I manually specify the kernel file location and root
25 > parameter:
26 >
27 >> kernel /linux-2.6.24-gentoo-r4 root=/dev/sdg1
28 >> boot
29 >
30 > The kernel starts to load, but panics because it is unable to find the
31 > root partition. When it stops it shows the available partitions, these
32 > include all the hard disk partitions but no USB key partition. In fact,
33 > if I omit the 'root' parameter from the grub shell the boot works fine
34 > but it uses the hard disk root partition instead of the USB one.
35 >
36 >>From the log on the screen the USB controller seems correctly detected,
37 > so I don't understand why it is not finding the root. While writing this
38 > one idea comes to my mind, maybe it is failing because I attach the key
39 > to a SDC/MMC/USB card reader? This evening I'll try to plug it into a
40 > different USB slot.
41 >
42 > Any other ideas welcome.
43 >
44 > raffaele
45 >
46 > --
47 > gentoo-amd64@l.g.o mailing list
48 >
49 Other ideas and SWAGS:
50
51 This link may be useful:
52 http://www.bootdisk.com/pendrive.htm
53
54 Perhaps the pen drive manufacturer did you favors and added some control
55 software?
56 I had a similar problem with fdisk results that I attributed to the helpful
57 manufacturer putting some extra software on the drive to add features for
58 the windows user (the bootable flag would have disappeared upon reboot, the
59 pen drive would not appear in BIOS). I may have been right. I used the HP
60 utilities referenced in the link to rewrite the recalcitrant pen drive into
61 a psuedo floppy drive with linux on board (HP provides a linux based windows
62 computer troubleshooting tool!). After verifying that I could boot the pen
63 drive as though it were a huge floppy, I rebooted to my hard drive and used
64 fdisk to delete existing partitions on the pen drive, created a bootable
65 partition, wrote the new partition table, exited fdisk, and formatted it
66 ext2. On reboot it showed as a bootable hard drive in BIOS. Encouraged, I
67 rebooted to the hard drive. Mounted the pen drive and copied /boot from the
68 hard drive to it. Create dummy directory on the pendrive:
69 >mkdir {pendrive path}/pendrive
70 Keeping the problem simple, the machine had one sata hard drive, one ide
71 dvd, and the one pen drive.
72 The major problems at this point were identifying which (hd?) to use in
73 editing the grub.conf and in running grub itself.
74 >umount {pendrive}
75 >grub
76 >root (hd0,1)
77 >root (hd1,1)
78 >find /pendrive
79 >quit
80 As the pen drive first (0) partition was the only ext2 partition on the
81 machine, only one of the two commands would expose an ext2 filesystem; in my
82 case (hd1,1). Find should provide the same information.
83 If the pen drive is the selected boot drive for my motherboard it will be
84 (hd0) for bios and grub.
85 So the pen drive grub.conf edits to:
86 timeout 5
87 default 0
88 fallback 1
89 splashimage=(hd0,0)/boot/grub/splash.xpm.gz
90
91 title USB Flash boot
92 root (hd0,0)
93 kernel (hd0,0)/boot/bzImage root=/dev/sdb1
94
95 title Gentoo Linux on hard drive, first partition (hd1,0)
96 root (hd1,0)
97 kernel (hd1,0)/boot/bzImage root=/dev/sda1
98
99 So far my hard drive always /dev/sda pendrive /dev/sdb. As a slob, I put
100 everything on one partition so all catastrophes can be catastrophic.
101
102 Still need to install grub so proper stage 1 and 1.5 and dynamic links can
103 be written:
104
105 >grub
106 >root (hd1,0) #should confirm unique ext2 file system in my case
107 >setup (hd1)
108 >quit
109
110 Proceeding in similar fashion should allow you to select the kernel on the
111 pen drive from grub and watch it load to the point where it can't find the
112 system because no system is on the pen drive.
113
114 Copying the system files may not quite work. Got some copy errors while
115 doing the libraries. Playing with 512 mb pen drive so no room to copy /sys.
116 Can verify that I completed kernel load and got into init.before lack of
117 needed files started an endless reboot cycle with boot sbin bin etc
118 libraries directories present.
119
120 .
121
122 --
123 gentoo-amd64@l.g.o mailing list

Replies

Subject Author
Re: [gentoo-amd64] boot Gentoo from USB key Drake Donahue <donahue95@×××××××.net>