User:Bugalo/Supermicro A2SDi-4C-HLN4F
The Supermicro A2SDi-4C-HLN4F is a low-power server Mini-ITX motherboard. It is fully functional with the latest Linux kernel versions.
Summary
This document will serve as a guide on how to install Gentoo on the Supermicro A2SDi-4C-HLN4F, to use is as a home NAS server, with the following configuration:
- Single Gentoo boot, in UEFI with GPT mode, using GRUB2 as a boot loader.
- ZFS on all partitions, except the ESP, including root, with native transparent compression and encryption. Deduplication will not be configured:
- Mirrored Zpools for all system partitions. Those will be located in two 64GB USB 3.1 flash drives.
- One RaidZ2 Zpool for data. It will be located in six 8TB hard drives.
- GNOME with systemd profile.
Hardware
Standard
Device | Make/model | Status | Vendor ID / Product ID | Kernel driver(s) | Firmware | Kernel version | Notes |
---|---|---|---|---|---|---|---|
CPU | Intel(R) Atom(TM) C3558 CPU @ 2.20GHz
|
Works | N/A | N/A | N/A | 5.4.28 | Supermicro produces very similar boards using variants of this processor with different core count and power consumptions. |
QuickAssist coprocessor | Intel(R) Atom(TM) C3000 Series QuickAssist Technology | Works | 8086:19e2 | N/A | qat_c3xxx.bin qat_c3xxx_mmp.bin | 5.4.28 | N/A |
GPU | Aspeed AST2400 BMC
|
Works | 1a03:2000 | ast | N/A | 5.4.28 | N/A |
ethernet | Works | 8086:19d1 8086:19d2 | ixgbe | N/A | 5.4.28 | N/A |
Installation
Bios
...
Preparing the Ubuntu Live Environment
Review the boot process...
- Create an Ubuntu bootable USB using, for example using UNetbootin.
- Plug the USB and boot the computer.
- Access the One-time boot menu of the BIOS by pressing F2.
- Choose the appropriate entry to boot from the live USB.
- In the GRUB menu, choose Try Ubuntu without installing.
- Connect to the internet through ethernet[1].
- Upgrade Ubuntu to use the latest ZFS modules availabe.
root #
apt-get update
root #
apt-get upgrade
- Verify that ZFS is loaded
user $
dmesg | grep -i zfs
[ 9.658459] ZFS: Loaded module v0.8.1-1ubuntu12, ZFS pool version 5000, ZFS filesystem version 5
- Create a folder for the Gentoo install.
root #
mkdir /mnt/gentoo
- Install the text editor of your choice, e.g. Vim.
root #
apt-get install vim
Important
This guide uses Vim as a text editor. Feel free to substitute it by your preferred editor.
Create the ZFS layout
All the partitions of the system will use the ZFS filesystem. ZFS allows the use of whole disks, without partitioning, to install the different parts of the system. In this case, the whole disk would be a ZFS pool, and we would create different ZFS datasets in it that would be conceptually similar to traditional partitions, but they don't need to have a fixed predetermined size. However, the choice of GRUB2 as a boot manager requires partitioning the disk, i.e a ZFS pool needs to be created in a partition, not in the whole disk. GRUB2 cannot currently reside in a ZFS pool with advanced features activated, such as encryption[2]. In order to satisfy both requirements of using GRUB2 as a boot loader and having the system residing in ZFS with native encryption, we need to create a ZFS pool compatible with GRUB2. Furthermore, a FAT formatted EFI System Partition needs to be created.
- Open GParted.
- Go to Device / Create Partition Table ... / gpt / Apply.
- Delete any partition of the USB flash drive
/dev/sda
. - Create a new partition,
/dev/sda1
, in the unallocated space, formatted in FAT32, named EFI system partition, with label ESP, of 128MB, and with flags "boot" and "esp". - Create an unformatted partition,
/dev/sda2
, in the unallocated space, named Gentoo-Boot, of 896MB. - Create an unformatted partition,
/dev/sda3
, in the unallocated space, named Gentoo-Root, occupying the remaining space. - Apply all operations and exit.
- Create a ZFS pool, with all GRUB2's unsupported features disabled, in
/dev/sda2
.root #
zpool create -d -o feature@allocation_classes=enabled \
-o feature@async_destroy=enabled \
-o feature@bookmarks=enabled \
-o feature@embedded_data=enabled \
-o feature@empty_bpobj=enabled \
-o feature@enabled_txg=enabled \
-o feature@extensible_dataset=enabled \
-o feature@filesystem_limits=enabled \
-o feature@hole_birth=enabled \
-o feature@large_blocks=enabled \
-o feature@lz4_compress=enabled \
-o feature@project_quota=enabled \
-o feature@resilver_defer=enabled \
-o feature@spacemap_histogram=enabled \
-o feature@spacemap_v2=enabled \
-o feature@userobj_accounting=enabled \
-o feature@zpool_checkpoint=enabled \
-f -o ashift=12 \
-o autotrim=on \
-o cachefile=/tmp/zpool.cache \
-O aclinherit=passthrough \
-O acltype=posixacl \
-O atime=off \
-O canmount=off \
-O devices=off \
-O mountpoint=/ \
-O normalization=formD \
-O xattr=sa \
-R /mnt/gentoo \
bpool /dev/disk/by-partlabel/Gentoo-Boot
- Create a ZFS pool, for the Gentoo system, in
/dev/sda3
.root #
zpool create -f -o ashift=12 \
-o autotrim=on \
-o cachefile=/tmp/zpool.cache \
-O acltype=posixacl \
-O aclinherit=passthrough \
-O atime=off \
-O canmount=off \
-O devices=off \
-O dnodesize=auto \
-O mountpoint=/ \
-O normalization=formD \
-O xattr=sa \
-R /mnt/gentoo \
rpool /dev/disk/by-partlabel/Gentoo-Root
- The status and properties of the pools created above can be checked with the following commands:
root #
zpool status
pool: bpool
state: ONLINE
status: Some supported features are not enabled on the pool. The pool can
still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
the pool may no longer be accessible by software that does not support
the features. See zpool-features(5) for details.
scan: none requested
config:
NAME STATE READ WRITE CKSUM
bpool ONLINE 0 0 0
Gentoo-Boot ONLINE 0 0 0
errors: No known data errors
pool: rpool
state: ONLINE
scan: none requested
config:
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
Gentoo-Root ONLINE 0 0 0
errors: No known data errors
root #
zfs get all bpool
root #
zfs get all rpool
- Create the ZFS dataset where GRUB2 will reside:
root #
zfs create -o canmount=off -o compression=gzip-9 -o mountpoint=none bpool/BOOT
root #
zfs create -o canmount=noauto -o compression=gzip-9 -o dnodesize=legacy -o mountpoint=/mnt/gentoo/boot bpool/BOOT/gentoo
Important
The LZ4 compression algorithm is generally favored over Gzip, due to its good balance between compression ratio and computational power required[5]. However, this guide usesgzip-9
as compression algorithm, offering the highest compression level at a higher computational cost. This is due to the availability of an Intel QuickAssist coprocessor in the system.Warning
Setting here the parameterdnodesize
to anything other thanlegacy
will result in the following error[6]:cannot set property for 'bpool': operation not supported on this type of pool
- Create the ZFS dataset where root will reside:
root #
zfs create -o canmount=off -o compression=gzip-9 -o encryption=aes-256-gcm -o keyformat=passphrase -o keylocation=prompt -o mountpoint=none rpool/ROOT
root #
zfs create -o canmount=noauto -o compression=gzip-9 -o encryption=aes-256-gcm -o keyformat=passphrase -o keylocation=prompt -o mountpoint=/mnt/gentoo/ rpool/ROOT/gentoo
Important
The default mode of operation of ZFS native encryption is aes-256-ccm. However, aes-256-gcm is generally preferred[7]. - Create the ZFS dataset where home will reside:
root #
zfs create -o compression=gzip-9 -o encryption=aes-256-gcm -o keyformat=passphrase -o mountpoint=/mnt/gentoo/home rpool/ROOT/home
- Mount all the ZFS datasets :
root #
zfs mount rpool/ROOT/gentoo
root #
zfs mount bpool/BOOT/gentoo
- Check that the ZFS layout is correct:
root #
zfs list -t all
- Set the ZFS dataset used for booting: Check that the
root #
zpool set bootfs=bpool/BOOT/gentoo bpool
bootfs
property has been properly set:root #
zpool get bootfs bpool
Install the Gentoo base system
This section will closely follow Gentoo's AMD64 Handbook, with adjustments where appropriate.
- Verify that the date and time of the system is correct. If not, fix it:
root #
date
Thu Jan 23 23:35:23 CET 2020
- Choose a stage tarball:
multilib 64-bit stage tarball
. - Move to the root installation directory:
root #
cd /mnt/gentoo/
- Find the name of the latest amd64 systemd stage3 at http://distfiles.gentoo.org/releases/amd64/autobuilds/latest-stage3-amd64-systemd.txt and download it: Note
Modify the name of the stage3 file appropriately.Tip
The downloaded stage3 file can be verified. - Unpack the stage3 tarball:
root #
tar xpvf stage3-*.tar.bz2 --xattrs-include='*.*' --numeric-owner
- Edit make.conf to configure:
- The compile options to optimize compiled code, including the CPU_FLAGS_X86[8].
- The global USE variable to specify system-wide package support.
- The ACCEPT_LICENSE variable to select the license group automatically accepted.
root #
vim /mnt/gentoo/etc/portage/make.conf
FILE/etc/portage/make.conf
Setting the CPU_FLAGS_X86, USE and ACCEPT_LICENSE variables for systemwide support'"`UNIQ--pre-0000004A-QINU`"''"`UNIQ--pre-0000004B-QINU`"''"`UNIQ--pre-0000004C-QINU`"''"`UNIQ--pre-0000004D-QINU`"''"`UNIQ--pre-0000004E-QINU`"''"`UNIQ--pre-0000004F-QINU`"'
Tip
A working make.conf for this system can be found here.
- Configure the Gentoo ebuild repository:
root #
mkdir --parents /mnt/gentoo/etc/portage/repos.conf
root #
cp /mnt/gentoo/usr/share/portage/config/repos.conf /mnt/gentoo/etc/portage/repos.conf/gentoo.conf
- Copy the DNS info:
root #
cp --dereference /etc/resolv.conf /mnt/gentoo/etc/
- Mount the necessary filesystems:
root #
mount --types proc /proc /mnt/gentoo/proc
root #
mount --rbind /sys /mnt/gentoo/sys
root #
mount --make-rslave /mnt/gentoo/sys
root #
mount --rbind /dev /mnt/gentoo/dev
root #
mount --make-rslave /mnt/gentoo/dev
root #
mount --bind /run /mnt/gentoo/run
root #
mount --make-slave /mnt/gentoo/run
- Copy the zpool.cache to the installation directory:
root #
mkdir -p /mnt/gentoo/etc/zfs
root #
cp /tmp/zpool.cache /mnt/gentoo/etc/zfs/zpool.cache
- Copy /etc/hostid, genkernel will later complain if it does not exist[9]:
root #
cp /etc/hostid /mnt/gentoo/etc/hostid
- Chroot into the new environment:
root #
chroot /mnt/gentoo /bin/bash
root #
source /etc/profile
root #
export PS1="(chroot) ${PS1}"
- Update the Gentoo ebuild repository:
(chroot) root #
emerge --sync --quiet
(chroot) root #
eselect news list
(chroot) root #
eselect news read
(chroot) root #
eselect news purge
- Choose the appropriate portage profile:
(chroot) root #
eselect profile list
(chroot) root #
eselect profile set default/linux/amd64/17.1/desktop/gnome/systemd
- Select fast mirrors available for source code download, by using mirrorselect:
(chroot) root #
emerge --ask app-portage/mirrorselect
(chroot) root #
mirrorselect -s4 -b10 -D
- Emerge Vim to be used as a text editor:
(chroot) root #
echo "app-editors/vim ~amd64" >> /etc/portage/package.accept_keywords/vim
(chroot) root #
echo "app-editors/vim-core ~amd64" >> /etc/portage/package.accept_keywords/vim-core
(chroot) root #
echo "app-editors/gvim ~amd64" >> /etc/portage/package.accept_keywords/gvim
(chroot) root #
emerge --ask app-editors/vim app-editors/gvim
- Set the timezone and reconfigure the sys-libs/timezone-data:
(chroot) root #
ls /usr/share/zoneinfo
(chroot) root #
echo "Europe/Madrid" > /etc/timezone
(chroot) root #
emerge --config sys-libs/timezone-data
- Configure the locales to use, at leaset, one UTF-8 locale:
- Edit /etc/locale.gen: and uncomment the line referencing
(chroot) root #
vim /etc/locale.gen
en_US.UTF-8 UTF-8
:FILE/etc/locale.gen
Adding an UTF-8 locale'"`UNIQ--pre-0000005B-QINU`"''"`UNIQ--pre-0000005C-QINU`"''"`UNIQ--pre-0000005D-QINU`"'
- Generate the locales:
(chroot) root #
locale-gen
(chroot) root #
eselect locale list
(chroot) root #
eselect locale set en_US.utf8
- Reload the environment:
(chroot) root #
env-update && source /etc/profile && export PS1="(chroot) ${PS1}"
- Edit /etc/locale.gen:
- Unmask the latest versions of sys-fs/zfs and sys-fs/zfs-kmod:
(chroot) root #
echo "sys-fs/zfs ~amd64" >> /etc/portage/package.accept_keywords/zfs
(chroot) root #
echo "sys-fs/zfs-kmod ~amd64" >> /etc/portage/package.accept_keywords/zfs-kmod
Note
ZFSOnLinux is under very active development, and the latest versions provide bug fixes and implement new interesting features, e.g zfs-0.8.0 introduced native encryption, support for TRIM in SSDs, etc[10].Important
Versions of sys-fs/zfs lower than 0.8.0 depend on sys-kernel/spl. However, as of version 0.8.0, this dependency has been removed.[10]. - Unmask the latest versions of sys-boot/grub and add ZFS support:
(chroot) root #
echo "sys-boot/grub ~amd64" >> /etc/portage/package.accept_keywords/grub
(chroot) root #
echo "sys-boot/grub libzfs" > /etc/portage/package.use/grub
- Update the world set:
(chroot) root #
emerge -auvDN @world
Configuring, building and installing the Linux kernel
At the time of writing this, ZFS 0.8.4 is not compatible with kernel versions 5.7.0 and above.
Working kernel configuration files, for different kernel versions, can be found here.
- Unmask the latest kernel versions:
(chroot) root #
echo "sys-kernel/gentoo-sources ~amd64" >> /etc/portage/package.accept_keywords/gentoo-sources
Warning
At the time of writing this, ZFS 0.8.4 is not compatible with kernel versions 5.7.0 and above. Mask the incompatible kernel versions:(chroot) root #
echo ">=sys-kernel/gentoo-sources-5.7.0" >> /etc/portage/package.mask/gentoo-sources
- Install the kernel and genkernel:
(chroot) root #
emerge -auvDN sys-kernel/gentoo-sources sys-kernel/genkernel
- Add compression support to sys-apps/kmod in order to be able to load compressed modules:
(chroot) root #
echo "sys-apps/kmod lzma zlib" >> /etc/portage/package.use/kmod
(chroot) root #
emerge -auvDN sys-apps/kmod
- Configure the kernel:
(chroot) root #
eselect kernel list
(chroot) root #
eselect kernel set 2
(chroot) root #
cd /usr/src/linux
(chroot) root #
make menuconfig
- Enable Firmware loading support: KERNEL Enable support for Linux firmware
'"`UNIQ--pre-00000072-QINU`"''"`UNIQ--pre-00000073-QINU`"''"`UNIQ--pre-00000074-QINU`"''"`UNIQ--pre-00000075-QINU`"''"`UNIQ--pre-00000076-QINU`"''"`UNIQ--pre-00000077-QINU`"'
- Architecture specific kernel configuration: KERNEL Selecting processor types and features
'"`UNIQ--pre-0000007A-QINU`"''"`UNIQ--pre-0000007B-QINU`"''"`UNIQ--pre-0000007C-QINU`"''"`UNIQ--pre-0000007D-QINU`"''"`UNIQ--pre-0000007E-QINU`"''"`UNIQ--pre-0000007F-QINU`"''"`UNIQ--pre-00000080-QINU`"''"`UNIQ--pre-00000081-QINU`"''"`UNIQ--pre-00000082-QINU`"''"`UNIQ--pre-00000083-QINU`"'</br>'"`UNIQ--pre-00000084-QINU`"''"`UNIQ--pre-00000085-QINU`"'
- Enable Hyper-Threading support: KERNEL Configuration for multi-processing support
'"`UNIQ--pre-00000088-QINU`"''"`UNIQ--pre-00000089-QINU`"''"`UNIQ--pre-0000008A-QINU`"''"`UNIQ--pre-0000008B-QINU`"''"`UNIQ--pre-0000008C-QINU`"'
KERNEL Power management for multi-processor systems'"`UNIQ--pre-0000008F-QINU`"''"`UNIQ--pre-00000090-QINU`"'
- Enable Intel QuickAssist Technology support: KERNEL Configuration for Intel QuickAssist Technology support
'"`UNIQ--pre-00000093-QINU`"''"`UNIQ--pre-00000094-QINU`"''"`UNIQ--pre-00000095-QINU`"''"`UNIQ--pre-00000096-QINU`"''"`UNIQ--pre-00000097-QINU`"'
- Enable SATA support, needed if using a SATA hard drive; SCSI, needed for SATA devices, USB external hard drives and optical drives, etc.: KERNEL Configuration options for SCSI support
'"`UNIQ--pre-0000009A-QINU`"''"`UNIQ--pre-0000009B-QINU`"''"`UNIQ--pre-0000009C-QINU`"''"`UNIQ--pre-0000009D-QINU`"''"`UNIQ--pre-0000009E-QINU`"''"`UNIQ--pre-0000009F-QINU`"''"`UNIQ--pre-000000A0-QINU`"''"`UNIQ--pre-000000A1-QINU`"'
- Enable NVMe device support: Note
This machine has an NVMe port. It will not be used in this build, but it can be used by selecting this configuration option.KERNEL Configuration for NVMe support'"`UNIQ--pre-000000A4-QINU`"''"`UNIQ--pre-000000A5-QINU`"''"`UNIQ--pre-000000A6-QINU`"'
- Enable compressed kernel modules: Warning
I have not been able to boot from a ZFS system with compressed modules enabled, although it should be entirely possible. Use at your own risk.KERNEL Enable module compression'"`UNIQ--pre-000000A9-QINU`"''"`UNIQ--pre-000000AA-QINU`"''"`UNIQ--pre-000000AB-QINU`"''"`UNIQ--pre-000000AC-QINU`"''"`UNIQ--pre-000000AD-QINU`"'
- Enable devtmpfs support: KERNEL Enabling devtmpfs support
'"`UNIQ--pre-000000B0-QINU`"''"`UNIQ--pre-000000B1-QINU`"''"`UNIQ--pre-000000B2-QINU`"''"`UNIQ--pre-000000B3-QINU`"'
- Enable support for the filesystems used: KERNEL Selecting necessary file systems
'"`UNIQ--pre-000000B6-QINU`"''"`UNIQ--pre-000000B7-QINU`"''"`UNIQ--pre-000000B8-QINU`"''"`UNIQ--pre-000000B9-QINU`"''"`UNIQ--pre-000000BA-QINU`"''"`UNIQ--pre-000000BB-QINU`"''"`UNIQ--pre-000000BC-QINU`"''"`UNIQ--pre-000000BD-QINU`"''"`UNIQ--pre-000000BE-QINU`"''"`UNIQ--pre-000000BF-QINU`"''"`UNIQ--pre-000000C0-QINU`"''"`UNIQ--pre-000000C1-QINU`"''"`UNIQ--pre-000000C2-QINU`"''"`UNIQ--pre-000000C3-QINU`"''"`UNIQ--pre-000000C4-QINU`"''"`UNIQ--pre-000000C5-QINU`"''"`UNIQ--pre-000000C6-QINU`"''"`UNIQ--pre-000000C7-QINU`"''"`UNIQ--pre-000000C8-QINU`"'
- Enable support for FUSE: KERNEL Enable support for FUSE
'"`UNIQ--pre-000000CB-QINU`"''"`UNIQ--pre-000000CC-QINU`"'
- Enable GPT support: KERNEL Enable support for GPT
'"`UNIQ--pre-000000CF-QINU`"''"`UNIQ--pre-000000D0-QINU`"''"`UNIQ--pre-000000D1-QINU`"''"`UNIQ--pre-000000D2-QINU`"'
- Enable UEFI support: KERNEL Enable support for UEFI
'"`UNIQ--pre-000000D5-QINU`"''"`UNIQ--pre-000000D6-QINU`"''"`UNIQ--pre-000000D7-QINU`"''"`UNIQ--pre-000000D8-QINU`"'</br>'"`UNIQ--pre-000000D9-QINU`"''"`UNIQ--pre-000000DA-QINU`"''"`UNIQ--pre-000000DB-QINU`"'
- Configure USB support: KERNEL Configuration for USB Host Controller Devices
'"`UNIQ--pre-000000DE-QINU`"''"`UNIQ--pre-000000DF-QINU`"''"`UNIQ--pre-000000E0-QINU`"''"`UNIQ--pre-000000E1-QINU`"''"`UNIQ--pre-000000E2-QINU`"''"`UNIQ--pre-000000E3-QINU`"''"`UNIQ--pre-000000E4-QINU`"''"`UNIQ--pre-000000E5-QINU`"''"`UNIQ--pre-000000E6-QINU`"''"`UNIQ--pre-000000E7-QINU`"''"`UNIQ--pre-000000E8-QINU`"''"`UNIQ--pre-000000E9-QINU`"''"`UNIQ--pre-000000EA-QINU`"''"`UNIQ--pre-000000EB-QINU`"''"`UNIQ--pre-000000EC-QINU`"'
- Configure USB support for input devices: KERNEL Configuration for USB input devices
'"`UNIQ--pre-000000EF-QINU`"''"`UNIQ--pre-000000F0-QINU`"''"`UNIQ--pre-000000F1-QINU`"''"`UNIQ--pre-000000F2-QINU`"''"`UNIQ--pre-000000F3-QINU`"''"`UNIQ--pre-000000F4-QINU`"''"`UNIQ--pre-000000F5-QINU`"'
- Enable USB audio: KERNEL Enable support for SND_USB_AUDIO
'"`UNIQ--pre-000000F8-QINU`"''"`UNIQ--pre-000000F9-QINU`"''"`UNIQ--pre-000000FA-QINU`"''"`UNIQ--pre-000000FB-QINU`"''"`UNIQ--pre-000000FC-QINU`"''"`UNIQ--pre-000000FD-QINU`"''"`UNIQ--pre-000000FE-QINU`"'
- Enable systemd support: KERNEL Enable support for Linux firmware
'"`UNIQ--pre-00000101-QINU`"''"`UNIQ--pre-00000102-QINU`"''"`UNIQ--pre-00000103-QINU`"''"`UNIQ--pre-00000104-QINU`"''"`UNIQ--pre-00000105-QINU`"''"`UNIQ--pre-00000106-QINU`"''"`UNIQ--pre-00000107-QINU`"''"`UNIQ--pre-00000108-QINU`"''"`UNIQ--pre-00000109-QINU`"''"`UNIQ--pre-0000010A-QINU`"''"`UNIQ--pre-0000010B-QINU`"''"`UNIQ--pre-0000010C-QINU`"''"`UNIQ--pre-0000010D-QINU`"''"`UNIQ--pre-0000010E-QINU`"''"`UNIQ--pre-0000010F-QINU`"''"`UNIQ--pre-00000110-QINU`"'</br>'"`UNIQ--pre-00000111-QINU`"''"`UNIQ--pre-00000112-QINU`"'</br>'"`UNIQ--pre-00000113-QINU`"''"`UNIQ--pre-00000114-QINU`"'</br>'"`UNIQ--pre-00000115-QINU`"''"`UNIQ--pre-00000116-QINU`"''"`UNIQ--pre-00000117-QINU`"'</br>'"`UNIQ--pre-00000118-QINU`"''"`UNIQ--pre-00000119-QINU`"''"`UNIQ--pre-0000011A-QINU`"''"`UNIQ--pre-0000011B-QINU`"'</br>'"`UNIQ--pre-0000011C-QINU`"''"`UNIQ--pre-0000011D-QINU`"''"`UNIQ--pre-0000011E-QINU`"''"`UNIQ--pre-0000011F-QINU`"''"`UNIQ--pre-00000120-QINU`"''"`UNIQ--pre-00000121-QINU`"'</br>'"`UNIQ--pre-00000122-QINU`"''"`UNIQ--pre-00000123-QINU`"''"`UNIQ--pre-00000124-QINU`"''"`UNIQ--pre-00000125-QINU`"''"`UNIQ--pre-00000126-QINU`"''"`UNIQ--pre-00000127-QINU`"''"`UNIQ--pre-00000128-QINU`"''"`UNIQ--pre-00000129-QINU`"''"`UNIQ--pre-0000012A-QINU`"'</br>'"`UNIQ--pre-0000012B-QINU`"''"`UNIQ--pre-0000012C-QINU`"''"`UNIQ--pre-0000012D-QINU`"''"`UNIQ--pre-0000012E-QINU`"'
- Configure the Aspeed AST2400: KERNEL Configuration for Aspeed AST2400
'"`UNIQ--pre-00000131-QINU`"''"`UNIQ--pre-00000132-QINU`"'</br>'"`UNIQ--pre-00000133-QINU`"''"`UNIQ--pre-00000134-QINU`"''"`UNIQ--pre-00000135-QINU`"''"`UNIQ--pre-00000136-QINU`"''"`UNIQ--pre-00000137-QINU`"''"`UNIQ--pre-00000138-QINU`"''"`UNIQ--pre-00000139-QINU`"''"`UNIQ--pre-0000013A-QINU`"''"`UNIQ--pre-0000013B-QINU`"''"`UNIQ--pre-0000013C-QINU`"''"`UNIQ--pre-0000013D-QINU`"''"`UNIQ--pre-0000013E-QINU`"''"`UNIQ--pre-0000013F-QINU`"''"`UNIQ--pre-00000140-QINU`"''"`UNIQ--pre-00000141-QINU`"''"`UNIQ--pre-00000142-QINU`"''"`UNIQ--pre-00000143-QINU`"''"`UNIQ--pre-00000144-QINU`"''"`UNIQ--pre-00000145-QINU`"''"`UNIQ--pre-00000146-QINU`"''"`UNIQ--pre-00000147-QINU`"''"`UNIQ--pre-00000148-QINU`"''"`UNIQ--pre-00000149-QINU`"''"`UNIQ--pre-0000014A-QINU`"''"`UNIQ--pre-0000014B-QINU`"''"`UNIQ--pre-0000014C-QINU`"''"`UNIQ--pre-0000014D-QINU`"''"`UNIQ--pre-0000014E-QINU`"''"`UNIQ--pre-0000014F-QINU`"''"`UNIQ--pre-00000150-QINU`"''"`UNIQ--pre-00000151-QINU`"''"`UNIQ--pre-00000152-QINU`"''"`UNIQ--pre-00000153-QINU`"''"`UNIQ--pre-00000154-QINU`"''"`UNIQ--pre-00000155-QINU`"''"`UNIQ--pre-00000156-QINU`"''"`UNIQ--pre-00000157-QINU`"''"`UNIQ--pre-00000158-QINU`"''"`UNIQ--pre-00000159-QINU`"''"`UNIQ--pre-0000015A-QINU`"''"`UNIQ--pre-0000015B-QINU`"''"`UNIQ--pre-0000015C-QINU`"''"`UNIQ--pre-0000015D-QINU`"''"`UNIQ--pre-0000015E-QINU`"''"`UNIQ--pre-0000015F-QINU`"''"`UNIQ--pre-00000160-QINU`"''"`UNIQ--pre-00000161-QINU`"''"`UNIQ--pre-00000162-QINU`"''"`UNIQ--pre-00000163-QINU`"''"`UNIQ--pre-00000164-QINU`"''"`UNIQ--pre-00000165-QINU`"''"`UNIQ--pre-00000166-QINU`"''"`UNIQ--pre-00000167-QINU`"''"`UNIQ--pre-00000168-QINU`"''"`UNIQ--pre-00000169-QINU`"''"`UNIQ--pre-0000016A-QINU`"''"`UNIQ--pre-0000016B-QINU`"''"`UNIQ--pre-0000016C-QINU`"''"`UNIQ--pre-0000016D-QINU`"''"`UNIQ--pre-0000016E-QINU`"''"`UNIQ--pre-0000016F-QINU`"''"`UNIQ--pre-00000170-QINU`"''"`UNIQ--pre-00000171-QINU`"''"`UNIQ--pre-00000172-QINU`"''"`UNIQ--pre-00000173-QINU`"''"`UNIQ--pre-00000174-QINU`"'
- Configure the Ethernet support: KERNEL Enabling Ethernet support
'"`UNIQ--pre-00000177-QINU`"''"`UNIQ--pre-00000178-QINU`"''"`UNIQ--pre-00000179-QINU`"''"`UNIQ--pre-0000017A-QINU`"''"`UNIQ--pre-0000017B-QINU`"''"`UNIQ--pre-0000017C-QINU`"''"`UNIQ--pre-0000017D-QINU`"''"`UNIQ--pre-0000017E-QINU`"'
- Configure the Xorg support: KERNEL Enabling evdev in the kernel
'"`UNIQ--pre-00000181-QINU`"''"`UNIQ--pre-00000182-QINU`"''"`UNIQ--pre-00000183-QINU`"'
KERNEL Disable legacy framebuffer support and enable basic console FB support'"`UNIQ--pre-00000186-QINU`"''"`UNIQ--pre-00000187-QINU`"''"`UNIQ--pre-00000188-QINU`"''"`UNIQ--pre-00000189-QINU`"''"`UNIQ--pre-0000018A-QINU`"''"`UNIQ--pre-0000018B-QINU`"''"`UNIQ--pre-0000018C-QINU`"''"`UNIQ--pre-0000018D-QINU`"''"`UNIQ--pre-0000018E-QINU`"''"`UNIQ--pre-0000018F-QINU`"'
- Enable NetworkManager support: KERNEL Enabling NetworkManager support
'"`UNIQ--pre-00000192-QINU`"''"`UNIQ--pre-00000193-QINU`"''"`UNIQ--pre-00000194-QINU`"''"`UNIQ--pre-00000195-QINU`"'
- Enable hardware clock support: KERNEL Necessary kernel options for a hardware clock
'"`UNIQ--pre-00000198-QINU`"''"`UNIQ--pre-00000199-QINU`"''"`UNIQ--pre-0000019A-QINU`"''"`UNIQ--pre-0000019B-QINU`"''"`UNIQ--pre-0000019C-QINU`"''"`UNIQ--pre-0000019D-QINU`"''"`UNIQ--pre-0000019E-QINU`"''"`UNIQ--pre-0000019F-QINU`"''"`UNIQ--pre-000001A0-QINU`"''"`UNIQ--pre-000001A1-QINU`"''"`UNIQ--pre-000001A2-QINU`"'
KERNEL Letting the kernel sync the system clock'"`UNIQ--pre-000001A5-QINU`"''"`UNIQ--pre-000001A6-QINU`"''"`UNIQ--pre-000001A7-QINU`"''"`UNIQ--pre-000001A8-QINU`"''"`UNIQ--pre-000001A9-QINU`"''"`UNIQ--pre-000001AA-QINU`"''"`UNIQ--pre-000001AB-QINU`"''"`UNIQ--pre-000001AC-QINU`"''"`UNIQ--pre-000001AD-QINU`"''"`UNIQ--pre-000001AE-QINU`"''"`UNIQ--pre-000001AF-QINU`"''"`UNIQ--pre-000001B0-QINU`"''"`UNIQ--pre-000001B1-QINU`"''"`UNIQ--pre-000001B2-QINU`"''"`UNIQ--pre-000001B3-QINU`"'
- Enable CPU microcode for the Intel CPU loading support: KERNEL Configuring the kernel to support Intel microcode loading
'"`UNIQ--pre-000001B6-QINU`"''"`UNIQ--pre-000001B7-QINU`"'</br>'"`UNIQ--pre-000001B8-QINU`"''"`UNIQ--pre-000001B9-QINU`"''"`UNIQ--pre-000001BA-QINU`"''"`UNIQ--pre-000001BB-QINU`"''"`UNIQ--pre-000001BC-QINU`"'
- Enable NTFS read and write support: KERNEL Enable built-in NTFS filesystem reading support
'"`UNIQ--pre-000001BF-QINU`"''"`UNIQ--pre-000001C0-QINU`"''"`UNIQ--pre-000001C1-QINU`"''"`UNIQ--pre-000001C2-QINU`"'
KERNEL Enabling NTFS over FUSE using NTFS-3G'"`UNIQ--pre-000001C5-QINU`"''"`UNIQ--pre-000001C6-QINU`"'
- Enable tmpfs support: KERNEL Enable tmpfs support
'"`UNIQ--pre-000001C9-QINU`"''"`UNIQ--pre-000001CA-QINU`"''"`UNIQ--pre-000001CB-QINU`"''"`UNIQ--pre-000001CC-QINU`"''"`UNIQ--pre-000001CD-QINU`"'
- Enable ALSA and PulseAudio sound support: KERNEL Enable ALSA support
'"`UNIQ--pre-000001D0-QINU`"''"`UNIQ--pre-000001D1-QINU`"'</br>'"`UNIQ--pre-000001D2-QINU`"''"`UNIQ--pre-000001D3-QINU`"''"`UNIQ--pre-000001D4-QINU`"''"`UNIQ--pre-000001D5-QINU`"''"`UNIQ--pre-000001D6-QINU`"''"`UNIQ--pre-000001D7-QINU`"''"`UNIQ--pre-000001D8-QINU`"''"`UNIQ--pre-000001D9-QINU`"''"`UNIQ--pre-000001DA-QINU`"'
KERNEL Enable PulseAudio support'"`UNIQ--pre-000001DD-QINU`"''"`UNIQ--pre-000001DE-QINU`"''"`UNIQ--pre-000001DF-QINU`"'</br>'"`UNIQ--pre-000001E0-QINU`"''"`UNIQ--pre-000001E1-QINU`"''"`UNIQ--pre-000001E2-QINU`"''"`UNIQ--pre-000001E3-QINU`"'
- Enable Firmware loading support:
- Prepare the kernel for module compilation:
(chroot) root #
make modules_prepare
- Compile the kernel:
(chroot) root #
make -j4
- Install the kernel modules:
(chroot) root #
make modules_install
- Install the kernel:
(chroot) root #
make install
- Rebuild the installed modules:
(chroot) root #
emerge --ask @module-rebuild
- Use genkernel to generate an initramfs:
(chroot) root #
genkernel initramfs --firmware --kernel-config=/usr/src/linux/.config --keymap --makeopts=-j4 --mountboot --no-clean --zfs
Note
Notice that native ZFS encryption is used for this system, rather than LUKS, and thus the lack of the--luks
option in the genkernel invacation.
Install Firmware for Intel QuickAssist
- Edit /usr/src/linux/.config, as explained above, to enable firmware loading support. Tip
Working kernel configuration files, for different kernel versions, can be found here. - Update the Kernel, as explained below.
- Install the firmware:
(chroot) root #
emerge -auvDN sys-kernel/linux-firmware
- Add support for individual selection of firmware files to sys-kernel/linux-firmware:
(chroot) root #
echo "sys-kernel/linux-firmware savedconfig" >> /etc/portage/package.use/linux-firmware
- Comment everything in /etc/portage/savedconfig/sys-kernel/linux-firmware-ddmmyyyy except the actual firmware files needed by the system:
(chroot) root #
vim /etc/portage/savedconfig/sys-kernel/linux-firmware-ddmmyyyy
FILE/etc/portage/savedconfig/sys-kernel/linux-firmware-ddmmyyyy
Add support for Intel QuickAssist firmware'"`UNIQ--pre-000001E9-QINU`"''"`UNIQ--pre-000001EA-QINU`"''"`UNIQ--pre-000001EB-QINU`"''"`UNIQ--pre-000001EC-QINU`"'
Note
Currently loaded firmware can be assessed byuser $
dmesg | grep -i firmware
- Re-emerge sys-kernel/linux-firmware:
(chroot) root #
emerge --ask sys-kernel/linux-firmware
- After reboot, check that the correct Intel QuickAssist firmware has been loaded
user $
dmesg
user $
grep -i qat
[ 5.048628] c3xxx 0000:01:00.0 qat_dev0 started 6 acceleration engines
Configure fstab
With the use of ZFS, modifying the fstab file is not strictly needed. However, by editing /etc/fstab, an easy way to mount /boot and /boot/efi will be provided (note the noauto
option.
- Edit /etc/fstab:
(chroot) root #
vim /etc/fstab
FILE/etc/fstab
Mounting rules for /boot and /boot/efi'"`UNIQ--pre-000001F2-QINU`"''"`UNIQ--pre-000001F3-QINU`"''"`UNIQ--pre-000001F4-QINU`"''"`UNIQ--pre-000001F5-QINU`"'
Configure the Network
- Set the computer's name:
(chroot) root #
echo 'hostname="foo"' > /etc/conf.d/hostname
- Install a DHCP client:
(chroot) root #
emerge --ask net-misc/dhcpcd
Install systemd
- Edit /usr/src/linux/.config, as explained above, to enable systemd support. Tip
Working kernel configuration files, for different kernel versions, can be found here. - Update the Kernel, as explained below.
- Edit make.conf to enable systemd support:
(chroot) root #
vim /etc/portage/make.conf
FILE/etc/portage/make.conf
Setting the USE variable for systemd support'"`UNIQ--pre-000001F9-QINU`"''"`UNIQ--pre-000001FA-QINU`"''"`UNIQ--pre-000001FB-QINU`"'
Tip
A working make.conf for this system can be found here. - Update the system with systemd support:
(chroot) root #
emerge -auvDN @world && emerge --depclean && emerge @preserved-rebuild && revdep-rebuild
- Create /etc/mtab as a symlink to /proc/self/mounts:
(chroot) root #
ln -sf /proc/self/mounts /etc/mtab
- Create a machine ID:
(chroot) root #
systemd-machine-id-setup
- Create a hostname:
(chroot) root #
hostnamectl set-hostname foo
- Enable the services needed to mount ZFS filesystems automatically:
(chroot) root #
systemctl enable zfs.target
(chroot) root #
systemctl enable zfs-import-cache
(chroot) root #
systemctl enable zfs-mount
(chroot) root #
systemctl enable zfs-import.target
(chroot) root #
systemctl enable zfs-import-scan
- Create a service to import /boot automatically and enable it:
(chroot) root #
vim /etc/systemd/system/zfs-import-bpool.service
FILE/etc/systemd/system/zfs-import-bpool.service
Systemd service to automatically import /boot'"`UNIQ--pre-000001FE-QINU`"''"`UNIQ--pre-000001FF-QINU`"''"`UNIQ--pre-00000200-QINU`"''"`UNIQ--pre-00000201-QINU`"'</br>'"`UNIQ--pre-00000202-QINU`"''"`UNIQ--pre-00000203-QINU`"''"`UNIQ--pre-00000204-QINU`"''"`UNIQ--pre-00000205-QINU`"'</br>'"`UNIQ--pre-00000206-QINU`"''"`UNIQ--pre-00000207-QINU`"'
(chroot) root #
systemctl enable zfs-import-bpool.service
- Create a service to mount /home automatically and enable it:
(chroot) root #
vim /etc/systemd/system/zfskey-home.service
FILE/etc/systemd/system/zfskey-home.service
Systemd service to automatically import /home'"`UNIQ--pre-0000020A-QINU`"''"`UNIQ--pre-0000020B-QINU`"''"`UNIQ--pre-0000020C-QINU`"''"`UNIQ--pre-0000020D-QINU`"''"`UNIQ--pre-0000020E-QINU`"'</br>'"`UNIQ--pre-0000020F-QINU`"''"`UNIQ--pre-00000210-QINU`"''"`UNIQ--pre-00000211-QINU`"''"`UNIQ--pre-00000212-QINU`"'</br>'"`UNIQ--pre-00000213-QINU`"''"`UNIQ--pre-00000214-QINU`"'
(chroot) root #
systemctl enable zfskey-home.service
Install GRUB
This guide uses GRUB as a boot loader.
- Edit make.conf to install GRUB2 for the
efi-64
platform:(chroot) root #
vim /etc/portage/make.conf
FILE/etc/portage/make.conf
Setting the GRUB_PLATFORMS variable for EFI-64 platform'"`UNIQ--pre-00000217-QINU`"''"`UNIQ--pre-00000218-QINU`"''"`UNIQ--pre-00000219-QINU`"'
Tip
A working make.conf for this system can be found here. - Emerge sys-boot/grub:
(chroot) root #
emerge -auvDN sys-boot/grub
- Get GRUB to probe the /boot partition: zfs
(chroot) root #
grub-probe /boot
Warning
The above command must returnZFS
, if not, something is wrong and the system will not boot. - Add parameters to the kernel command line in order to boot from a ZFS partition:
(chroot) root #
vim /etc/default/grub
FILE/etc/default/grub
Setting the GRUB_CMDLINE_LINUX variable to boot from ZFS'"`UNIQ--pre-0000021E-QINU`"''"`UNIQ--pre-0000021F-QINU`"''"`UNIQ--pre-00000220-QINU`"'
- Create the /boot/grub directory:
(chroot) root #
mkdir /boot/grub
- Generate the GRUB configuration file:
(chroot) root #
grub-mkconfig -o /boot/grub/grub.cfg
- Check that the configuration file includes instructions to load the ZFS module: insmod zfs
(chroot) root #
grep 'insmod zfs' /boot/grub/grub.cfg
- Install the bootloader:
(chroot) root #
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=Gentoo --recheck --no-floppy
- Check if the ZFS module for GRUB has been installed: /boot/grub/x86_64-efi/zfs.mod
(chroot) root #
ls /boot/grub/*/zfs.mod
- Unmount the boot partitions:
(chroot) root #
umount /boot/efi
(chroot) root #
umount /boot
- Allow bpool/BOOT/gentoo to be managed by legacy tools, such as GRUB and the /etc/fstab:
(chroot) root #
zfs set mountpoint=legacy bpool/BOOT/gentoo
User Accounts
- Secure the root account with a strong password:
(chroot) root #
passwd
- Create a regular user:
(chroot) root #
useradd -m -G audio,cdrom,portage,usb,users,video,wheel -s /bin/bash foo
(chroot) root #
passwd foo
First ZFS snapshot
Create a first ZFS snapshot. If anythong goes wrong afterwards, it will serve as a backup of a the freshly installed system.
- Create a snapshot of the boot filesystem:
(chroot) root #
zfs snapshot bpool/BOOT/gentoo@install
- Create a snapshot of the root filesystem:
(chroot) root #
zfs snapshot rpool/ROOT/gentoo@install
- Create a snapshot of the home filesystem:
(chroot) root #
zfs snapshot rpool/ROOT/home@install
Tip
The following commands can be used to manage snapshots:- Create:
root #
zfs snapshot bpool/BOOT/gentoo@install
- List:
root #
zfs list -t all
- Rollback:
root #
zfs rollback bpool/BOOT/gentoo@install
- Clone:
root #
zfs clone bpool/BOOT/gentoo@install bpool/BOOT/gentoo@install_backup
- Rename:
root #
zfs rename bpool/BOOT/gentoo@install_backup bpool/BOOT/gentoo@original_install
- Destroy:
root #
zfs destroy bpool/BOOT/gentoo@install
- Create:
Rebooting
- Exit the chroot environment:
(chroot) root #
exit
- Unmount all mounted partitions:
root #
cd
root #
umount -l /mnt/gentoo/{dev,sys,proc,run}
root #
umount -R /mnt/gentoo/home
root #
umount -R /mnt/gentoo
- Change the mountpoint of the ZFS filesystems:
root #
zfs set mountpoint=/ rpool/ROOT/gentoo
root #
zfs set mountpoint=/home rpool/ROOT/home
- Reboot into the Gentoo environment:
root #
reboot
- Remove the downloaded stage3 files:
root #
rm /stage3-amd64-systemd-20191223.tar.bz2
- If systemd gives errors regarding the locales, run:
root #
localectl set-locale LANG=en_US.UTF-8
FUSE
- Edit /usr/src/linux/.config, as explained above, to enable FUSE support. Tip
Working kernel configuration files, for different kernel versions, can be found here. - Update the Kernel, as explained below.
- Install the userspace FUSE tools:
root #
emerge --ask sys-fs/fuse
Sudo
- Enable the
offensive
USE flag to get funny replies when typing in wrong passwords:root #
echo “app-admin/sudo offensive” >> /etc/portage/package.use/sudo
- Install sudo:
root #
emerge -auvDN app-admin/sudo
- Grant administrator privileges to all the users of the
wheel
group by editing the /etc/sudoers file:root #
visudo
FILE/etc/sudoers
Modify administrator privileges'"`UNIQ--pre-00000226-QINU`"''"`UNIQ--pre-00000227-QINU`"''"`UNIQ--pre-00000228-QINU`"'
- Enable bash completion with sudo:
root #
echo "complete -cf sudo" >> $HOME/.bashrc
- Allow X applications to be run with sudo:
user $
xhost local:root
Aspeed AST2400 Graphics
Configure the drivers for the Aspeed AST2400 Graphics.
- Edit /usr/src/linux/.config, as explained above, to enable the Aspeed AST2400 graphics support. Tip
Working kernel configuration files, for different kernel versions, can be found here. - Update the Kernel, as explained below.
- Edit make.conf to globally enable Aspeed AST2400 graphics and disable wayland support:
root #
vim /etc/portage/make.conf
FILE/etc/portage/make.conf
Setting the VIDEO_CARDS variable for Aspeed AST2400 graphics support'"`UNIQ--pre-0000022B-QINU`"''"`UNIQ--pre-0000022C-QINU`"''"`UNIQ--pre-0000022D-QINU`"''"`UNIQ--pre-0000022E-QINU`"''"`UNIQ--pre-0000022F-QINU`"'
Tip
A working make.conf for this system can be found here. - Update the system to reinstall packages with AST graphics support:
root #
emerge -auvDN @world && emerge --depclean && emerge @preserved-rebuild && revdep-rebuild
Xorg
Configure the Xorg X server.
- Edit /usr/src/linux/.config, as explained above, to enable Xorg support. Tip
Working kernel configuration files, for different kernel versions, can be found here. - Update the Kernel, as explained below.
- Edit make.conf to enable Xorg support and set the drivers for input devices:
root #
vim /etc/portage/make.conf
FILE/etc/portage/make.conf
Setting the USE variable for X support and configure INPUT_DEVICES'"`UNIQ--pre-00000233-QINU`"''"`UNIQ--pre-00000234-QINU`"''"`UNIQ--pre-00000235-QINU`"''"`UNIQ--pre-00000236-QINU`"''"`UNIQ--pre-00000237-QINU`"'
Tip
A working make.conf for this system can be found here. - Install Xorg:
root #
emerge -auvDN x11-base/xorg-server
- Update the environment settings and source the profile:
root #
env-update && source /etc/profile
- Install packages to test if the X server is working:
root #
emerge --ask x11-wm/twm x11-terms/xterm
- Install package to test if the 3D acceleration is working:
root #
emerge --ask x11-apps/mesa-progs
- Test if the X server is working:
user $
startx
- Test if the 3D acceleration is working:
user $
glxinfo | grep rendering
direct rendering: Yes
user $
glxgears
- Exit the X environment:
user $
exit
- Remove the packages installed for testing:
root #
emerge -Cav x11-wm/twm x11-terms/xterm x11-apps/mesa-progs
- Update the system to reinstall packages with X support:
root #
emerge -auvDN @world && emerge --depclean && emerge @preserved-rebuild && revdep-rebuild
NetworkManager
Configure NetworkManager support.
- Edit /usr/src/linux/.config, as explained above, to enable NetworkManager support. Tip
Working kernel configuration files, for different kernel versions, can be found here. - Update the Kernel, as explained below.
- Edit make.conf to enable NetworkManager support:
root #
vim /etc/portage/make.conf
FILE/etc/portage/make.conf
Setting the USE variable for NetworkManager support'"`UNIQ--pre-00000242-QINU`"''"`UNIQ--pre-00000243-QINU`"''"`UNIQ--pre-00000244-QINU`"'
Tip
A working make.conf for this system can be found here. - Remove the Wifi support:
root #
echo "net-misc/networkmanager -wext -wifi" >> /etc/portage/package.use/networkmanager
- Update the system to reinstall packages with NetworkManager support:
root #
emerge -auvDN @world && emerge --depclean && emerge @preserved-rebuild && revdep-rebuild
- Enable NetworkManager to be started at boot time:
root #
systemctl enable NetworkManager
GNOME Light
Install a minimal GNOME desktop environment.
- Edit make.conf to enable GNOME support:
root #
vim /etc/portage/make.conf
FILE/etc/portage/make.conf
Setting the USE variable for GNOME support'"`UNIQ--pre-00000248-QINU`"''"`UNIQ--pre-00000249-QINU`"''"`UNIQ--pre-0000024A-QINU`"'
Tip
A working make.conf for this system can be found here. - Emerge GNOME Light:
root #
emerge -auvDN gnome-base/gnome-light
- Update the environment variables and reload the environment
root #
env-update && source /etc/profile
- Verify that the
plugdev
group exists and add each GNOME user to it:root #
getent group plugdev
plugdev:x:272:
root #
gpasswd -a foo plugdev
root #
gpasswd -a root plugdev
- Enable GDM on boot:
root #
systemctl enable gdm.service
- Install GNOME tweaks and shell extensions for GNOME 3 customization:
root #
emerge -auvDN gnome-extra/gnome-tweaks gnome-extra/gnome-shell-extensions
- Provide admin privileges in system dialogs to the users in the wheel group:
root #
vim /etc/polkit-1/rules.d/49-wheel.rules
FILE/etc/polkit-1/rules.d/49-wheel.rules
Administrator wheel group'"`UNIQ--pre-00000251-QINU`"''"`UNIQ--pre-00000252-QINU`"''"`UNIQ--pre-00000253-QINU`"'
- Allow the root user to launch X window applications:
user $
vim ~/.bashrc
FILE/home/foo/.bashrc
X windows as root'"`UNIQ--pre-00000256-QINU`"''"`UNIQ--pre-00000257-QINU`"'
- Enable tap to click in GDM:
user $
xhost +SI:localuser:gdm
user $
sudo -u gdm gsettings set org.gnome.desktop.peripherals.touchpad tap-to-click true
GNOME
From the GNOME packages not installed by GNOME Light, install those that are really needed.
- Install gnome-extra/gnome-system-monitor:
root #
emerge -auvDN gnome-extra/gnome-system-monitor
- Install sys-block/gparted:
root #
echo "sys-block/gparted ~amd64" >> /etc/portage/package.accept_keywords/gparted
root #
emerge -auvDN sys-block/gparted
Chromium
Install the Chromium web browser.
- Unmask the latest Chromium ebuild:
root #
echo “www-client/chromium ~amd64” >> /etc/portage/package.accept_keywords/chromium
- Emerge Chromium:
root #
emerge -auvDN www-client/chromium
- Open Chromium in incognito mode by default:
root #
cp /usr/share/applications/chromium-browser-chromium.desktop ~/.local/share/applications/
root #
vim ~/.local/share/applications/chromium-browser-chromium.desktop
FILE/home/foo/.local/share/applications/chromium-browser-chromium.desktop
Launcher for Chromium in incognito mode'"`UNIQ--pre-00000261-QINU`"''"`UNIQ--pre-00000262-QINU`"''"`UNIQ--pre-00000263-QINU`"'
- Enable click-to-install GNOME Shell Extensions through Chromium:
- Install the required browser add-on through the Chrome store.
- Emerge the backend:
root #
emerge -auvDN gnome-extra/chrome-gnome-shell
Firefox
Install the Firefox web browser.
- Unmask the latest Firefox ebuild:
root #
echo “www-client/firefox ~amd64” >> /etc/portage/package.accept_keywords/firefox
- Emerge Firefox:
root #
emerge -auvDN www-client/firefox
- Open Firefox in incognito mode by default:
root #
cp /usr/share/applications/firefox.desktop ~/.local/share/applications/
root #
vim ~/.local/share/applications/firefox.desktop
FILE/home/foo/.local/share/applications/firefox.desktop
Launcher for Firefox in incognito mode'"`UNIQ--pre-00000269-QINU`"''"`UNIQ--pre-0000026A-QINU`"''"`UNIQ--pre-0000026B-QINU`"'
- Enable click-to-install GNOME Shell Extensions through Firefox:
- Install the required browser add-on through Add-ons for Firefox.
- Emerge the backend:
root #
emerge -auvDN gnome-extra/chrome-gnome-shell
Hardware Clock
Configure Hardware Clock support.
- Edit /usr/src/linux/.config, as explained above, to enable Hardware Clock support. Tip
Working kernel configuration files, for different kernel versions, can be found here. - Update the Kernel, as explained below.
- Check that the Hardware Clock is in use:
user $
timedatectl | grep "RTC time"
- Configure GNOME automatically update the Hardware Clock from online servers: gnome-control-center > Details > Date & Time > Automatic Date & Time (set on).
Localization
Change some language specific settings.
- Modify the keyboard layout for the console:
root #
localectl list-keymaps
root #
localectl set-keymap es
root #
localectl | grep "VC Keymap"
VC Keymap: es
- Modify the keyboard layout for the X server:
root #
localectl list-x11-keymap-layouts
root #
localectl set-x11-keymap es
root #
localectl | grep "X11 Layout"
X11 Layout: es
- Edit make.conf to enable systemwide localization:
root #
vim /etc/portage/make.conf
FILE/etc/portage/make.conf
Setting the LINGUAS and L11N variables for systemwide localization'"`UNIQ--pre-00000271-QINU`"''"`UNIQ--pre-00000272-QINU`"''"`UNIQ--pre-00000273-QINU`"''"`UNIQ--pre-00000274-QINU`"'
Tip
A working make.conf for this system can be found here. - Update the system with with systemwide localization:
root #
emerge -auvDN @world && emerge --depclean && emerge @preserved-rebuild && revdep-rebuild
Loading of CPU microcode
CPU microcode for the Intel CPU will be loaded by GRUB at boot time.
- Edit /usr/src/linux/.config, as explained above, to enable CPU microcode loading support. Tip
Working kernel configuration files, for different kernel versions, can be found here. - Update the Kernel, as explained below.
- Install the microcode firmware package and the manipulation tool:
root #
echo "sys-firmware/intel-microcode hostonly" >> /etc/portage/package.use/intel-microcode
root #
emerge -auvDN sys-firmware/intel-microcode sys-apps/iucode_tool
- Mount the /boot and /boot/efi partitions:
root #
mount /boot
root #
mount /boot/efi
- Manually generate the microcode cpio archive:
root #
iucode_tool -S --write-earlyfw=/boot/early_ucode.cpio /lib/firmware/intel-ucode/*
iucode_tool: system has processor(s) with signature 0x000506f1
iucode_tool: Writing selected microcodes to: /boot/early_ucode.cpio
Note
GRUB2 will automatically try to load any file named /boot/early_ucode.cpio. - Regenerate the GRUB configuration file:
root #
grub-mkconfig -o /boot/grub/grub.cfg
- After reboot, check that the microcode has been loaded:
root #
dmesg | grep microcode
[ 4.749506] microcode: sig=0x506f1, pf=0x1, revision=0x2e
[ 4.751567] microcode: Microcode Update Driver: v2.2.
root #
grep microcode /proc/cpuinfo
microcode : 0x2e
microcode : 0x2e
microcode : 0x2e
microcode : 0x2e
USB support
Configure support for USB devices.
- Edit /usr/src/linux/.config, as explained above, to enable USB support. Tip
Working kernel configuration files, for different kernel versions, can be found here. - Update the Kernel, as explained below.
- Install the usbutils to be able to query the USB interfaces:
root #
emerge -auvDN sys-apps/usbutils
NTFS support
Configure NTFS read and write support.
- Edit /usr/src/linux/.config, as explained above, to enable in-kernel NTFS read and FUSE write support. Tip
Working kernel configuration files, for different kernel versions, can be found here. - Update the Kernel, as explained below.
- Enable USE flags as needed:
root #
echo "sys-fs/ntfs3g ntfsdecrypt suid" >> /etc/portage/package.use/ntfs3g
- Emerge sys-fs/ntfs3g:
root #
emerge -auvDN sys-fs/ntfs3g
tmpfs support
Configure tmpfs support.
- Edit /usr/src/linux/.config, as explained above, to enable tmpfs support. Tip
Working kernel configuration files, for different kernel versions, can be found here. - Update the Kernel, as explained below.
- Systemd will automatically mount /tmp as tmpfs. Place portage's tmpdir inside /tmp:
root #
vim /mnt/gentoo/etc/portage/make.conf
FILE/etc/portage/make.conf
Setting the PORTAGE_TMPDIR variable for tmpfs use'"`UNIQ--pre-00000286-QINU`"''"`UNIQ--pre-00000287-QINU`"''"`UNIQ--pre-00000288-QINU`"'
Tip
A working make.conf for this system can be found here. - Mount as tmpfs any other appropriate directory, by using /etc/fstab:
root #
vim /etc/fstab
FILE/etc/fstab
Mounting rules for tmpfs directories'"`UNIQ--pre-0000028B-QINU`"''"`UNIQ--pre-0000028C-QINU`"''"`UNIQ--pre-0000028D-QINU`"'
ALSA and PulseAudio support
Configure ALSA and PulseAudio support.
- Edit /usr/src/linux/.config, as explained above, to enable ALSA and PulseAudio support. Tip
Working kernel configuration files, for different kernel versions, can be found here. - Update the Kernel, as explained below.
- Edit make.conf to enable ALSA and PulseAudio support:
root #
vim /etc/portage/make.conf
FILE/etc/portage/make.conf
Setting the USE variable for ALSA and PulseAudio support'"`UNIQ--pre-00000290-QINU`"''"`UNIQ--pre-00000291-QINU`"''"`UNIQ--pre-00000292-QINU`"'
Tip
A working make.conf for this system can be found here. - Update the system to reinstall packages with ALSA and PulseAudio support:
root #
emerge -auvDN @world && emerge --depclean && emerge @preserved-rebuild && revdep-rebuild
- Emerge media-sound/alsa-utils:
root #
emerge -auvDN media-sound/alsa-utils
- Add ffmpeg support to media-plugins/alsa-plugins and emerge it:
root #
echo "media-plugins/alsa-plugins ffmpeg" >> /etc/portage/package.use/alsa-plugins
root #
emerge -auvDN media-plugins/alsa-plugins
S.M.A.R.T. support
Configure S.M.A.R.T. support.
- Install sys-apps/smartmontools
root #
emerge -auvDN sys-apps/smartmontools
- Check if the device has S.M.A.R.T. support
root #
smartctl -i /dev/sda
- Print the health status of a drive
root #
smartctl -H /dev/sda
- Perform a short S.M.A.R.T. test
root #
smartctl -t short /dev/sda
- Perform a long S.M.A.R.T. test
root #
smartctl -t long /dev/sda
- Show the results of the S.M.A.R.T. tests
root #
smartctl -l selftest /dev/sda
root #
smartctl -a /dev/sda
- Print the S.M.A.R.T. error log
root #
smartctl -l error /dev/sda
Automatic S.M.A.R.T. scans
Configure the S.M.A.R.T. daemon to monitor the S.M.A.R.T. information of the drives[12]:
- Edit
/etc/smartd.conf
to perform scheduled self-tests. Modify as needed:root #
vim /etc/smartd.conf
FILE/etc/smartd.conf
Configure scheduled S.M.A.R.T. self-tests'"`UNIQ--pre-0000029D-QINU`"'#DEVICESCAN'"`UNIQ--pre-0000029E-QINU`"''"`UNIQ--pre-0000029F-QINU`"''"`UNIQ--pre-000002A0-QINU`"'
- Enable the smartd daemon:
root #
systemctl enable smartd.service
root #
systemctl start smartd.service
root #
systemctl status smartd.service
ZFS Mirrors
All of the ZFS system partitions are set in a Mirror configuration. The following steps can be performed at any point of the installation. However, if only two USB flash drives are available and one is used for the live environment, it cannot be done until the Gentoo system is bootable.
- Open GParted.
- Go to Device / Create Partition Table ... / gpt / Apply.
- Delete any partition of the USB flash drive
/dev/sdb
. - Create a new partition,
/dev/sdb1
, in the unallocated space, formatted in FAT32, named EFI system partition 2, with label ESP_2, of 128MB. - Create an unformatted partition,
/dev/sdb2
, in the unallocated space, named Gentoo-Boot-2, of 896MB. - Create an unformatted partition,
/dev/sdb3
, in the unallocated space, named Gentoo-Root-2, occupying the remaining space. - Apply all operations and exit.
- Create a Mirror with
/dev/sda2
and/dev/sdb2
:root #
zpool attach bpool /dev/disk/by-partlabel/Gentoo-Boot /dev/disk/by-partlabel/Gentoo-Boot-2
- Create a Mirror with
/dev/sda3
and/dev/sdb3
:root #
zpool attach rpool /dev/disk/by-partlabel/Gentoo-Root /dev/disk/by-partlabel/Gentoo-Root-2
- Check the status of the Zpools:
root #
zpool status
pool: bpool
state: ONLINE
status: Some supported features are not enabled on the pool. The pool can
still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
the pool may no longer be accessible by software that does not support
the features. See zpool-features(5) for details.
scan: resilvered 44.6M in 0 days 00:00:06 with 0 errors on Wed Apr 8 18:21:04 2020
config:
NAME STATE READ WRITE CKSUM
bpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
Gentoo-Boot ONLINE 0 0 0
Gentoo-Boot-2 ONLINE 0 0 0
errors: resilvered 9.18G in 0 days 01:48:42 with 0 errors on Wed Apr 8 20:10:56 2020
pool: rpool
state: ONLINE
scan: none requested
config:
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
Gentoo-Root ONLINE 0 0 0
Gentoo-Root-2 ONLINE 0 0 0
errors: No known data errors
- Scrub the Zpools:
root #
zpool scrub bpool
root #
zpool scrub rpool
- Check the status of the Zpools:
root #
zpool status
pool: bpool
state: ONLINE
status: Some supported features are not enabled on the pool. The pool can
still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
the pool may no longer be accessible by software that does not support
the features. See zpool-features(5) for details.
scan: scrub repaired 0B in 0 days 00:00:18 with 0 errors on Wed Apr 8 18:43:59 2020
config:
NAME STATE READ WRITE CKSUM
bpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
Gentoo-Boot ONLINE 0 0 0
Gentoo-Boot-2 ONLINE 0 0 0
errors: No known data errors
pool: rpool
state: ONLINE
scan: scrub repaired 0B in 0 days 00:10:42 with 0 errors on Wed Apr 8 20:33:10 2020
config:
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
Gentoo-Root ONLINE 0 0 0
Gentoo-Root-2 ONLINE 0 0 0
errors: No known data errors
RaidZ2 ZFS data pool
The ZFS data set will be in a RaidZ2 configuration. It will consist of 6x8TB hard drives. The following steps have this particularity: two currently filled up hard drives will be part of the RaidZ2 array. In order to do that, the RaidZ2 array we be created degraded, i.e. without redundancy. The data of one hard drive will be copied over, and then this hard drive will be added to the array, providing a single-drive redundancy. After this, the data of the second drive will be copied to the array, and then the hard drive will be added to the array. The rationale of this procedure is that, at the time of writing this, ZFS does not allow for array expansion[13].
A degraded ZFS RaidZ2 array does not provide data redundancy protection, and thus there is a danger of data loss. Continue at your own risk.
- The four empty hard drives will be tested with a S.M.A.R.T. test and a badblocks test: Warning
The badblocks test is destructive and will delete all the data in the hard drive.- Perform a short and a long S.M.A.R.T. test and check the results. Change
/dev/sdc
appropriately for each diskroot #
smartctl -t short /dev/sdc
root #
smartctl -t long /dev/sdc
root #
smartctl -H /dev/sdc
root #
smartctl -l selftest /dev/sdc
root #
smartctl -a /dev/sdc
root #
smartctl -l error /dev/sdc
- Perform a badblocks test. Change
/dev/sdc
appropriately for each diskWarning
The badblocks test is destructive and will delete all the data in the hard drive.root #
badblocks -wsv -b 4096 /dev/sdc
Checking for bad blocks in read-write mode
From block 0 to 1953506645
Testing with pattern 0xaa: done
Reading and comparing: done
Testing with pattern 0x55: done
Reading and comparing: done
Testing with pattern 0xff: done
Reading and comparing: done
Testing with pattern 0x00: done
Reading and comparing: done
Pass completed, 0 bad blocks found. (0/0/0 errors)
- Perform a short and a long S.M.A.R.T. test and check the results. Change
- Open GParted.
- Go to Device / Create Partition Table ... / gpt / Apply. Repeat for the four hard drives
/dev/sdc
,/dev/sdd
,/dev/sde
and/dev/sdf
. - Delete any partition of the hard drives
/dev/sdc
,/dev/sdd
,/dev/sde
and/dev/sdf
. - Create an unformatted partition
/dev/sdc1
,/dev/sdd1
,/dev/sde1
and/dev/sdf1
. in each hard drive/dev/sdc
,/dev/sdd
,/dev/sde
and/dev/sdf
respectively, in their unallocated space, named Data-1, Data-2, Data-3 and Data-4 respectively, occupying all their available space. - Apply all operations and exit.
- Create the folder where the array will be mounted
root #
mkdir /mnt/Data
root #
chmod -R 777 /mnt/Data
- Create six 7TGB sparse image files in /tmp/zfs_img/ to use as initial hard drives. This will not occupy the whole 30TB because only written areas are allocated
root #
mkdir /tmp/zfs_img
root #
truncate -s 7T /tmp/zfs_img/Data-1.img
root #
truncate -s 7T /tmp/zfs_img/Data-2.img
root #
truncate -s 7T /tmp/zfs_img/Data-3.img
root #
truncate -s 7T /tmp/zfs_img/Data-4.img
root #
truncate -s 7T /tmp/zfs_img/Data-5.img
root #
truncate -s 7T /tmp/zfs_img/Data-6.img
- Create the RaidZ2 pool with the six sparse image files, enabling autoexpand
root #
zpool create -f -o autoexpand=on \
-o ashift=12 \
-o cachefile=/tmp/zpool.cache \
-O acltype=posixacl \
-O aclinherit=passthrough \
-O atime=off \
-O canmount=off \
-O devices=off \
-O dnodesize=auto \
-O mountpoint=/ \
-O normalization=formD \
-O xattr=sa \
dpool raidz2 \
/tmp/zfs_img/Data-1.img /tmp/zfs_img/Data-2.img /tmp/zfs_img/Data-3.img \
/tmp/zfs_img/Data-4.img /tmp/zfs_img/Data-5.img /tmp/zfs_img/Data-6.img
- Replace four of the files with the four hard drives
root #
zpool replace -f dpool /tmp/zfs_img/Data-1.img /dev/disk/by-partlabel/Data-1
root #
zpool replace -f dpool /tmp/zfs_img/Data-2.img /dev/disk/by-partlabel/Data-2
root #
zpool replace -f dpool /tmp/zfs_img/Data-3.img /dev/disk/by-partlabel/Data-3
root #
zpool replace -f dpool /tmp/zfs_img/Data-4.img /dev/disk/by-partlabel/Data-4
- Take the remaining two files offline
root #
zpool offline -f dpool /tmp/zfs_img/Data-5.img
root #
zpool offline -f dpool /tmp/zfs_img/Data-6.img
- Create any ZFS dataset where the data will reside
root #
zfs create -o canmount=noauto -o compression=gzip-9 -o encryption=aes-256-gcm -o keyformat=passphrase -o keylocation=prompt -o mountpoint=/mnt/Data dpool/Data
- Check the status of the Zpool:
root #
zpool status
- Mount the ZFS dataset
root #
zfs mount dpool/Data
- Copy all the data from one of the extra, full hard drives
user $
rsync -rtOvcsP /run/media/foo/HDD/ /mnt/Data/ && rsync -rtOvcsPn /run/media/foo/HDD/ /mnt/Data/
- Scrub the Zpool:
root #
zpool scrub dpool
- Check the status of the Zpools:
root #
zpool status
pool: bpool
state: ONLINE
status: Some supported features are not enabled on the pool. The pool can
still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
the pool may no longer be accessible by software that does not support
the features. See zpool-features(5) for details.
scan: scrub repaired 0B in 0 days 00:00:01 with 0 errors on Wed Apr 29 15:14:18 2020
config:
NAME STATE READ WRITE CKSUM
bpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
Gentoo-Boot ONLINE 0 0 0
Gentoo-Boot-2 ONLINE 0 0 0
errors: No known data errors
pool: dpool
state: DEGRADED
status: One or more devices are faulted in response to persistent errors.
Sufficient replicas exist for the pool to continue functioning in a
degraded state.
action: Replace the faulted device, or use 'zpool clear' to mark the device
repaired.
scan: scrub repaired 0B in 0 days 05:21:45 with 0 errors on Wed May 6 16:30:40 2020
config:
NAME STATE READ WRITE CKSUM
dpool DEGRADED 0 0 0
raidz2-0 DEGRADED 0 0 0
Data-1 ONLINE 0 0 0
Data-2 ONLINE 0 0 0
Data-3 ONLINE 0 0 0
Data-4 ONLINE 0 0 0
/tmp/zfs_img/Data-5.img FAULTED 0 0 0 external device fault
/tmp/zfs_img/Data-6.img FAULTED 0 0 0 external device fault
errors: No known data errors
pool: rpool
state: ONLINE
scan: scrub repaired 0B in 0 days 00:04:44 with 0 errors on Wed Apr 29 15:19:05 2020
config:
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
Gentoo-Root ONLINE 0 0 0
Gentoo-Root-2 ONLINE 0 0 0
errors: No known data errors
- Perform a short and a long S.M.A.R.T. test and check the results. Change
/dev/sda
appropriatelyroot #
smartctl -t short /dev/sda
root #
smartctl -t long /dev/sda
root #
smartctl -H /dev/sda
root #
smartctl -l selftest /dev/sda
root #
smartctl -a /dev/sda
root #
smartctl -l error /dev/sda
- Perform a badblocks test. Change
/dev/sda
appropriatelyWarning
The badblocks test is destructive and will delete all the data in the hard drive.root #
badblocks -wsv -b 4096 /dev/sda
Checking for bad blocks in read-write mode
From block 0 to 1953506645
Testing with pattern 0xaa: done
Reading and comparing: done
Testing with pattern 0x55: done
Reading and comparing: done
Testing with pattern 0xff: done
Reading and comparing: done
Testing with pattern 0x00: done
Reading and comparing: done
Pass completed, 0 bad blocks found. (0/0/0 errors)
- Open GParted.
- For
/dev/sda
, go to Device / Create Partition Table ... / gpt / Apply. Change/dev/sda
appropriately. - Delete any partition of the hard drive
/dev/sda
. Change/dev/sda
appropriately. - Create an unformatted partition
/dev/sda1
in the unallocated space of/dev/sda
, named Data-5, occupying all its available space. - Apply all operations and exit.
- Replace the fifth file with the new hard drive
root #
zpool replace -f dpool /tmp/zfs_img/Data-5.img /dev/disk/by-partlabel/Data-5
- Check the status of the Zpool:
root #
zpool status
pool: bpool
state: ONLINE
status: Some supported features are not enabled on the pool. The pool can
still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
the pool may no longer be accessible by software that does not support
the features. See zpool-features(5) for details.
scan: scrub repaired 0B in 0 days 00:00:01 with 0 errors on Mon May 11 15:55:23 2020
config:
NAME STATE READ WRITE CKSUM
bpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
Gentoo-Boot ONLINE 0 0 0
Gentoo-Boot-2 ONLINE 0 0 0
errors: No known data errors
pool: dpool
state: DEGRADED
status: One or more devices are faulted in response to persistent errors.
Sufficient replicas exist for the pool to continue functioning in a
degraded state.
action: Replace the faulted device, or use 'zpool clear' to mark the device
repaired.
scan: resilvered 3.02T in 2 days 01:13:14 with 0 errors on Thu May 14 11:04:47 2020
config:
NAME STATE READ WRITE CKSUM
dpool DEGRADED 0 0 0
raidz2-0 DEGRADED 0 0 0
Data-1 ONLINE 0 0 0
Data-2 ONLINE 0 0 0
Data-3 ONLINE 0 0 0
Data-4 ONLINE 0 0 0
Data-5 ONLINE 0 0 0
/tmp/zfs_img/Data-6.img FAULTED 0 0 0 external device fault
errors: No known data errors
pool: rpool
state: ONLINE
scan: scrub repaired 0B in 0 days 00:07:03 with 0 errors on Mon May 11 16:02:30 2020
config:
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
Gentoo-Root ONLINE 0 0 0
Gentoo-Root-2 ONLINE 0 0 0
errors: No known data errors
- Scrub the Zpool:
root #
zpool scrub dpool
- Check the status of the Zpools:
root #
zpool status
pool: bpool
state: ONLINE
status: Some supported features are not enabled on the pool. The pool can
still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
the pool may no longer be accessible by software that does not support
the features. See zpool-features(5) for details.
scan: scrub repaired 0B in 0 days 00:00:01 with 0 errors on Mon May 11 15:55:23 2020
config:
NAME STATE READ WRITE CKSUM
bpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
Gentoo-Boot ONLINE 0 0 0
Gentoo-Boot-2 ONLINE 0 0 0
errors: No known data errors
pool: dpool
state: DEGRADED
status: One or more devices are faulted in response to persistent errors.
Sufficient replicas exist for the pool to continue functioning in a
degraded state.
action: Replace the faulted device, or use 'zpool clear' to mark the device
repaired.
scan: scrub repaired 0B in 0 days 06:55:52 with 0 errors on Thu May 14 18:21:25 2020
config:
NAME STATE READ WRITE CKSUM
dpool DEGRADED 0 0 0
raidz2-0 DEGRADED 0 0 0
Data-1 ONLINE 0 0 0
Data-2 ONLINE 0 0 0
Data-3 ONLINE 0 0 0
Data-4 ONLINE 0 0 0
Data-5 ONLINE 0 0 0
/tmp/zfs_img/Data-6.img FAULTED 0 0 0 external device fault
errors: No known data errors
pool: rpool
state: ONLINE
scan: scrub repaired 0B in 0 days 00:07:03 with 0 errors on Mon May 11 16:02:30 2020
config:
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
Gentoo-Root ONLINE 0 0 0
Gentoo-Root-2 ONLINE 0 0 0
errors: No known data errors
- Copy all the data from the other extra, full hard drive
user $
rsync -rtOvcsP /run/media/foo/HDD2/ /mnt/Data/ && rsync -rtOvcsPn /run/media/foo/HDD2/ /mnt/Data/
- Scrub the Zpool:
root #
zpool scrub dpool
- Check the status of the Zpools:
root #
zpool status
pool: bpool
state: ONLINE
status: Some supported features are not enabled on the pool. The pool can
still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
the pool may no longer be accessible by software that does not support
the features. See zpool-features(5) for details.
scan: scrub repaired 0B in 0 days 00:00:01 with 0 errors on Mon May 11 15:55:23 2020
config:
NAME STATE READ WRITE CKSUM
bpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
Gentoo-Boot ONLINE 0 0 0
Gentoo-Boot-2 ONLINE 0 0 0
errors: No known data errors
pool: dpool
state: DEGRADED
status: One or more devices are faulted in response to persistent errors.
Sufficient replicas exist for the pool to continue functioning in a
degraded state.
action: Replace the faulted device, or use 'zpool clear' to mark the device
repaired.
scan: scrub repaired 0B in 0 days 06:55:52 with 0 errors on Thu May 14 18:21:25 2020
config:
NAME STATE READ WRITE CKSUM
dpool DEGRADED 0 0 0
raidz2-0 DEGRADED 0 0 0
Data-1 ONLINE 0 0 0
Data-2 ONLINE 0 0 0
Data-3 ONLINE 0 0 0
Data-4 ONLINE 0 0 0
Data-5 ONLINE 0 0 0
/tmp/zfs_img/Data-6.img FAULTED 0 0 0 external device fault
errors: No known data errors
pool: rpool
state: ONLINE
scan: scrub repaired 0B in 0 days 00:07:03 with 0 errors on Mon May 11 16:02:30 2020
config:
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
Gentoo-Root ONLINE 0 0 0
Gentoo-Root-2 ONLINE 0 0 0
errors: No known data errors
- Perform a short and a long S.M.A.R.T. test and check the results. Change
/dev/sdb
appropriatelyroot #
smartctl -t short /dev/sdb
root #
smartctl -t long /dev/sdb
root #
smartctl -H /dev/sdb
root #
smartctl -l selftest /dev/sdb
root #
smartctl -a /dev/sdb
root #
smartctl -l error /dev/sdb
- Perform a badblocks test. Change
/dev/sdb
appropriatelyWarning
The badblocks test is destructive and will delete all the data in the hard drive.root #
badblocks -wsv -b 4096 /dev/sdb
Checking for bad blocks in read-write mode
From block 0 to 1953506645
Testing with pattern 0xaa: done
Reading and comparing: done
Testing with pattern 0x55: done
Reading and comparing: done
Testing with pattern 0xff: done
Reading and comparing: done
Testing with pattern 0x00: done
Reading and comparing: done
Pass completed, 0 bad blocks found. (0/0/0 errors)
- Open GParted.
- For
/dev/sdb
, go to Device / Create Partition Table ... / gpt / Apply. Change/dev/sdb
appropriately. - Delete any partition of the hard drive
/dev/sdb
. Change/dev/sdb
appropriately. - Create an unformatted partition
/dev/sdb1
in the unallocated space of/dev/sdb
, named Data-6, occupying all its available space. - Apply all operations and exit.
- Replace the sixth file with the new hard drive
root #
zpool replace -f dpool /tmp/zfs_img/Data-6.img /dev/disk/by-partlabel/Data-6
- Check the status of the Zpool:
root #
zpool status
pool: bpool
state: ONLINE
status: Some supported features are not enabled on the pool. The pool can
still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
the pool may no longer be accessible by software that does not support
the features. See zpool-features(5) for details.
scan: scrub repaired 0B in 0 days 00:00:01 with 0 errors on Wed Apr 29 15:14:18 2020
config:
NAME STATE READ WRITE CKSUM
bpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
Gentoo-Boot ONLINE 0 0 0
Gentoo-Boot-2 ONLINE 0 0 0
errors: No known data errors
pool: dpool
state: ONLINE
scan: resilvered 3.47T in 1 days 21:27:55 with 0 errors on Tue May 26 11:09:45 2020
config:
NAME STATE READ WRITE CKSUM
dpool ONLINE 0 0 0
raidz2-0 ONLINE 0 0 0
Data-1 ONLINE 0 0 0
Data-2 ONLINE 0 0 0
Data-3 ONLINE 0 0 0
Data-4 ONLINE 0 0 0
Data-5 ONLINE 0 0 0
Data-6 ONLINE 0 0 0
errors: No known data errors
pool: rpool
state: ONLINE
scan: scrub repaired 0B in 0 days 00:04:44 with 0 errors on Wed Apr 29 15:19:05 2020
config:
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
Gentoo-Root ONLINE 0 0 0
Gentoo-Root-2 ONLINE 0 0 0
errors: No known data errors
- Scrub the Zpool:
root #
zpool scrub dpool
- Check the status of the Zpools:
root #
zpool status
pool: bpool
state: ONLINE
status: Some supported features are not enabled on the pool. The pool can
still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
the pool may no longer be accessible by software that does not support
the features. See zpool-features(5) for details.
scan: scrub repaired 0B in 0 days 00:00:01 with 0 errors on Wed Apr 29 15:14:18 2020
config:
NAME STATE READ WRITE CKSUM
bpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
Gentoo-Boot ONLINE 0 0 0
Gentoo-Boot-2 ONLINE 0 0 0
errors: No known data errors
pool: dpool
state: ONLINE
scan: scrub repaired 0B in 0 days 08:33:41 with 0 errors on Tue May 26 20:26:46 2020
config:
NAME STATE READ WRITE CKSUM
dpool ONLINE 0 0 0
raidz2-0 ONLINE 0 0 0
Data-1 ONLINE 0 0 0
Data-2 ONLINE 0 0 0
Data-3 ONLINE 0 0 0
Data-4 ONLINE 0 0 0
Data-5 ONLINE 0 0 0
Data-6 ONLINE 0 0 0
errors: No known data errors
pool: rpool
state: ONLINE
scan: scrub repaired 0B in 0 days 00:04:44 with 0 errors on Wed Apr 29 15:19:05 2020
config:
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
Gentoo-Root ONLINE 0 0 0
Gentoo-Root-2 ONLINE 0 0 0
errors: No known data errors
ZFS automatic snapshots
sys-fs/zfs-auto-snapshot provides scripts used to rotate periodic snapshots through cron jobs.
- Install sys-process/cronie and sys-fs/zfs-auto-snapshot:
root #
emerge -auvDN sys-process/cronie sys-fs/zfs-auto-snapshot && emerge --depclean && emerge @preserved-rebuild && revdep-rebuild
- Disable the default cron job that would create a frequent snapshot each 15 minutes:
root #
rm /etc/cron.d/zfs-auto-snapshot
- Enable and start the cronie systemd service:
root #
systemctl enable cronie.service
root #
systemctl start cronie.service
root #
systemctl status cronie.service
- Set the
com.sun:auto-snapshot
property totrue
for each zpool of interest:root #
zfs set com.sun:auto-snapshot=true bpool/BOOT/gentoo
root #
zfs set com.sun:auto-snapshot=true rpool/ROOT/gentoo
root #
zfs set com.sun:auto-snapshot=true rpool/ROOT/home
root #
zfs set com.sun:auto-snapshot=true dpool/Data
- Enable the desired periodic auto-snaphot jobs on each pool:
root #
zfs set com.sun:auto-snapshot:hourly=true bpool/BOOT/gentoo
root #
zfs set com.sun:auto-snapshot:daily=true bpool/BOOT/gentoo
root #
zfs set com.sun:auto-snapshot:weekly=true bpool/BOOT/gentoo
root #
zfs set com.sun:auto-snapshot:monthly=true bpool/BOOT/gentoo
root #
zfs set com.sun:auto-snapshot:hourly=true rpool/ROOT/gentoo
root #
zfs set com.sun:auto-snapshot:daily=true rpool/ROOT/gentoo
root #
zfs set com.sun:auto-snapshot:weekly=true rpool/ROOT/gentoo
root #
zfs set com.sun:auto-snapshot:monthly=true rpool/ROOT/gentoo
root #
zfs set com.sun:auto-snapshot:hourly=true rpool/ROOT/home
root #
zfs set com.sun:auto-snapshot:daily=true rpool/ROOT/home
root #
zfs set com.sun:auto-snapshot:weekly=true rpool/ROOT/home
root #
zfs set com.sun:auto-snapshot:monthly=true rpool/ROOT/home
root #
zfs set com.sun:auto-snapshot:hourly=true dpool/Data
root #
zfs set com.sun:auto-snapshot:daily=true dpool/Data
root #
zfs set com.sun:auto-snapshot:weekly=true dpool/Data
root #
zfs set com.sun:auto-snapshot:monthly=true dpool/Data
- Modify the cron jobs as needed:
root #
vim /etc/cron.hourly/zfs-auto-snapshot
root #
vim /etc/cron.daily/zfs-auto-snapshot
root #
vim /etc/cron.weekly/zfs-auto-snapshot
root #
vim /etc/cron.monthly/zfs-auto-snapshot
To Do...
Aspeed IPMI in the kernel.
Fan speed:
https://wiki.archlinux.org/index.php/Fan_speed_control
3D acceleration
Xorg/Hardware_3D_acceleration_guide
Sensors
lm_sensors Lm_sensors
https://wiki.archlinux.org/index.php/S.M.A.R.T.
hddtemp https://packages.gentoo.org/packages/app-admin/hddtemp
https://wiki.archlinux.org/index.php/Hddtemp
SSH server: SSH NFS server: Nfs-utils https://wiki.archlinux.org/index.php/NFS Samba server: Samba/Guide
Update the Linux kernel
root #
mount /boot
root #
mount /boot/efi
root #
emerge --sync
root #
emerge -auvDN sys-kernel/gentoo-sources
root #
emerge --depclean
root #
emerge @preserved-rebuild
root #
revdep-rebuild
root #
eselect kernel list
root #
eselect kernel set 2
root #
cd /usr/src/linux
root #
cp /usr/src/linux-`uname -r`/.config /usr/src/linux/
root #
make syncconfig
root #
make modules_prepare
root #
make -j4
root #
make modules_install
root #
make install
root #
emerge --ask @module-rebuild
root #
genkernel initramfs --firmware --kernel-config=/usr/src/linux/.config --keymap --makeopts=-j4 --mountboot --no-clean --zfs
root #
grub-mkconfig -o /boot/grub/grub.cfg
root #
eclean-kernel -pn 2
root #
eclean-kernel -n 2
Removal of old kernels
root #
mount /boot
root #
mount /boot/efi
root #
mount /boot/efi_2
root #
emerge -Cav =sys-kernel/gentoo-sources-X.Y.Z
root #
emerge --depclean
root #
emerge @preserved-rebuild
root #
revdep-rebuild
root #
rm -r /usr/src/linux-X.Y.Z
root #
rm -r /lib/modules/X.Y.Z
root #
rm /boot/config-X.Y.Z-gentoo
root #
rm /boot/initramfs-X.Y.Z-gentoo.img
root #
rm /boot/System.map-X.Y.Z-gentoo
root #
rm /boot/vmlinuz-X.Y.Z-gentoo
root #
grub-mkconfig -o /boot/grub/grub.cfg
Troubleshooting
Gparted reporting the whole disk as a single Zpool
At the time of writing this, GParted reports the whole disk as a single Zpool when any of its partitions is formatted with ZFS[14]. This is not happening in other disk utilities such as GNOME Disks, parted or fdisk. This is due to a bug of the blkid utility, in its stable version, which wrongly reports the disk type. Updating sys-apps/util-linux to its latest version fixes this problem:
root #
echo "=sys-apps/util-linux-2.35.1-r1 ~amd64" >> /etc/portage/package.accept_keywords/util-linux
root #
emerge -auvDN sys-apps/util-linux && emerge --depclean && emerge @preserved-rebuild && revdep-rebuild
Wayland
At the time of writing this, the Aspeed AST2400 graphics does not support Wayland. If GNOME is compiled with Wayland support, the computer will freeze upon booting, before even the login screen[11].
- To fix the issue, boot in safe mode and edit
/etc/gdm/custom.conf
to disable Wayland:root #
vim /etc/gdm/custom.conf
FILE/etc/gdm/custom.conf
Disable Wayland'"`UNIQ--pre-00000413-QINU`"''"`UNIQ--pre-00000414-QINU`"''"`UNIQ--pre-00000415-QINU`"''"`UNIQ--pre-00000416-QINU`"'
- Disable Wayland support in the system:
root #
vim /etc/portage/make.conf
FILE/etc/portage/make.conf
Setting the USE variable to disable Wayland support'"`UNIQ--pre-00000419-QINU`"''"`UNIQ--pre-0000041A-QINU`"''"`UNIQ--pre-0000041B-QINU`"'
Tip
A working make.conf for this system can be found here.root #
emerge -auvDN @world && emerge --depclean && emerge @preserved-rebuild && revdep-rebuild
- Re-emerge gnome-base/gnome-desktop:
root #
emerge --ask gnome-base/gnome-desktop
See also
- Handbook:AMD64 — A handbook dedicated to installing and configuring Gentoo on the amd64 architecture., an effort to centralize documentation into a coherent handbook.
- UEFI_Dual_boot_with_Windows_7/8 — describes how to dual boot Microsoft Windows on a UEFI computer.
- Sakaki%27s_EFI_Install_Guide
- User:Bugalo/Dell_XPS_15_7590
- User:Monsieurp/Gentoo_Linux_on_ZFS
- ZFS — a next generation filesystem created by Matthew Ahrens and Jeff Bonwick.
External resources
- https://github.com/bugalo/gentoo_Supermicro_A2SDi-4C-HLN4F
- https://github.com/zfsonlinux/zfs/wiki/Debian-Buster-Root-on-ZFS
- https://wiki.archlinux.org/index.php/ZFS#GRUB-compatible_pool_creation
- https://www.funtoo.org/ZFS_as_Root_Filesystem
- https://www.reddit.com/r/zfs/comments/bnvdco/zol_080_encryption_dont_encrypt_the_pool_root/
- https://wiki.archlinux.org/index.php/ZFS
- https://github.com/zfsonlinux/zfs/issues/8810
- https://github.com/HankB/Linux_ZFS_Root/tree/master/Debian
- https://wiki.archlinux.org/index.php/ZFS#Native_encryption
References
- ↑ Connect to a wired (Ethernet) network, Official Ubuntu Documentation. Retrieved on January 22nd, 2020.
- ↑ ZFS: GRUB-compatible pool creation, ArchWiki. Retrieved on January 22nd, 2020.
- ↑ Richard Laager. Debian Buster Root on ZFS, GitHub, December 27th, 2019. Retrieved on January 23rd, 2020.
- ↑ numinit. ZoL 0.8.0 encryption: don't encrypt the pool root!, Reddit, May, 2019. Retrieved on January 23rd, 2020.
- ↑ Patrick Kennedy. The Case For Using ZFS Compression, Serve The Home, January 2nd, 2018. Retrieved on January 23rd, 2020.
- ↑ populationless. Cannot set 'bootfs' property when 'dnodesize' is set to anything but legacy #8538, GitHub, March 27th, 2019. Retrieved on January 23rd, 2020.
- ↑ Laplacian. How to choose between AES-CCM and AES-GCM for storage volume encryption, Cryptography Stack Exchange, October 2nd, 2014. Retrieved on January 23rd, 2020.
- ↑ x86 Options, GCC, the GNU Compiler Collection, October 2nd, 2014. Retrieved on January 24th, 2020.
- ↑ Thomas Deutschmann. ZFS: Change hostid handling, Gentoo Git Repositories, March 27th, 2019. Retrieved on January 24th, 2020.
- ↑ 10.0 10.1 Brian Behlendorf. zfs-0.8.0, GitHub, May 23rd, 2019. Retrieved on January 25th, 2020.
- ↑ 11.0 11.1 ASPEED AST2400 graphics failure (skewed - wrong stride) in Wayland sessions including the login screen , Ubuntu in Launchpad. Retrieved on April 8th, 2020.
- ↑ Smartd configuration example, ArchWiki. Retrieved on September 12th, 2020.
- ↑ [WIP raidz expansion, alpha preview 1], GitHub. Retrieved on April 13th, 2020.
- ↑ zfs partition wrongly shows occupying the whole disk, GNOME GitLab. Retrieved on April 7th, 2020.