/[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.10 - (show annotations) (download) (as text)
Sat Sep 25 12:38:50 2004 UTC (10 years ago) by swift
Branch: MAIN
Changes since 1.9: +41 -3 lines
File MIME type: application/xml
#13685 - Instructions for copying over the kernel from the LiveCD

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

  ViewVC Help
Powered by ViewVC 1.1.20