223 lines
6.9 KiB
Markdown
223 lines
6.9 KiB
Markdown
---
|
|
title: Arch Linux Install guide
|
|
description:
|
|
published: true
|
|
date: 2019-11-05T23:55:19.047Z
|
|
tags:
|
|
---
|
|
|
|
# btw I install arch
|
|
|
|
> This **turbo install guide** makes a lot of assumptions on what you want and doesn't cover many real world setups. Always follow the [official wiki](https://wiki.archlinux.org/index.php/Installation_guide) if in doubt.
|
|
{.is-info}
|
|
|
|
|
|
Alternatively, check out [our installer](https://git.fosc.space/fosc/fosc-arch-installer) when it's ready.
|
|
|
|
## Partitioning
|
|
To partition disks, always use `cgdisk` unless you have a good reason not to. It's just the best, like a 🦈.
|
|
|
|
> Find the names of your disks using `lsblk`
|
|
{.is-info}
|
|
|
|
In this guide, the first SATA disk (`sda`) is used. On a modern computer, you may use `nvme0n1` or even `mmcblk0` on embedded systems.
|
|
|
|
`cgdisk /dev/sda`
|
|
|
|
Try to make it look something like:
|
|
```
|
|
/dev/sda1 200M (ef00) /boot
|
|
/dev/sda2 $REST_OF_HDD (8300) /
|
|
```
|
|
|
|
The first partition will store the bootloader and the kernel, and will be read by the UEFI to boot. The second one will contain Arch.
|
|
Format the partitions and mount them.
|
|
|
|
> On an SSD, `f2fs` is recommended instead of `ext4` for unparalled speed.
|
|
{.is-info}
|
|
|
|
|
|
```
|
|
mkfs.vfat -F 32 /dev/sda1
|
|
mkfs.ext4 /dev/sda2
|
|
|
|
mount /dev/sda2 /mnt
|
|
mkdir /mnt/boot
|
|
mount /dev/sda1 /mnt/boot
|
|
```
|
|
|
|
## Internet access
|
|
If Ethernet was plugged in during boot, it will be ready.
|
|
When plugging it after the fact, it's best to just reboot. Alternatively, run `dhcpcd`, `killall dhpcd` and run `dhcpcd` again to get an IP address.
|
|
No, that didn't make sense, but it works way too well.
|
|
|
|
> If a WiFi install is absolutely necessary, run the Arch installer-exclusive `wifi-menu` tool.
|
|
{.is-warning}
|
|
|
|
Check your internet connectivity with `ping` before continuing.
|
|
|
|
## Actual install
|
|
To install packages to a folder instead of normally, `pacstrap` is used. Here a good set of packages to get a running system is provided.
|
|
> This can also be used to fix a broken system, such as one turned off during an update, by reinstalling damaged packages.
|
|
{.is-info}
|
|
|
|
|
|
`pacstrap /mnt base base-devel linux linux-firmware f2fs-tools nano xorg-server gnome gnome-extra firefox networkmanager htop zsh grml-zsh-config`
|
|
|
|
## Chrooting
|
|
*The art of running a process as if it was in another system.*
|
|
|
|
It's time to enter the freshly installed Arch rootfs!
|
|
`arch-chroot /mnt /bin/zsh`
|
|
|
|
## Making the system bootable
|
|
Run `bootctl install`
|
|
|
|
systemd-boot will be the bootloader used. It boots entries stored at `/boot/loader/entries/` and is configured at `/boot/loader/loader.conf`.
|
|
|
|
Copy an example boot entry to the correct place and then edit it.
|
|
```
|
|
cp /usr/share/systemd/bootctl/arch.conf /boot/loader/entries/
|
|
nano /boot/loader/entries/arch.conf
|
|
```
|
|
|
|
You will need to edit the `options` line so your kernel is told where to find your Arch partition. In this guide, the file would end up like this:
|
|
```
|
|
title Arch Linux
|
|
linux /vmlinuz-linux
|
|
initrd /initramfs-linux.img
|
|
options root=/dev/sda2 rw
|
|
```
|
|
|
|
> Once this is done, your Arch install is fully bootable!
|
|
{.is-success}
|
|
|
|
However, don't reboot just yet. There are still some things to do before getting into a properly running system.
|
|
|
|
While we are in the subject of the kernel options cmdline, let's enter...
|
|
|
|
|
|
#### The PARTUUID dilemma
|
|
> Using partition names to boot instead of their unique indetifiers will cause the OS not to boot if (when) the partition count or disk order of the computer changes.
|
|
> It may change even across reboots. To avoid this issue, extract your partition's `PARTUUID` using `blkid` and edit your options line accordingly.
|
|
{.is-danger}
|
|
|
|
```
|
|
title Arch Linux
|
|
linux /vmlinuz-linux
|
|
initrd /initramfs-linux.img
|
|
options root=PARTUUID="9b505600-2d6a-3660-b0c3-d2dfd653c5fd" rw
|
|
```
|
|
|
|
> As long as your firmware doesn't change disk order randomly, **and you know what to touch if it breaks**, this step can be done later.
|
|
{.is-info}
|
|
|
|
|
|
## Configuring the system so it's usable
|
|
### Language
|
|
At least a language needs to be generated and set as the preferred system language.
|
|
```
|
|
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
|
|
echo LANG=en_US.UTF-8 > /etc/locale.conf
|
|
locale-gen
|
|
```
|
|
|
|
### Users
|
|
Change `root`'s password and its shell, then add your user and change their password too.
|
|
```
|
|
passwd
|
|
chsh root -s /bin/zsh
|
|
|
|
useradd -m -G wheel -s /bin/zsh user
|
|
passwd user
|
|
```
|
|
|
|
### Enabling services
|
|
Upon bootup, NetworkManager will manage our network interfaces and a graphical login screen provided by GDM will be shown.
|
|
```systemctl enable NetworkManager gdm```
|
|
|
|
|
|
## Restart
|
|
> And we are truly done!
|
|
{.is-success}
|
|
```
|
|
exit
|
|
reboot
|
|
```
|
|
|
|
|
|
|
|
|
|
# btw I use arch
|
|
*but it sucks, blackscreens and lasts 5 minutes on battery*
|
|
|
|
Unless some major hardware quirks are happening (damn you, NVIDIA!) you should be able to start using your computer now.
|
|
|
|
What to do now is heavily dependent on your hardware and desktop environment. A few common tips are provided.
|
|
|
|
## Time
|
|
Use the `timedatectl` tool.
|
|
|
|
```
|
|
timedatectl set-timezone Europe/Madrid
|
|
timedatectl set-ntp true
|
|
```
|
|
|
|
## I forgot to install a terminal emulator
|
|
You always have the TTYs.
|
|
|
|
Press `ctrl+alt+F4` and login normally.
|
|
|
|
## Package management
|
|
Read the [pacman rosetta](https://wiki.archlinux.org/index.php/Pacman/Rosetta).
|
|
|
|
TL;DR, `pacman -Syu thingy1 thingy2 ...` to install thingy1 and thingy2.
|
|
|
|
## sudo doesn't work
|
|
It works, you are just not allowed to run commands as root.
|
|
|
|
Login as root and edit /etc/sudoers.
|
|
`nano /etc/sudoers`
|
|
|
|
Uncomment (remove the #) from this line near the end of the file.
|
|
`# %wheel ALL=(ALL) ALL`
|
|
|
|
## Laptops
|
|
### TLP
|
|
This daemon tunes tunables inside the heavily tunable Linux kernel so you have a semblance of battery life.
|
|
|
|
Install `tlp` and enable it, which is quirky.
|
|
```
|
|
systemctl enable --now tlp tlp-sleep
|
|
systemctl mask systemd-rfkill
|
|
```
|
|
|
|
### NVIDIA Optimus
|
|
Install `nvidia` and `nvidia-utils` as normal.
|
|
|
|
These by default will hijack your screen and run everything with the NVIDIA card. The NVIDIA control panel allows you to turn the GPU off completely.
|
|
|
|
> However, this doesn't really work on some laptops, which will just blackscreen or exhibit buggy behavior.
|
|
> Plus, it drains the battery pretty much *instantly*.
|
|
{.is-warning}
|
|
|
|
Install `bumblebee` so the integrated graphics have priority and activate its service: `systemctl enable bumblebeed`.
|
|
|
|
You will need to add your user to the `bumblebee` group. Run `gpasswd -a yourusername bumblebee`.
|
|
|
|
To run programs with the NVIDIA card, run `optirun program`. For Steam games, change their executable command line to `optirun %command%`.
|
|
|
|
Finally, to allow the card to turn off completely when unused, install `bbswitch`.
|
|
> Even LESS laptops will like that. The workaround involves editing your kernel cmdline options to blacklist a little bit of Windows-specific BIOS code.
|
|
> Try adding `acpi_osi=! acpi_osi="Windows 2012"`. Try with 2009 or 2015 instead for 9xxm and 20xx series respectively if it doesn't work.
|
|
{.is-danger}
|
|
|
|
More information [can be found at the usual place](https://wiki.archlinux.org/index.php/NVIDIA_Optimus)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|