wiki/Archguide.md

239 lines
7.8 KiB
Markdown
Raw Permalink Normal View History

2019-04-23 02:14:47 +00:00
---
title: Arch Linux Install guide
description:
published: true
2020-03-19 05:25:07 +00:00
date: 2020-03-19T05:25:06.772Z
2019-04-23 02:14:47 +00:00
tags:
---
2019-11-05 23:03:28 +00:00
# btw I install arch
2019-04-23 02:14:47 +00:00
2019-11-05 23:03:28 +00:00
> 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}
2019-04-23 02:14:47 +00:00
2019-11-05 23:03:28 +00:00
Alternatively, check out [our installer](https://git.fosc.space/fosc/fosc-arch-installer) when it's ready.
2019-06-01 21:39:25 +00:00
2019-04-23 02:14:47 +00:00
## Partitioning
2019-11-05 23:03:28 +00:00
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}
2019-04-23 02:14:47 +00:00
2019-11-05 23:03:28 +00:00
In this guide, the first SATA disk (`sda`) is used. On a modern computer, you may use `nvme0n1` or even `mmcblk0` on embedded systems.
2019-04-23 02:14:47 +00:00
2019-11-05 23:03:28 +00:00
`cgdisk /dev/sda`
Try to make it look something like:
```
2019-04-23 02:14:47 +00:00
/dev/sda1 200M (ef00) /boot
/dev/sda2 $REST_OF_HDD (8300) /
2019-11-05 23:03:28 +00:00
```
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}
2019-04-23 02:14:47 +00:00
2019-06-01 21:39:25 +00:00
```
mkfs.vfat -F 32 /dev/sda1
mkfs.ext4 /dev/sda2
2019-04-23 02:14:47 +00:00
2019-06-01 21:39:25 +00:00
mount /dev/sda2 /mnt
mkdir /mnt/boot
mount /dev/sda1 /mnt/boot
```
2019-04-23 02:14:47 +00:00
2019-11-05 23:07:40 +00:00
## 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.
2019-04-23 02:14:47 +00:00
## Actual install
2019-11-05 23:07:40 +00:00
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.
2019-11-05 23:46:28 +00:00
> This can also be used to fix a broken system, such as one turned off during an update, by reinstalling damaged packages.
{.is-info}
2019-04-23 02:14:47 +00:00
2019-11-05 23:46:28 +00:00
`pacstrap /mnt base base-devel linux linux-firmware f2fs-tools nano xorg-server gnome gnome-extra firefox networkmanager htop zsh grml-zsh-config`
2019-04-23 02:14:47 +00:00
2019-11-05 23:46:28 +00:00
## Chrooting
*The art of running a process as if it was in another system.*
2019-04-23 02:14:47 +00:00
2019-11-05 23:46:28 +00:00
It's time to enter the freshly installed Arch rootfs!
2019-06-01 21:39:37 +00:00
`arch-chroot /mnt /bin/zsh`
2019-04-23 02:14:47 +00:00
2019-11-05 23:46:28 +00:00
## 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.
2019-11-13 08:17:08 +00:00
There is a [big caveat](https://doc.fosc.space/Archguide#the-partuuid-dilemma) here which is good to read.
2019-11-05 23:46:28 +00:00
## Configuring the system so it's usable
### Language
At least a language needs to be generated and set as the preferred system language.
2019-06-01 21:39:25 +00:00
```
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
echo LANG=en_US.UTF-8 > /etc/locale.conf
2019-04-23 02:14:47 +00:00
locale-gen
2019-06-01 21:39:25 +00:00
```
2019-04-23 02:14:47 +00:00
2019-11-05 23:46:28 +00:00
### Users
Change `root`'s password and its shell, then add your user and change their password too.
2019-06-01 21:39:25 +00:00
```
2019-04-23 02:14:47 +00:00
passwd
chsh root -s /bin/zsh
useradd -m -G wheel -s /bin/zsh user
passwd user
2019-06-01 21:39:25 +00:00
```
2019-04-23 02:14:47 +00:00
2019-11-05 23:46:28 +00:00
### Enabling services
Upon bootup, NetworkManager will manage our network interfaces and a graphical login screen provided by GDM will be shown.
2019-06-01 21:39:25 +00:00
```systemctl enable NetworkManager gdm```
2019-04-23 02:14:47 +00:00
2019-11-05 23:46:28 +00:00
## 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.
2019-11-06 00:08:58 +00:00
Press <kbd>ctrl</kbd>+<kbd>alt</kbd>+<kbd>F4</kbd> and login normally.
2019-11-05 23:46:28 +00:00
## 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.
2019-11-05 23:52:02 +00:00
## sudo doesn't work
2019-11-06 00:04:21 +00:00
It works, you are just not allowed to use it.
2019-11-05 23:52:02 +00:00
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`
2019-11-06 00:02:34 +00:00
## Connecting to wifi via cli
Use `nmtui` to control NetworkManager from a terminal.
2019-11-06 00:03:51 +00:00
## Bluetooth doesn't even exist
Install `bluez` and `bluez-utils` and enable the service `systemctl enable --now bluetooth`.
Bluetooth audio needs `pulseaudio-bluetooth`.
When using a minimal desktop environment you can try some of the applets such as `blueman` or `gnome-bluetooth` to control it.
## Audio in general
Always install `pavucontrol` to completely manage your audio needs.
Mics by default come muted. Unmute it and/or boost it.
A similar deal happens with bluetooth audio, by default it runs on basically analog phone emulation mode.
Change to high quality audio profile to not **instantly die** upon music playback.
## Battery life is nonexistent
The TLP daemon tunes tunables inside the heavily tunable Linux kernel so you have a semblance of battery life.
2019-11-06 00:05:29 +00:00
You can also install it in normal desktops and it makes some difference in wall power draw.
2019-11-05 23:46:28 +00:00
Install `tlp` and enable it, which is quirky.
```
2020-03-19 05:25:07 +00:00
systemctl enable --now tlp
systemctl mask systemd-rfkill systemd-rfkill.socket
2019-11-05 23:46:28 +00:00
```
2019-11-06 00:07:47 +00:00
## The PARTUUID dilemma
2019-11-08 07:44:21 +00:00
> Using partition names to boot instead of their unique identifiers will cause the OS not to boot if (when) the partition count or disk order of the computer changes.
2019-11-06 00:07:47 +00:00
> 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**, you can ignore this.
>
> *For now.*
{.is-info}
2019-11-06 00:02:34 +00:00
## NVIDIA Optimus
2019-11-05 23:46:28 +00:00
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.
2019-11-05 23:55:20 +00:00
> Plus, it drains the battery pretty much *instantly*.
2019-11-05 23:46:28 +00:00
{.is-warning}
Install `bumblebee` so the integrated graphics have priority and activate its service: `systemctl enable bumblebeed`.
2019-11-05 23:55:20 +00:00
You will need to add your user to the `bumblebee` group. Run `gpasswd -a yourusername bumblebee`.
2019-11-05 23:46:28 +00:00
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.
2019-11-05 23:55:20 +00:00
> 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.
2019-11-05 23:46:28 +00:00
{.is-danger}
More information [can be found at the usual place](https://wiki.archlinux.org/index.php/NVIDIA_Optimus)
2019-04-23 02:14:47 +00:00