-
Notifications
You must be signed in to change notification settings - Fork 0
/
DustArch.typ
3584 lines (2443 loc) · 95.6 KB
/
DustArch.typ
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#import "dustypst/dustypst.typ": admindoc_project, note, important, tip, warning, caution, linkfn, filepath, terminal-root, terminal, cmd, pkg-aur, pkgtable, filesrc, codeblock, pkg
#show: admindoc_project.with(title: "DustArch", subtitle: "DustVoice's Arch Linux from scratch")
= Inside the `archiso`
This chapter is aimed at assisting with the general setup of a customized Arch
Linux installation, using an official Arch Linux image (`archiso`).
#note[
As Arch Linux is a rolling release GNU/Linux distribution, it is advised, to
have a working internet connection, in order to get the latest package upgrades
and to install additional software, as the `archiso` doesn't have all packages
available from cache, especially the ones that need to be installed from the `AUR`.
/ AUR (Arch User Repository):
A huge collection of packages contributed and maintained by the community, which
in order to install you need to download and build.\
Accessable and browsable under #linkfn("https://aur.archlinux.org/")[aur.archlinux.org].
Furthermore, one should bear in mind that depending on the version, or rather
modification date, of this guide, the exact steps taken may already be outdated.
If you encounter any problems along the way, you will either have to resolve the
issue yourself or utilize the great #linkfn("https://wiki.archlinux.org/")[ArchWiki],
or the #linkfn("https://bbs.archlinux.org/")[Arch Linux forums].
]
To get some explanation on how this document is formatted, look into the
@glossary
== Syncing up `pacman`
First of all, we need to sync up `pacman`'s package repository, in order to be
able to install the latest, as well as new packages to the `archiso` and our new
system.
#terminal-root("/")[`pacman -Sy`]
#warning[
Using #cmd[`pacman -Sy`] should be sufficient, in order to be able to search for
packages from within the `archiso`, without upgrading the system, but might
break your system, if you use this command on an existing installation!
#cmd[pacstrap] uses the latest packages anyways.
]
#caution[
To be on the safe side, it is advised to always use #cmd[`pacman -Syu`]!
Only on the `archiso` is there an exception to be made, as #cmd[`pacman -Syu`] will
probably fail due to `RAM` limitations!
]
=== Official repositories
After doing that, we can now install any software from the official repositories
by issuing
#terminal-root("/")[`pacman -S <package_name>`]
where you would replace `<package_name>` with the actual package name.
If you want to remove an installed package, use
#terminal-root("/")[`pacman -Rsu <package_name>`]
If you don't know the exact package name, or if you just want to search for a
keyword, for example, `xfce`, to list all packages having something to do with `xfce`,
use
#terminal-root("/")[`pacman -Ss <keyword>`]
If you really need to force remove a package, which you should use _with extreme caution_,
you could use
#terminal-root("/")[`pacman -Rdd <package_name>`]
=== `AUR`
If you want to install a package from the #linkfn("https://aur.archlinux.org/")[AUR],
I would advise proceeding in the following manner, in order to install the `AUR`-helper #pkg-aur("paru") or
alternatively #pkg-aur("paru-bin").
#enum[
Clone the package with `git`
#terminal("~")[`git clone https://aur.archlinux.org/paru.git`]
If you are on a slow PC or don't want to compile `paru` from scratch, you can
also use the #linkfn("https://aur.archlinux.org/packages/paru-bin")[paru-bin].
][
Switch to the package directory
][
Execute #cmd[`makepkg`] with the appropriate argments
#terminal("~/paru")[`makepkg -si`]
][
Delete all files created, as `paru` will now be handling all the `AUR` stuff.
#terminal("~/paru")[
`cd ..`
`rm -rf paru`
]
]
If you only install `AUR` packages the manual way, you might have to resolve
some `AUR` dependencies manually, which can't be automatically resolved by `makepkg`'s `-s` option,
which uses `pacman`.
In order to install a desired `AUR` package, you _must_ switch to your normal,
non-`root` user, because `makepkg` doesn't run as `root`.
=== Software categories
In this guide, the software is categorized into three different categories
/ `console`: Intended to be used with either the native linux console or with a terminal
emulator
/ `GUI`: Intended to be used within a graphical desktop environment
/ `hybrid`: To be used either within both a console and a graphical desktop environment
(e.g. `networkmanager`), or there are packages available for both a console and
a graphical desktop environment (e.g. `pulseaudio` with `pulsemixer` for `Console` and `pavucontrol` for `GUI`)
=== Software installation
In this guide, I'll be explicitly listing the packages installed in a specific
section at the beginning of the individual sections.
This allows you to
- clearly see what packages get installed/need to be installed in a specific
section
- install packages before you start with the section in order to minimize waiting
time
The packages are always the recommended packages.
For further clarification for specific packages (e.g. `UEFI` specific packages),
continue reading the section, as there is most certainly an explanation or
follow-up section there.
Of course, as always, you can and *should* adapt everything according to your
needs, as this guide is, again, _no tutorial, but a guide_.
== Formatting the drive
First, you probably want to get a list of all available drives, together with
their corresponding device name, by issuing
#terminal-root("/")[`fdisk -l`]
The output of #cmd[`fdisk -l`] is dependent on your system configuration and
many other factors, like the `BIOS` initialization order, etc.
#caution[
Don't assume the same path of a device between reboots!
Always double-check!
There is nothing worse than formatting a drive you didn't mean to format!
]
=== The standard way
In my case, the partition I want to install the root file system on will be #filepath("/dev/mapper/DustPortable"),
which is an unlocked `luks2` volume that will be located on #filepath("/dev/sda2").
For my `swap`, I will use a `swapfile`.
#note[
A `swap` size twice the size of your RAM is recommended by a lot of people.
To be exact, every distribution has different recommendations for `swap` sizes.
Also `swap` size heavily depends on whether you want to be able to hibernate,
etc.
]
==== In my opinion
You should make the `swap` size at least your RAM size and for RAM sizes over `4GB` with
the intention to hibernate, at least one and a half times your RAM size.
If you haven't yet partitioned your disk, please refer to the #linkfn(
"https://wiki.archlinux.org/index.php/Partitioning",
)[general partitioning tutorial] in the ArchWiki.
=== Full system encryption
#note[
This is only one way to do it (read: it is the way I have previously done it).
]
I'm using a `LUKS` setup, with `btrfs` and `luks2`. For more information look
into the #linkfn("https://wiki.archlinux.org/")[ArchWiki].
This setup has different partitions, used for the `EFI System Partition`, `root` partition,
etc. compared to the ones used in the rest of the guide. The only part of the
guide, which currently uses the drives & partitions used in this section is
@manual-secure-boot.
To start things, we first have to decide, which disk, or partition, is going to
be `luks2` encrypted.
In my case, I'll be using my SSD in a USB-C enclosure to be able to take the
system with me on the go. For that, I will use a `GPT` partition scheme. I will
then create a `2 GiB` `EFI System partition` (I have multiple kernels installed
at a time), in my case #filepath("/dev/sda1"), defined as an `EFI System partition` type
in `gdisk`, as well as the main `luks2` volume, in my case #filepath("/dev/sda2"),
defined as a `Linux filesystem` partition type in `gdisk`.
After partitioning our disk, we now have to set everything up.
==== `EFI System Partition`
#pkgtable(core: "dosfstools")
I won't set up my `EFI System Partition` with `cryptsetup`, as it makes no sense
in my case.
Every `EFI` binary (or `STUB`) will have to be signed with my custom Secure Boot
keys, as described in @manual-secure-boot, so tempering with the `EFI System Partition` poses
no risk to my system.
Instead, I will simply format it with a `FAT32` filesystem
#terminal-root("/")[`mkfs.fat -F 32 -n EFI /dev/sda1`]
We will bother with mounting it later on.
When you _do_ want to encrypt your `EFI System Partition`, in conjunction with
e.g. `grub`, please either use `LUKS 1`, or make sure to have the latest version
of `grub` installed on your system, to make it work with `LUKS 2`! I will use `limine` though,
so for me, all of this isn't a consideration.
==== `LUKS`
#pkgtable(core: "cryptsetup")
First off we have to create the `LUKS` volume
#terminal-root("/")[`cryptsetup luksFormat --type luks2 /dev/sda2`]
In my case, I will convert the key slot to `pbkdf2`, as `luks2` defaults to `argon2id`,
which doesn't play well with my portable setup, namely the differing RAM sizes.
#terminal-root("/")[`cryptsetup luksConvertKey --pbkdf pbkdf2 /dev/sda2`]
/ pbkdf: Password-Based Key Derivation Function
After that, we have to open the volume
#terminal-root("/")[`cryptsetup open /dev/sda2 DustPortable`]
The volume is now accessible under #filepath("/dev/mapper/DustPortable").
==== `btrfs`
#pkgtable(core: "btrfs-progs")
First off we need to create the filesystem
#terminal-root("/")[`mkfs.btrfs -L DustPortable /dev/mapper/DustPortable`]
After that, we mount the `btrfs` root under #filepath("/mnt/meta")
#terminal-root("/")[
```
mkdir /mnt/meta
mount /dev/mapper/DustPortable /mnt/meta
```
]
Now we create the desired filesystem layout.
We will create 5 top-level subvolumes that will be mounted at the appropriate
places later on.
#terminal-root("/mnt/meta")[
```
btrfs subvolume create @
btrfs subvolume create @home
btrfs subvolume create @snapshots
btrfs subvolume create @var_log
btrfs subvolume create @swapfile
```
]
== Preparing the `chroot` environment
As a first step, it might make sense to edit the #filepath("/etc/pacman.d/mirrorlist") to
move the mirrors geographically closest to you to the top.
=== `pacstrap` in
Generally, we need to `pacstrap` the _minimum packages_ needed. We will install
all other packages later on.
#pkgtable(core: "base base-devel linux linux-firmware")
This is the actual command used in my case
#terminal-root("/")[`pacstrap /mnt/meta/@ base base-devel linux linux-firmware`]
=== Mounting party
Now we have to mount the subvolumes and boot partition we created earlier to the
appropriate locations.
First off, we mount the #filepath("/") subvolume `@`
#terminal-root("/")[
```
mkdir /mnt/DustPortable
mount -o subvol=@ /dev/mapper/DustPortable /mnt/DustPortable
```
]
Now we can mount the #filepath("/home") subvolume `@home`
#terminal-root(
"/mnt/DustPortable",
)[`mount -o subvol=@home /dev/mapper/DustPortable home`]
The #filepath("/.snapshots") subvolume `@snapshots` closely follows
#terminal-root("/")[
```
mkdir .snapshots
mount -o subvol=@snapshots /dev/mapper/DustPortable .snapshots
```
]
After that we have to move the log dir #filepath("/var/log") to the appropriate
subvolume `@var_log`
#terminal-root("/mnt/DustPortable")[
```
mv var/log var/log_bak
mount -o subvol=@var_log /dev/mapper/DustPortable var/log
mkdir var/log
mv var/log_bak/* var/log/
rmdir var/log_bak
```
]
Finally, we can generate the `swapfile`
#terminal-root("/mnt/DustPortable")[
```
mkdir swapfile
mount -o subvol=@swapfile /dev/mapper/DustPortable swapfile
btrfs filesystem mkswapfile --size 128G swapfile/swapfile
swapon swapfile/swapfile
```
]
#important[
I use my SSD inside a USB-C enclosure (although it is rated at 40Gbps it is
*not* Thunderbolt 3!), which means that it _doesn't_ support `TRIM`. This is why
I personally need to add `nodiscard` to every `mount` command option, which
would look something along the lines of this
#terminal-root("/")[
`mount -o subvol=@,nodiscard /dev/mapper/DustPortable /mnt/DustPortable`
]
]
The only thing left to do now is mount the boot partition, namely my `EFI System Partition`
#terminal-root("/mnt/DustPortable")[
```
mv boot boot_bak
mkdir boot
mount /dev/sda1 boot
mv boot_bak/* boot/
rmdir boot_bak
```
]
After that we can generate the #filepath("/etc/fstab") using `genfstab`
#terminal-root("/")[
`genfstab -U /mnt/DustPortable >> /mnt/DustPortable/etc/fstab`
]
and you're ready to enter the `chroot` environment.
=== Outdated `archiso`
If you're using an older version of the `archiso`, you might want to replace the `mirrorlist` present
on the `archiso` with the newest #linkfn("https://archlinux.org/mirrorlist/all")[online one]
#terminal-root("/")[
`curl https://archlinux.org/mirrorlist/all > /etc/pacman.d/mirrorlist`
]
#pkgtable(extra: "reflector")
The best way to do this tho is using a package from the official repositories
named `reflector`. It comes with all sorts of options, for example sorting
mirrors by speed, filtering by country, etc.
#terminal-root(
"/",
)[
`reflector --verbose --latest 200 --sort rate --save /etc/pacman.d/mirrorlist`
]
After that, you would need to reinstall the `pacman-mirror` package and run
#terminal-root("/")[`pacman -Syyuu`]
for best results.
#caution[
Be wary though as there could arise keyring issues etc. Normally the `pacstrap` command
takes care of syncing everything etc.
]
=== Living behind a proxy
If you're sitting behind a proxy, you're generally in for an unpleasant time.
Generally, you need to set the `http_proxy`, `https_proxy`, `ftp_proxy` variables
as well as their *upper case* counterparts.
#terminal-root("/")[
```
export http_proxy="http://ldiproxy.lsjv.rlp.de:8080"
export https_proxy=$http_proxy
export ftp_proxy=$http_proxy
export HTTP_PROXY=$http_proxy
export HTTPS_PROXY=$http_proxy
export FTP_PROXY=$http_proxy
```
]
If you can't `pacstrap` after that, you probably have the issue that the `systemd-timesyncd`,
as well as the `pacman-init` service didn't execute correctly.
#terminal-root("/")[
```
systemctl status systemd-timesyncd.service
systemctl status pacman-init.service
```
]
To mitigate this, you need to initialize `pacman` yourself.
First off check whether the correct time is set.
#terminal-root("/")[`timedatectl`]
In my case the time zone was not correctly set, why my time was off by one hour,
so I had to set it manually.
#terminal-root("/")[`timedatectl set-timezone Europe/Berlin`]
After that, we have to execute the `pacman-init` stuff manually
#terminal-root("/")[
```
pacman-key --init
pacman-key --populate
```
]
#note[
You might also want to add the following lines to #filepath("/etc/sudoers"), in
order to keep the proxy environment variables alive when executing a command
through `sudo`
#filesrc(part: true, perm: true, "/etc/sudoers")[
```
Defaults env_keep += "http_proxy"
Defaults env_keep += "https_proxy"
Defaults env_keep += "ftp_proxy"
Defaults env_keep += "HTTP_PROXY"
Defaults env_keep += "HTTPS_PROXY"
Defaults env_keep += "FTP_PROXY"
```
]
]
= Entering the `chroot`
#pkgtable(extra: "arch-install-scripts")
#note[
As we want to set up our new system, we need to have access to the different
partitions, the internet, etc. which we wouldn't get by solely using `chroot`.
That's why we are using `arch-chroot`, provided by the `arch-install-scripts` package,
which is shipped with the `archiso`. This script takes care of all the
aforementioned stuff, so we can set up our system properly.
]
#terminal-root("/")[`arch-chroot /mnt/DustPortable`]
Et Voila! You successfully `chroot`-ed inside your new system and you'll be
greeted by a `bash` prompt, which is the default shell on fresh Arch Linux
installations.
== Installing additional packages
#pkgtable(
core: "amd-ucode base-devel btrfs-progs diffutils dmraid dnsmasq dosfstools efibootmgr emacs-nativecomp exfat-utils iputils linux-headers openssh sudo usbutils", extra: "efitools fish git intel-ucode neovim networkmanager networkmanager-openconnect networkmanager-openvpn nushell parted polkit rsync zsh", aur: "limine",
)
#note[
There are many command line text editors available, like `nano`, `vi`, `vim`, `emacs`,
etc.
I'll be using `neovim` as my simple text editor, until a certain point, at which
I'll replace it with my doom-`emacs` setup, though it shouldn't matter what
editor you choose for the rest of the guide.
]
Make sure to enable the `NetworkManager.service` service, in order for the
Internet connection to work correctly, upon booting into the fresh system later
on.
#terminal-root("/")[`systemctl enable NetworkManager.service`]
With `polkit` installed, create a file to enable users of the `network` group to
add new networks without the need for `sudo`.
#filesrc(
part: true, perm: true, "/etc/polkit-1/rules.d/50-org.freedesktop.NetworkManager.rules",
)[
```
polkit.addRule(function(action, subject) {
if (action.id.indexOf(
"org.freedesktop.NetworkManager."
) == 0 && subject.isInGroup("network")) {
return polkit.Result.YES;
}
});
```
]
If you use `UEFI`, you'll also need the `efibootmgr`, in order to modify the `UEFI` entries.
=== Additional kernels
#pkgtable(
core: "linux-lts linux-lts-headers linux-zen linux-zen-headers", extra: "linux-hardened linux-hardened-headers",
)
In addition to the standard `linux` kernel, there are a couple of different
options out there. Just to name a few, there are `linux-lts`, `linux-zen`, and `linux-hardened`.
You can simply install them and then add the corresponding `initramfs` and
kernel image to your bootloader entries.
Make sure you have allocated enough space on your `EFI System Partition` though.
== Master of time
After that, you have to set your timezone and update the system clock.
Generally speaking, you can find all the different timezones under #filepath("/usr/share/zoneinfo").
In my case, my timezone file resides under #filepath("/usr/share/zoneinfo/Europe/Berlin").
To achieve the desired result, I will want to symlink this to the #filepath("/etc/localtime") and
set the hardware clock.
#terminal-root("/")[
```
ln -s /usr/share/zoneinfo/Europe/Berlin /etc/localtime
hwclock --systohc --utc
```
]
Now you can also enable time synchronization over the network
#terminal-root("/")[
```
timedatectl set-timezone Europe/Berlin
timedatectl set-ntp true
```
]
and check that everything is alright
#terminal-root("/")[`timedatectl status`]
== Master of locales
Now you have to generate your locale information.
For that you have to edit #filepath("/etc/locale.gen") and uncomment the locales
you want to enable.
I recommend always uncomment `en_US.UTF-8 UTF8`, even if you want to use another
language primarily.
In my case, I only uncommented the `en_US.UTF-8 UTF8` line
#filesrc(part: true, perm: true, "/etc/locale.gen")[
```
en_US.UTF-8 UTF8
```
]
After that, you still have to actually generate the locales by issuing
#terminal-root("/")[`locale-gen`]
and set the locale
#terminal-root("/")[
`localectl set-locale LANG="en_US.UTF-8"`
]
After that, we're done with this part.
== Naming your machine
Now we can set the `hostname` for our new install and add `hosts` entries.
Apart from being mentioned in your command prompt, the `hostname` also serves
the purpose of identifying or naming your machine locally, as well as in a
networked scenario. This will enable you to see your PC with the correct name in
your router, etc.
=== `hostname`
To change the `hostname`, simply edit #filepath("/etc/hostname"), enter the
desired name, then save and quit
#filesrc(perm: true, "/etc/hostname")[
```
DustArch
```
]
=== `hosts`
Now we need to specify some `hosts` entries by editing #filepath("/etc/hosts")
#filesrc(perm: true, "/etc/hosts")[
```
// # Static table lookup for hostnames.
// # See hosts(5) for details.
127.0.0.1 localhost .
::1 localhost .
127.0.1.1 DustArch.localhost DustArch
```
]
== User setup
Now you should probably change the default `root` password and create a new non-`root` user,
as using your new system purely through the native `root` user is not
recommended from a security standpoint.
=== Give `root` a password
To change the password for the current user (the `root` user) issue
#terminal-root("/")[`passwd`]
and choose a new password.
=== Create a personal user
#pkgtable(core: "sudo bash")
We are going to create a new user and set the password, groups, and shell for
this user
#terminal-root("/")[
```
useradd -m -p "" -G "adm,audio,disk,floppy,kvm,
log,lp,network,rfkill,scanner,storage,
users,optical,power,wheel" -s /bin/bash dustvoice
passwd dustvoice
```
]
We must now allow the `wheel` group `sudo` access.
We edit the #filepath("/etc/sudoers") file and uncomment the `%wheel` line.
#filesrc(part: true, perm: true, "/etc/sudoers")[
```
%wheel ALL=(ALL) ALL
```
]
You could also add a new line below the `root` line
#filesrc(part: true, perm: true, "/etc/sudoers")[
```
root ALL=(ALL) ALL
```
]
with your new username
#filesrc(part: true, perm: true, "/etc/sudoers")[
```
dustvoice ALL=(ALL) ALL
```
]
to solely grant the _new_ user `sudo` privileges.
== Boot manager <boot-manager>
In this section, different boot managers/boot methods are explained.
=== `EFISTUB`
#pkgtable(core: "efibootmgr ")
You can directly boot the system, by making use of the `EFISTUB` contained in
the kernel image. To utilize this, we can use `efibootmgr` to create an entry in
the `UEFI`
#terminal-root(
"/",
)[
```
efibootmgr
--disk /dev/sda
--part 2
--create
--label "Arch Linux"
--loader /vmlinuz-linux
--unicode
'root=<root-partition-uuid> rw initrd=\initramfs-linux.img resume=UUID=<swap-partition-uuid>'
--verbose
```
]
#warning[
You need to replace the `<[...]-partition-uuid>` parts with your corresponding
values!
]
This only makes sense of course, if you're using `UEFI` instead of a legacy `BIOS`.
In this case, it doesn't matter of course, if your machine _theoretically supports_ `UEFI`,
but rather if it is the /enabled mode/!
=== `grub`
#pkgtable(core: "dosfstools efibootmgr grub", extra: "mtools os-prober")
Of course, you can also use a boot manager to boot the system, as the name
implies.
If I can't use `EFISTUB`, e.g. either because the system has no `UEFI` support,
or because I need another feature of a boot manager, I could use `grub`.
#tip[
Currently, I mainly use `limine` as a boot manager *especially* on my portable
setup, as `grub` is *such a huge pain in the butt!*
`limine` is insanely easy to set up and configure, without all the `BIOS Boot partition` crap
that I find myself mainly using this. Refer to @limine for further information.
]
#note[
You'll probably only need the `efibootmgr` package, if you plan to utilize `UEFI`.
]
==== `grub` - `BIOS`
If you chose the `BIOS - MBR` variation, you'll have to _do nothing special_.
If you chose the `BIOS - GPT` variation, you'll have to _have a `+1M` boot partition_ created
with the partition type set to `BIOS boot`.
In both cases, you'll have to _run the following command_ now
#terminal-root("/")[`grub-install --target=i386-pc /dev/sdb`]
It should obvious that you would need to replace #filepath("/dev/sdb") with the
disk you actually want to use. Note however that you have to specify a _disk_ and _not a partition_,
so _no number_.
==== `grub` - `UEFI`
If you chose the `UEFI - GPT` variation, you'd have to _have the `EFI System Partition` mounted_ at #filepath("/boot") (where #filepath("/dev/sda2") is
the partition holding said `EFI System Partition` in my particular setup)
Now _install `grub` to the `EFI System Partition`_
#terminal-root("/")[
```
grub-install
--target x86_64-efi
--efi-directory /boot
--bootloader-id=grub
--recheck
```
]
If you've planned on dual booting Arch with Windows and therefore reused the `EFI System Partition` created
by Windows, you might not be able to boot to `grub` just yet.
In this case, boot into Windows, open a `cmd` window as Administrator, and type
in
#terminal-root(
windows: true, "C:\\Windows\\System32",
)[`bcdedit /set {bootmgr} path \EFI\grub\grubx64.efi`]
To make sure that the path is correct, you can use
#terminal-root("/")[`ls /boot/EFI/grub`]
under Linux to make sure, that the `grubx64.efi` file is really there.
==== `grub` config
In all cases, you now have to create the main `grub.cfg` configuration file.
But before we actually generate it, we'll make some changes to the default `grub` settings,
which the `grub.cfg` will be generated from.
===== Adjust the timeout
First of all I want my `grub` menu to wait indefinitely for my command to boot
an OS.
#filesrc(part: true, perm: true, "/etc/default/grub")[
```
GRUB_TIMEOUT=-1
```
]
I decided on this because I'm dual booting with Windows and after Windows
updates itself, I don't want to accidentally boot into my Arch Linux, just
because I wasn't quick enough to select the Windows Boot Loader from the `grub` menu.
Of course, you can set this parameter to whatever you want.
Another way of achieving what I described, would be to make `grub` remember the
last selection.
#filesrc(part: true, perm: true, "/etc/default/grub")[
```
GRUB_TIMEOUT=5
GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT="true"
```
]
===== Enable the recovery
After that, I also want the recovery option to show up, which means that besides
the standard and fallback images, also the recovery one would show up.
#filesrc(part: true, perm: true, "/etc/default/grub")[
```
GRUB_DISABLE_RECOVERY=false
```
]
===== NVIDIA fix
Now, as I'm using the binary NVIDIA driver for my graphics card, I also want to
make sure, to revert `grub` back to text mode, after I select a boot entry, in
order for the NVIDIA driver to work properly. You might not need this
#filesrc(part: true, perm: true, "/etc/default/grub")[
```
GRUB_GFXPAYLOAD_LINUX=text
```
]
===== Add power options
I also want to add two new menu entries, to enable me to shut down the PC, or
reboot it, right from the `grub` menu.
#codeblock[
```
menuentry '=> Shutdown' {
halt
}
menuentry '=> Reboot' {
reboot
}
```
]
===== Installing `memtest`
As I want all possible options to possibly troubleshoot my PC right there in my `grub` menu,
without the need to boot into a live OS, I also want to have a memory tester
there.
====== `BIOS`
#pkgtable(extra: "memtest86+")
For a `BIOS` setup, you'll simply need to install the `memtest86+` package, with
no further configuration.
====== `UEFI`
#pkgtable(aur: "memtest86-efi")
For a `UEFI` setup, you'll first need to install the package and then tell #pkg-aur("memtest86-efi") how
to install itself
#terminal-root("/")[`memtest86-efi -i`]
Now select option 3, to install it as a `grub2` menu item.
===== Enabling hibernation
We need to add the `resume` kernel parameter to #filepath("/etc/default/grub"),
containing my `swap` partition `UUID`, in my case
#filesrc(
part: true, perm: true, "/etc/default/grub",
)[
```
GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet resume=UUID=097c6f11-f246-40eb-a702-ba83c92654f2"
```
]
If you have to change anything, like the `swap` partition `UUID`, inside the `grub` configuration
files, you'll always have to rerun #cmd[`grub-mkconfig`] as explained in
@generate-grub-config.
===== Disabling `os-prober`
Sometimes it makes sense to disable the `os-prober` functionality of grub, even
though `os-prober` is installed on the system (which auto enables it), for
example when installing arch for portability purposes. We can disable the
os-prober functionality in the `grub` default config file.
#filesrc(part: true, perm: true, "/etc/default/grub")[
```
GRUB_DISABLE_OS_PROBER=true
```
]
===== Generating the `grub` config <generate-grub-config>
Now we can finally generate our `grub.cfg`
#terminal-root("/")[`grub-mkconfig -o /boot/grub/grub.cfg`]
Now you're good to boot into your new system.
=== `limine` <limine>
#pkgtable(aur: "limine")
#tip[
You will have to switch to your normal user to install the `AUR` package.
If you're at it though, you could also already install `paru`, to make things
easier.
#pkgtable(extra: "asp bat devtools", aur: "paru-bin")