handbook-base.html (10523B)
1 <!doctype html> 2 <html lang="en"> 3 <head> 4 <meta charset="utf-8"> 5 <meta name="viewport" content="width=device-width, initial-scale=1"> 6 <title>The base system - Chamesle</title> 7 <meta name="description" content="The init is OpenRC. /sbin/init is busybox init, which reads /etc/inittab: it runs openrc sysinit, openrc boot"> 8 <link rel="canonical" href="https://chamesle.org/handbook-base.html"> 9 <meta property="og:type" content="website"> 10 <meta property="og:site_name" content="Chamesle"> 11 <meta property="og:title" content="The base system - Chamesle"> 12 <meta property="og:description" content="The init is OpenRC. /sbin/init is busybox init, which reads /etc/inittab: it runs openrc sysinit, openrc boot"> 13 <meta property="og:url" content="https://chamesle.org/handbook-base.html"> 14 <link rel="stylesheet" href="style.css?25"> 15 <link rel="icon" href="img/logo.png"> 16 </head> 17 <body> 18 19 <div id="page"> 20 21 <div id="top"> 22 <h1><a href="./"><img src="img/banner.png" alt="Chamesle Linux" width="223" height="56"></a></h1> 23 </div> 24 25 <div id="nav"> 26 <a href="./">Home</a> | 27 <a href="download.html">Download</a> | 28 <b>Handbook</b> | 29 <a href="packages.html">Packages</a> | 30 <a href="new.html">News</a> | 31 <a href="board.html">Board</a> | 32 <a href="chat.html">Chat</a> | 33 <a href="source.html">Source</a> | 34 <a href="https://x22.chamesle.org/">X22</a> | 35 <a href="https://github.com/tortr-rs/mag">mag</a> | 36 <a href="about.html">About</a> 37 </div> 38 39 <main> 40 <p><a href="handbook-rifle.html">← rifle</a> | <a href="docs.html">Contents</a> | <a href="handbook-kernel.html">The kernel and firmware →</a></p> 41 <h2>6. The base system</h2> 42 <h2 id="s6-1">6.1 init</h2> 43 <p>The init is OpenRC. <code>/sbin/init</code> is busybox init, which reads <code>/etc/inittab</code>: it runs <code>openrc sysinit</code>, <code>openrc boot</code> and <code>openrc default</code> in turn, then puts a login on <code>tty1</code> to <code>tty6</code>. OpenRC starts the services of each runlevel, each after what it needs, and stops them in order when the machine goes down.</p> 44 <p>A runlevel is a directory in <code>/etc/runlevels</code> with links to the services in <code>/etc/init.d</code>. A fresh install has:</p> 45 <table> 46 <tr><th>runlevel</th><th>services</th></tr> 47 <tr><td>sysinit</td><td><code>devfs</code>, <code>dmesg</code>, <code>udev</code>, <code>udev-trigger</code>, <code>udev-settle</code></td></tr> 48 <tr><td>boot</td><td><code>modules</code>, <code>hwclock</code>, <code>sysctl</code>, <code>hostname</code>, <code>bootmisc</code>, <code>syslog</code>, <code>seedrng</code>, <code>swap</code></td></tr> 49 <tr><td>default</td><td><code>udev-postmount</code>, <code>dhcpcd</code></td></tr> 50 <tr><td>shutdown</td><td><code>killprocs</code>, <code>mount-ro</code>, <code>savecache</code></td></tr> 51 </table> 52 <p><code>fsck</code>, <code>root</code> and <code>localmount</code> come in because the boot ones need them: the file systems are checked, <code>/</code> is remounted read-write and <code>/etc/fstab</code> is mounted. On ZFS, <code>zfs-import</code> and <code>zfs-mount</code> are in sysinit too.</p> 53 <h2 id="s6-2">6.2 Services</h2> 54 <p>Every package with a daemon has its service next to it, in a package called after it with <code>-openrc</code> on the end. mag installs that one by itself once OpenRC and the daemon are both there, so <code>mag install lightdm</code> brings <code>lightdm-openrc</code> too. Then:</p> 55 <pre>rc-update add lightdm start it at every boot 56 rc-update del dhcpcd not at boot any more 57 rc-service iwd start 58 rc-service iwd stop 59 rc-service dhcpcd restart 60 rc-status what runs, by runlevel 61 rc-update what starts at boot, and in which runlevel</pre> 62 <p><code>rc-update add</code> puts a service in the default runlevel unless you name another. <code>service NAME start</code> works too. The service files are in <code>/etc/init.d</code> and their settings in <code>/etc/conf.d/NAME</code>. <code>openrc-run(8)</code> has the rest.</p> 63 <p>Chamesle before base r20 ran dinit, and before r18 Winchester. The upgrade to r20 moves you over by itself: what was enabled there (<code>/etc/dinit.d/boot.d</code>, or <code>boot-services</code> of <code>/etc/init.conf</code>) is added to the default runlevel. dinit is still process 1 until the next boot, so reboot that once with <code>dinit-reboot</code>.</p> 64 <h2 id="s6-3">6.3 Shutting down</h2> 65 <p><code>reboot</code>, <code>halt</code> and <code>poweroff</code> ask init to stop. <code>openrc shutdown</code> stops the services, the ones others need last, sends <code>TERM</code> and then <code>KILL</code> to what is left, turns swap off and remounts the file systems read-only.</p> 66 <h2 id="s6-4">6.4 The files in /etc</h2> 67 <table> 68 <tr><th>file</th><th>what it holds</th></tr> 69 <tr><td><code>passwd</code>, <code>shadow</code>, <code>group</code></td><td>accounts, password hashes, groups</td></tr> 70 <tr><td><code>shells</code></td><td>the login shells; <code>/bin/mksh</code> is one</td></tr> 71 <tr><td><code>hostname</code></td><td>the host name</td></tr> 72 <tr><td><code>init.d/</code>, <code>runlevels/</code></td><td>the services, and the ones started at boot (6.2)</td></tr> 73 <tr><td><code>modules</code></td><td>kernel modules loaded at boot, one a line</td></tr> 74 <tr><td><code>fstab</code></td><td>the file systems (3.5)</td></tr> 75 <tr><td><code>profile</code></td><td><code>PATH</code>, <code>PAGER</code>, <code>umask 022</code>, and <code>/etc/profile.d/*.sh</code></td></tr> 76 <tr><td><code>os-release</code></td><td><code>NAME=Chamesle</code>, <code>ID=chamesle</code></td></tr> 77 <tr><td><code>mag/</code></td><td>the repos, the keys and the architecture (4.3)</td></tr> 78 <tr><td><code>skel/</code></td><td>the files new homes start from</td></tr> 79 </table> 80 <p>The login shell is mksh and <code>/etc/profile</code> is read by login shells. For a prompt and aliases make <code>~/.mkshrc</code> and set <code>ENV=$HOME/.mkshrc</code> in <code>/etc/profile</code>.</p> 81 <h2 id="s6-5">6.5 Users</h2> 82 <pre>adduser alice 83 adduser alice wheel 84 adduser alice video 85 adduser alice input</pre> 86 <p><code>adduser</code> makes the account, the group and the home, and asks for the password; <code>passwd alice</code> changes it. <code>deluser alice</code> takes the account away.</p> 87 <p><code>wheel</code> may use <code>doas</code>, which is in the base with <code>permit persist :wheel</code> in <code>/etc/doas.d/wheel.conf</code>. <code>video</code> opens <code>/dev/dri</code>, the graphics, and <code>input</code> the keyboard and mouse under <code>/dev/input</code>. There is no logind to hand them out, so whoever runs X or a Wayland compositor needs both, or Xorg stops with <code>open /dev/dri/card0: Permission denied</code> and <code>no screens found</code>. Groups count from the next login.</p> 88 <h2 id="s6-6">6.6 udev and modules</h2> 89 <p>eudev is the udev. <code>udevd</code> gives devices their nodes in <code>/dev</code> and loads the modules the hardware needs.</p> 90 <p>kmod provides <code>modprobe</code>, <code>insmod</code>, <code>rmmod</code>, <code>lsmod</code>, <code>modinfo</code> and <code>depmod</code>. A kernel's modules are in <code>/lib/modules/VERSION</code>. To load one by hand: <code>modprobe name</code>. To load one at every boot, put its name on a line of <code>/etc/modules</code>. The base loads the input and network drivers of <code>/usr/lib/modules-load.d/chamesle.conf</code> too. To keep one from loading, put <code>blacklist name</code> in a file in <code>/etc/modprobe.d/</code>.</p> 91 <h2 id="s6-7">6.7 Networking</h2> 92 <p><code>dhcpcd</code> is the DHCP client and is in the base set. It is the <code>dhcpcd</code> service, enabled by default, and takes every interface, so a cable is up at boot. <code>ip</code> lists them:</p> 93 <pre>ip addr 94 ip link set eth0 up</pre> 95 <p>A static address:</p> 96 <pre>ip addr add 192.168.1.10/24 dev eth0 97 ip route add default via 192.168.1.1 98 echo 'nameserver 192.168.1.1' > /etc/resolv.conf</pre> 99 <p>and <code>rc-update del dhcpcd</code>.</p> 100 <h2 id="s6-8">6.8 Wireless</h2> 101 <p>The card needs its firmware (7.4). Then iwd:</p> 102 <pre>mag install iwd dbus</pre> 103 <p>and add it, which starts dbus with it:</p> 104 <pre>rc-update add iwd 105 rc-service iwd start</pre> 106 <p><code>iwctl</code> connects, the same as on the ISO (2.3), and remembers the network. dhcpcd gives it an address.</p> 107 <p><code>wpa_supplicant</code> works too, for those who know it: <code>mag install wpa_supplicant</code>.</p> 108 <h2 id="s6-9">6.9 Mounting and disks</h2> 109 <pre>mount /dev/sdb1 /mnt/usb 110 mount -t vfat -o ro /dev/sdb1 /mnt/usb 111 umount /mnt/usb</pre> 112 <p><code>mount</code> and <code>umount</code> are busybox's; <code>lsblk</code>, <code>blkid</code>, <code>sfdisk</code> and <code>cfdisk</code> are packages of their own, <code>mkfs.ext4</code> and <code>fsck.ext4</code> are e2fsprogs', <code>mkfs.fat</code> is dosfstools', <code>zpool</code> and <code>zfs</code> are <code>zfs</code>.</p> 113 <p>On a ZFS root, the boot runs <code>zfs mount -a</code> right after <code>mount -a</code>, which mounts <code>rpool/home</code> and <code>rpool/var</code>; the root itself was mounted by the initramfs.</p> 114 <h2 id="s6-10">6.10 Kernel settings</h2> 115 <p>The boot loads every <code>/etc/sysctl.d/*.conf</code> and <code>/etc/sysctl.conf</code> at boot. The base ships <code>/etc/sysctl.d/10-chamesle.conf</code>: kernel addresses and <code>dmesg</code> are for root only (<code>doas dmesg</code>), a process may <code>ptrace</code> only its own children, users get no BPF, links and files in sticky directories like <code>/tmp</code> are protected, setuid programs leave no core dumps, and the network takes no redirects or source routes and filters spoofed addresses. To change one, put it in a file of your own that sorts later, <code>/etc/sysctl.d/90-local.conf</code>:</p> 116 <pre>kernel.dmesg_restrict = 0</pre> 117 <p><code>sysctl -a</code> lists them all, <code>sysctl -w name=value</code> changes one until the next boot.</p> 118 <hr> 119 <p><a href="handbook-rifle.html">← rifle</a> | <a href="docs.html">Contents</a> | <a href="handbook-kernel.html">The kernel and firmware →</a></p> 120 </main> 121 122 <hr> 123 <div id="foot"> 124 Something wrong on this page? Tell us on the <a href="board.html">board</a>.<br> 125 Chamesle installs with <code>chamesle-install</code>, or by hand from the <a href="docs.html">handbook</a>.<br> 126 <a href="https://ko-fi.com/L6N725GI1V">Ko-fi</a><br> 127 <a href="#" id="edit-link">Edit text</a><br> 128 $Date: 2026-11-23 $ 129 </div> 130 131 </div> 132 133 <script src="edit.js"></script> 134 </body> 135 </html>