Gentoo installation tips and tricks/sr-ec
Gentoo инсталација дозвољава врло флексибилан приступ различитим инсталационим методама. Како је скоро немогуће навести све 'tip or trick' у инструкцијама за инсталацију овај документ ће покушати да представи све постављене референтне 'tips and tricks'.
Увод
Напомена
Овај документ садржи различите 'tips and tricks' за инсталацијију Gentoo/x86. О њима је доста расправљано - сматрају се као додатак инструкцијама за инсталацију а не као замена.
Напредна инсталација
Software RAID
Уколико нисте упознати како фунционише RAID, прочитајте ову страницу Software RAID HOWTO.
Када сте покренули инсталациони диск, стартујте одговарајуће RAID модуле. На пример, уколико планирате да користите RAID-1:
root #
modprobe raid1
Када креирате партиције диска обратите пажњу да оне користе fd
(Linux RAID autodetect) као Тип Партиције а не 83
(Linux native). Можете променити тип партиције користећи команду t
у програму fdisk
.
Пре него што почнемо да креирамо RAID блокове, неопходно је да креирамо metadevice nodes:
root #
mknod /dev/md1 b 9 1
root #
mknod /dev/md2 b 9 2
root #
mknod /dev/md3 b 9 3
Након партиционисања, креирајте фајл /etc/mdadm.conf (да, заправо, у окружењу Инсталационог диска) користећи наредбу mdadm
, напредни алат за RAID management. На пример, како би сте дефинисали партиције boot, swap and root mirrored (RAID-1) на два диска /dev/sda и /dev/sdb, можете корисити:
root #
mdadm --create --verbose /dev/md1 --level=1 --raid-devices=2 --metadata=0.90 /dev/sda1 /dev/sdb1
root #
mdadm --create --verbose /dev/md2 --level=1 --raid-devices=2 --metadata=0.90 /dev/sda2 /dev/sdb2
root #
mdadm --create --verbose /dev/md3 --level=1 --raid-devices=2 --metadata=0.90 /dev/sda3 /dev/sdb3
Не смете корилстити било коју striping форму као што је RAID-0 or RAID-5 на партицији са које покрећете (boot). Такође,
--metadata=0.90
неопходна је само овим критичним системима. Други типови filesystems могу користити одређеније фотмате метаподатака.Драјвер Linux Software RAID покренуће креирање metadevices. Процес креирања можете пратити преко /proc/mdstat. Сачекајте да се metadevices потпуно креирају како би сте могли да безбедно наставите даље.
root #
mdadm --detail --scan > /etc/mdadm.conf
Од сада користите /dev/md1 за boot партицију, /dev/md2 за swap партицију и /dev/md3 за root партицију.
Непосредно пре промене chroot, не заборавите да прекопирате /etc/mdadm.conf у /mnt/gentoo/etc.
Када сте конфигурисали 'kernel' проверите да ли имате одговарајућу RAID подршку У вашем 'kernel'-у а не у модулу.
Приликом инсталације додатних алата, не заборавите да инсталирате и sys-fs/mdadm командом emerge. Овај алат није доступан на свим инсталационим дисковима па не можете инсталирати Gentoo у RAID-у када користите инсталицију без интернета!
Приликом конфигурисања вашег 'bootloader'-а обратите пажњу да је инсталиран у MBR на ОБА диска, уколико се користи 'mirroring'.
ATA RAID користи 2.4 kernel-е
Обратите пажњу да покренете Инсталациони диск користећи опцију doataraid
. Када се покрене, проверите садржај /dev/ataraid. Треба да садржи различите disc* директоријуме за сваки доступан хард диск у ATA RAID. Цео диск се приказује као disc док су партиције приказане као part*.
Запишите наведене /dev/ataraid/disc*/* 'device' фајлове на којима ће те инсталирати Gentoo. Потребно је заменити /dev/sda приликом инсталације са овим путањама.
Пре 'chroot'-а, bind-mount /dev структуру у ново окружење:
root #
mount --rbind /dev /mnt/gentoo/dev
Приликом конфигурације вашег 'kernel'-а проверите да ли сте омогућили подршку за ATA RAID чипсет и опције. На пример, популарни ATA RAID систем је Promise FastTrack built-in RAID у том случају неопходно је уградити Promise FastTrack Options
у ваш 'kernel'.
When configuring GRUB, you first have to create a GRUB bootdisk. This is not as hard as you think. First install GRUB as you would, but when you come to the part where GRUB is getting installed in the MBR, follow the following instructions:
root #
cd /boot/grub
root #
dd if=stage1 of=/dev/fd0 bs=512 count=1
root #
dd if=stage2 of=/dev/fd0 bs=512 seek=1
You still need to write your grub.conf file. This is no different from the installation instructions, just make sure that your root=
points to the ATA RAID device.
After finishing the installation, boot with your GRUB bootdisk. You will be greeted by a GRUB prompt. Now configure GRUB to boot from the ATA RAID device:
grub>
root (hd0,x)
grub>
setup (hd0)
grub>
quit
Now reboot (with the GRUB bootfloppy removed).
LILO users can safely use the instructions mentioned in the installation instructions.
Using the Installation CD kernel
If you don't want to compile a kernel yourself you can use the kernel from the Installation CD and copy it to your system. When you come to the point that you're asked to compile a kernel, go to another terminal (press Alt + F2) and log in with the root password you've supplied at the beginning of the installation.
Copy over the kernel and modules to your Gentoo system:
${KN} is the kernel name, usually something like 'gentoo' or 'smp'.
root #
cp /mnt/cdrom/isolinux/${KN} /mnt/cdrom/isolinux/${KN}.igz /mnt/gentoo/boot
root #
mkdir -p /mnt/gentoo/lib/modules
root #
cp -Rp /lib/modules/`uname -r` /mnt/gentoo/lib/modules
To have all modules that are currently running (from the Installation CD) loaded during bootup of your Gentoo system, run the following command from within the chrooted environment:
root #
mkdir -p /etc/modules-load.d
root #
cut -d ' ' -f 1 /proc/modules >> /etc/modules-load.d/local.conf
Verify the /etc/modules-load.d/local.conf content and update appropriately.
Simplifying the installation
Leaving the terminal
Many people want to leave their system when it's compiling. In certain cases this is rather difficult as the installation is done in a public environment where you cannot trust everyone. If this is the case, you want to be able to perform the compilation in the background and log out from all terminals.
There are several possible solutions for this. The first one is to use screen. After booting the Installation CD, set the root password and start a screen session:
Not all Installation CDs provide screen. If this is the case, you will have to use one of the other methods described in this section.
root #
screen -S gentoo
Once inside the screen session you can perform the entire installation. When leaving a terminal, press Ctrl + a, d (that is, Ctrl and a at the same time, then followed by a d) to detach the screen session. It is now safe log out of the system (without losing work).
To regain access to the terminal, log in as root again and attach to the running screen session:
root #
screen -x gentoo
If screen is not an option, there is still a way to leave the terminal. Follow the installation instructions, but when a long-term compilation begins (for instance the ./scripts/bootstrap.sh step), use nohup
which allows for a process to continue even when the session closed with a log out. Don't forget the trailing "&", otherwise the process will not be placed in the background! Remember where you are (the pwd command will show you that) as you will need to know this later on.
root #
pwd
/var/db/repos/gentoo
root #
nohup ./scripts/bootstrap.sh &
Now exit the chrooted environment (exit) and the Installation CD session. The compilation will continue in the background.
To check the compilation, log in as root (on the Installation CD) and chroot back into the environment, then go to the directory where the session was left off:
root #
chroot /mnt/gentoo /bin/bash
root #
env-update && source /etc/profile
root #
cd /var/db/repos/gentoo
Now use the less command on the nohup.out file that is situated inside that directory. The compilation will append its output to that file, so if you want to follow the compilation progress, run less nohup.out and press F to follow the changes. When the compilation is finished, continue with the next step of the installation instructions.
When finished following the changes, press Ctrl + c followed by a q. This won't stop the compilation process, only the less process.
Fixing errors and issues
Extensive testing of the disks
If you think your disk needs to be thoroughly checked for consistency (bad sectors and such), you can use the -c
(that's lowercase c) option while placing the ext2/ext3/ext4 filesystem on it (using mke2fs
). This will format, perform a read-test and mark all bad blocks as such. If you are really paranoid, use -c -c
to format your disk and perform an extensive read/write test.
root #
mke2fs -j -c /dev/sda3
Recovering from a malfunctioning installation
If for some reason your Gentoo installation fails, you don't have to redo the installation all over again. Instead, you can safely "go" to the point where you think you made a mistake (or where you think the instructions are flawed) and try a different approach.
First of all you need to chroot back into your Gentoo Linux environment. Follow the instructions again, but ignore the partitioning steps as your partitions are already created and even populated. You can therefore immediately mount those partitions at /mnt/gentoo. You should also ignore the steps about stage extraction and modifying make.conf - you don't want to overwrite your files do you?
Once chrooted inside your Gentoo Linux environment, immediately go to the step where you think you should try a different approach. Don't redo all the steps like bootstrapping and such unless that is the place where you think things went wrong.
For instance, if you believe that you have a wrongly configured grub.conf, you can immediately fire up your editor to update /boot/grub/grub.conf.
Once you have tried a different approach for your situation, you should consider how much of the subsequent steps you need to perform again. If the subsequent steps are depending on your change, you will need to redo those.
For instance,
- if you have changed a variable inside make.conf you will need to do all subsequent compiling since those depend on the settings inside make.conf
- if you have altered /boot/grub/grub.conf you can immediately exit the chrooted environment and reboot as no subsequent steps are depending on grub.conf
- if you have recompiled your kernel you only need to make sure that your bootloader configuration points to the correct kernel image (double-check that you mounted your /boot!), then you can exit the chrooted environment and reboot
- if you have altered /etc/fstab you can exit the chrooted environment and reboot
As you can see, for most recovery operations you can immediately reboot. Only in certain cases will you need to redo the subsequent installation steps.
This page is based on a document formerly found on our main website gentoo.org.
The following people contributed to the original document: Xavier Neys, nightmorph
They are listed here because wiki history does not allow for any external attribution. If you edit the wiki article, please do not add yourself here; your contributions are recorded on each article's associated history page.