Installing Gentoo: Difference between revisions

From BitFolk
Jump to navigation Jump to search
(Guide to install Gentoo on Xen)
No edit summary
Line 5: Line 5:
==Installation==
==Installation==


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


Then, you can follow the [https://wiki.gentoo.org/wiki/Handbook:AMD64 official handbook] with those modifications:
Then, you can follow the [https://wiki.gentoo.org/wiki/Handbook:AMD64 official handbook] with those modifications:
<ul>
<ul>
  <li><code>/dev/sda</code> is <code>/dev/xvda</code></li>
  <li><code>/dev/sda</code> is <code>/dev/xvda</code></li>
<ul>
  <li>You do not require additional partitions unless your bootloader has no native way of reading your root filesystem (for example, full disk encryption)</li>
</ul>
  <li>The IP to configure on eth0 is ${prefix}::2/64 and the gateway is ${prefix}::1. For example, this is my configuration:
  <li>The IP to configure on eth0 is ${prefix}::2/64 and the gateway is ${prefix}::1. For example, this is my configuration:
<pre>config_eth0="85.119.83.7/21 2001:ba8:1f1:f0af::2/64"
<pre>config_eth0="85.119.83.7/21 2001:ba8:1f1:f0af::2/64"
Line 16: Line 19:
  </li>
  </li>
  <li>For IPv4, pick the configuration from the live system</li>
  <li>For IPv4, pick the configuration from the live system</li>
  <li>For the kernel configuration, you have to enable the Xen support. Those options worked for me:
  <li>Recommended to set a <code>PORTAGE_NICENESS</code> setting in <code>/etc/portage/make.conf</code> so installing/updating things does not impact the running services</li>
<li>In <code>/etc/portage/repos.conf/gentoo.conf</code>, you can set the <code>sync-uri</code> to the [[Local software mirrors]]
<pre>sync-uri = rsync://mirror.bitfolk.com/gentoo-portage</pre></li>
<li>The binary [https://wiki.gentoo.org/wiki/Project:Distribution_Kernel distribution kernel] just works for Xen</li>
<li>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:
<pre>rr2 ~ # grep -i xen /usr/src/linux-4.19.97-gentoo/.config
<pre>rr2 ~ # grep -i xen /usr/src/linux-4.19.97-gentoo/.config
CONFIG_XEN=y
CONFIG_XEN=y
Line 51: Line 58:
CONFIG_XEN_HAVE_VPMU=y</pre>
CONFIG_XEN_HAVE_VPMU=y</pre>
  </li>
  </li>
  <li>Add <code>co:2345:respawn:/sbin/agetty hvc0 115200 linux</code> to <code>/etc/inittab</code> for the Xen console</li>
  <li>Add <code>hvc0:2345:respawn:/sbin/agetty -L 9600 hvc0</code> to <code>/etc/inittab</code> for the Xen console</li>
<li>In <code>/etc/default/grub</code>, set:
<pre>GRUB_CMDLINE_LINUX="console=hvc0 xencons=tty"
...
GRUB_TERMINAL=console</pre></li>
</ul>
</ul>



Revision as of 11:40, 1 February 2021

Warning Warning: This guide is currently a work in progress. You should not expect it to work or be correct. Please see the discussion page for some areas where it might be improved.
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
  • Recommended to set a PORTAGE_NICENESS setting in /etc/portage/make.conf 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
  • Add hvc0:2345:respawn:/sbin/agetty -L 9600 hvc0 to /etc/inittab for the Xen console
  • 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.