gentoo second install x86 btrfs debian

Now that my Gentoo Phase 2 has been put on hold for the near future, I have to satisfy this itch to install gentoo on my main laptop. Having it on my primary rig, would allow me to use it more often than pulling out my backup system.

My blind first attempt, at a gentoo install, gave me a lot of confidence in the gentoo community. This second attempt substantially lessens the time/aggro I spent previously installing gentoo.

I significantly pruned the install path from my previous gentoo install process, removing many distractions. I could have just copied over those btrfs subvolumes, but I wanted to start clean.

Beware if you systemd, don't just blindly follow this.

Install Environment

This time I start from my running debian. I have a working environment, networking and x-browser. No faffing about with any install disks etc. And I can continue working without downtime, while gentoo/emerge is crunching cpu/disk.

You may follow this, installing from your own distro.

Partitions

I like btrfs - cow, subvolumes, snapshots, send/receive. I have subvolumes for each os. I create new ones for this gentoo install, and use a few other existing ones.

# mount -L os /media/os
# btrfs subvolume create /media/os/@gentoo32
# btrfs subvolume create /media/os/@portage

The gentoo handbook refers to /mnt/gentoo. So we mount our subvolumes there.

# mkdir -p /mnt/gentoo
# mount -L os -o defaults,relatime,compress=lzo,subvol=@gentoo32 /mnt/gentoo/

I will use other subvolumes after this install completes to my satisfaction, as I don't want any accidents. This also keeps it simple & straightforward, with everything on one subvolume.

Stage3

Download, verify & extract latest gentoo stage3. I use /tmp as working directory, as we won't need those files later.

$ cd /tmp
$ wget http://distfiles.gentoo.org/releases/x86/autobuilds/current-install-x86-minimal/stage3-i686-{yyyymmdd}.tar.bz2
$ wget http://distfiles.gentoo.org/releases/x86/autobuilds/current-install-x86-minimal/stage3-i686-{yyyymmdd}.tar.bz2.DIGESTS
$ sha512sum -c stage3-*.tar.bz2.DIGESTS
# tar --numeric-owner --xattrs -xvapf stage3-*.tar.bz2 -C /mnt/gentoo/

I downloaded a 228M file, which extracted 860M. So be patient..

Filesystems

mount required psuedo filesystems
# mount -o bind /proc /mnt/gentoo/proc
# mount --rbind /sys /mnt/gentoo/sys
# mount --make-rslave /mnt/gentoo/sys
# mount --rbind /dev /mnt/gentoo/dev
# mount --make-rslave /mnt/gentoo/dev
# mount --rbind /run/shm /mnt/gentoo/run/shm

Anything outside chroot will be inaccessible.

# cp -L /etc/resolv.conf /mnt/gentoo/etc/

Enter the chroot

# chroot /mnt/gentoo /bin/bash
# source /etc/profile
# export PS1="(chroot) $PS1"

my favourite editor :-)
# ln -s /bin/busybox /usr/local/bin/vi

Portage
ref: gentoo portage

Do yourself a favour, and ignore everything the handbook says about portage.. for now!
Learning everything about portage is really really useful, but not during installation. Particularly, if you are a gentoo newbie.

Install the latest portage snapshot, with all the above settings.
emerge-webrsync -q

/usr/portage is created during this first run. Ignore all those warnings..

This will take time.. be patient ;)

News

$ man news.eselect
$ eselect news list
$ eselect news read [number]

Action the relevant news items. Do your own research though. I got news items too old, and although relevant, not completely correct either.

Timezone

$ ls /usr/share/zoneinfo
# echo "Europe/London" >/etc/timezone
# ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime

Locales

$ cat /etc/locale.gen
en_GB.UTF-8 UTF-8

Each locale should be on a separate line. Atleast one should be UTF-8.

# locale-gen
$ locale -a
$ eselect locale list
# eselect locale set {number}

$ cat /etc/env.d/02locale

Reload environment, after changes.
$ env-update && source /etc/profile && export PS1="(chroot)$PS1"

Kernel

No kernel is installed. We make our own.
ref: gentoo kernel

I moved the kernel section up ahead this time. While the kernel compiles, we continue the rest of the install..
on another terminal :) Enter chroot, and reload environment.

/etc/fstab

$ cat /etc/fstab

Networking

Gentoo utils are best in class. I use netifrc. Busybox udhcpc automatically for all configured interfaces.

My wireless card wasn't detected without lspci.
$ emerge --search pciutils
# emerge --ask sys-apps/pciutils

Configure interfaces
# ln -s /etc/conf.d/net.{lo,wlp3s0}

I need iw and wpa_supplicant.
ref: wpa_supplicant
# emerge --ask net-wireless/{wpa_supplicant,iw}

# vi /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
update_config=1

# wpa-passphrase {ssid} {password} >>/etc/wpa_supplicant/wpa_supplicant.conf

# vi /etc/conf.d/hostname
hostname="{hostname}"

# vi /etc/hosts
127.0.0.1 localhost.localdomain localhost {hostname}
Misc

keyboard
# vi /etc/conf.d/keymaps

root passwd
# passwd

Bootloader

No bootloaders to be installed in this instance, as I use an existing one and add another entry in wheezy's /etc/grub.d/

menuentry "@gentoo32/vmlinuz" {
  set gfxpayload=auto
  set rtlbl=os
  set subvol=@gentoo32
  search --no-floppy --set root --label $rtlbl
  set bootoptions="root=LABEL=$rtlbl ro rootfstype=btrfs rootflags=defaults,noatime,compress=lzo,subvol=$subvol quiet"
  linux /$subvol/vmlinuz $bootoptions
  initrd /$subvol/initrd.img
}

filesystem:
ensure you have the corresponding filesystem tools.

# emerge --ask sys-fs/btrfs-progs

Don't forget the other terminal.. and finish installing the kernel & initramfs!

Exit the chroot

# exit
# reboot

No comments:

Post a Comment

most viewed