Saturday, September 20, 2014

Install Gentoo in VM.

Write down my experience to install gentoo in vm.

1.
Boot from install-x86-minimal-20140902.iso

2.
mount /dev/sda1 /mnt/gentoo

3.
links http://www.gentoo.org/main/en/mirrors.xml

4.
mount -t proc proc /mnt/gentoo/proc
mount --rbind /dev /mnt/gentoo/dev
mount --rbind /sys /mnt/gentoo/sys
cp -L /etc/resolv.conf /mnt/gentoo/etc/
chroot /mnt/gentoo /bin/bash
source /etc/profile

5.
emerge gentoo-sources

6.
cd /usr/src/linux
make menuconfig
make -j2

7.
cp arch/x86/boot/bzImage /boot/kernel-$(uname -r)

8.
make modules_install

9.
emerge genkernel
genkernel --install --no-ramdisk-modules initramfs
(It will create initramfs-genkernel-x86-3.14.16-gentoo in /boot/.)

10.
cat /etc/fstab
/dev/sda1 / ext4 noatime 0 1

11.
change root password

12
emerge grub

13.
livecd ~ # grub2-install /dev/sda
Installation finished. No error reported.

livecd ~ # grub2-mkconfig -o /boot/grub/grub.cfg
Generating grub.cfg ...
Found linux image: /boot/kernel-3.14.16-gentoo
Found initrd image: /boot/initramfs-genkernel-x86-3.14.16-gentoo
done

14.
emerge dhcpcd

echo "modules = "dhcpcd"" > /etc/conf.d/net
echo "config_enp2s1="dhcp" >> /etc/conf.d/net

Problem:
scripts/mod/empty.c:1:0: error: CPU you selected does not support x86-64 instruction set

Solution:
When make menuconfig, make sure un-check 64-bit kernel.
[ ] 64-bit kernel

Problem:
/usr/bin/xz: /var/tmp/genkernel/initramfs-3.14.16-gentoo: Cannot allocate memory
ERROR: Compression (/usr/bin/xz -e --check=none -z -f -9) failed

Solution:
Increase memory for the VM. In my case, to 1GB.

Problem:
Could not find the root block device in UUID=XXX

Solution:
livecd ~# lspci
SCSI storage controller: LSI Logic / Symbios Logic 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 01)
Ethernet controller: Advanced Micro Devices, Inc. [AMD] 79c970 [PCnet32 LANCE] (rev 10)

When make menuconfig, make sure

Device Drivers  --->
SCSI device support  --->
[*] SCSI low-level drivers  --->
<*>   BusLogic SCSI support
[*] Fusion MPT device support  --->
<*>   Fusion MPT ScsiHost drivers for SPI
<*>   Fusion MPT ScsiHost drivers for FC
<*>   Fusion MPT ScsiHost drivers for SAS
<*>   Fusion MPT misc device (ioctl) driver

[*] Network device support  --->
[*]   Ethernet driver support  --->
<*>     AMD PCnet32 PCI support


Reference:
http://www.gentoo.org/doc/en/gentoo-x86-quickinstall.xml
http://www.360doc.com/content/13/1030/15/1956846_325320292.shtml

2 comments:

Unknown said...

there might be some step missing before step 4. The rootfs is missing if you do not get tar ball from gentoo mirror site or the cd image (no available on minimal iso image) and extract it (to sda1) as the base system. If you want to get it from the gentoo mirror site, you should set up the networking configuration before downloading.

All the stuff I mentioned are just detail. XD

Unknown said...

非常感谢