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