/[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.11 - (show annotations) (download) (as text)
Mon Jan 24 08:13:25 2005 UTC (9 years, 6 months ago) by swift
Branch: MAIN
Changes since 1.10: +14 -3 lines
File MIME type: application/xml
Device nodes arent automatically created by mdadm, sent in by Rob Kolosky

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

  ViewVC Help
Powered by ViewVC 1.1.20