User:Zulu Foxtrott/Parts/Installation/System

About fstab
Under Linux, all partitions used by the system must be listed in. This file contains the mount points of those partitions (where they are seen in the file system structure), how they should be mounted and with what special options (automatically or not, whether users can mount them or not, etc.)

The fstab file
The file uses a table-like syntax. Every line consists of six fields, separated by whitespace (space(s), tabs or a mixture). Each field has its own meaning:


 * 1) The first field shows the block special device or remote filesystem to be mounted. Several kinds of device identifiers are available for block special device nodes, including paths to device files, filesystem labels and UUIDs, and partition labels and UUIDs.
 * 2) The second field shows the mount point at which the partition should be mounted.
 * 3) The third field shows the filesystem used by the partition.
 * 4) The fourth field shows the mount options used by  when it wants to mount the partition. As every filesystem has its own mount options, users are encouraged to read the mount man page  for a full listing. Multiple mount options are comma-separated.
 * 5) The fifth field is used by dump to determine if the partition needs to be dumped or not. This can generally be left as 0 (zero).
 * 6) The sixth field is used by  to determine the order in which filesystems should be checked if the system wasn't shut down properly. Btrfs filesystems should have 0 here. On other filesystems the root filesystem should have 1 while the rest should have 2 (or 0 if a filesystem check isn't necessary).

In the remainder of the text, the partitions (and the respective block device files) outlined in the default partitioning scheme will be used. Correspondingly, the subvolumes used from this point on will be kept in line with the default Btrfs filesystem layout.

Filesystem labels and UUIDs
Both MBR (BIOS) and GPT include support for filesystem labels and filesystem UUIDs. These attributes can be defined in as alternatives for the  command to use when attempting to find and mount block devices. Filesystem labels and UUIDs are identified by the LABEL and UUID prefix and can be viewed with the command:

Because of uniqueness, readers that are using an MBR-style partition table are recommended to use UUIDs over labels to define mountable volumes in.

Partition labels and UUIDs
Users who have gone the GPT route have a couple more 'robust' options available to define partitions in. Partition labels and partition UUIDs can be used to identify the block device's individual partition(s), regardless of what filesystem has been chosen for the partition itself. Partition labels and UUIDs are identified by the PARTLABEL and PARTUUID prefixes respectively and can be viewed nicely in the terminal by running the command:

While not always true for partition labels, using a UUID to identify a partition in provides a guarantee that the bootloader will not be confused when looking for a certain volume, even if the filesystem would be changed in the future. Using the block device files for defining the partitions in  is risky for systems that are restarted often and have storage media (and thus block devices) added and removed regularly.

The naming for block device files depends on a number of factors, including how and in what order the storage devices are attached to the system. They also could show up in a different order depending on which of the devices are detected by the kernel first during the early boot process. With this being stated, unless one intends to constantly fiddle with the device ordering, using default block device files is a simple and straightforward approach.

Creating the fstab file
Create the file that once the installation is finished and the target system runs will be located at :

To successfully mount Btrfs subvolumes additionally the  mount option needs to be set and given the name of the respective subvolume that is to be mounted. Otherwise the system wouldn't take the Btrfs filesystem's structure into account and instead mount the parent volume, which in turn would render all files relevant to boot the target system inaccessible under their expected paths.

Add the rules that match the previously decided partitioning scheme and, if applicable, Btrfs filesystem structure. If other partitions or drives are used, append rules for those devices too.

Below is an elaborate example of an file, providing everything what is needed to properly bring up a system that is using the default partitioning scheme in combination with the default Btrfs filesystem layout:

To improve performance, most users would want to add the  mount option, which results in a faster system since access times aren't registered (those are not needed generally anyway). This is also recommended for solid state drive (SSD) users, who may also enable the  mount option (ext4 and btrfs only for now) which makes the   command work.

And this is what the file would have to look like following the examples given in the instructions, if the main partition has been encrypted with LUKS:

Double-check the file, save and quit to continue.

Setting a hostname
One of the choices the user has to make is name his/her system. This seems to be quite easy, but lots of users are having difficulties finding the appropriate name for their Linux system. To speed things up, know that the decision is not final - it can be changed afterwards. The example below sets the target system's hostname to tux.

Setting a temporary root password
The root Linux account is an all-powerful account, so pick a strong password. The temporary root password must be changed on first login as soon as the target system successfully booted Gentoo. This will of course be mentioned later on in the instructions again, but better set up a reminder now so no oversight will happen.

To set a temporary root password the file needs to be manipulated. For basic security reasons passwords in are not stored in plaintext, instead only hashes of the passwords are recorded.

To calculate such a hash for the password of choice the command from the  program can be used. Add the  option to use the relatively secure SHA512 algorithm.

First, will ask for the password, so type it in. While typing in the password of choice there will be no indication that any input is received, as this would allow an onlooker to record the length of the password. Press when done. Second, will ask for verification of the password, so type it in once more (as before there will be no indication that any input is received) and again conclude with pressing. Finally the hash of the password will be displayed as output:

In the example the password "gentoo" was used. It is wise not to use the same.

Init and boot configuration
Gentoo (at least when using OpenRC) uses to configure the services, startup, and shutdown of a system. Open up and enjoy all the comments in the file. Review the settings and change where needed.

Next, open to handle keyboard configuration. Edit it to configure and select the right keyboard.

Take special care with the keymap variable. If the wrong keymap is selected, then weird results will come up when typing on the keyboard.

Finally, edit to set the clock options. Edit it according to personal preference.

If the hardware clock is not using UTC, then it is necessary to set  in the file. Otherwise the system might show clock skew behavior.