User:Zeb/install

From ArchWiki
Jump to navigation Jump to search
Install guide

My PC

Installation in UEFI mode

Connect to the Internet at install

We need a connection that works with the installer. The EDIMAX AC1200 USB (802.11ac) adapter requires a compiled module (rtl8812au) from the AUR, and therefore cannot be used during initial install. We need to use an adapter that works out of the box within the installer, either of:

  • wired Ethernet. This is the fastest and easiest way as it requires no further config.
  • a WiFi adapter that works with the kernel used in the installer, such as an EDIMAX EW-7318USg (802.11n) adapter. This will require activating the WiFi connection via wifi-menu.

Basic install

Boot 2017.05.01 install image on USB disk. Had to prevent KMS detection which does not work for my graphics card and screen combination. Press e to edit boot entry, add:

 nomodeset vga=791

At prompt:

 loadkeys uk

Activate network and connect to the internet. For wired Ethernet, it should work without issuing further command. Otherwise, for wired Ethernet use dhcpcd <name of interface> or for WiFI use wifi-menu depending on the adapter. Verify IP address and internet connection with e.g. ip addr and ping www.google.com.

 timedatectl set-ntp true

Drive partitioning:

  • Warning: First time only
    Configure NVMe SSD drive with an ESP:
 # gdisk /dev/nvme0n1
 n +512M EF00
 n +40G 8300
 n -10G 8300 <- reserved space for SSD overprovisioning
 w
 mkfs.fat -F32 /dev/nvme0n1p1
 mkfs.ext4 /dev/nvme0n1p2
 mkfs.ext4 /dev/nvme0n1p3
 mount /dev/nvme0n1p2 /mnt
 mkdir /mnt/boot
 mkdir /mnt/home
 mount /dev/nvme0n1p3 /mnt/home
 mount /dev/nvme0n1p1 /mnt/boot
  • (If reinstalling) Do not reformat /home!
 mkfs.fat -F32 /dev/nvme0n1p1
 mkfs.ext4 /dev/nvme0n1p2
 mount /dev/nvme0n1p2 /mnt
 mkdir /mnt/boot
 mkdir /mnt/home
 mount /dev/nvme0n1p3 /mnt/home
 mount /dev/nvme0n1p1 /mnt/boot

Adjust mirror for pacman at /etc/pacman.d/mirrorlist

 pacstrap /mnt base base-devel

I'll configure swap later.

 genfstab -U /mnt >> /mnt/etc/fstab
 arch-chroot /mnt
 ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime
 hwclock --systohc --utc

Uncomment en_GB.UTF-8 UTF-8, fr_FR.UTF-8 UTF8 and other needed localizations in /etc/locale.gen, and generate them with:

 locale-gen
 echo LANG=fr_FR.UTF-8 > /etc/locale.conf
 echo KEYMAP=uk > /etc/vconsole.conf

Edit and add:

/etc/vconsole.conf
...
FONT=lat1-16
FONT_MAP=
 echo arch > /etc/hostname

Add a matching line to /etc/hosts:

 127.0.1.1	arch.localdomain	arch
 pacman -Suy
 pacman -S iw wpa_supplicant dialog
 pacman -S intel-ucode
 mkinitcpio -p linux

Ignore warning missing modules aic914xx and wd719x [1]

Change root password:

 passwd

Install boot loader. We use UEFI with systemd-boot:

 bootctl --path=/boot install

Edit loader config file and entries:

/boot/loader/loader.conf
default arch
timeout 8
editor  1
/boot/loader/entries/arch.conf
title   Arch Linux
linux   /vmlinuz-linux
initrd  /intel-ucode.img
initrd  /initramfs-linux.img
options nomodeset vga=791 root=PARTUUID=034ba318-de59-4fb3-b02d-2ff5350b449d rw

Exit and reboot:

 exit
 umount -R /mnt
 reboot

Reboot

Login as root. Create user eric:

 useradd -m -G wheel -s /bin/bash eric
 passwd eric

Configure /etc/sudoers: uncomment %wheel sudo access with no password.

Adjusting fstab

To external drive partitions, add to their fstab arguments:

 ,nofail,x-systemd.device-timeout=1

Network and internet

Use the same working interface than the one used for install. For wired Ethernet use dhcpcd <name of interface> or for WiFI use wifi-menu depending on the adapter. Verify IP address and internet connection with e.g. ip addr and ping www.google.com.

Pacman

Edit /etc/pacman.conf Uncomment multilib section. Add:

 [archlinuxfr]
 SigLevel = Never
 Server = http://repo.archlinux.fr/$arch
 pacman -S yaourt

Edit /etc/yaourtrc

 DETAILUPGRADE=2
 DIFFEDITCMD="kdiff3"

Find best mirrors

 pacman -S reflector
 reflector -l 30 --sort rate --save /etc/pacman.d/mirrorlist
 pacman -S pkgfile
 pkgfile --update

Useful helper functions

 yaourt -S pkgtools

Xorg / NVIDIA

We use nvidia-dkms se that we can automatically support the linux-ck kernel later.

 pacman -S linux-headers
 pacman -S nvidia-dkms xorg-server xorg-apps nvidia-settings lib32-nvidia-utils lib32-libvdpau

Choose 1) libglvnd Reboot to use nvidia driver.

Optimise SSD

  • tmpfs

Nothing to do: automatically in RAM with systemd.

  • I/O scheduler
Note: Not necessary at this stage. This is for info only, we will switch to BFQ with linux-ck kernel as explained below

To change the default scheduler, create:

/etc/udev/rules.d/60-schedulers.rules
# set deadline scheduler for non-rotating disks
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="deadline"

Of course, set Deadline/CFQ to the desired schedulers. Changes should occur upon next boot. To check success of the new rule:

$ cat /sys/block/sdX/queue/scheduler  # where X is the device in question
  • enable periodic TRIM
 systemctl enable fstrim.timer
 systemctl start fstrim.timer
  • build PKGs in tmp

In /etc/makepkg.conf:

 #BUILDDIR=/tmp/makepkg <- don't uncomment if using yaourt, which has its own /tmp/yaourt-* folder
 MAKEFLAGS="-j$(nproc)"
  • profile-sync-daemon
 yaourt -S profile-sync-daemon

Configure it for browsers (Firefox, Chrome, etc).

 yaourt -S google-chrome firefox firefox-i10n-fr
 psd

Edit psd.conf if required.

 $ psd
 # systemctl --user start psd
 # systemctl --user enable psd

Tools for NVMe drive:

 yaourt -S nvme-cli

Optimise HDD

/etc/udev/rules.d/50-hdparm.rules
# set the Advanced Power Management feature for the ST4000DM000 HDD
ACTION=="add", SUBSYSTEM=="block", KERNEL=="sdc", RUN+="/usr/bin/hdparm -B 254 -S 0 /dev/sdc"

KDE

 pacman -S sddm
 systemctl enable sddm

To use a Samsung TV, it is good to ignore EdidDpi, use /etc/X11/xorg.conf.d/20-nvidia.conf with

 Option         "UseEdidDpi" "False"
 Option         "DPI" "96 x 96"

as such:

/etc/X11/xorg.conf.d/20-nvidia.conf
...
Section "Monitor"
    # HorizSync source: edid, VertRefresh source: edid
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "SAMSUNG"
    HorizSync       26.0 - 81.0
    VertRefresh     24.0 - 75.0
    Option         "DPMS"
    Option         "UseEdidDpi" "False"
    Option         "DPI" "96 x 96"
EndSection
...
 systemctl start sddm

For the moment, image is huge, but fonts are better than without 20-nvidia.conf.

 pacman -S plasma-meta

Then in plasma, go to System Settings -> Startup -> SDDM and change theme to Breeze (or Brise if in French).

 pacman -S kde-applications-meta

Choose 1) cronie

 pacman -S kde-l10n-fr

To have nm applet in KDE:

 systemctl enable NetworkManager
 systemctl start NetworkManager

Note that NetworkManager service interferes with netctl or systemd-networkd and makes the 5G adapter not working if NetworkManager is not configured yet. Stop NetworkManager if it has not been yet configured to be able to connect in console.

Once NetworkManager is used you should disable netctl or systemd-networkd profile:

 # netctl disable [INTERFACE_NAME]

In KDE, set regionalisation. For GTK2 and 3 appearance, choose Breeze.

VPN

To configure VPN in plasma-nm:

 yaourt -S networkmanager-openvpn

and reboot.

Other packages

Video discs support

 yaourt -S libbdplus libdvdcss
 yaourt -S ttf-bitstream-vera-sans
 yaourt -S ttf-liberation
 yaourt -S ttf-linux-libertine
 yaourt -S abs

Games - use steam-native and steam-native-runtime in case Steam crashes due to library conflicts.

 yaourt -S steam steam-fonts sc-controller-git
 yaourt -S steam-native steam-native-runtime

Sound with PlayOnLinux (e.g. Skyrim):

 yaourt -S playonlinux lib32-openal

lm_sensors

 yaourt -S lm_sensors

ASUS Maximus VIII Gene: need to modprobe nct6775?

As root:

 sensors-detect

Use default options.

WiFi 5G

Using wired Ethernet or the 802.11n WiFi USB adapter used previously, install the 8812au drivers:

 yaourt -S rtl8812au-dkms-git

Plug in the EDIMAX USB AC1200 adapter. Activate using NetworkManager (e.g. under KDE). Do not use other daemons such as systemd-networkd and NetworkManager at the same time! See Network_configuration#Network_managers and Wireless_network_configuration.

Swap and swappiness

 fallocate -l 8G /mnt/sdb1/swapfile
 chmod 600 /mnt/sdb1/swapfile
 mkswap /mnt/sdb1/swapfile
 swapon /mnt/sdb1/swapfile

Finally, edit /etc/fstab to add an entry for the swap file:

 /mnt/sdb1/swapfile none swap defaults 0 0

Create and edit:

/etc/sysctl.d/99-sysctl.conf
vm.swappiness=1
vm.vfs_cache_pressure=50

Bluetooth

 yaourt -S bluez-firmware bluez-utils
 yaourt -S pulseaudio-bluetooth
 systemctl enable bluetooth
 systemctl start bluetooth

Preload

 yaourt -S preload
 sudo systemctl enable preload
 sudo systemctl start preload

NTP

 yaourt -S ntp
 sudo systemctl start ntpd
 sudo systemctl enable ntpd

WiFi revisited

Recently, plugging the EDIMAX USB AC1200 lead to the creation of interface wlp0s26f7u3 instead of enp0s26f7u3 (same than using the Edimax EW-7318USg). Disabling all of systemd-networkd and associated wpa_supplicant@ services and keeping NetworkManager service solves the problem entirely, but logging into KDE and entering the KWallet password is required.

Switch to linux-ck kernel

Use nvidia-dkms.

 yaourt -S linux-ck-headers

Import keys signing the kernels

 # pacman-key -r 79BE3E4300411886
 # pacman-key -r 38DBBDC86092693E
 yaourt -S linux-ck

Select either of:

 22. Intel Skylake (MSKYLAKE) (NEW)
 choice[1-24?]: 22

or

 24. optimizations autodetected by GCC (MNATIVE) (NEW)
 choice[1-24?]: 24
 Support for P6_NOPs on Intel chips (X86_P6_NOP) [N/y/?] (NEW) y

Edit boot entries:

/boot/loader/loader.conf
default arch-ck
timeout 8
editor  1
/boot/loader/entries/arch-ck.conf
title   Arch Linux CK kernel
linux   /vmlinuz-linux-ck
initrd  /intel-ucode.img
initrd  /initramfs-linux-ck.img
options nomodeset vga=791 root=PARTUUID=034ba318-de59-4fb3-b02d-2ff5350b449d rw

and

/boot/loader/entries/arch-ck-bfq.conf
title   Arch Linux CK kernel with BFQ
linux   /vmlinuz-linux-ck
initrd  /intel-ucode.img
initrd  /initramfs-linux-ck.img
options scsi_mod.use_blk_mq=1 nvidia-drm.modeset=1 vga=791 root=PARTUUID=034ba318-de59-4fb3-b02d-2ff5350b449d rw


BFQ I/O scheduler will be the default for all drives. There is nothing to do, so comment out any scheduler setting we previously created:

/etc/udev/rules.d/60-schedulers.rules
# set deadline scheduler for non-rotating disks
#ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="deadline"

Since ck patch for kernel 4.12 you need to force BFQ:

/etc/udev/rules.d/60-schedulers.rules
# set deadline scheduler for all disks
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/scheduler}="bfq"

Reboot.

Add a subnet to connect a NAS directly to PC and share Wifi internet

/etc/sysctl.d/30-ipforward.conf
net.ipv4.ip_forward=1
net.ipv6.conf.default.forwarding=1
net.ipv6.conf.all.forwarding=1

First time:

# cp /etc/iptables/empty.rules /etc/iptables/iptables.rules

Then start the iptables.service unit. As with other services, if you want iptables to be loaded automatically on boot, you must enable it.

iptables rules for IPv6 are, by default, stored in /etc/iptables/ip6tables.rules, which is read by ip6tables.service. You can start it the same way as above.

Create rules:

# iptables -t nat -A POSTROUTING -o wlp0s20f0u8u4 -j MASQUERADE
# iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
# iptables -A FORWARD -i enp0s31f6 -o wlp0s20f0u8u4 -j ACCEPT

Save them to apply at boot:

# iptables-save > /etc/iptables/iptables.rules

Then create a class A network on the PC with

 static address 10.0.0.1 mask 255.0.0.0 gw 0.0.0.0

And configure NIC on NAS:

 static address 10.0.0.2 mask 255.0.0.0 gw 10.0.0.1 with DNS 192.168.1.1 or 8.8.8.8

See Internet sharing and iptables for more info.

To access class A from 192.168.1.x network, add a static route in the router R7000 config:

 destination 10.0.0.0/8 gw 192.168.1.107 (the IP of the PC), Metric 2.

Annexes

UEFI install testing

UEFI_install

Storage devices and partitioning

With parted:

(parted) print devices                                                    
  /dev/sda (512GB)
  /dev/sdb (1000GB)
  /dev/sdc (4001GB)
  /dev/nvme0n1 (256GB)

$ LANG=C sudo parted <<<'unit MiB print all'
GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) unit MiB print all                                               
Model: ATA Samsung SSD 850 (scsi)
Disk /dev/sda: 488386MiB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start     End        Size       File system  Name                 Flags
 1      1.00MiB   513MiB     512MiB                  BIOS boot partition  bios_grub
 2      513MiB    41473MiB   40960MiB   ext4         Linux filesystem
 3      41473MiB  439552MiB  398079MiB  ext4         Linux filesystem


Model: ATA HGST HTS721010A9 (scsi)
Disk /dev/sdb: 953870MiB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start      End        Size       File system  Name  Flags
 1      1.00MiB    830989MiB  830988MiB  ext4
 2      830989MiB  953869MiB  122880MiB  ntfs               msftdata


Model: ATA ST4000DM000-1F21 (scsi)
Disk /dev/sdc: 3815448MiB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start    End         Size        File system  Name  Flags
 1      1.00MiB  3815447MiB  3815446MiB  ext4


Warning: Unable to open /dev/sr0 read-write (Read-only file system).  /dev/sr0 has been opened
read-only.
Error: /dev/sr0: unrecognised disk label
Model: HL-DT-ST BD-RE BH10LS30 (scsi)                                     
Disk /dev/sr0: 4192MiB
Sector size (logical/physical): 2048B/2048B
Partition Table: unknown
Disk Flags: 

Model: Unknown (unknown)
Disk /dev/nvme0n1: 244198MiB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start     End        Size       File system  Name              Flags
 1      1.00MiB   513MiB     512MiB     fat32        EFI System        boot, esp
 2      513MiB    41473MiB   40960MiB   ext4         Linux filesystem
 3      41473MiB  233985MiB  192512MiB  ext4         Linux filesystem


With fdisk:

$ LANG=C sudo fdisk -l
Disk /dev/nvme0n1: 238.5 GiB, 256060514304 bytes, 500118192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 551CE15D-33F0-4043-A475-FD9F19249B1D

Device            Start       End   Sectors  Size Type
/dev/nvme0n1p1     2048   1050623   1048576  512M EFI System
/dev/nvme0n1p2  1050624  84936703  83886080   40G Linux filesystem
/dev/nvme0n1p3 84936704 479201279 394264576  188G Linux filesystem


Disk /dev/sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 68B46F5C-4EAC-4F6B-A479-211AFB91CA82

Device          Start        End    Sectors   Size Type
/dev/sdb1        2048 1701865471 1701863424 811.5G Linux filesystem
/dev/sdb2  1701865472 1953523711  251658240   120G Microsoft basic data


Disk /dev/sda: 477 GiB, 512110190592 bytes, 1000215216 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 52D59049-F1D2-4C37-996A-A853A0E0C320

Device        Start       End   Sectors   Size Type
/dev/sda1      2048   1050623   1048576   512M BIOS boot
/dev/sda2   1050624  84936703  83886080    40G Linux filesystem
/dev/sda3  84936704 900202495 815265792 388.8G Linux filesystem


Disk /dev/sdc: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: FB170288-F674-4B77-AF34-8E3ED7A5B4B0

Device     Start        End    Sectors  Size Type
/dev/sdc1   2048 7814035455 7814033408  3.7T Linux filesystem

Final fstab

# 
# 
# /etc/fstab: static file system information
#
# <file system> <dir>   <type>  <options>       <dump>  <pass>

# /dev/nvme0n1p2
UUID=127d6fdd-0cf1-4fe9-aaad-2b22a1e0b83c       /               ext4            rw,relatime,data=ordered        0 1

# /dev/nvme0n1p1
UUID=03EC-A664          /boot           vfat            rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro    0 2

# /dev/nvme0n1p3
UUID=f21cb979-119e-487c-bc02-c955e0c6e85e       /home           ext4            rw,relatime,data=ordered        0 2

# efivarfs
efivarfs                /sys/firmware/efi/efivars       efivarfs        rw,nosuid,nodev,noexec,relatime 0 0

# /dev/sda3
UUID=c20a194f-5e65-458a-b502-5f4b9a7a819e       /mnt/sda3       ext4            rw,relatime,data=ordered        0 2

# /dev/sda2
UUID=e07245b9-6a7a-442e-ad70-26e7a08bfd2f       /mnt/sda2       ext4            rw,relatime,data=ordered        0 2

# /dev/sdb1
UUID=aea63989-3e6e-4b28-9a34-d8d670b5b802       /mnt/sdb1       ext4            rw,relatime,data=ordered        0 2

# /dev/sdb2
UUID=32D88D617B391DC2   /mnt/sdb2       ntfs            rw,relatime,uid=0,gid=0,fmask=0177,dmask=077,nls=utf8,errors=continue,mft_zone_multiplier=1     0 0

# /dev/sdc1
UUID=93d7f6a7-f718-47d8-8429-89b1647c93ec       /mnt/bigdata    ext4            rw,relatime,data=ordered        0 2

# swap file
/mnt/sdb1/swapfile      none            swap            defaults        0 0

Setting up WiFi with systemd

Note: This is for information only. The preferred method (as above) uses NetworkManager which was painless with the 5GHz adapter.
Warning: Use only one network manager daemon at a time, they are mutually exclusive since several daemons running at the same time may lead to blocking interface activation. See Network_configuration#Network_managers. Before using other managers (e.g. netctl via wifi-setup) type:
 # systemctl stop NetworkManager
 ip link

indicates wireless interface is named wlp0s26f7u3.

 wpa_passphrase NETGEAR41 <password> > /etc/wpa_supplicant-wlp0s26f7u3.conf
 nano /etc/systemd/network/wireless.network
 [Match]
 Name=wlp0s26f7u3
 
 [Network]
 DHCP=ipv4
 systemctl start systemd-networkd
 systemctl start wpa_supplicant@wlp0s26f7u3

You can verify with dhcpcd that an IP is received (use ip -a to check).

To make it persistent:

 systemctl enable systemd-networkd
 systemctl enable wpa_supplicant@wlp0s26f7u3


Same example for the 5GHz adapter:

 ip link

indicates wireless interface is named enp0s26f7u3.

 wpa_passphrase NETGEAR41-5G <password> > /etc/wpa_supplicant-enp0s26f7u3.conf
 nano /etc/systemd/network/wireless5g.network
 [Match]
 Name=enp0s26f7u3
 
 [Network]
 DHCP=ipv4
 systemctl start systemd-networkd
 systemctl start wpa_supplicant@enp0s26f7u3

You can verify with dhcpcd that an IP is received (use ip -a to check).

To make it persistent:

 systemctl enable systemd-networkd
 systemctl enable wpa_supplicant@enp0s26f7u3