/[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.14 - (hide annotations) (download) (as text)
Mon Aug 1 13:02:53 2005 UTC (9 years ago) by swift
Branch: MAIN
Changes since 1.13: +8 -2 lines
File MIME type: application/xml
#100962 - Add bind-mounting or recreation of nodes

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

  ViewVC Help
Powered by ViewVC 1.1.20