Installing Gentoo

From BitFolk
Jump to: navigation, search
Warning Warning: This guide assumes that you’re already comfortable with Linux in general and Gentoo in particular.

Installation

First thing is to boot in rescue mode from the Xen Shell and to create /mnt/gentoo/. Partition and then mount your virtual disk over this, then download your desired stage3 tarball into this location.

Then, you can follow the official handbook with those modifications:

  • /dev/sda is /dev/xvda
    • You do not require additional partitions unless your bootloader has no native way of reading your root filesystem (for example, full disk encryption)
  • The IP to configure on eth0 is ${prefix}::2/64 and the gateway is ${prefix}::1. For example, this is my configuration:
    config_eth0="85.119.83.7/21 2001:ba8:1f1:f0af::2/64"
    routes_eth0="default via 85.119.80.1
    default via 2001:ba8:1f1:f0af::1"
  • For IPv4, pick the configuration from the live system
  • In /etc/portage/make.conf, it's recommended to set a PORTAGE_NICENESS setting so installing/updating things does not impact the running services
  • In /etc/portage/repos.conf/gentoo.conf, you can set the sync-uri to the Local software mirrors
    sync-uri = rsync://mirror.bitfolk.com/gentoo-portage
  • The binary distribution kernel just works for Xen
  • However, should you wish to compile your own kernel - for the kernel configuration, you have to enable the Xen support. Those options worked for me:
    rr2 ~ # grep -i xen /usr/src/linux-4.19.97-gentoo/.config
    CONFIG_XEN=y
    CONFIG_XEN_PV=y
    CONFIG_XEN_PV_SMP=y
    CONFIG_XEN_512GB=y
    CONFIG_XEN_SAVE_RESTORE=y
    # CONFIG_XEN_DEBUG_FS is not set
    CONFIG_XEN_BLKDEV_FRONTEND=y
    # CONFIG_XEN_SCSI_FRONTEND is not set
    CONFIG_XEN_NETDEV_FRONTEND=y
    CONFIG_INPUT_XEN_KBDDEV_FRONTEND=y
    CONFIG_HVC_XEN=y
    CONFIG_HVC_XEN_FRONTEND=y
    # CONFIG_XEN_WDT is not set
    CONFIG_DRM_XEN=y
    CONFIG_DRM_XEN_FRONTEND=m
    CONFIG_XEN_FBDEV_FRONTEND=y
    # Xen driver support
    CONFIG_XEN_BALLOON=y
    CONFIG_XEN_SCRUB_PAGES_DEFAULT=y
    CONFIG_XEN_DEV_EVTCHN=y
    CONFIG_XENFS=y
    CONFIG_XEN_COMPAT_XENFS=y
    CONFIG_XEN_SYS_HYPERVISOR=y
    CONFIG_XEN_XENBUS_FRONTEND=y
    CONFIG_XEN_GNTDEV=m
    CONFIG_XEN_GRANT_DEV_ALLOC=m
    # CONFIG_XEN_GRANT_DMA_ALLOC is not set
    CONFIG_SWIOTLB_XEN=y
    # CONFIG_XEN_PVCALLS_FRONTEND is not set
    CONFIG_XEN_PRIVCMD=y
    CONFIG_XEN_HAVE_PVMMU=y
    CONFIG_XEN_HAVE_VPMU=y
  • In /etc/inittab, add hvc0:2345:respawn:/sbin/agetty -L 9600 hvc0 for the Xen console and set it to run on startup:
    # cd /etc/init.d/
    # ln -sv agetty agetty.hvc0
    # rc-update add agetty.hvc0 default
  • In /etc/securetty, add hvc0
  • In /etc/default/grub, set:
    GRUB_CMDLINE_LINUX="console=hvc0 xencons=tty"
    ...
    GRUB_TERMINAL=console

Misc

If you have questions, I’m on the IRC channel as alarig.

I used https://www.mad-hacking.net/documentation/linux/deployment/xen/pv-guest-basics.xml to know what the Xen options are for.