Common actions include enabling services by sym-linking a service’s directory in /etc/sv/ into /var/service/, managing monitored services with the sv command, and automatically executing commands on system startup by adding them to /etc/rc.local.
Also, don't forget you can check the system logs with the dmesg command.
Do any necessary configuration to connect to the internet and persist it across boots. If not using static IPs you will minimally need to set up a DHCP client, and a wireless daemon if using Wi-Fi:
For DHCP with dhcpcd or ndhc, you can simply copy and rename the service folder suffixing your network interface’s name, edit the run file to use such interface, and then enable the service.
For wireless connections, enable the (potentially interface specific) wpa_supplicant or iwd services and use wpa_cli or iwctl respectively to easily set up a new connection. Note that iwd can also be used as a DHCP client, and that it requires dbus to be running.
For Domain Name Resolution (DNS), you may use a separate application that provides security features and/or caching, like stubby or unbound, or use the nameservers already set up by your DHCP client, or simply add your preferred nameservers manually to /etc/resolv.conf. Note that also, firefox has built-in resolution capabilities using DNS-over-HTTPS and name caching.
To set up audio, install the alsa-utils package and use the alsamixer tool to unmute channels and set the volume. If you see that your desired sound card is not set as default, find the card’s index number in /proc/asound/cards and set it as the default in /etc/asound.conf:
# Set default sound card defaults.ctl.card ❬card_index❭ defaults.pcm.card ❬card_index❭ defaults.hwdep.card ❬card_index❭ defaults.timer.card ❬card_index❭
This section focuses on installing and configuring the Xorg display server with a window manager. You can follow the installation below and simply add or replace any drivers and components you need—for information on installing proprietary or vendor specific graphics drivers, access Void’s documentation with the void-docs command, e.g:
# void-docs -r nvidia
Keyboard layout: To set the default keyboard layout(s) for Xorg, add an X configuration file that defines an input class setting the "XkbLayout" option to them:
# Set keyboard layout Section "InputClass" Identifier "default keyboard layout" MatchDriver "libinput" MatchIsKeyboard "on" # Either set one layout: Option "XkbLayout" "❬layout❭" # Or define more layouts to switch between, e.g. # by pressing both Ctrl keys simultaneously: #Option "XkbLayout" "❬layout❭,❬layout_alt❭" #Option "XkbOptions" "grp:ctrls_toggle" EndSection
Touchpad tapping: To enable tapping on touchpad devices, add an X configuration file that defines an input class setting the "Tapping" option to them:
# Enable tapping Section "InputClass" Identifier "enable touchpad tapping" MatchDriver "libinput" MatchIsTouchpad "on" Option "Tapping" "on" EndSection
Graphics driver: To specify the driver to use with a graphics device and its configuration, first find the BusID of the device with lspci (the first column) and format it accordingly—usually just prefixing it with "PCI:" and replacing the dot with a colon—then use it in an X configuration file specifying the desired driver along with any options, in the following format:
# DDX Intel Graphics driver configuration (from xf86-video-intel package) Section "Device" # Some identifier Identifier "integrated graphics device" # Driver to use with the device Driver "intel" # BusID of the device in our PC BusID "PCI:00:02:0" # Driver settings (optional) # This one is driver specific, to prevent tearing without compositing Option "TearFree" "on" EndSection
Session timeouts: To set the screen locker and DPMS timeouts, set the BlankTime and OffTime options respectively in a server flags X configuration file:
# Xorg server configuration Section "ServerFlags" Option "BlankTime" "❬minutes_blank❭" Option "StandbyTime" "0" Option "SuspendTime" "0" Option "OffTime" "❬minutes_off❭" EndSection
X is commonly started using the startx script, provided by the xinit package, which handles the more complex aspects of setting up the server. To configure it, modify the xinitrc script in /etc/X11/xinit/ to launch your desired application (like a window manager) when X starts, after doing any necessary setup - for example:
#!/bin/sh # start some nice programs - some applications put scripts there if [ -d /etc/X11/xinit/xinitrc.d ] ; then for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do [ -x "$f" ] && . "$f" done unset f fi # apply per-user wallpaper - this uses ImageMagick display -background gray12 -backdrop -window root $HOME/Pictures/.wallpaper.*g # start screen locker daemon xss-lock slock & # start session dbus-launch --exit-with-x11 spectrwm
To start X automatically when logging in from a login shell, execute startx in /etc/profile, which is read and executed by the login shell at such point, conditioning such execution on any parameters you require:
(...) # startx automatically when logging in on tty1 as a regular user if [ ! $DISPLAY ] && [ "$(tty)" = '/dev/tty1' ] && [ $(id -u) -ne 0 ]; then exec startx fi
Note: The "exec" command above is desirable, as when the X server exits, the user will be logged out. This denies the ability of killing (or crashing) the X server to bypass locking or authentication mechanisms, and it does not prevent running Xorg root-less.
To manage input and ACPI events use acpid, a daemon which links such events to an action. It can be used to set volume and backlight levels on key presses, to react to power or battery related events, and much more. Generically, to trigger an action in response to an event:
i) Use the tool acpi_listen to identify the event by triggering it.
ii) Add an entry for the event to a file in /etc/acpi/events/, and its associated handler script (if such is required) in /etc/acpi/handlers/.
iii) Restart the acpid service.
The script /etc/acpi/handler.sh has preset actions for some ACPI events. Since its dynamic power management functionality will have to be implemented differently for one’s machine, and to maximize the modularity of the configuration, it is advisable to limit such script to handling system power states and then manage others with dedicated files:
# anything, that is one of these event=button/(power|sleep|lid) action=/etc/acpi/handler.sh %e
To reboot, simply log out and hit Ctrl+Alt+Del on the login shell, which is set to send the appropriate signal to the OS.
To shutdown or suspend the system, use acpid and zzz. Simply enable the acpid service if you have not yet done so, and the following will already be configured for you:After setting up an environment that allows for hibernation (with an appropriately sized swap partition and the corresponding kernel parameter), you can trigger it by issuing the “zzz -Z” command as a response to an event of your choosing through acpid.
Files to manage volume and backlight related input events through acpid are provided in the Appendix.
Battery: Some laptops send the appropriate signals the OS as a battery discharges, which you can handle with acpid. For others, you can query battery status and load with the acpi command, provided by the homonymous package, whenever another event occurs or on a timer (see next section).
Power: See the “Power profiles” subsection of the “Power saving and performance” section further below, and the relevant files in the Appendix.
To schedule the execution of commands you can use snooze, which has services already set up to run commands on an hourly, daily, weekly and monthly basis that you can enable. You can also use snooze to run a command at a particular time and date, or on different periods.
The simplest way to use it is to enable a service for a particular run frequency, and drop executable scripts in its corresponding folder with the name ”chron.❬frequency❭“ in /etc/ (which may have to be created).
Among other things, scheduling can be used to automate system maintenance, updating backups, querying for information over the web, send notifications, etc. Common periodic actions most users will require are described below.
There are many ways to synchronize the system’s clock with that of a time server. A simple and effective one is using the SNTP Perl script from the site kloth.net:
i) Install perl if you have not already. Apart from being handy, Perl is a dependency of a large amount of packages so it would likely be pulled as such at some point.
ii) Copy the script on the website to a file, commenting out the invocation of the “output_ntp_data” function (as suggested) near the bottom, to make it less verbose.
iii) Set is as executable, and drop it in /usr/local/bin/.
iv) Add an entry in chron.weekly so that snooze may trigger its execution regularly:
#!/bin/sh /usr/bin/perl /usr/local/bin/sntp -u pool.ntp.org
Filesystems on SSD drives should be subject to trimming periodically to maintain drive performance and health. For this, use the tool fstrim provided by the util-linux package, itself a dependency of the base-minimal meta-package.
To trim all supported filesystems listed in fstab weekly, use the following:
#!/bin/sh /usr/bin/fstrim -A