255 lines
12 KiB
HTML
255 lines
12 KiB
HTML
<!DOCTYPE html>
|
|
<HTML LANG="en">
|
|
<HEAD>
|
|
<LINK HREF="http://www.trinity.moe/knowledge/alpine" REL="canonical" />
|
|
<LINK HREF="https://raw.githubusercontent.com/devenblake/homepage/main/favicon.ico" REL="shortcut icon" TYPE="image/x-icon" />
|
|
<LINK HREF="/css/blank.css" ID="styling" REL="stylesheet" />
|
|
<META CHARSET="UTF-8" />
|
|
<META CONTENT="noindex" NAME="googlebot" /> <!-- FUCK GOOGLE -->
|
|
<META CONTENT="interest-cohort=()" HTTP-EQUIV="Permissions-Policy" /> <!-- FUCK GOOGLE -->
|
|
<META NAME="viewport" CONTENT="width=device-width, initial-scale=1" />
|
|
<TITLE>knowledge/linux</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
<P><A HREF="/">~ Return to the rest of the site</A></P>
|
|
<SCRIPT SRC="/js/cookies.js" TYPE="application/javascript"></SCRIPT>
|
|
<SCRIPT SRC="/js/sheets.js" TYPE="application/javascript"></SCRIPT>
|
|
<SCRIPT TYPE="application/javascript">window.onload = window.initializesheets;</SCRIPT>
|
|
<H1>linux</H1>
|
|
<H3>updated 2022-04-23</H3>
|
|
<HR ALIGN="left" SIZE="1" WIDTH="25%" />
|
|
<H2>Alpine</H2>
|
|
<H3>Resources</H3>
|
|
<UL>
|
|
<LI><A HREF="https://pkgs.alpinelinux.org/contents">Alpine repositories content search</A></LI>
|
|
</UL>
|
|
<H3>Always install manual pages</H3>
|
|
<P>
|
|
Alpine doesn't include man pages in program packages to save on space, instead keeping them in <CODE>[<I>package</I>]-doc</CODE> sibling packages.
|
|
To always install doc packages with program packages, <CODE>apk add docs</CODE>.
|
|
</P>
|
|
|
|
<H2>Arch and Artix</H2>
|
|
<H3>Bootstrapping: Installing essential packages</H3>
|
|
<P>
|
|
On Artix, use <CODE>basestrap(8)</CODE>.
|
|
On Arch, use <CODE>pacstrap(8)</CODE>.
|
|
</P>
|
|
<P>
|
|
At a minimum you need <CODE>base</CODE> on both Arch and Artix.
|
|
On Artix, you need to select the initialization you want to use: <CODE>66</CODE>, <CODE>dinit</CODE>, <CODE>openrc</CODE>, <CODE>runit</CODE>, or <CODE>s6-base</CODE>.
|
|
On both Arch and Artix, select a kernel; <CODE>linux</CODE>, <CODE>linux-lts</CODE>, or another Linux configuration or fork.
|
|
Arch says you need to install <CODE>linux-firmware</CODE>, technically you don't need to do so but you should.
|
|
Artix says you need to install the appropriate elogind package (<CODE>elogind-$(<B>INIT_SYSTEM</B>)</CODE>; e.g. <CODE>elogind-66</CODE>).
|
|
This isn't necessary if you aren't using elogind, but you <I>most likely</I> want elogind.
|
|
Install <CODE>base-devel</CODE> if you plan on using the AUR or if you don't know what the AUR is yet.
|
|
</P>
|
|
<P>
|
|
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 <CODE>man-db</CODE> and others would also be useful.
|
|
</P>
|
|
|
|
<H2>C Language</H2>
|
|
<P>
|
|
For compilation, <CODE>tcc(1)</CODE>, <CODE>gcc(1)</CODE>, and <CODE>clang(1)</CODE> are all reasonable choices depending on your needs.
|
|
</P>
|
|
<P>
|
|
On Alpine Linux, the standard library headers are in the <CODE>musl-dev</CODE> package.
|
|
</P>
|
|
<P>
|
|
In most system package managers, standard library documentation can be found in the <CODE>man-pages</CODE> and <CODE>man-pages-posix</CODE> packages.
|
|
</P>
|
|
<P>
|
|
Many Linux software distributions' system package managers have meta-packages that pull all necessities for C development as dependencies.
|
|
Alpine has <CODE>build-base</CODE> and Debian has <CODE>build-essential</CODE>.
|
|
</P>
|
|
|
|
<H2>Debian</H2>
|
|
<P>
|
|
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.
|
|
</P>
|
|
|
|
<H2 ID="fstab">fstab</H2>
|
|
<P>See <CODE>fstab(5).</CODE></P>
|
|
<P>postmarketOS requires that the <CODE>localmount</CODE> OpenRC service be enabled for the system to read <CODE>fstab(5)</CODE>.
|
|
<P>Arch and Artix have fstab generators at <CODE>genfstab(8)</CODE> and <CODE>fstabgen(8)</CODE> respectively in their installation scripts.</P>
|
|
|
|
<H2 ID="login_manager">Login manager</H2>
|
|
<P>Use <CODE>elogind</CODE>.</P>
|
|
|
|
<H2>Make utility</H2>
|
|
<P>
|
|
<CODE>make(1)</CODE> in modern times is fragmented into the GNU version (in context, <I><CODE>gmake</CODE></I>) and the {Free,Open,Net}BSD version (<I><CODE>bmake</CODE></I>).
|
|
Complex Makefiles may not be useable in both.
|
|
It's custom for Linux systems to have <CODE>make(1)</CODE> as GNU Make and <CODE>bmake(1)</CODE> as BSD Make, and BSD-based systems to have <CODE>make(1)</CODE> as BSD Make and <CODE>gmake(1)</CODE> as GNU Make.
|
|
</P>
|
|
|
|
<H2>Mount LUKS encrypted partitions at boot</H2>
|
|
<H3>Sources</H3>
|
|
<UL>
|
|
<LI><A HREF="https://www.howtoforge.com/automatically-unlock-luks-encrypted-drives-with-a-keyfile/">Automatically Unlock LUKS Encrypted Drives With A Keyfile</A></LI>
|
|
<LI><A HREF="https://wiki.gentoo.org/wiki/Dm-crypt">Dm-crypt</A> (Gentoo Wiki)</LI>
|
|
<LI><A HREF="https://wiki.alpinelinux.org/wiki/LVM_on_LUKS">LVM on LUKS</A> (Alpine Wiki)</LI>
|
|
</UL>
|
|
<P>See <A HREF="/knowledge/cryptography#luks_partitioning">cryptography#LUKS partitioning</A> for how to make a LUKS partition.</P>
|
|
<P>
|
|
<CODE>e2fsprogs</CODE> is needed for the <CODE>dm_mod</CODE> kernel module used for LUKS partition decryption.
|
|
</P>
|
|
<P>
|
|
On most OpenRC-initialized distributions, the <CODE>cryptsetup-openrc</CODE> package provides a <CODE>dmcrypt</CODE> service for OpenRC.
|
|
Make sure that service is added to runlevel boot.
|
|
</P>
|
|
<P>
|
|
Configure <CODE>/etc/conf.d/dmcrypt</CODE>, and accordingly fstab.
|
|
<CODE>dmcrypt</CODE> will need the UUID of the <I>physical</I> block device while fstab (if being configured with UUIDs will need the UUID of the decrypted block device in the device mapper.
|
|
</P>
|
|
|
|
<H2>On-line manual</H2>
|
|
<P>
|
|
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 <CODE>man(1)</CODE> utility and the manual "pages" it references.
|
|
</P>
|
|
<P>
|
|
Alpine by default uses <CODE>mandoc</CODE>.
|
|
</P>
|
|
|
|
<H2>Paging</H2>
|
|
<P>
|
|
<CODE>less(1)</CODE> is <CODE>more(1)</CODE>; more or less.
|
|
</P>
|
|
|
|
<H2>Partitions and filesystems</H2>
|
|
<H3>See also</H3>
|
|
<UL>
|
|
<LI><A HREF="https://wiki.archlinux.org/title/EFI_system_partition">EFI system partition (Arch Wiki)</A></LI>
|
|
<LI><A HREF="https://wiki.artixlinux.org/Main/Installation#Partition_your_disk_.28BIOS.29">Installation#Partition your disk - Artix wiki</A></LI>
|
|
<LI><A HREF="https://wiki.archlinux.org/title/Installation_guide#Partition_the_disks">Installation guide#Partition the disks - Arch wiki</A></LI>
|
|
</UL>
|
|
<P>
|
|
Don't use partitioners included with OS media where the same job can be done by <A HREF="https://gparted.org/">GParted</A> (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.
|
|
</P>
|
|
<P>
|
|
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.
|
|
</P>
|
|
<P>
|
|
<B>Please note that a separate boot partition is mandatory if you intend to boot via (U)EFI.</B>
|
|
Check out the linked pages in the "See also" section.
|
|
</P>
|
|
<P>
|
|
Use <CODE>mkfs(8)</CODE> for creating filesystems and <CODE>mount(8)</CODE> for mounting partitions' filesystems.
|
|
</P>
|
|
|
|
<H2>postmarketOS</H2>
|
|
<P>
|
|
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.
|
|
</P>
|
|
<H3>Random MAC address generation on Wifi</H3>
|
|
<P>
|
|
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 <CODE>/etc/NetworkManager/conf.d/</CODE> you can make a file with any name that has the following:
|
|
</P>
|
|
<P><CODE><PRE>
|
|
[device]
|
|
wifi.scan-rand-mac-address=no
|
|
</PRE></CODE></P>
|
|
<P>
|
|
On a live system you can then <CODE>rc-service networkmanager restart</CODE> to restart NetworkManager and have it load the new configuration.
|
|
</P>
|
|
|
|
<H2 ID="power">Power</H2>
|
|
<P>Much of this can be configured in the ACPI settings in your <A HREF="#login_manager">login manager</A>, provided you have one running that can do this.</P>
|
|
<P>Check out <CODE>tlp</CODE> for Thinkpads and some other Lenovo devices.</P>
|
|
|
|
<H2>Task management</H2>
|
|
<P><CODE>top(1)</CODE> comes with busybox, otherwise use <CODE>htop</CODE>.</P>
|
|
|
|
<H2 ID="text_editing">Text editing</H2>
|
|
<P>
|
|
<CODE>nano(1)</CODE> is a text editor that's usually recommended for beginners because its controls are more intuitive.
|
|
<CODE>ne(1)</CODE> is like <CODE>nano(1)</CODE> but with different superpowers. Not yet in pkgsrc.
|
|
</P>
|
|
<H3>ed</H3>
|
|
<P>
|
|
A particularly shoddy attempt at <CODE>ed(1)</CODE> is provided by <CODE>busybox</CODE>.
|
|
A traditional <CODE>ed(1)</CODE> implementation is in plan9ports.
|
|
I'm pretty sure some later UNIX-based OSes doubled the <CODE>ed(1)</CODE> 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 <CODE>ed.c</CODE>).
|
|
</P>
|
|
<H3>vi</H3>
|
|
<P>
|
|
Unlike <CODE>busybox</CODE>'s <CODE>ed(1)</CODE> implementation, its <CODE>vi(1)</CODE> is very useable.
|
|
<CODE>vim(1)</CODE> is a popular re-implementation of <CODE>vi(1)</CODE>.
|
|
</P>
|
|
<H3>emacs</H3>
|
|
<P>
|
|
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(?).
|
|
</P>
|
|
<H3>cat</H3>
|
|
<P>
|
|
Technically <CODE>cat(1)</CODE> and other UNIX utilities can be used in a hacky way for text editing functions.
|
|
You'd be better off using <CODE>ed(1)</CODE>; the UX is very similar.
|
|
</P>
|
|
|
|
<H2>util-linux</H2>
|
|
<H3>See also</H3>
|
|
<UL>
|
|
<LI><A HREF="https://en.wikipedia.org/wiki/Util-linux">util-linux - Wikipedia</A></LI>
|
|
</UL>
|
|
<P>
|
|
<CODE>util-linux</CODE> is distributed on all popular Linux distributions and contains utilities users may expect to be already present on their systems, like <CODE>more(1)</CODE> or <CODE>hexdump(1)</CODE>.
|
|
</P>
|
|
|
|
<H2>WiFi</H2>
|
|
<P>
|
|
I use <CODE>iwd(8)</CODE> and <CODE>iwctl(8)</CODE>.
|
|
Some prefer NetworkManager and I believe that's the default on Debian.
|
|
The Artix wiki suggests connman.
|
|
</P>
|
|
<H3>wpa_supplicant</H3>
|
|
<P>
|
|
<CODE>wpa_supplicant(1)</CODE> is often used by insane people without any helper scripts.
|
|
I haven't had good luck with it but Alpine set it up automatically.
|
|
</P>
|
|
|
|
<H2>X</H2>
|
|
<H3>Sources</H3>
|
|
<UL>
|
|
<LI><A HREF="https://wiki.archlinux.org/title/Xorg">Xorg</A> (Arch Wiki)</LI>
|
|
</UL>
|
|
<P>
|
|
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; <CODE>twin(1)</CODE> exists for windowed multitasking within a framebuffer and Wayland is another windowing system intended to replace X.
|
|
</P>
|
|
<P>
|
|
Some Linux software distributions have included scripts to automatically fetch and install an X server.
|
|
Alpine has <CODE>setup-xorg-base</CODE>, which adds the packages <CODE>xorg-server</CODE>, <CODE>xf86-input-libinput</CODE>, <CODE>eudev</CODE>, and <CODE>mesa</CODE>, and then enables the OpenRC services for udev.
|
|
</P>
|
|
<P>
|
|
<CODE>startx(1)</CODE> is provided as part of xinit.
|
|
</P>
|
|
<P>
|
|
Arch has the <CODE><A HREF="https://archlinux.org/groups/x86_64/xorg/">xorg</A></CODE> and <CODE><A HREF="https://archlinux.org/groups/x86_64/xorg-apps/">xorg-apps</A></CODE> package groups.
|
|
Documentation can be found within <CODE>xorg-docs</CODE>,
|
|
drivers within the <CODE><A HREF="https://archlinux.org/groups/x86_64/xorg-drivers/">xorg-drivers</A></CODE> package group,
|
|
the server itself as <CODE>xorg-server</CODE>,
|
|
the X event monitor as <CODE>xorg-xev</CODE>,
|
|
xinit as <CODE>xorg-xinit</CODE>,
|
|
xinput as <CODE>xorg-xinput</CODE>,
|
|
XRandR as <CODE>xorg-xrandr</CODE>,
|
|
the X resource database manager as <CODE>xorg-xrdb</CODE>,
|
|
xset as <CODE>xorg-xset</CODE>,
|
|
and xsetroot as <CODE>xorg-xsetroot</CODE>.
|
|
</P>
|
|
</BODY>
|
|
</HTML>
|