/[gentoo]/xml/htdocs/doc/en/gentoo-x86-tipsntricks.xml
Gentoo

Contents of /xml/htdocs/doc/en/gentoo-x86-tipsntricks.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (show annotations) (download) (as text)
Sun Aug 1 10:53:12 2004 UTC (10 years, 4 months ago) by swift
Branch: MAIN
Changes since 1.5: +79 -2 lines
File MIME type: application/xml
#50641 - Inform users how to recover from a malfunctioning installation

1 <?xml version='1.0' encoding="UTF-8"?>
2 <!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
3
4 <guide link="/doc/en/gentoo-x86-tipsntricks.xml">
5 <title>Gentoo/x86 Installation Tips &amp; Tricks</title>
6 <author title="Author">
7 <mail link="swift@gentoo.org">Sven Vermeulen</mail>
8 </author>
9
10 <abstract>
11 The Gentoo installation allows for very flexible approaches to the various
12 installation methods. As it is almost impossible to insert every single tip or
13 trick in the installation instructions this document tries to deal with all
14 submitted tips and tricks for reference purposes.
15 </abstract>
16
17 <license/>
18
19 <version>1.3</version>
20 <date>August 01, 2004</date>
21
22 <chapter>
23 <title>Introduction</title>
24 <section>
25 <title>Preliminary</title>
26 <body>
27
28 <p>
29 This document contains various tips and tricks for the Gentoo/x86 installation.
30 Most of them are discussed in a dense way - they are meant as an addendum to the
31 installation instructions and not as a replacement.
32 </p>
33
34 </body>
35 </section>
36 <section>
37 <title>Contents</title>
38 <body>
39
40 <p>
41 <b>Advanced Installations</b>
42 </p>
43
44 <ul>
45 <li><uri link="#software-raid">Software RAID</uri></li>
46 <li><uri link="#ata-raid-2.4">ATA RAID using 2.4 kernels</uri></li>
47 </ul>
48
49 <p>
50 <b>Simplifying the Installation</b>
51 </p>
52
53 <ul>
54 <li><uri link="#leave_terminal">Leaving the Terminal</uri></li>
55 </ul>
56
57 <p>
58 <b>Fixing Errors/Issues</b>
59 </p>
60
61 <ul>
62 <li><uri link="#checking-disks">Extensive Testing of your Disks</uri></li>
63 <li>
64 <uri link="#recover">Recovering from a malfunctioning installation</uri>
65 </li>
66 </ul>
67
68 </body>
69 </section>
70 </chapter>
71 <chapter>
72 <title>Advanced Installations</title>
73 <section id="software-raid">
74 <title>Software RAID</title>
75 <body>
76
77 <note>
78 If you are not known to software raid, please read the <uri
79 link="http://tldp.org/HOWTO/Software-RAID-HOWTO.html">Software-RAID-HOWTO</uri>.
80 </note>
81
82 <p>
83 Once you are booted from the LiveCD, load the appropriate RAID modules. For
84 instance, if you plan on using RAID-1:
85 </p>
86
87 <pre caption="Loading the RAID-1 module">
88 # <i>modprobe raid1</i>
89 </pre>
90
91 <p>
92 When you partition your disks, make sure that your partitions use <c>fd</c>
93 (Linux raid autodetect) as Partition Type instead of <c>83</c> (Linux native).
94 You can alter the partition type using the <c>t</c> command in <c>fdisk</c>.
95 </p>
96
97 <p>
98 After partitioning, create the <path>/etc/raidtab</path> file (yes, indeed, on
99 the LiveCD environment) and insert the necessary commands for your RAID setup.
100 For instance, to have your boot, swap and root partition mirrored (RAID-1)
101 covering <path>/dev/sda</path> and <path>/dev/sdb</path>, you can use:
102 </p>
103
104 <pre caption="/etc/raidtab for RAID-1 setup">
105 raiddev /dev/md0
106 raid-level 1
107 nr-raid-disks 2
108 chunk-size 32
109 persistent-superblock 1
110 device /dev/sda1
111 raid-disk 0
112 device /dev/sdb1
113 raid-disk 1
114
115 raiddev /dev/md1
116 raid-level 1
117 nr-raid-disks 2
118 chunk-size 32
119 persistent-superblock 1
120 device /dev/sda2
121 raid-disk 0
122 device /dev/sdb2
123 raid-disk 1
124
125 raiddev /dev/md2
126 raid-level 1
127 nr-raid-disks 2
128 chunk-size 32
129 persistent-superblock 1
130 device /dev/sda3
131 raid-disk 0
132 device /dev/sdb3
133 raid-disk 1
134 </pre>
135
136 <p>
137 Now create the necessary RAID devices for each RAID device you listed in
138 <path>/etc/raidtab</path>:
139 </p>
140
141 <pre caption="Creating RAID devices">
142 # <i>mkraid /dev/md0</i>
143 # <i>mkraid /dev/md1</i>
144 # <i>mkraid /dev/md2</i>
145 </pre>
146
147 <p>
148 The Linux Software RAID driver will start creating the metadevices. You can see
149 its progress in <path>/proc/mdstat</path>. Wait until the metadevices are
150 completely finished before proceeding.
151 </p>
152
153 <p>
154 From now onwards, use <path>/dev/md0</path> for the boot partition,
155 <path>/dev/md1</path> for the swap partition and <path>/dev/md2</path> for the
156 root partition.
157 </p>
158
159 <p>
160 After mounting <path>/dev/md2</path> on <path>/mnt/gentoo</path>, don't forget
161 to copy over <path>/etc/raidtab</path> to <path>/mnt/gentoo/etc</path>.
162 </p>
163
164 <p>
165 When you're configuring your kernel, make sure you have the appropriate RAID
166 support <e>in</e> your kernel and not as module.
167 </p>
168
169 <p>
170 When installing extra tools, emerge <c>raidtools</c> as well. Note that this
171 isn't available on all LiveCDs so you might not be able to install Gentoo on a
172 Software RAID when using a networkless installation!
173 </p>
174
175 <p>
176 When configuring your bootloader, make sure it gets installed in the MBR of
177 <e>both</e> disks if you use mirroring.
178 </p>
179
180 </body>
181 </section>
182 <section id="ata-raid-2.4">
183 <title>ATA RAID using 2.4 kernels</title>
184 <body>
185
186 <p>
187 Make sure you boot your LiveCD using the <c>doataraid</c> option. Once booted,
188 check the contents of <path>/dev/ataraid</path>. It should contain various
189 <path>disc*</path> directories for each harddisk available in the ATA RAID. An
190 entire disk is displayed as <path>disc</path> while partitions are
191 <path>part*</path>.
192 </p>
193
194 <p>
195 Write down the various <path>/dev/ataraid/disc*/*</path> device files that you
196 use to install Gentoo on. You will need to substitute the <path>/dev/hda</path>
197 examples in the installation with this path.
198 </p>
199
200 <p>
201 Before chrooting, bind-mount the <path>/dev</path> structure in the new
202 environment:
203 </p>
204
205 <pre caption="Bind-mounting /dev">
206 # <i>mount -o bind /dev /mnt/gentoo/dev</i>
207 </pre>
208
209 <p>
210 When configuring your kernel, make sure you enable support for your ATA RAID
211 chipset and options. For instance, a popular ATA RAID system is a <e>Promise
212 FastTrack built-in RAID</e> in which case you definitely need <c>Promise
213 FastTrack Options</c> built in into your kernel.
214 </p>
215
216 <p>
217 When configuring GRUB, you first have to create a GRUB bootdisk. This is not as
218 hard as you think. First install GRUB as you would, but when you come to the
219 part where GRUB is getting installed in the MBR, follow the following
220 instructions:
221 </p>
222
223 <pre caption="Creating a GRUB bootdisk">
224 # <i>cd /boot/grub</i>
225 # <i>dd if=stage1 of=/dev/fd0 bs=512 count=1</i>
226 # <i>dd if=stage2 of=/dev/fd0 bs=512 seek=1</i>
227 </pre>
228
229 <p>
230 You still need to write your <path>grub.conf</path> file. This is no different
231 from the installation instructions, just make sure that your <c>root=</c> points
232 to the ATA RAID device.
233 </p>
234
235 <p>
236 After finishing the installation, boot with your GRUB bootdisk. You will be
237 greeted by a GRUB prompt. Now configure GRUB to boot from the ATA RAID device:
238 </p>
239
240 <pre caption="Installing GRUB on the ATA RAID">
241 grub&gt; root (hd0,x)
242 grub&gt; setup (hd0)
243 grub&gt; quit
244 </pre>
245
246 <p>
247 Now reboot (with the GRUB bootfloppy removed).
248 </p>
249
250 <p>
251 LILO users can safely use the instructions mentioned in the installation
252 instructions.
253 </p>
254
255 </body>
256 </section>
257 </chapter>
258
259 <chapter>
260 <title>Simplifying the Installation</title>
261 <section id="leave_terminal">
262 <title>Leaving your Terminal</title>
263 <body>
264
265 <p>
266 Many people want to leave their system when it's compiling. In certain cases
267 this is rather difficult as the installation is done in a public environment
268 where you cannot trust everyone. If this is the case, you want to be able to
269 perform the compilation in the background and log out from all terminals.
270 </p>
271
272 <p>
273 There are several possible solutions for this. The first one is to use
274 <c>screen</c>. After booting the LiveCD, set your root password and start a
275 screen session:
276 </p>
277
278 <note>
279 Not all LiveCDs provide screen. If this is the case, you will have to use one of
280 the other methods described in this section.
281 </note>
282
283 <pre caption="Starting a screen session">
284 # <i>screen -S gentoo</i>
285 </pre>
286
287 <p>
288 Once inside the screen session you can perform the entire installation. When you
289 want to leave your terminal, press <c>Ctrl-a, d</c> (that is, control and a at
290 the same time, then followed by a d) to <e>detach</e> your screen session. You
291 can now safely log out of your system.
292 </p>
293
294 <p>
295 To regain access to your terminal, log in as root again and <e>attach</e> to
296 the running screen session:
297 </p>
298
299 <pre caption="Attaching to a screen session">
300 # <i>screen -x gentoo</i>
301 </pre>
302
303 <p>
304 If you can't use screen, there is still a way to leave your terminal. Follow the
305 installation instructions, but when you come to the point where a long-term
306 compilation would be started (for instance the <c>./scripts/bootstrap.sh</c>
307 step), use <c>nohup</c> which allows for a process to continue even when you log
308 out. Don't forget the trailing "&amp;", otherwise the process won't be placed in
309 the background! Remember where you are (the <c>pwd</c> command will show you
310 that) as you will need to know this later on.
311 </p>
312
313 <pre caption="Using nohup">
314 # <i>pwd</i>
315 /usr/portage
316 # <i>nohup ./scripts/bootstrap.sh &amp;</i>
317 </pre>
318
319 <p>
320 Now exit the chrooted environment (<c>exit</c>) and the LiveCD session. Your
321 compilation will continue in the background.
322 </p>
323
324 <p>
325 When you want to check the compilation, log in as root (on the LiveCD) and
326 chroot back into your environment and go to the directory where you left off:
327 </p>
328
329 <pre caption="Chrooting back">
330 # <i>chroot /mnt/gentoo /bin/bash</i>
331 # <i>env-update &amp;&amp; source /etc/profile</i>
332 # <i>cd /usr/portage</i>
333 </pre>
334
335 <p>
336 Now use the <c>less</c> command on the <path>nohup.out</path> file that is
337 situated inside that directory. The compilation will append its output to that
338 file, so if you want to follow the compilation progress, run <c>less
339 nohup.out</c> and press <c>F</c> to follow the changes. When the compilation is
340 finished, you can continue with the next step of the installation instructions.
341 </p>
342
343 <p>
344 If you ever get tired of following the changes, press <c>Ctrl-C</c> followed by
345 a <c>q</c>. This won't stop the compilation process, only the <c>less</c>
346 process.
347 </p>
348
349 </body>
350 </section>
351 </chapter>
352
353 <chapter>
354 <title>Fixing Errors/Issues</title>
355 <section id="checking-disks">
356 <title>Extensive Testing of your Disks</title>
357 <body>
358
359 <p>
360 If you think your disk needs to be thoroughly checked for consistency (bad
361 sectors and such), you can use the <c>-c</c> option while placing the ext2 or
362 ext3 filesystem on it (using <c>mke2fs</c>). This will perform a read-test and
363 will mark all bad blocks as such. If you are really paranoid, use <c>-c -c</c>
364 to perform an extensive read/write test.
365 </p>
366
367 <pre caption="Checking for disk consistency">
368 # <i>mke2fs -j -c /dev/hda3</i>
369 </pre>
370
371 </body>
372 </section>
373 <section id="recover">
374 <title>Recovering from a malfunctioning installation</title>
375 <body>
376
377 <p>
378 If for some reason your Gentoo installation fails, you don't have to redo the
379 installation all over again. Instead, you can safely "go" to the point where you
380 think you made a mistake (or where you think the instructions are flawed) and
381 try a different approach.
382 </p>
383
384 <p>
385 First of all you need to chroot back into your Gentoo Linux environment. Follow
386 the instructions again, but ignore the partitioning steps as your partitions are
387 already created and even populated. You can therefore immediately mount those
388 partitions at <path>/mnt/gentoo</path>. You should also ignore the steps about
389 stage extraction and modifying <path>make.conf</path> - you don't want to
390 overwrite your files do you?
391 </p>
392
393 <p>
394 Once chrooted inside your Gentoo Linux environment, immediately go to the step
395 where you think you should try a different approach. Don't redo all the steps
396 like bootstrapping and such unless that is the place where you think things
397 went wrong.
398 </p>
399
400 <p>
401 For instance, if you believe that you have a wrongly configured
402 <path>grub.conf</path>, you can immediately fire up your editor to update
403 <path>/boot/grub/grub.conf</path>.
404 </p>
405
406 <p>
407 Once you have tried a different approach for your situation, you should consider
408 how much of the subsequent steps you need to perform again. If the subsequent
409 steps are depending on your change, you will need to redo those.
410 </p>
411
412 <p>
413 For instance,
414 </p>
415
416 <ul>
417 <li>
418 if you have changed a variable inside <path>make.conf</path> you will need
419 to do all subsequent compiling since those depend on the settings inside
420 <path>make.conf</path>
421 </li>
422 <li>
423 if you have altered <path>/boot/grub/grub.conf</path> you can immediately
424 exit the chrooted environment and reboot as no subsequent steps are
425 depending on <path>grub.conf</path>
426 </li>
427 <li>
428 if you have recompiled your kernel you only need to make sure that your
429 bootloader configuration points to the correct kernel image (double-check
430 that you mounted your <path>/boot</path>!), then you can exit the chrooted
431 environment and reboot
432 </li>
433 <li>
434 if you have altered <path>/etc/fstab</path> you can exit the chrooted
435 environment and reboot
436 </li>
437 </ul>
438
439 <p>
440 As you can see, for most recovery operations you can immediately reboot. Only in
441 certain cases will you need to redo the subsequent installation steps.
442 </p>
443
444 </body>
445 </section>
446
447 </chapter>
448
449 </guide>

  ViewVC Help
Powered by ViewVC 1.1.20