guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Review of installation manual draft


From: Petter
Subject: Review of installation manual draft
Date: Wed, 27 Jan 2016 20:21:11 +0100

Hi,

During the last week on IRC a few of us have been putting together a proposal for updating the GuixSD installation instructions in the manual. It was initially intended to be a guide for how to install GuixSD with encrypted root to the Libreboot site; but as the steps are generic, and the GuixSD manual doesn't address this we thought we'd make a proposal here instead. The instructions for encrypted root are quite detailed, and to try and keep the entire installation manual in the same vein, other steps have been redone with detailed, step for step, instructions. Which will hopefully make it easier for less experienced users to get GuixSD up and running, with or without encryption.

First of all we'd like to know if there are any major issues/objections with this proposal, issues that would result in restructuring, or even that we drop it altogether. Better we know now before going into polish mode. We're also very interested in comments and suggestions to make it better of course.

Current issues:
- typing in the mapped-devices field perfectly is error-prone, maybe put a commented out mapped-devices field in the example configuration instead and the manual will say to enable it for users opting for encryption. - it would be nice to print a list of available layouts for the loadkeys command. Please let me know if you know how to do this.
 - maybe elaborate on how to use cfdisk and/or similar tools

Ideas:
- maybe it would be good to use a dedicated bare-bones config for (1) fully encrypted, (2) encrypted root without /boot, (3) encrypted /home, (4) unencrypted; to get people up and running quickly, then add desktop environment etc. in a post-installation document.

Thanks,
Petter

------------------current draft-------------------------------

7.1.3 Booting the installation image
Once you have successfully booted the image on the USB stick, you should end up with a root prompt. Several console TTYs are configured and can be used to run commands as root. TTY2 shows this documentation, browsable using the Info reader commands (see Help in Info: An Introduction).



7.1.3.1 Keyboard
The installation image uses the US Qwerty keyboard layout. To change you can use the "loadkeys" command with your preferred layout. Example <layout>: "dvorak".
# loadkeys <layout>



7.1.3.2 Network
Run this to see what your network interfaces are called:
# ifconfig -a

To configure the network run this command, substituting <network-interface> with the one you want to use. Example <network-interface>: "eno1".
# ifconfig <network-interface> up && dhclient <network-interface>

Try to ping a server to see if a connection was established. For example, gnu.org.
# ping -c 3 gnu.org

If ping fails with a `ping: unknown host` error, first check if there is an issue with your cable. If not, try to restart nscd.
# deco restart nscd





7.1.4 Preparing the disk
First you need to decide if you want encrypted root or not. If you're going for unencrypted skip to the next paragraph. For encrypted root you need to figure out if you can have /boot encrypted or not. For /boot to be encrypted you need boot firmware with an embedded boot loader, such as Coreboot/Libreboot. Otherwise you'll need to leave /boot unencrypted, in this case create a separate partition for it. 100 MB should be enough, make it type "Linux (83)".

Your main partition will be where you install root (/). If you're going to install a desktop this partition should be at least 15 GB. Make it use the rest of your disk (after potentially making a boot partition) if you don't know how large to make it. Make it type "Linux (83)"



7.1.4.1 Disk partitioning
Before proceeding with partitioning you need to be sure about the device name of the disk you're installing to. Example "/dev/sda"
For partitioning there are several tools available, cfdisk is one.
# cfdisk /dev/<disk>

If you went for unencrypted we'll refer to your root partition as "<your-root-partition>". If you went for encrypted we'll refer to your encrypted root partition as "<your-encrypted-root-partition>". Any separate partition for /boot will be referred to as "<your-boot-partition>".
Typical value: "sda1".



7.1.4.2 Disk encryption
Skip this chapter if you're not doing encrypted root.

Encrypt the encrypted partition with LUKS, using your favorite cryptsetup invocation, for example: # cryptsetup -v --cipher serpent-xts-plain64 --key-size 512 --hash whirlpool --use-random --verify-passphrase luksFormat /dev/<your-encrypted-root-partition>

Open the LUKS partition. You can verify its effect by doing "ls /dev/mapper" before and after this command, on success a "guixsd" file will appear.
# cryptsetup luksOpen /dev/<your-encrypted-root-partition> guixsd

We'll later refer to your mapped device (f.ex. "mapper/guixsd") as "<your-root-partition>".



7.1.4.3 Filesystem and mount
Make a filesystem, f.ex. ext4. For unencrypted root you can use the "-L" flag, with a string argument, to create a label for later reference.
# mkfs.ext4 /dev/<your-root-partition>

Mount it under /mnt
# mount /dev/<your-root-partition> /mnt

Run this command to make /gnu/store copy-on-write, such that packages added to it during the installation phase will be written to the target disk rather than kept in memory.
# deco start cow-store /mnt

Create the /etc on your mounted partition
# mkdir /mnt/etc





7.1.5 Preparing the configuration file
Now we're going to prepare the configuration file. There are two example configuration files available in the live image, located in /etc/configuration.
"bare-bones.scm" is a minimal configuration with no X11 display server.
"desktop.scm" will install some desktop environments.
Even if you want a desktop eventually you can start with "bare-bones.scm"; and once you're able to boot properly add X11 and desktop environments etc. to your configuration and reconfigure your system. This will save you time if you run into problems and need to install GuixSD again.
# cp /etc/configuration/bare-bones.scm /mnt/etc/config.scm

Now we'll open and modify the configuration file. The live image comes with two text editors: GNU nano (see GNU nano Manual), and GNU Zile, an Emacs clone. Open your configuration file with one of them.
# zile /mnt/etc/config.scm

We'll do the updates in turn from top to bottom. you'll recognize some of the crypto steps from earlier, but note that previously we've been setting up the partition for the installation. These steps gives instructions to be used when booting the system.

Adjust "host-name", "timezone" and "locale" to your wishes. If you're going to change locale you should check what is available and exactly how it is typed; close the editor or change virtual console (Ctrl-Alt-F#), and run the command "locale -a".

Update "device" in the bootloader field to "/dev/<disk>". This will instruct the installation to install GRUB to the MBR of your disk. This is fine even if you're going to use the boot loader in your boot firmware, it will just be unused in this case.



7.1.5.1 Special configuration for encrypted root
Skip this chapter if you're doing unencrypted root.

For encrypted root setups we need to add some lines to the configuration with instructions on how do decrypt your partition during boot. Add the "mapped-devices" field below to your your operating-system declaration. (If that last sentence didn't make much sense: Insert the code snippet below between the lines (bootloader ...) and (file-systems ...))
Make sure to update the following fields:
"source", the device name of your encrypted partition. Example "/dev/sda1" "target", a name you make up that will appear in /dev/mapper/ after decryption. We'll later refer to this as "<target-name>". Example "guixsd".
   (mapped-devices (list (mapped-device
     (source "/dev/<your-encrypted-partition>")
     (target "<target-name>")
     (type luks-device-mapping))))

Moving on to the file-systems field, update these two fields:
"device", set this value to "/dev/mapper/<target-name>". Example "/dev/mapper/guixsd" "title", change this value to "'device". (Makes the "device" field be interpreted as a file name rather than a partition label name)

*****TODO: Unencrypted /boot*****



7.1.5.2 Special configuration for unencrypted root
Skip this chapter if you're doing encrypted root.

In the file-systems field, update this field:
"device", set this value to the label you made when you created the filesystem. Example "my-root"



7.1.5.3 Finishing up the configuration
And finally, update the values in the "users" field.
"name", the username.
"comment", you can set this to the name of the user.
"home-directory", set this to "/home/<username>".

This concludes the updates to the configuration file and the preparation for installation.





7.1.6 Installation
What remains now is to actually install the system. First run this command to get up to speed with the project's progress since this installer was created.
# guix pull

Then run this command to initialize the system based on the configuration file you've prepared.
# guix system init /mnt/etc/config.scm /mnt

This will copy all the necessary files, and install GRUB on /dev/<disk>, unless you pass the --no-grub option. For more information, see Invoking guix system. This command may trigger downloads or builds of missing packages, which can take some time.

Once that command has completed—and hopefully succeeded!—you can run reboot and boot into the new system. The root password in the new system is initially empty; other users’ passwords need to be initialized by running the passwd command as root, unless your configuration specifies otherwise (see user account passwords).

Join us on #guix on the Freenode IRC network or on address@hidden to share your experience—good or not so good.





ADDENDUM #1
Manual steps to boot your fully encrypted system from an embedded GRUB.
Press "c" in GRUB to enter command mode.

First find the partition here which corresponds to your /dev/<disk> from earlier. For example "/dev/sda1" on GPT will be "ahci0,gpt1"
# ls

Now decrypt it, <grub-partition> is the partition you found in the previous step. Don't use quotes.
# cryptomount <grub-partition>

Load GuixSD's GRUB configuration file
# configfile (crypto0)/boot/grub/grub.cfg





ADDENDUM #2
When you're ready to update the GRUB configuration file in your boot firmware you can base them off of these examples. Values to update:
"cryptomount" (there's one in both menu entries).
"--root" flag, to point to "/dev/<your-root-partition>". Example "/dev/mapper/guixsd".

menuentry "GuixSD (current)" {
  cryptomount <grub-partition>
  set root=(crypto0)
  set guix_system=/var/guix/profiles/system
linux ${guix_system}/kernel/bzImage --root=/dev/<your-root-partition> --system=${guix_system} --load=${guix_system}/boot
  initrd ${guix_system}/initrd
}

menuentry "GuixSD fallback" {
  cryptomount <grub-partition>
  configfile (crypto0)/boot/grub/grub.cfg
}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]