I had never installed Gentoo before, so I tried following the Gentoo Handbook. I realized that the Japanese version wasn’t updated.

Environment

  • uname -a: Linux debian 3.13-1-amd64 #1 SMP Debian 3.13.7-1 (2014-03-25)x86_64 GNU/Linux
  • Virtualbox 4.3.6

1. About Installing Gentoo Linux

  • Simple, cutting-edge meta-distribution
  • Can build the entire system from scratch, use precompiled packages,
  • Or even half-and-half is OK

2. Choosing the Right Installation Media

3. Network Configuration

  • It connected automatically so I skipped it
  • Set proxy at this timing if needed
  • Use net-setup, pppoe-setup, pptp
    • net-setup is typical
  • If kernel modules (drivers) are missing
  • Do it manually
    • ls /lib/modules3.12.13-gentoo/kernel/drivers/net/
    • Find it and modprode pcnet32
  • For wireless, check with iwconfig
    • iwconfig eth0 essid hogehogeman
    • iwconfig eth0 key 1234hoehogeman

4. Preparing the Disk

  • Block devices
    • SCASI, SATA appear as /dev/sd*
  • Partitions
    • For MBR
    • 4 primary partitions
    • More than that requires logical partitions
  • Create partitions with parted
    • Specify partition ID,
    • Create the filesystem itself in the next step
    • parted /dev/sda
    • (parted) print
    • (parted) mklabel gpt # Set partition table to GPT
    • (parted) rm 2 # Remove unwanted partitions if any
    • (parted) mkpart primary ext2 0 32mb # /boot
    • (parted) mkpart primary linux-swap 32mb 544mb # swap
    • (parted) mkpart primary btrfs 544mb -1s # /
    • When creating btrfs, ext*, ocfs2 or xfs filesystem on partitions, ext4??
  • Create filesystems
    • mkfs.ext2 /dev/sda1
    • mkfs.btrfs /dev/sda3
    • mkswap /dev/sda2
    • swapon /dev/sda2
  • Mount
    • mkdir /mnt/gentoo
    • mount /dev/sda3 /mnt/gentoo
    • mkdir /mnt/gentoo/boot
    • mount /dev/sda3 /mnt/gentoo/boot

5. Installing Gentoo Installation Files

  • Save and extract stage3-i686-20140401.tar.bz2
  • Install portage (from /snapshot)
  • Configure portage compilation
    • Reference /mnt/gentoo/usr/share/portage/config/make.conf.example
    • Configure /mnt/gentoo/etc/make.conf

6. Installing Gentoo Base System

  • Copy DNS information
    • cp /etc/resolv.conf /mnt/gentoo/etc
  • Enter the new environment with chroot
  • After entering
    • env-update # Change environment variables??
    • source /etc/profile
    • export PS1="(chroot) $PS1"
  • Update portage
    • emerge –sync
  • Check profile??
    • eselect profile list
  • Check USE variable??
    • Details in part 2

7. Kernel Configuration

  • emerge gentoo-sources
    • In another tty tail -f /mnt/gentoo/var/log/emerge-fetch.log
    • Saved in usr/src/
  • emerge pciutils and lspci
  • lspci outside chroot
  • Or copy lsmod
  • make menuconfig
    • Processor type and features –> Processor family
    • Device Drivers –> Generic Driver Options –> Maintain a devtmpfs filesystem to mount as /dev
    • File systems –> Btrfs filesystem support
    • File systems –> Partition Types
    • Enable the block layer
    • Watch out for these
  • make -j3
    • Got “CPU you selected does not support x86-64”
    • Give up on 64bit kernel
  • make modules_install
    • Install around /lib/modules
  • Move kernel image
    • cp arch/i386/boot/bzImage /boot/kernel-3.12.13-gentoo-r1
    • Configure autoload modules around /etc/conf.d/modules

8. System Configuration

  • Configure /etc/fstab
    • Wanted vim at this point, so emerge vim
  • /etc/conf.d/hostname
  • /etc/conf.d/net

9. System Logging Tools

  • emerge syslog-ng; rc-update add syslog-ng default
    • Well, okay
  • emerge btrfs-progs
    • Don’t need it anymore…

10. Configuring the Bootloader

  • Since it’s grub2 now, refer to the English version
  • emerge sys-boot/grub
  • grub2-install /dev/sda
    • Seems the partition needs bios_grub flag
    • Got error like “this GPT partition label contains no BIOS boot partition;”
    • (parted) set 1 bios_grub on is OK
    • http://wiki.gentoo.org/wiki/GRUB2
  • grub2-mkconfig -o /boot/grub/grub.cfg
    • Can write to /etc/default/grub or /etc/grub.d
    • But it searches automatically even without writing
    • Seems like it can’t identify the filesystem
    • grub2-probe / => btrfs
    • grub2-probe /boot => unknown filesystem
      • ext2 not being recognized is bad
      • Probably because I used grub2-install

Got Stuck

  • Realized here that both BIOS boot partition and Boot Partition are needed…
  • Reformat only /boot
    • Done
  • Remount and enter
    • mount /dev/sda3 /mnt/gentoo/
    • mkfs.ext2 /dev/sda4
    • mount /dev/sda4 /mnt/gentoo/boot
    • mount –rbind /dev /mnt/gentoo/dev
    • mount -t proc none /mnt/gentoo/proc
    • mount –rbind /sys /mnt/gentoo/sys
    • chroot /mnt/gentoo /bin/bash * Fix /etc/fstab, copy kernel * Reinstall grub2
  • Boot gentoo from grub
    • Forgot to set root password
    • Enter and passwd root