| 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 & 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.1</version> |
| 20 |
<date>April 11, 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 |
</body> |
| 58 |
</section> |
| 59 |
</chapter> |
| 60 |
<chapter> |
| 61 |
<title>Advanced Installations</title> |
| 62 |
<section id="software-raid"> |
| 63 |
<title>Software RAID</title> |
| 64 |
<body> |
| 65 |
|
| 66 |
<note> |
| 67 |
If you are not known to software raid, please read the <uri |
| 68 |
link="http://tldp.org/HOWTO/Software-RAID-HOWTO.html">Software-RAID-HOWTO</uri>. |
| 69 |
</note> |
| 70 |
|
| 71 |
<p> |
| 72 |
Once you are booted from the LiveCD, load the appropriate RAID modules. For |
| 73 |
instance, if you plan on using RAID-1: |
| 74 |
</p> |
| 75 |
|
| 76 |
<pre caption="Loading the RAID-1 module"> |
| 77 |
# <i>modprobe raid1</i> |
| 78 |
</pre> |
| 79 |
|
| 80 |
<p> |
| 81 |
When you partition your disks, make sure that your partitions use <c>fd</c> |
| 82 |
(Linux raid autodetect) as Partition Type instead of <c>83</c> (Linux native). |
| 83 |
You can alter the partition type using the <c>t</c> command in <c>fdisk</c>. |
| 84 |
</p> |
| 85 |
|
| 86 |
<p> |
| 87 |
After partitioning, create the <path>/etc/raidtab</path> file (yes, indeed, on |
| 88 |
the LiveCD environment) and insert the necessary commands for your RAID setup. |
| 89 |
For instance, to have your boot, swap and root partition mirrored (RAID-1) |
| 90 |
covering <path>/dev/sda</path> and <path>/dev/sdb</path>, you can use: |
| 91 |
</p> |
| 92 |
|
| 93 |
<pre caption="/etc/raidtab for RAID-1 setup"> |
| 94 |
raiddev /dev/md0 |
| 95 |
raid-level 1 |
| 96 |
nr-raid-disks 2 |
| 97 |
chunk-size 32 |
| 98 |
persistent-superblock 1 |
| 99 |
device /dev/sda1 |
| 100 |
raid-disk 0 |
| 101 |
device /dev/sdb1 |
| 102 |
raid-disk 1 |
| 103 |
|
| 104 |
raiddev /dev/md1 |
| 105 |
raid-level 1 |
| 106 |
nr-raid-disks 2 |
| 107 |
chunk-size 32 |
| 108 |
persistent-superblock 1 |
| 109 |
device /dev/sda2 |
| 110 |
raid-disk 0 |
| 111 |
device /dev/sdb2 |
| 112 |
raid-disk 1 |
| 113 |
|
| 114 |
raiddev /dev/md2 |
| 115 |
raid-level 1 |
| 116 |
nr-raid-disks 2 |
| 117 |
chunk-size 32 |
| 118 |
persistent-superblock 1 |
| 119 |
device /dev/sda3 |
| 120 |
raid-disk 0 |
| 121 |
device /dev/sdb3 |
| 122 |
raid-disk 1 |
| 123 |
</pre> |
| 124 |
|
| 125 |
<p> |
| 126 |
Now create the necessary RAID devices for each RAID device you listed in |
| 127 |
<path>/etc/raidtab</path>: |
| 128 |
</p> |
| 129 |
|
| 130 |
<pre caption="Creating RAID devices"> |
| 131 |
# <i>mkraid /dev/md0</i> |
| 132 |
# <i>mkraid /dev/md1</i> |
| 133 |
# <i>mkraid /dev/md2</i> |
| 134 |
</pre> |
| 135 |
|
| 136 |
<p> |
| 137 |
The Linux Software RAID driver will start creating the metadevices. You can see |
| 138 |
its progress in <path>/proc/mdstat</path>. Wait until the metadevices are |
| 139 |
completely finished before proceeding. |
| 140 |
</p> |
| 141 |
|
| 142 |
<p> |
| 143 |
From now onwards, use <path>/dev/md0</path> for the boot partition, |
| 144 |
<path>/dev/md1</path> for the swap partition and <path>/dev/md2</path> for the |
| 145 |
root partition. |
| 146 |
</p> |
| 147 |
|
| 148 |
<p> |
| 149 |
After mounting <path>/dev/md2</path> on <path>/mnt/gentoo</path>, don't forget |
| 150 |
to copy over <path>/etc/raidtab</path> to <path>/mnt/gentoo/etc</path>. |
| 151 |
</p> |
| 152 |
|
| 153 |
<p> |
| 154 |
When you're configuring your kernel, make sure you have the appropriate RAID |
| 155 |
support <e>in</e> your kernel and not as module. |
| 156 |
</p> |
| 157 |
|
| 158 |
<p> |
| 159 |
When installing extra tools, emerge <c>raidtools</c> as well. Note that this |
| 160 |
isn't available on all LiveCDs so you might not be able to install Gentoo on a |
| 161 |
Software RAID when using a networkless installation! |
| 162 |
</p> |
| 163 |
|
| 164 |
<p> |
| 165 |
When configuring your bootloader, make sure it gets installed in the MBR of |
| 166 |
<e>both</e> disks if you use mirroring. |
| 167 |
</p> |
| 168 |
|
| 169 |
</body> |
| 170 |
</section> |
| 171 |
<section id="ata-raid-2.4"> |
| 172 |
<title>ATA RAID using 2.4 kernels</title> |
| 173 |
<body> |
| 174 |
|
| 175 |
<p> |
| 176 |
Make sure you boot your LiveCD using the <c>doataraid</c> option. Once booted, |
| 177 |
check the contents of <path>/dev/ataraid</path>. It should contain various |
| 178 |
<path>disc*</path> directories for each harddisk available in the ATA RAID. An |
| 179 |
entire disk is displayed as <path>disc</path> while partitions are |
| 180 |
<path>part*</path>. |
| 181 |
</p> |
| 182 |
|
| 183 |
<p> |
| 184 |
Write down the various <path>/dev/ataraid/disc*/*</path> device files that you |
| 185 |
use to install Gentoo on. You will need to substitute the <path>/dev/hda</path> |
| 186 |
examples in the installation with this path. |
| 187 |
</p> |
| 188 |
|
| 189 |
<p> |
| 190 |
Before chrooting, bind-mount the <path>/dev</path> structure in the new |
| 191 |
environment: |
| 192 |
</p> |
| 193 |
|
| 194 |
<pre caption="Bind-mounting /dev"> |
| 195 |
# <i>mount -o bind /dev /mnt/gentoo/dev</i> |
| 196 |
</pre> |
| 197 |
|
| 198 |
<p> |
| 199 |
When configuring your kernel, make sure you enable support for your ATA RAID |
| 200 |
chipset and options. For instance, a popular ATA RAID system is a <e>Promise |
| 201 |
FastTrack built-in RAID</e> in which case you definitely need <c>Promise |
| 202 |
FastTrack Options</c> built in into your kernel. |
| 203 |
</p> |
| 204 |
|
| 205 |
<p> |
| 206 |
When configuring GRUB, you first have to create a GRUB bootdisk. This is not as |
| 207 |
hard as you think. First install GRUB as you would, but when you come to the |
| 208 |
part where GRUB is getting installed in the MBR, follow the following |
| 209 |
instructions: |
| 210 |
</p> |
| 211 |
|
| 212 |
<pre caption="Creating a GRUB bootdisk"> |
| 213 |
# <i>cd /boot/grub</i> |
| 214 |
# <i>dd if=stage1 of=/dev/fd0 bs=512 count=1</i> |
| 215 |
# <i>dd if=stage2 of=/dev/fd0 bs=512 seek=1</i> |
| 216 |
</pre> |
| 217 |
|
| 218 |
<p> |
| 219 |
You still need to write your <path>grub.conf</path> file. This is no different |
| 220 |
from the installation instructions, just make sure that your <c>root=</c> points |
| 221 |
to the ATA RAID device. |
| 222 |
</p> |
| 223 |
|
| 224 |
<p> |
| 225 |
After finishing the installation, boot with your GRUB bootdisk. You will be |
| 226 |
greeted by a GRUB prompt. Now configure GRUB to boot from the ATA RAID device: |
| 227 |
</p> |
| 228 |
|
| 229 |
<pre caption="Installing GRUB on the ATA RAID"> |
| 230 |
grub> root (hd0,x) |
| 231 |
grub> setup (hd0) |
| 232 |
grub> quit |
| 233 |
</pre> |
| 234 |
|
| 235 |
<p> |
| 236 |
Now reboot (with the GRUB bootfloppy removed). |
| 237 |
</p> |
| 238 |
|
| 239 |
<p> |
| 240 |
LILO users can safely use the instructions mentioned in the installation |
| 241 |
instructions. |
| 242 |
</p> |
| 243 |
|
| 244 |
</body> |
| 245 |
</section> |
| 246 |
</chapter> |
| 247 |
|
| 248 |
<chapter> |
| 249 |
<title>Simplifying the Installation</title> |
| 250 |
<section id="leave_terminal"> |
| 251 |
<title>Leaving your Terminal</title> |
| 252 |
<body> |
| 253 |
|
| 254 |
<p> |
| 255 |
Many people want to leave their system when it's compiling. In certain cases |
| 256 |
this is rather difficult as the installation is done in a public environment |
| 257 |
where you cannot trust everyone. If this is the case, you want to be able to |
| 258 |
perform the compilation in the background and log out from all terminals. |
| 259 |
</p> |
| 260 |
|
| 261 |
<p> |
| 262 |
There are several possible solutions for this. The first one is to use |
| 263 |
<c>screen</c>. After booting the LiveCD, set your root password and start a |
| 264 |
screen session: |
| 265 |
</p> |
| 266 |
|
| 267 |
<note> |
| 268 |
Not all LiveCDs provide screen. If this is the case, you will have to use one of |
| 269 |
the other methods described in this section. |
| 270 |
</note> |
| 271 |
|
| 272 |
<pre caption="Starting a screen session"> |
| 273 |
# <i>screen -S gentoo</i> |
| 274 |
</pre> |
| 275 |
|
| 276 |
<p> |
| 277 |
Once inside the screen session you can perform the entire installation. When you |
| 278 |
want to leave your terminal, press <c>Ctrl-a, d</c> (that is, control and a at |
| 279 |
the same time, then followed by a d) to <e>detach</e> your screen session. You |
| 280 |
can now safely log out of your system. |
| 281 |
</p> |
| 282 |
|
| 283 |
<p> |
| 284 |
To regain access to your terminal, log in as root again and <e>attach</e> to |
| 285 |
the running screen session: |
| 286 |
</p> |
| 287 |
|
| 288 |
<pre caption="Attaching to a screen session"> |
| 289 |
# <i>screen -x gentoo</i> |
| 290 |
</pre> |
| 291 |
|
| 292 |
<p> |
| 293 |
If you can't use screen, there is still a way to leave your terminal. Follow the |
| 294 |
installation instructions, but when you come to the point where a long-term |
| 295 |
compilation would be started (for instance the <c>./scripts/bootstrap.sh</c> |
| 296 |
step), use <c>nohup</c> which allows for a process to continue even when you log |
| 297 |
out. Don't forget the trailing "&", otherwise the process won't be placed in |
| 298 |
the background! Remember where you are (the <c>pwd</c> command will show you |
| 299 |
that) as you will need to know this later on. |
| 300 |
</p> |
| 301 |
|
| 302 |
<pre caption="Using nohup"> |
| 303 |
# <i>pwd</i> |
| 304 |
/usr/portage |
| 305 |
# <i>nohup ./scripts/bootstrap.sh &</i> |
| 306 |
</pre> |
| 307 |
|
| 308 |
<p> |
| 309 |
Now exit the chrooted environment (<c>exit</c>) and the LiveCD session. Your |
| 310 |
compilation will continue in the background. |
| 311 |
</p> |
| 312 |
|
| 313 |
<p> |
| 314 |
When you want to check the compilation, log in as root (on the LiveCD) and |
| 315 |
chroot back into your environment and go to the directory where you left off: |
| 316 |
</p> |
| 317 |
|
| 318 |
<pre caption="Chrooting back"> |
| 319 |
# <i>chroot /mnt/gentoo /bin/bash</i> |
| 320 |
# <i>env-update && source /etc/profile</i> |
| 321 |
# <i>cd /usr/portage</i> |
| 322 |
</pre> |
| 323 |
|
| 324 |
<p> |
| 325 |
Now use the <c>less</c> command on the <path>nohup.out</path> file that is |
| 326 |
situated inside that directory. The compilation will append its output to that |
| 327 |
file, so if you want to follow the compilation progress, run <c>less |
| 328 |
nohup.out</c> and press <c>F</c> to follow the changes. When the compilation is |
| 329 |
finished, you can continue with the next step of the installation instructions. |
| 330 |
</p> |
| 331 |
|
| 332 |
<p> |
| 333 |
If you ever get tired of following the changes, press <c>Ctrl-C</c> followed by |
| 334 |
a <c>q</c>. This won't stop the compilation process, only the <c>less</c> |
| 335 |
process. |
| 336 |
</p> |
| 337 |
|
| 338 |
</body> |
| 339 |
</section> |
| 340 |
</chapter> |
| 341 |
|
| 342 |
</guide> |