~ Return to the rest of the site

linux

updated 2022-04-23


Alpine

Resources

Always install manual pages

Alpine doesn't include man pages in program packages to save on space, instead keeping them in [package]-doc sibling packages. To always install doc packages with program packages, apk add docs.

Arch and Artix

Bootstrapping: Installing essential packages

On Artix, use basestrap(8). On Arch, use pacstrap(8).

At a minimum you need base on both Arch and Artix. On Artix, you need to select the initialization you want to use: 66, dinit, openrc, runit, or s6-base. On both Arch and Artix, select a kernel; linux, linux-lts, or another Linux configuration or fork. Arch says you need to install linux-firmware, technically you don't need to do so but you should. Artix says you need to install the appropriate elogind package (elogind-$(INIT_SYSTEM); e.g. elogind-66). This isn't necessary if you aren't using elogind, but you most likely want elogind. Install base-devel if you plan on using the AUR or if you don't know what the AUR is yet.

It's also a good idea to install any utilities you'll need on the bootstrapped system. Text editors, network managers or utilities, and other administration tools, for example. Manual utilities such as man-db and others would also be useful.

C Language

For compilation, tcc(1), gcc(1), and clang(1) are all reasonable choices depending on your needs.

On Alpine Linux, the standard library headers are in the musl-dev package.

In most system package managers, standard library documentation can be found in the man-pages and man-pages-posix packages.

Many Linux software distributions' system package managers have meta-packages that pull all necessities for C development as dependencies. Alpine has build-base and Debian has build-essential.

Debian

Debian is a Linux software distribution known for its stability and longevity. Debian uses SystemD as its initialization system, the GNU core utilities, and dpkg and apt for package management.

fstab

See fstab(5).

postmarketOS requires that the localmount OpenRC service be enabled for the system to read fstab(5).

Arch and Artix have fstab generators at genfstab(8) and fstabgen(8) respectively in their installation scripts.

Login manager

Use elogind.

Make utility

make(1) in modern times is fragmented into the GNU version (in context, gmake) and the {Free,Open,Net}BSD version (bmake). Complex Makefiles may not be useable in both. It's custom for Linux systems to have make(1) as GNU Make and bmake(1) as BSD Make, and BSD-based systems to have make(1) as BSD Make and gmake(1) as GNU Make.

Mount LUKS encrypted partitions at boot

Sources

See cryptography#LUKS partitioning for how to make a LUKS partition.

e2fsprogs is needed for the dm_mod kernel module used for LUKS partition decryption.

On most OpenRC-initialized distributions, the cryptsetup-openrc package provides a dmcrypt service for OpenRC. Make sure that service is added to runlevel boot.

Configure /etc/conf.d/dmcrypt, and accordingly fstab. dmcrypt will need the UUID of the physical block device while fstab (if being configured with UUIDs will need the UUID of the decrypted block device in the device mapper.

On-line manual

In the context of POSIX and UNIX-like systems, an "on-line" manual is a manual that is accessible via the computer system it documents. Particularly, the man(1) utility and the manual "pages" it references.

Alpine by default uses mandoc.

Paging

less(1) is more(1); more or less.

Partitions and filesystems

See also

Don't use partitioners included with OS media where the same job can be done by GParted (which has live media available) or another good general-purpose partitioner. BSDs and Plan 9 are exceptions to this rule due to their exotic partitioning systems. Using utilities from a shell or TUIs does not make you "cooler" than someone who needs a GUI for partitioning; in some cases, messing up partitioning can have serious consequences, so it's always nice to have some idiot-proofing. I always partition my disks with the GParted live media.

You should do your own research on how you should partition your disks. I personally use separate partitions for /boot, /home, /, and swap. Your needs will vary.

Please note that a separate boot partition is mandatory if you intend to boot via (U)EFI. Check out the linked pages in the "See also" section.

Use mkfs(8) for creating filesystems and mount(8) for mounting partitions' filesystems.

postmarketOS

postmarketOS is an Alpine-based Linux software distribution that makes configuring and using Linux easy on mobile devices. It uses OpenRC for initialization, busybox for core utilities, and can come with any of multiple windowing systems and window managers.

Random MAC address generation on Wifi

By default, postmarketOS will generate a random software MAC address when connecting to a new WLAN network. You can disable this by adding a NetworkManager rule. In /etc/NetworkManager/conf.d/ you can make a file with any name that has the following:

[device]
wifi.scan-rand-mac-address=no

On a live system you can then rc-service networkmanager restart to restart NetworkManager and have it load the new configuration.

Power

Much of this can be configured in the ACPI settings in your login manager, provided you have one running that can do this.

Check out tlp for Thinkpads and some other Lenovo devices.

Task management

top(1) comes with busybox, otherwise use htop.

Text editing

nano(1) is a text editor that's usually recommended for beginners because its controls are more intuitive. ne(1) is like nano(1) but with different superpowers. Not yet in pkgsrc.

ed

A particularly shoddy attempt at ed(1) is provided by busybox. A traditional ed(1) implementation is in plan9ports. I'm pretty sure some later UNIX-based OSes doubled the ed(1) buffers, there's pretty much no downside to doing so in the modern era but it should be very easy to do yourself if it hasn't already been done (just double some of the array sizes in the beginning of ed.c).

vi

Unlike busybox's ed(1) implementation, its vi(1) is very useable. vim(1) is a popular re-implementation of vi(1).

emacs

Emacs ("editor macros") is a text editor with a very powerful Lisp interpreter included. Lisp is mostly antiquated due to its undeserved lack of popularity. Linus Torvalds uses his own fork of uEmacs ("micro Emacs"), an Emacs without the Lisp interpreter(?).

cat

Technically cat(1) and other UNIX utilities can be used in a hacky way for text editing functions. You'd be better off using ed(1); the UX is very similar.

util-linux

See also

util-linux is distributed on all popular Linux distributions and contains utilities users may expect to be already present on their systems, like more(1) or hexdump(1).

WiFi

I use iwd(8) and iwctl(8). Some prefer NetworkManager and I believe that's the default on Debian. The Artix wiki suggests connman.

wpa_supplicant

wpa_supplicant(1) is often used by insane people without any helper scripts. I haven't had good luck with it but Alpine set it up automatically.

X

Sources

X is a graphical windowing system that can be used on Linux, FreeBSD, OpenBSD, NetBSD, and some proprietary operating systems as well. X is not the only windowing system; twin(1) exists for windowed multitasking within a framebuffer and Wayland is another windowing system intended to replace X.

Some Linux software distributions have included scripts to automatically fetch and install an X server. Alpine has setup-xorg-base, which adds the packages xorg-server, xf86-input-libinput, eudev, and mesa, and then enables the OpenRC services for udev.

startx(1) is provided as part of xinit.

Arch has the xorg and xorg-apps package groups. Documentation can be found within xorg-docs, drivers within the xorg-drivers package group, the server itself as xorg-server, the X event monitor as xorg-xev, xinit as xorg-xinit, xinput as xorg-xinput, XRandR as xorg-xrandr, the X resource database manager as xorg-xrdb, xset as xorg-xset, and xsetroot as xorg-xsetroot.