<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=WhyNotHugo</id>
	<title>Alpine Linux - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=WhyNotHugo"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/WhyNotHugo"/>
	<updated>2026-04-29T13:14:15Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Infinitime&amp;diff=32342</id>
		<title>Infinitime</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Infinitime&amp;diff=32342"/>
		<updated>2026-04-23T16:06:31Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: Create page (lists build dependencies)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://infinitime.io/ InfiniTime] is an open source firmware for the Pinetime smartwatch written in C++ and based on [https://www.freertos.org/ FreeRTOS].&lt;br /&gt;
&lt;br /&gt;
All dependencies for compiling the firmware are packaged in the Alpine repositories, and can be installed via:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apk add -t .infinitime-dev \&lt;br /&gt;
	cmake \&lt;br /&gt;
	gcc-arm-none-eabi \&lt;br /&gt;
	lv_font_conv \&lt;br /&gt;
	nrf5-sdk \&lt;br /&gt;
	py3-cbor2 \&lt;br /&gt;
	py3-cryptography \&lt;br /&gt;
	py3-intelhex&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=System_Disk_Mode&amp;diff=32338</id>
		<title>System Disk Mode</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=System_Disk_Mode&amp;diff=32338"/>
		<updated>2026-04-20T16:08:53Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: /* See also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;System Disk mode is the traditional or classic harddisk installation of Alpine Linux. This mode is suitable for use cases like [[Tutorials_and_Howtos#Desktop|desktop]], [[Setting up the build environment|development machine]] etc. &lt;br /&gt;
&lt;br /&gt;
{{Tip|If an entire hard disk(s) is available for Alpine Linux, [[Installation#setup-alpine_based_System_Disk_Install|setup-alpine based install]] is the recommended way to install Alpine Linux.}}&lt;br /&gt;
&lt;br /&gt;
== setup-disk based Installation ==&lt;br /&gt;
&lt;br /&gt;
To perform a traditional hard-disk installation of Alpine Linux, after completing the base configuration, proceed to create, format and mount your partitions with MOUNTPOINT {{Path|&#039;&#039;&#039;/mnt&#039;&#039;&#039;}} as root and run the command {{Codeline|&#039;&#039;&#039;&amp;lt;Code&amp;gt;setup-disk -m sys /mnt&amp;lt;/Code&amp;gt;&#039;&#039;&#039;}}.&lt;br /&gt;
&lt;br /&gt;
The [[Alpine_setup_scripts#setup-disk|&amp;lt;code&amp;gt;setup-disk&amp;lt;/code&amp;gt;]] script performs a traditional hard disk install of your running system and can be customized using [[Alpine_setup_scripts#Environment_Variables|environment variables]]. A working [[Configure_Networking#Connectivity_testing|internet access]] configured in step 1 below is mandatory to complete this installation, if &#039;&#039;&#039;Extended image&#039;&#039;&#039; is not used. The detailed steps are given below:&lt;br /&gt;
&lt;br /&gt;
# Follow the [[Installation#General_course_of_action|Installation guide]] to complete the [[Installation#Base_configuration|base configuration]], if not already done. &lt;br /&gt;
# If necessary formatted partition(s) are unavailable, manually [[Setting up disks manually#Creating_partitions|create]] them first and [[Setting up disks manually#Formatting_partitions|format]] them including swap partition(if used). If you&#039;re using legacy BIOS mode, use DOS i.e MBR partition table and ensure that proper partition is bootable for [[Bootloaders#Syslinux|extlinux]].&lt;br /&gt;
# Mount the &#039;&#039;&#039;/ (root)&#039;&#039;&#039;  partition on a mount point i.e say {{Path|/mnt}} as follows: {{Cmd|# mount /dev/sdXY /mnt}}&lt;br /&gt;
# If you&#039;re using [[UEFI|EFI]], create a mount point &amp;lt;code&amp;gt;/mnt/boot&amp;lt;/code&amp;gt; and mount the EFI system partition(ESP) on it. {{Cmd|&amp;lt;nowiki&amp;gt;# mkdir -p /mnt/boot&lt;br /&gt;
# mount /dev/sdXY /mnt/boot&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
# If [[Swap|swap]] partition is available, you can also enable it now: {{Cmd|# swapon /dev/sdXY }}&lt;br /&gt;
# Install Alpine Linux using the following command: {{Cmd|# setup-disk -m sys /mnt}}&lt;br /&gt;
# The above command detects your file system layout and generates {{Path|/etc/fstab}} and installs a [[Bootloaders|bootloader]] based on the optional [[Alpine_setup_scripts#Environment_Variables|environment variable]] &amp;lt;Code&amp;gt;BOOTLOADER&amp;lt;/Code&amp;gt; and completes the installation by transferring your running system&#039;s configuration to the hard disk.&lt;br /&gt;
# At the end of Installation, you can [[Installation#Reboot|reboot]] to boot into the newly installed Alpine Linux and [[Installation#Post-Installation|configure]] further.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== Mounting on /dev/sdXY sysroot failed ===&lt;br /&gt;
&lt;br /&gt;
The error message appears as follows with variations in &amp;lt;code&amp;gt;/dev/sda8&amp;lt;/code&amp;gt; depending on the partition number and SSD/HDD etc:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
mounting /dev/sda8 on /sysroot failed: No such file or directory&lt;br /&gt;
mounting root: failed&lt;br /&gt;
initramfs emergency recovery shell launched. Type &#039;exit&#039; to continue boot&lt;br /&gt;
sh: can&#039;t access tty: job control turned off&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above error message can be caused by various reasons. Follow the below steps in the emergency shell to identify one possible cause.&lt;br /&gt;
&lt;br /&gt;
# Verify that the partition name in which Alpine Linux was installed matches the above [[#Mounting on /dev/sdXY sysroot failed|error]] by issuing the command and also note down the filesystem type of that partition (say TYPE=&amp;quot;ext4&amp;quot;) : {{Cmd| blkid}}&lt;br /&gt;
# If the expected disk (e.g., /dev/sda, /dev/nvme0n1) itself is missing in the output of {{ic| blkid}}, check [[#Disks not detected after setup-disk|Disks not detected after setup-disk]].&lt;br /&gt;
# Verify that sysroot exists by issuing the command. {{Cmd|ls -ld /sysroot}}&lt;br /&gt;
# Check if the above error message apears when issuing the command. {{Cmd|mount /dev/sda8 /sysroot}}&lt;br /&gt;
# If there is no error message, proceed to check if the issue is caused by a [[#Filesystem corruption|filesystem corruption]].&lt;br /&gt;
# If the manual mount command fails with &amp;quot;No such file or directory&amp;quot; even though you verified /sysroot exists in Step 3, this confirms the kernel doesn&#039;t recognize the filesystem type. Check whether filesystem modules(change ext4 if needed) are loaded by issuing the command. {{Cmd|&amp;lt;nowiki&amp;gt;lsmod | grep ext4 &amp;lt;/nowiki&amp;gt;}} &lt;br /&gt;
# If there is no output, then it confirms that the above [[#Mounting on /dev/sdXY sysroot failed|issue]] is caused by [[#Missing filesystem modules in the kernel cmdline|missing filesystem module]].&lt;br /&gt;
&lt;br /&gt;
==== Disks not detected after setup-disk====&lt;br /&gt;
&lt;br /&gt;
After running the standard Alpine installation command: {{ic|setup-disk -m sys /mnt}} and rebooting, the system gives the error mentioned in [[#Mounting on /dev/sdXY sysroot failed|Mounting on /dev/sdXY sysroot failed]] with the expected disk (e.g., /dev/sda, /dev/nvme0n1) missing to show at the output of {{ic| blkid}}. This prevents booting into the installed system. &lt;br /&gt;
&lt;br /&gt;
Issue: As per [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/issues/10615 bug report] this might be caused by BIOS storage controller being set to &amp;quot;RAID On (Intel Rapid Storage Technology)&amp;quot;.  &lt;br /&gt;
&lt;br /&gt;
Resolution: Switch the storage mode in BIOS/UEFI: Go to BIOS → Storage or SATA/NVMe Operation. Change setting from:RAID On (Intel Rapid Storage Technology) to: AHCI or AHCI/NVMe.&lt;br /&gt;
&lt;br /&gt;
==== Missing filesystem modules in the kernel cmdline ====&lt;br /&gt;
&lt;br /&gt;
[[BusyBox]] mount command does not autoload modules, so need to add filesystem modules to the kernel cmdline. Even though alpine installer does this automatically, this has to be taken care of in case of manual disk install, particularly for [[Dualbooting|dualboot]] installations.&lt;br /&gt;
&lt;br /&gt;
# To resolve, issue the command to load the appropriate filesystem module(say TYPE=&amp;quot;ext4&amp;quot;).{{Cmd|modprobe ext4}}&lt;br /&gt;
# To verify if the issue is resolved, reissue the command.{{Cmd|mount /dev/sda8 /sysroot}} &lt;br /&gt;
# If mount succeeded, issue the following command to boot into Alpine Linux. {{Cmd|exit}}&lt;br /&gt;
&lt;br /&gt;
Choose the appropriate solution based on your use case for a permanent fix:&lt;br /&gt;
&lt;br /&gt;
*If you are using [[Bootloaders#GRUB|grub]], then ensure that {{Codeline|GRUB_CMDLINE_LINUX}} line in the file {{Path|/etc/default/grub}} has the appropriate filesystem module &amp;lt;code&amp;gt;ext4&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;rootfstype=ext4&amp;lt;/code&amp;gt; as follows: {{Cat|/etc/default/grub|&amp;lt;nowiki&amp;gt;...&lt;br /&gt;
GRUB_CMDLINE_LINUX=&amp;quot;console=ttyS0,19200n8 net.ifnames=0 modules=sd-mod,usb-storage,ext4 quiet rootfstype=ext4&amp;quot;&lt;br /&gt;
...&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
* If you are using [[Bootloaders#Syslinux|ExtLinux/SysLinux]], then ensure that {{Codeline|APPEND}} line in the file {{Path|/boot/extlinux.conf}} has &amp;lt;code&amp;gt;root=UUID=&amp;lt;UUID ID&amp;gt;&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;root=/dev/sdXY&amp;lt;/code&amp;gt; and the same matches the root path in the {{Path|/etc/fstab}} file. Also ensure that modules has the appropriate filesystem like &amp;lt;code&amp;gt;ext4&amp;lt;/code&amp;gt; as follows: {{Cat|/boot/extlinux.conf|&amp;lt;nowiki&amp;gt;...&lt;br /&gt;
APPEND root=/dev/sdXY modules=sd-mod,usb-storage,ext4 quiet&lt;br /&gt;
# root=UUID=&amp;lt;UUID ID&amp;gt; can be used also in the APPEND Line.&lt;br /&gt;
...&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
{{Note|For both above cases, you may need to issue {{Codeline|update-grub}} or {{Codeline|update-extlinux}} after making above changes.}}&lt;br /&gt;
 &lt;br /&gt;
*For a solution independent of [[Bootloaders|bootloaders]], ensure that the file {{Path|/etc/mkinitfs/mkinitfs.conf}} has the necessary filesystem module in it. Refer [[Initramfs init|Initramfs]] page for more information and recreate initramfs image.&lt;br /&gt;
&lt;br /&gt;
==== Filesystem corruption ====&lt;br /&gt;
&lt;br /&gt;
To fix filesystem corruption issues, the command fsck must be run on the root partition. The root partition should be umounted before running fsck. Boot from a [[Rescue disk]] to run the fsck command on the root partition:{{Cmd|&amp;lt;nowiki&amp;gt;# fsck -y /dev/&amp;lt;DEVICE&amp;gt;&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
After running fsck, proceed to Reboot the Computer.&lt;br /&gt;
&lt;br /&gt;
If the fsck Command does Fix the Corruption on the Root File System but the &#039;&#039;&#039;Error: Mounting Root Failed&#039;&#039;&#039; still persists then the next step would be to ReBuild the &#039;&#039;&#039;initramfs&#039;&#039;&#039; File System with the &#039;&#039;&#039;mkinitfs&#039;&#039;&#039; Command then Reboot. You need to &#039;&#039;&#039;Mount the Root Partition&#039;&#039;&#039; and [[Chroot]] into the Mounted Root Partition before running the mkinitfs Command as shown in the [[Initramfs init|initramfs]] page. &lt;br /&gt;
&lt;br /&gt;
==== Check File System Kernel Modules are Loading ====&lt;br /&gt;
&lt;br /&gt;
Run the below command to output the File System Kernel modules, where the file system can be one among the following: &#039;&#039;&#039;ext2&#039;&#039;&#039;, &#039;&#039;&#039;ext3&#039;&#039;&#039;, &#039;&#039;&#039;ext4&#039;&#039;&#039;, &#039;&#039;&#039;btrfs&#039;&#039;&#039;, &#039;&#039;&#039;xfs&#039;&#039;&#039;, &#039;&#039;&#039;fat&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;# lsmod | grep &amp;lt;File System&amp;gt;&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
An example output is given below for the above command, with necessary abbreviations explained:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
alpinepc:~# lsmod | grep ext4&lt;br /&gt;
&lt;br /&gt;
ext4                 1155072  2&lt;br /&gt;
crc16                  12288  1 ext4&lt;br /&gt;
mbcache                16384  1 ext4&lt;br /&gt;
jbd2                  200704  1 ext4&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
EXT4 = [[Filesystems|File System]]&amp;lt;br&amp;gt;&lt;br /&gt;
CRC16 = EXT4 Compression Support&amp;lt;br&amp;gt;&lt;br /&gt;
MBCACHE = MetaData Cache&amp;lt;br&amp;gt;&lt;br /&gt;
JBD2 = Journaling&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Blinking underscore ===&lt;br /&gt;
&lt;br /&gt;
On a UEFI system, at the end of Installation after rebooting, the computer screen may appear with a &#039;&#039;&#039;blinking underscore&#039;&#039;&#039;. This may be due to the firmware not finding a valid boot entry.&lt;br /&gt;
&lt;br /&gt;
The [[UEFI#EFI bootloaders|EFI bootloader]] entries are added without writing to NVRAM, thus preventing GRUB from calling {{ic|efibootmgr}}. In some cases the UEFI firmware may not boot from a bootloader without a valid NVRAM entry. In such cases, at the end of installation, instead of rebooting, manually add an entry for Alpine Linux in the NVRAM as follows:&lt;br /&gt;
* Install the {{pkg|efibootmgr}} package:{{Cmd|# apk add efibootmgr}}&lt;br /&gt;
* Adjust the device name {{ic|/dev/sdX}} and partition number {{ic|1}}, before issuing the command: {{Cmd|# efibootmgr --create --disk /dev/sdX --part 1 --label &amp;quot;Alpine&amp;quot; --loader &#039;\EFI\alpine\grubx64.efi&#039;}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Bootloaders]] - For information on GRUB, Syslinux and rEFInd&lt;br /&gt;
* [[Installing Alpine on HDD dualbooting|Install to HDD with dual-boot]]&lt;br /&gt;
* [[Installing Alpine Linux in a chroot|Installing Alpine Linux in a chroot]]&lt;br /&gt;
* [https://github.com/itoffshore/alpine-linux-scripts setup-partitions]&lt;br /&gt;
* [[Data Disk Mode]]&lt;br /&gt;
* [[Diskless Mode]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Data_Disk_Mode&amp;diff=32337</id>
		<title>Data Disk Mode</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Data_Disk_Mode&amp;diff=32337"/>
		<updated>2026-04-20T16:08:23Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: /* See Also */ System Disk Mode&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In Data Disk mode also the operating system runs from system RAM, thus it enjoys the same accelerated operation speed as [[Diskless Mode|diskless]] mode. However, swap storage and the entire {{Path|/var}} directory tree get mounted from a persistent storage device (two newly created partitions). The directory {{Path|/var}} holds e.g. all log files, mailspools, databases, etc., as well as &amp;lt;code&amp;gt;[[Alpine_local_backup|lbu]]&amp;lt;/code&amp;gt; backup commits and the package cache. This mode is useful for having RAM accelerated servers with variable amounts of user-data that exceed the available RAM size. It enables the entire current system state (not just the boot state) to survive a system crash in accordance with the particular filesystem guarantees. &lt;br /&gt;
&lt;br /&gt;
== Installation  ==&lt;br /&gt;
{{Seealso|Diskless Mode}}&lt;br /&gt;
Following the [[Installation#Installation_Step_Details|Installation steps]] to complete the [[Installation#Base_configuration|base configuration]] completes the pre-setup of [[Diskless_Mode|&amp;quot;diskless&amp;quot;]] Alpine Linux system. In data disk mode, the boot device may also remain the initial (and possibly read-only) installation media, or be copied to a partition (e.g. /dev/sdXY) with &amp;lt;code&amp;gt;[[Alpine_setup_scripts#setup-bootable|setup-bootable]]&amp;lt;/code&amp;gt;. Refer [[Create_a_Bootable_Device|Creating a bootable device]] for creating a bootable medium to boot the Data Disk Mode Installation.&lt;br /&gt;
&lt;br /&gt;
As per Bug: [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/issues/10474 #10474], &amp;lt;Code&amp;gt;setup-alpine&amp;lt;/Code&amp;gt; script will create the data partition and mount it as /var, but &#039;&#039;&#039;setup-alpine&#039;s &amp;quot;data&amp;quot; disk mode can not yet configure lbu config storage settings automatically&#039;&#039;&#039;. The &#039;&#039;&#039;current workaround&#039;&#039;&#039;, is to select &amp;quot;none&amp;quot; at the &#039;where to store configs&#039; prompt (as the new data partition is not listed anyway) and configure lbu manually after &amp;lt;code&amp;gt;[[Alpine_setup_scripts#setup-alpine|setup-alpine]]&amp;lt;/code&amp;gt; exits, and before rebooting:&lt;br /&gt;
&lt;br /&gt;
# Identify the created data partition, e.g. &amp;lt;code&amp;gt;/dev/sd&#039;&#039;XY&#039;&#039;&amp;lt;/code&amp;gt;, and its filesystemtype, e.g. using &amp;lt;code&amp;gt;&#039;&#039;lsblk&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
# Manually edit the lbu backups location in &amp;lt;code&amp;gt;/etc/lbu/lbu.conf&amp;lt;/code&amp;gt; and configure &amp;lt;code&amp;gt;LBU_MEDIA=sd&#039;&#039;XY&#039;&#039;&amp;lt;/code&amp;gt; (according to the previous findings).&lt;br /&gt;
# Save the configuration on that partition for the next boot with &amp;lt;code&amp;gt;lbu commit&amp;lt;/code&amp;gt;.&lt;br /&gt;
# If (a new) partition fails to get mounted, execute: &amp;lt;code&amp;gt;mkdir /media/&#039;&#039;sdXY&#039;&#039; ; echo &amp;quot;/dev/sd&#039;&#039;XY&#039;&#039; /media/sd&#039;&#039;XY&#039;&#039; &#039;&#039;fstype&#039;&#039; noauto,rw 0 0&amp;quot; &amp;gt;&amp;gt; /etc/fstab&amp;lt;/code&amp;gt;, and try &amp;lt;code&amp;gt;lbu commit&amp;lt;/code&amp;gt; again.&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[Alpine_local_backup|Alpine Local backup Utility - &#039;&#039;lbu&#039;&#039;&#039;]]&lt;br /&gt;
* [[Alpine_Package_Keeper#Local_Cache|Local package cache]]&lt;br /&gt;
* [[Manually editing a existing apkovl]]&lt;br /&gt;
* [[Back Up a Flash Memory Installation]]&lt;br /&gt;
* [[Upgrading_Alpine#Upgrading_Alpine_Linux_on_other_removable_media_(such_as_CF/USB)|Upgrading Diskless to New Alpine Linux Release]]&lt;br /&gt;
* [[PXE boot#Specifying an apkovl|Diskless PXE Boot]]&lt;br /&gt;
* [[How to make a custom ISO image with mkimage]]&lt;br /&gt;
* [[QEMU#Live_mode|QEMU Diskless example]] &lt;br /&gt;
* [[Alpine local backup#Include special files.2Ffolders to the apkovl|Include special files section]] - To include custom files outside of &amp;lt;code&amp;gt;/etc&amp;lt;/code&amp;gt; in .apkovl file.&lt;br /&gt;
* [[System Disk Mode]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Diskless]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=PipeWire&amp;diff=32325</id>
		<title>PipeWire</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=PipeWire&amp;diff=32325"/>
		<updated>2026-04-14T16:50:14Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: /* Realtime scheduling */ The details for configuring limits apply to the PAM configuration, not the rtkit configuration.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
[https://pipewire.org/ PipeWire] is a multimedia processing engine that aims to improve audio and video handling on Linux. PipeWire can act as a replacement for both [[PulseAudio]] and [[ALSA]] servers.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* [[XDG_RUNTIME_DIR]] must be set in the running environment.&lt;br /&gt;
* [[D-Bus#D-Bus_session_bus|D-Bus session bus]] must be running.&lt;br /&gt;
* [[Setting_up_a_new_user#Creating_a_new_user|Non-root user accounts]] require appropriate [[Setting_up_a_new_user#Groups_for_desktop_usage|groups for desktop usage]].&lt;br /&gt;
* WirePlumber requires [[eudev]] for ALSA device discovery.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
Install {{Pkg|pipewire}} and {{Pkg|wireplumber}} (session manager).&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add pipewire wireplumber}}&lt;br /&gt;
&lt;br /&gt;
=== Pulseaudio interface ===&lt;br /&gt;
&lt;br /&gt;
The package {{Pkg|pipewire-pulse}} allows pulseaudio applications and [[#GUI_tools|GUI tools]] to use PipeWire as audio server in the backend.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add pipewire-pulse}}&lt;br /&gt;
&lt;br /&gt;
=== JACK compatibility ===&lt;br /&gt;
&lt;br /&gt;
Since PipeWire replaces JACK, Install {{Pkg|pipewire-jack}} package, so it provides ABI-compatible libraries for JACK applications.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add pipewire-jack}}&lt;br /&gt;
&lt;br /&gt;
=== ALSA support ===&lt;br /&gt;
&lt;br /&gt;
Install {{Pkg|pipewire-alsa}} package to provide support for ALSA applications.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add pipewire-alsa}}&lt;br /&gt;
&lt;br /&gt;
=== GUI tools ===&lt;br /&gt;
&lt;br /&gt;
* {{Pkg|pavucontrol}}: simple GUI app for controlling sound, outputs, etc. Consider using {{Pkg|pavucontrol-qt}} when using [[KDE|Plasma]]. &lt;br /&gt;
&lt;br /&gt;
: [[#Pulseaudio_interface|Pulseaudio interface]] is mandatory for {{Ic|pavucontrol}} to work with PipeWire.&lt;br /&gt;
&lt;br /&gt;
* {{Pkg|xfce4-mixer}}: XFCE Audio mixer.&lt;br /&gt;
&lt;br /&gt;
: Currently available in the [[Repositories#Testing|testing]] repository.&lt;br /&gt;
&lt;br /&gt;
* {{Pkg|qpwgraph}}: graph manager dedicated to PipeWire with Qt GUI Interface.&lt;br /&gt;
&lt;br /&gt;
== Launch PipeWire ==&lt;br /&gt;
&lt;br /&gt;
Most [[Desktop_environments_and_Window_managers#Desktop_environments|desktop environments]] launch PipeWire automatically in Alpine Linux upon relogging (i.e. logging out and logging in) after [[#Installation|installing the above packages]]. Proceed with the section below only if PipeWire is [[#Testing|not launched]] after a relogin/reboot.&lt;br /&gt;
&lt;br /&gt;
{{Note|[[#PipeWire_user_service|PipeWire user service]] is the recommended method to launch PipeWire and will replace [[#pipewire-launcher|pipewire-launcher]]. Do &#039;&#039;&#039;NOT&#039;&#039;&#039; use both methods to avoid running multiple instances of PipeWire.}}&lt;br /&gt;
&lt;br /&gt;
=== PipeWire user service ===&lt;br /&gt;
&lt;br /&gt;
Since [[Release_Notes_for_Alpine_3.22.0#OpenRC_User_services|Alpine 3.22]], PipeWire can be launched as a user service.&lt;br /&gt;
&lt;br /&gt;
==== User service prerequisites ====&lt;br /&gt;
&lt;br /&gt;
* Ensure the [[OpenRC#Prerequisites|OpenRC User service Prerequisites]] are met and [[OpenRC#Configure environment variables|environment variables are configured]].&lt;br /&gt;
* PipeWire will fail to start, if [[#Realtime scheduling|realtime scheduling]] is not configured. &lt;br /&gt;
* Issue the command {{ic|$ rc-status -Ur}} to view and verify the current user runlevel as &#039;&#039;&#039;gui&#039;&#039;&#039; and &#039;&#039;&#039;default&#039;&#039;&#039; for Wayland and Xorg respectively.&lt;br /&gt;
&lt;br /&gt;
==== User service management ====&lt;br /&gt;
&lt;br /&gt;
To start the {{Ic|pipewire}} user service and its {{Ic|wireplumber}} session manager:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ rc-service -U pipewire start&lt;br /&gt;
$ rc-service -U wireplumber start}}&lt;br /&gt;
&lt;br /&gt;
To enable the {{Ic|pipewire}} and {{Ic|wireplumber}} user services in [[Wayland]], in [[Xorg]] change {{Ic|gui}} to {{Ic|default}}:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ rc-update -U add pipewire gui&lt;br /&gt;
$ rc-update -U add wireplumber gui}}&lt;br /&gt;
&lt;br /&gt;
The above steps may be repeated for {{Ic|pipewire-pulse}} user service.&lt;br /&gt;
&lt;br /&gt;
{{Note|The {{ic|pipewire-pulse}} user service would be required to enable various functions, including setting audio levels with {{ic|pactl}}, when [[PulseAudio#PulseAudio_Utils|running pulseaudio with pulseaudio-utils]] and to enable associated volume user keys.}}&lt;br /&gt;
&lt;br /&gt;
=== pipewire-launcher ===&lt;br /&gt;
&lt;br /&gt;
{{Note|The {{Ic|pipewire-launcher}} script will be removed in the future to be replaced with the [[#PipeWire_user_service|PipeWire user service]].}}&lt;br /&gt;
&lt;br /&gt;
Launch PipeWire by using the &amp;lt;code&amp;gt;pipewire-launcher&amp;lt;/code&amp;gt; script. You&#039;ll probably get quite a few errors but just ignore them for now.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ /usr/libexec/pipewire-launcher}}&lt;br /&gt;
&lt;br /&gt;
If xinitrc is used, add {{Path|/usr/libexec/pipewire-launcher}} to your {{Path|~/.xinitrc}}.&lt;br /&gt;
&lt;br /&gt;
If you do not use GUI by default, add the following stanza to your shell configuration file:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|export $(dbus-launch) &lt;br /&gt;
/usr/libexec/pipewire-launcher}}&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
PipeWire and WirePlumber store their default configuration in {{Path|/usr/share/pipewire}} and {{Path|/usr/share/wireplumber}} respectively. If you want to edit the configuration, you need to move it to {{Path|/etc}}:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;# cp -a /usr/share/pipewire /etc&lt;br /&gt;
# cp -a /usr/share/wireplumber /etc&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
=== Screen sharing on Wayland ===&lt;br /&gt;
&lt;br /&gt;
Applications which don&#039;t implement native Wayland screensharing rely on [https://github.com/flatpak/xdg-desktop-portal xdg-desktop-portal] plus the correct backend for your compositor. Screen sharing is known to work on:&lt;br /&gt;
* GNOME with &amp;lt;code&amp;gt;xdg-desktop-portal-gtk&amp;lt;/code&amp;gt;&lt;br /&gt;
* KDE Plasma with &amp;lt;code&amp;gt;xdg-desktop-portal-kde&amp;lt;/code&amp;gt; and Firefox&lt;br /&gt;
* Sway with &amp;lt;code&amp;gt;xdg-desktop-portal-wlr&amp;lt;/code&amp;gt; and Firefox, see [[Sway]] for details&lt;br /&gt;
&lt;br /&gt;
=== Bluetooth audio ===&lt;br /&gt;
{{Main|Bluetooth}}&lt;br /&gt;
* Enable PulseAudio support as described above&lt;br /&gt;
* Install bluetooth service packages: &amp;lt;code&amp;gt;bluez bluez-openrc pipewire-spa-bluez&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: install GUI manager for bluetooth &amp;lt;code&amp;gt;blueman&amp;lt;/code&amp;gt;&lt;br /&gt;
* Enable and start bluetooth service: &amp;lt;code&amp;gt;rc-update add bluetooth; rc-service bluetooth start&amp;lt;/code&amp;gt;&lt;br /&gt;
* Restart PipeWire&lt;br /&gt;
* Use commandline program &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; or GUI program &amp;lt;code&amp;gt;blueman-manager&amp;lt;/code&amp;gt; to scan and pair bluetooth audio devices.&lt;br /&gt;
* Use pavucontrol to adjust volume and manually select high definition bluetooth codecs.&lt;br /&gt;
&lt;br /&gt;
=== Video ===&lt;br /&gt;
&lt;br /&gt;
Video should work out-of-the-box with v4l2 devices (e.g. a lot of webcams) and [https://gstreamer.freedesktop.org/ GStreamer] applications.&lt;br /&gt;
&lt;br /&gt;
=== Realtime scheduling ===&lt;br /&gt;
&lt;br /&gt;
Realtime scheduling will increase certain threads priorities to assist with low latency audio processing.  By default, PipeWire tries to enable realtime scheduling with the [https://docs.pipewire.org/page_module_rt.html rt module]. &lt;br /&gt;
&lt;br /&gt;
This can be done in one of two ways: via {{Pkg|rtkit}} or via PAM.&lt;br /&gt;
&lt;br /&gt;
==== Without PAM ====&lt;br /&gt;
&lt;br /&gt;
If the current session is not using [[PAM]] and the system [[D-Bus]] is available, the rt module will try to use {{Pkg|rtkit}}. Only users in the {{Ic|rtkit}} group shall be allowed to increase priorities via this mechanism.&lt;br /&gt;
&lt;br /&gt;
==== Using PAM ====&lt;br /&gt;
&lt;br /&gt;
Since [https://gitlab.freedesktop.org/pipewire/pipewire/-/releases/0.3.66 PipeWire 0.3.66], a [[PAM]] configuration is included. This configuration applies to sessions started via PAM for members of the {{Ic|pipewire}} group.&lt;br /&gt;
&lt;br /&gt;
The default system wide settings are defined in {{Path|/etc/security/limits.d/25-pw-rlimits.conf}}. Parameters such as &amp;lt;var&amp;gt;rt.prio&amp;lt;/var&amp;gt; may be adapted according to each use case as necessary. Alternatively, it can be set at [https://docs.pipewire.org/page_module_rt.html  user level] within the ceiling set by the system&#039;s rlimits.&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.config/pipewire/pipewire.conf.d/my-rt-args.conf|&amp;lt;nowiki&amp;gt;context.modules = [&lt;br /&gt;
{   name = libpipewire-module-rt&lt;br /&gt;
    args = {&lt;br /&gt;
        #nice.level   = 20&lt;br /&gt;
        #rt.prio      = 88&lt;br /&gt;
    }&lt;br /&gt;
    flags = [ ifexists nofail ]&lt;br /&gt;
}&lt;br /&gt;
]&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
Use the &amp;lt;code&amp;gt;wpctl&amp;lt;/code&amp;gt; utility from {{Pkg|wireplumber}} to test the working of PipeWire:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ wpctl status}}&lt;br /&gt;
&lt;br /&gt;
=== pw-cat playback ===&lt;br /&gt;
&lt;br /&gt;
Test sound is working using an audio file in a format supported by [http://www.mega-nerd.com/libsndfile/ libsndfile]{{insecure url|Server refuses HTTPS connections}} (e.g. flac, opus, ogg, wav). Use &amp;lt;code&amp;gt;pw-cat&amp;lt;/code&amp;gt; utility from {{Pkg|pipewire-tools}}:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ pw-cat -p test.flac&lt;br /&gt;
$ pw-play /usr/share/sounds/alsa/Front_Center.wav&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== pw-cat recording ===&lt;br /&gt;
&lt;br /&gt;
If you have a microphone test audio recording is working.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ pw-cat -r --list-targets&lt;br /&gt;
$ pw-cat -r recording.flac&lt;br /&gt;
(Speak for a while then stop it with Ctrl+c)&lt;br /&gt;
$ pw-cat -p recording.flac&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== PulseAudio ===&lt;br /&gt;
&lt;br /&gt;
Test PulseAudio clients using a media player, as most use PulseAudio.&lt;br /&gt;
&lt;br /&gt;
=== JACK ===&lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;jack_simple_client&amp;lt;/code&amp;gt; from {{Pkg|jack-simple-clients}}:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ jack_simple_client}}&lt;br /&gt;
&lt;br /&gt;
You should hear a sustained beep.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== `wpctl status` shows no targets ===&lt;br /&gt;
&lt;br /&gt;
First, check whether ALSA knows about your sound card using the &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; utility from {{pkg|alsa-utils}} package:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ aplay -l}}&lt;br /&gt;
&lt;br /&gt;
If sound devices are found, the issue is likely with your PipeWire configuration.  Ensure that [[eudev]] is installed, and consider double-checking the instructions above.&lt;br /&gt;
&lt;br /&gt;
If no sound devices are found, your sound card may not be supported in the version of the Linux Kernel you&#039;re running.  You should search online for fixes relating to your current kernel version and the codec of your sound card.  You can find each of these with:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ uname -r&lt;br /&gt;
$ cat /proc/asound/card0/codec* {{!}} grep Codec}}&lt;br /&gt;
&lt;br /&gt;
Modern devices might require {{Pkg|sof-firmware}}, which is the case if you get &amp;lt;code&amp;gt;sof firmware file is missing&amp;lt;/code&amp;gt; errors in dmesg.&lt;br /&gt;
&lt;br /&gt;
=== Error acquiring bus address: Cannot autolaunch D-Bus without X11 $DISPLAY ===&lt;br /&gt;
&lt;br /&gt;
Check and ensure that [[D-Bus#D-Bus session bus|D-Bus session bus]] is started along with your GUI session i.e. you are in a tty.&lt;br /&gt;
&lt;br /&gt;
=== Connection failure: Connection refused ===&lt;br /&gt;
&lt;br /&gt;
When using [[Wayland]], ensure that [[Wayland#XDG_RUNTIME_DIR|XDG_RUNTIME_DIR]] is configured correctly. If this is not set, PipeWire will create a directory in your home folder instead, called {{Path|~/pulse}}, and on attempting to run {{Ic|pavucontrol}} or {{Ic|pactl}}, you will get the following error:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ pactl list&lt;br /&gt;
Connection failure: Connection refused&lt;br /&gt;
pa_context_connect() failed: Connection refused}}&lt;br /&gt;
&lt;br /&gt;
If you are running Alpine 3.22+ and continue to experience this error after verifying that [[Wayland#XDG_RUNTIME_DIR|XDG_RUNTIME_DIR]] is correctly set, ensure that the &amp;lt;code&amp;gt;pipewire-pulse&amp;lt;/code&amp;gt; [[#PipeWire_user_service|user service is running]].&lt;br /&gt;
&lt;br /&gt;
=== Bluetooth connect failed: br-connection-profile-unavailable === &lt;br /&gt;
&lt;br /&gt;
Ensure {{Ic|wireplumber}}, the session manager, is running.&lt;br /&gt;
&lt;br /&gt;
=== Play/Pause buttons not working on bluetooth headphones ===&lt;br /&gt;
&lt;br /&gt;
Check {{Path|/var/log/messages}} for lines similar to:&lt;br /&gt;
&lt;br /&gt;
{{Cat|/var/log/messages|bluetoothd[3463]: profiles/audio/avctp.c:uinput_create() Can&#039;t open input device: No such file or directory (2)&lt;br /&gt;
bluetoothd[3463]: profiles/audio/avctp.c:init_uinput() AVRCP: failed to init uinput for WH-1000XM5}}&lt;br /&gt;
&lt;br /&gt;
Then {{Ic|bluez}} is trying to register the headphones buttons as an input devices, but &amp;lt;code&amp;gt;uinput&amp;lt;/code&amp;gt; is not loaded. Try &amp;lt;code&amp;gt;modprobe uinput&amp;lt;/code&amp;gt;. If this works, see [[Architecture#Loading_of_Kernel_Modules|Loading of Kernel Modules]] for instructions on how to make sure this module is loaded automatically on each startup.&lt;br /&gt;
&lt;br /&gt;
=== RTKit error: org.freedesktop.DBus.Error.ServiceUnknown ===&lt;br /&gt;
&lt;br /&gt;
 mod.rt ../src/modules/module-rt.c:330:translate_error: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown&lt;br /&gt;
 mod.rt ../src/modules/module-rt.c:995:do_rtkit_setup: RTKit does not give us MaxRealtimePriority, using 1&lt;br /&gt;
 mod.rt ../src/modules/module-rt.c:330:translate_error: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown&lt;br /&gt;
 mod.rt ../src/modules/module-rt.c:1000:do_rtkit_setup: RTKit does not give us MinNiceLevel, using 0&lt;br /&gt;
 mod.rt ../src/modules/module-rt.c:330:translate_error: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown&lt;br /&gt;
 mod.rt ../src/modules/module-rt.c:1005:do_rtkit_setup: RTKit does not give us RTTimeUSecMax, using -1&lt;br /&gt;
&lt;br /&gt;
Follow [[#Realtime scheduling|Realtime scheduling]] section to resolve the above error message.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Bluetooth]]&lt;br /&gt;
* Official PipeWire links &lt;br /&gt;
** [https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/home Wiki]&lt;br /&gt;
** [https://docs.pipewire.org Documentation site]&lt;br /&gt;
** [https://gitlab.freedesktop.org/pipewire/pipewire Source repository]&lt;br /&gt;
* [https://wiki.archlinux.org/index.php/PipeWire PipeWire on the ArchWiki]&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/PipeWire PipeWire on the Gentoo Wiki]&lt;br /&gt;
&lt;br /&gt;
[[Category:Sound]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=XDG_RUNTIME_DIR&amp;diff=32276</id>
		<title>XDG RUNTIME DIR</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=XDG_RUNTIME_DIR&amp;diff=32276"/>
		<updated>2026-04-09T05:15:30Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: /* Initialising via mkrundir */ no longer has issues in containers&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Various daemons and applications depend on the &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; environment variable being set, including [[Wayland]], [[PipeWire]] and others. This variable should point to a private, ephemeral directory owned by the current user. The exact semantics and details for this variable (and the directory to which it points) are documented in the [https://specifications.freedesktop.org/basedir/latest/#variables XDG base directory specification].&lt;br /&gt;
&lt;br /&gt;
A few mechanisms exist to properly initialise this variable and its corresponding directory, as described below. Only one should be used for a user&#039;s session; configuring multiple of these mechanisms will lead to misbehaviours.&lt;br /&gt;
&lt;br /&gt;
== Initialising via elogind ==&lt;br /&gt;
&lt;br /&gt;
When using [[elogind]] as a seat manager, it exports &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; and other XDG environment variables automatically for each session. No further configuration is required. &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; would be set as {{Path|/run/user/$(id -u)}} by &#039;&#039;&#039;elogind&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Initialising via pam_rundir ==&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jjk-jacky/pam_rundir pam_rundir] is a [[PAM]] module that provides the runtime directory variable. Installing the package {{pkg|pam-rundir}} takes care of dependencies and no further configuration is required. &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; would be set as  {{Path|/run/user/$(id -u)}} by pam_rundir.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/ifreund/dumb_runtime_dir dumb_runtime_dir] is functionally equivalent and has cleaner, simpler code, but is not currently packaged in Alpine.&lt;br /&gt;
&lt;br /&gt;
== Initialising via mkrundir ==&lt;br /&gt;
&lt;br /&gt;
[https://git.sr.ht/~whynothugo/mkrundir mkrundir] is an executable that can be used to initialise the runtime directory explicitly by each user. To use &amp;lt;code&amp;gt;mkrundir&amp;lt;/Code&amp;gt;, install the package {{pkg|mkrundir}} available in [[Repositories#Testing|testing]] repository. The path to &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; is printed by mkrundir.  A shell init script (e.g.: {{Path|~/.profile}} must include an entry as follows at the &#039;&#039;&#039;top&#039;&#039;&#039; of the file {{Cat|~/.profile|...&lt;br /&gt;
export XDG_RUNTIME_DIR{{=}}$(mkrundir)&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
See [https://whynothugo.nl/journal/2026/04/02/creating-an-xdg%20runtime%20dir/ this article] for background on its design.&lt;br /&gt;
&lt;br /&gt;
== Initialising manually in /tmp ==&lt;br /&gt;
&lt;br /&gt;
Generally, care should be taken when configuring the &amp;lt;code&amp;gt;XDG_*&amp;lt;/code&amp;gt; variables manually as this configuration may have errors or conflict with other utilities that do this automatically. Use this only on a system that&#039;s not using [[elogind]] and other solutions outlined above cannot handle this. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; can be initialised manually by adding below snippet to shell init scripts (e.g.: {{Path|~/.profile}}):&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.profile|&amp;lt;nowiki&amp;gt;if test -z &amp;quot;${XDG_RUNTIME_DIR}&amp;quot;; then&lt;br /&gt;
  export XDG_RUNTIME_DIR=/tmp/xdg/&amp;quot;${UID}&amp;quot;-xdg-runtime-dir&lt;br /&gt;
    if ! test -d &amp;quot;${XDG_RUNTIME_DIR}&amp;quot;; then&lt;br /&gt;
      mkdir -p &amp;quot;${XDG_RUNTIME_DIR}&amp;quot;&lt;br /&gt;
      chmod 0700 &amp;quot;${XDG_RUNTIME_DIR}&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
fi &lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* An overview of different approaches for [https://whynothugo.nl/journal/2026/04/02/creating-an-xdg_runtime_dir/ creating an XDG_RUNTIME_DIR]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=XDG_RUNTIME_DIR&amp;diff=32275</id>
		<title>XDG RUNTIME DIR</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=XDG_RUNTIME_DIR&amp;diff=32275"/>
		<updated>2026-04-09T05:14:45Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: /* Initialising via mkrundir */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Various daemons and applications depend on the &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; environment variable being set, including [[Wayland]], [[PipeWire]] and others. This variable should point to a private, ephemeral directory owned by the current user. The exact semantics and details for this variable (and the directory to which it points) are documented in the [https://specifications.freedesktop.org/basedir/latest/#variables XDG base directory specification].&lt;br /&gt;
&lt;br /&gt;
A few mechanisms exist to properly initialise this variable and its corresponding directory, as described below. Only one should be used for a user&#039;s session; configuring multiple of these mechanisms will lead to misbehaviours.&lt;br /&gt;
&lt;br /&gt;
== Initialising via elogind ==&lt;br /&gt;
&lt;br /&gt;
When using [[elogind]] as a seat manager, it exports &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; and other XDG environment variables automatically for each session. No further configuration is required. &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; would be set as {{Path|/run/user/$(id -u)}} by &#039;&#039;&#039;elogind&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Initialising via pam_rundir ==&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jjk-jacky/pam_rundir pam_rundir] is a [[PAM]] module that provides the runtime directory variable. Installing the package {{pkg|pam-rundir}} takes care of dependencies and no further configuration is required. &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; would be set as  {{Path|/run/user/$(id -u)}} by pam_rundir.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/ifreund/dumb_runtime_dir dumb_runtime_dir] is functionally equivalent and has cleaner, simpler code, but is not currently packaged in Alpine.&lt;br /&gt;
&lt;br /&gt;
== Initialising via mkrundir ==&lt;br /&gt;
&lt;br /&gt;
[https://git.sr.ht/~whynothugo/mkrundir mkrundir] is an executable that can be used to initialise the runtime directory explicitly by each user. To use &amp;lt;code&amp;gt;mkrundir&amp;lt;/Code&amp;gt;, install the package {{pkg|mkrundir}} available in [[Repositories#Testing|testing]] repository. The path to &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; is printed by mkrundir.  A shell init script (e.g.: {{Path|~/.profile}} must include an entry as follows at the &#039;&#039;&#039;top&#039;&#039;&#039; of the file {{Cat|~/.profile|...&lt;br /&gt;
export XDG_RUNTIME_DIR{{=}}$(mkrundir)&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
As per [https://git.sr.ht/~whynothugo/mkrundir mkrundir] website, this might have issues inside containers, due to privilege escalation.&lt;br /&gt;
&lt;br /&gt;
== Initialising manually in /tmp ==&lt;br /&gt;
&lt;br /&gt;
Generally, care should be taken when configuring the &amp;lt;code&amp;gt;XDG_*&amp;lt;/code&amp;gt; variables manually as this configuration may have errors or conflict with other utilities that do this automatically. Use this only on a system that&#039;s not using [[elogind]] and other solutions outlined above cannot handle this. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; can be initialised manually by adding below snippet to shell init scripts (e.g.: {{Path|~/.profile}}):&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.profile|&amp;lt;nowiki&amp;gt;if test -z &amp;quot;${XDG_RUNTIME_DIR}&amp;quot;; then&lt;br /&gt;
  export XDG_RUNTIME_DIR=/tmp/xdg/&amp;quot;${UID}&amp;quot;-xdg-runtime-dir&lt;br /&gt;
    if ! test -d &amp;quot;${XDG_RUNTIME_DIR}&amp;quot;; then&lt;br /&gt;
      mkdir -p &amp;quot;${XDG_RUNTIME_DIR}&amp;quot;&lt;br /&gt;
      chmod 0700 &amp;quot;${XDG_RUNTIME_DIR}&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
fi &lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* An overview of different approaches for [https://whynothugo.nl/journal/2026/04/02/creating-an-xdg_runtime_dir/ creating an XDG_RUNTIME_DIR]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=APKBUILD_examples:Python&amp;diff=32273</id>
		<title>APKBUILD examples:Python</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=APKBUILD_examples:Python&amp;diff=32273"/>
		<updated>2026-04-07T21:55:22Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Typical Python packages use Python-specific build systems, making their &amp;lt;code&amp;gt;build()&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;package()&amp;lt;/code&amp;gt; functions different compared to an application which uses &#039;&#039;make&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Considerations ==&lt;br /&gt;
&lt;br /&gt;
=== pkgname ===&lt;br /&gt;
&lt;br /&gt;
Package name for a Python &#039;&#039;library&#039;&#039; must be prefixed with &#039;&#039;py3-&#039;&#039;.  &lt;br /&gt;
&lt;br /&gt;
For an &#039;executable&#039; (for example, &amp;lt;code&amp;gt;black&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;binwalk&amp;lt;/code&amp;gt;), you generally don&#039;t need to prefix it.  &lt;br /&gt;
&lt;br /&gt;
=== arch ===&lt;br /&gt;
&lt;br /&gt;
; noarch : Use for pure Python packages (i.e. without compiled code).&lt;br /&gt;
; all (and others) :  Use for packages with native extensions (i.e. with compiled code).&lt;br /&gt;
&lt;br /&gt;
=== depends ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Do not&#039;&#039;&#039; add python3 to &amp;lt;tt&amp;gt;depends=&amp;lt;/tt&amp;gt; (it&#039;s auto-detected via dynamic linking to python library).&lt;br /&gt;
&lt;br /&gt;
=== source ===&lt;br /&gt;
&lt;br /&gt;
Most Python packages are published in [https://pypi.python.org/pypi PyPI](the Python Package Index).&lt;br /&gt;
If the package has a source tarball available in PyPI (that’s true for most packages), and it contains tests (some explicitly remove them from PyPI), you should reference it in &amp;lt;tt&amp;gt;source=&amp;lt;/tt&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
https://files.pythonhosted.org/packages/source/${_pyname%${_pyname#?}}/$_pyname/$_pyname-$pkgver.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;tt&amp;gt;_pyname&amp;lt;/tt&amp;gt; is the real name of the Python package.&lt;br /&gt;
&lt;br /&gt;
Otherwise, use the normal upstream git tarballs.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
=== pep517 invocation ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pkgname=&amp;quot;py3-foo&amp;quot;&lt;br /&gt;
_pyname=foo&lt;br /&gt;
...&lt;br /&gt;
depends=&amp;quot;py3-bar py3-baz&amp;quot;&lt;br /&gt;
makedepends=&amp;quot;py3-gpep517 py3-setuptools py3-wheel python3-dev&amp;quot;&lt;br /&gt;
checkdepends=&amp;quot;py3-pytest&amp;quot;&lt;br /&gt;
subpackages=&amp;quot;$pkgname-pyc&amp;quot;&lt;br /&gt;
source=&amp;quot;$pkgname-$pkgver.tar.gz::https://github.com/xyz/foo/archive/refs/tags/v$pkgver.tar.gz&amp;quot;&lt;br /&gt;
builddir=&amp;quot;$srcdir/$_pyname-$pkgver&amp;quot;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
build() {&lt;br /&gt;
	gpep517 build-wheel --wheel-dir .dist --output-fd 3 3&amp;gt;&amp;amp;1&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
check() {&lt;br /&gt;
	python3 -m venv --clear --system-site-packages testenv&lt;br /&gt;
	testenv/bin/python3 -m installer .dist/*.whl&lt;br /&gt;
	testenv/bin/python3 -m pytest&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
package() {&lt;br /&gt;
	python3 -m installer -d &amp;quot;$pkgdir&amp;quot; \&lt;br /&gt;
		dist/*.whl&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Depending on the &amp;lt;code&amp;gt;build-backend&amp;lt;/code&amp;gt; in the pyproject.toml, the package should depend on py3-setuptools, py3-flit-core, py3-poetry-core or py3-hatchling at build time. If a project specifies literally &amp;lt;code&amp;gt;flit&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;poetry&amp;lt;/code&amp;gt;, patch it to use the &amp;lt;code&amp;gt;-core&amp;lt;/code&amp;gt; variant.&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]] [[Category:Python]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=XDG_RUNTIME_DIR&amp;diff=32266</id>
		<title>XDG RUNTIME DIR</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=XDG_RUNTIME_DIR&amp;diff=32266"/>
		<updated>2026-04-02T08:52:27Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: Consolidate intro&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Various daemons and applications depend on the &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; environment variable being set, including [[Wayland]], [[PipeWire]] and others. This variable should point to a private, ephemeral directory owned by the current user. The exact semantics and details for this variable (and the directory to which it points) are documented in the [https://specifications.freedesktop.org/basedir/latest/#variables XDG base directory specification].&lt;br /&gt;
&lt;br /&gt;
A few mechanisms exist to properly initialise this variable and its corresponding directory, as described below. Only one should be used for a user&#039;s session; configuring multiple of these mechanisms will lead to misbehaviours.&lt;br /&gt;
&lt;br /&gt;
== Initialising via elogind ==&lt;br /&gt;
&lt;br /&gt;
When using [[elogind]] as a seat manager, it exports &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; and other XDG environment variables automatically for each session. No further configuration is required. &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; would be set as {{Path|/run/user/$(id -u)}} by &#039;&#039;&#039;elogind&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Initialising via pam_rundir ==&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jjk-jacky/pam_rundir pam_rundir] is a [[PAM]] module that provides the runtime directory variable. Installing the package {{pkg|pam-rundir}} takes care of dependencies and no further configuration is required. &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; would be set as  {{Path|/run/user/$(id -u)}} by pam_rundir.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/ifreund/dumb_runtime_dir dumb_runtime_dir] is functionally equivalent and has cleaner, simpler code, but is not currently packaged in Alpine.&lt;br /&gt;
&lt;br /&gt;
== Initialising via mkrundir ==&lt;br /&gt;
&lt;br /&gt;
[https://git.sr.ht/~whynothugo/mkrundir mkrundir] is an executable that can be used to initialise the runtime directory explicitly by each user. To use &amp;lt;code&amp;gt;mkrundir&amp;lt;/Code&amp;gt;, install the package {{pkg|mkrundir}} available in [[Repositories#Testing|testing]] repository. &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; would be set as {{Path|/run/user-$UID}} by mkrundir.  In your shell init script (e.g.: {{Path|~/.profile}} include an entry as follows at the &#039;&#039;&#039;top&#039;&#039;&#039; of the file {{Cat|~/.profile|...&lt;br /&gt;
export XDG_RUNTIME_DIR{{=}}$(mkrundir)&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
As per [https://git.sr.ht/~whynothugo/mkrundir mkrundir] website, this might have issues inside containers, due to privilege escalation.&lt;br /&gt;
&lt;br /&gt;
== Initialising manually in /tmp ==&lt;br /&gt;
&lt;br /&gt;
Generally, care should be taken when configuring the &amp;lt;code&amp;gt;XDG_*&amp;lt;/code&amp;gt; variables manually as this configuration may have errors or conflict with other utilities that do this automatically. Use this only on a system that&#039;s not using [[elogind]] and other solutions outlined above cannot handle this. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; can be initialised manually by adding below snippet to shell init scripts (e.g.: {{Path|~/.profile}}):&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.profile|&amp;lt;nowiki&amp;gt;if test -z &amp;quot;${XDG_RUNTIME_DIR}&amp;quot;; then&lt;br /&gt;
  export XDG_RUNTIME_DIR=/tmp/xdg/&amp;quot;${UID}&amp;quot;-xdg-runtime-dir&lt;br /&gt;
    if ! test -d &amp;quot;${XDG_RUNTIME_DIR}&amp;quot;; then&lt;br /&gt;
      mkdir -p &amp;quot;${XDG_RUNTIME_DIR}&amp;quot;&lt;br /&gt;
      chmod 0700 &amp;quot;${XDG_RUNTIME_DIR}&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
fi &lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* An overview of different approaches for [https://whynothugo.nl/journal/2026/04/02/creating-an-xdg_runtime_dir/ creating an XDG_RUNTIME_DIR]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=XDG_RUNTIME_DIR&amp;diff=32265</id>
		<title>XDG RUNTIME DIR</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=XDG_RUNTIME_DIR&amp;diff=32265"/>
		<updated>2026-04-02T08:51:42Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Various daemons and applications depend on &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; being set, including [[Wayland]], [[PipeWire]] and others.&lt;br /&gt;
&lt;br /&gt;
The exact semantics and details for this variable (and the directory to which it points) are documented in the [https://specifications.freedesktop.org/basedir/latest/#variables XDG base directory specification].&lt;br /&gt;
&lt;br /&gt;
A few mechanisms exist to properly initialise this variable and its corresponding directory, as described below. Only one should be used for a user&#039;s session; configuring multiple of these mechanisms will lead to misbehaviours.&lt;br /&gt;
&lt;br /&gt;
== Initialising via elogind ==&lt;br /&gt;
&lt;br /&gt;
When using [[elogind]] as a seat manager, it exports &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; and other XDG environment variables automatically for each session. No further configuration is required. &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; would be set as {{Path|/run/user/$(id -u)}} by &#039;&#039;&#039;elogind&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Initialising via pam_rundir ==&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jjk-jacky/pam_rundir pam_rundir] is a [[PAM]] module that provides the runtime directory variable. Installing the package {{pkg|pam-rundir}} takes care of dependencies and no further configuration is required. &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; would be set as  {{Path|/run/user/$(id -u)}} by pam_rundir.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/ifreund/dumb_runtime_dir dumb_runtime_dir] is functionally equivalent and has cleaner, simpler code, but is not currently packaged in Alpine.&lt;br /&gt;
&lt;br /&gt;
== Initialising via mkrundir ==&lt;br /&gt;
&lt;br /&gt;
[https://git.sr.ht/~whynothugo/mkrundir mkrundir] is an executable that can be used to initialise the runtime directory explicitly by each user. To use &amp;lt;code&amp;gt;mkrundir&amp;lt;/Code&amp;gt;, install the package {{pkg|mkrundir}} available in [[Repositories#Testing|testing]] repository. &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; would be set as {{Path|/run/user-$UID}} by mkrundir.  In your shell init script (e.g.: {{Path|~/.profile}} include an entry as follows at the &#039;&#039;&#039;top&#039;&#039;&#039; of the file {{Cat|~/.profile|...&lt;br /&gt;
export XDG_RUNTIME_DIR{{=}}$(mkrundir)&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
As per [https://git.sr.ht/~whynothugo/mkrundir mkrundir] website, this might have issues inside containers, due to privilege escalation.&lt;br /&gt;
&lt;br /&gt;
== Initialising manually in /tmp ==&lt;br /&gt;
&lt;br /&gt;
Generally, care should be taken when configuring the &amp;lt;code&amp;gt;XDG_*&amp;lt;/code&amp;gt; variables manually as this configuration may have errors or conflict with other utilities that do this automatically. Use this only on a system that&#039;s not using [[elogind]] and other solutions outlined above cannot handle this. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; can be initialised manually by adding below snippet to shell init scripts (e.g.: {{Path|~/.profile}}):&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.profile|&amp;lt;nowiki&amp;gt;if test -z &amp;quot;${XDG_RUNTIME_DIR}&amp;quot;; then&lt;br /&gt;
  export XDG_RUNTIME_DIR=/tmp/xdg/&amp;quot;${UID}&amp;quot;-xdg-runtime-dir&lt;br /&gt;
    if ! test -d &amp;quot;${XDG_RUNTIME_DIR}&amp;quot;; then&lt;br /&gt;
      mkdir -p &amp;quot;${XDG_RUNTIME_DIR}&amp;quot;&lt;br /&gt;
      chmod 0700 &amp;quot;${XDG_RUNTIME_DIR}&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
fi &lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* An overview of different approaches for [https://whynothugo.nl/journal/2026/04/02/creating-an-xdg_runtime_dir/ creating an XDG_RUNTIME_DIR]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Steam&amp;diff=32190</id>
		<title>Steam</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Steam&amp;diff=32190"/>
		<updated>2026-03-26T07:24:22Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: /* Troubleshooting */ recommend gamescope&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page explains how to run [https://store.steampowered.com/about/ Steam], a popular game distribution platform by Valve on Alpine Linux. Steam requires glibc to run, and thus won&#039;t run natively on Alpine Linux. The simplest approach is to run it as [[Flatpak]]. Other workarounds involve using a virtual machine, a chroot or a container. It is theoretically possible to run the windows version of Steam using {{Pkg|wine}}.&lt;br /&gt;
&lt;br /&gt;
== Installation via Flatpak ==&lt;br /&gt;
&lt;br /&gt;
# Follow the [[Flatpak#Installing_Flatpak|Flatpak]] wiki page and ensure that [[Flatpak#Installing_Flatpak|Flathub repository]] is enabled. &lt;br /&gt;
# Install the Steam flatpak package from Flathub.{{Cmd|$ flatpak --user install com.valvesoftware.Steam}}&lt;br /&gt;
# After installation Steam can be started either using its .desktop file or from the command line: {{Cmd|$ flatpak run com.valvesoftware.Steam}}&lt;br /&gt;
&lt;br /&gt;
== Installation via Rootfs ==&lt;br /&gt;
&lt;br /&gt;
The [https://git.sr.ht/~whynothugo/steam-container steam-container] project provides a Makefile to provision a rootfs with Arch Linux and runs Steam in a [[Bubblewrap]] container.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== My controllers aren&#039;t detected ===&lt;br /&gt;
&lt;br /&gt;
By default regular desktop users don&#039;t have permission to interact with controllers&#039; device nodes. The exact solution varies depending on whether udev, logind or mdevd are being used:&lt;br /&gt;
&lt;br /&gt;
==== With udev and logind ====&lt;br /&gt;
&lt;br /&gt;
On systems with [[udev]] and [[Elogind]], the rules from the official Steam package address this. They are available as an Alpine package.&lt;br /&gt;
&lt;br /&gt;
  # apk add {{pkg|steam-devices|arch=x86_64}}&lt;br /&gt;
&lt;br /&gt;
These udev rules rely on the &amp;lt;code&amp;gt;TAG+=&amp;quot;uaccess&amp;quot;&amp;lt;/code&amp;gt;, and will not work without [[Elogind]].&lt;br /&gt;
&lt;br /&gt;
==== With udev without logind ====&lt;br /&gt;
&lt;br /&gt;
On systems with [[udev]] and without logind, the above rules can be used as reference, modifying them to change device ownership to a user or group of your choosing (typically, plugdev).&lt;br /&gt;
&lt;br /&gt;
==== With mdevd ====&lt;br /&gt;
&lt;br /&gt;
With mdevd, you&#039;ll need to write your own rules. Be sure that they precede te generic input rule, since the first match wins. The following example sets changes group ownership for a &amp;quot;Nintendo Switch Pro Controller&amp;quot; to the &amp;quot;plugdev&amp;quot; group, and sets permissions so that any member of the group may access the device:&lt;br /&gt;
&lt;br /&gt;
 # Nintendo Switch Pro Controller (must precede generic input rule)&lt;br /&gt;
 DEVPATH=/devices/virtual/misc/uhid/0005:057E:2009\.[0-9A-F]{4}/input/input[0-9]+;.* root:plugdev 660&lt;br /&gt;
&lt;br /&gt;
=== SteamVR won&#039;t launch ===&lt;br /&gt;
&lt;br /&gt;
Out of the box SteamVR might not be able to launch and give you various errors. Steam tries to fix this itself by setting the right capabilities on the SteamVR binary, but this doesn&#039;t work in the Flatpak. Instead we&#039;ll have do it manually.&lt;br /&gt;
&lt;br /&gt;
  # setcap CAP_SYS_NICE+ep ~/.var/app/com.valvesoftware.Steam/data/Steam/steamapps/common/SteamVR/bin/linux64/vrcompositor-launcher&lt;br /&gt;
&lt;br /&gt;
Then restart Steam.&lt;br /&gt;
&lt;br /&gt;
There is an issue for this [https://github.com/flathub/com.valvesoftware.Steam/issues/636#issuecomment-779763326 on the Flathub repository].&lt;br /&gt;
&lt;br /&gt;
=== Steam - Error: OpenGL GLX extension not supported by display ===&lt;br /&gt;
&lt;br /&gt;
Add the Mesa gallium driver and reboot your system.&lt;br /&gt;
&lt;br /&gt;
 # apk add {{pkg|mesa-dri-gallium|arch=x86_64}}&lt;br /&gt;
&lt;br /&gt;
=== eventfd: Too many open files ===&lt;br /&gt;
&lt;br /&gt;
Due to a low amount of allowed open file descriptors, Proton games may crash shortly after launching. This can be worked around by disabling esync but many games will perform measurably worse without it. Instead, user limits should be increased. In order to do this, you will need [[PAM]] and a PAM enabled login.&lt;br /&gt;
&lt;br /&gt;
Add the following to &amp;lt;code&amp;gt;/etc/security/limits.conf&amp;lt;/code&amp;gt;:&lt;br /&gt;
 @users hard nofile 524288&lt;br /&gt;
&lt;br /&gt;
{{Note|Although you should already belong to the users group, you can run &amp;lt;code&amp;gt;groups&amp;lt;/code&amp;gt; to check.}}&lt;br /&gt;
&lt;br /&gt;
Reboot and run &amp;lt;code&amp;gt;ulimit -Hn&amp;lt;/code&amp;gt; to verify the new limits are applied.&lt;br /&gt;
&lt;br /&gt;
=== dbus-launch: no such file or directory ===&lt;br /&gt;
&lt;br /&gt;
Set up [[D-Bus|dbus]] for your session.&lt;br /&gt;
&lt;br /&gt;
=== Steam games launched via Proton crash before creating a window ===&lt;br /&gt;
&lt;br /&gt;
Instead of just using the in-Steam menu to install and select a Proton version, try installing the flatpak community build for Proton onto your system. There are several versions, depending on your desired stability, and the experimental version available in Flathub is called &amp;quot;com.valvesoftware.Steam.CompatibilityTool.Proton-Exp&amp;quot;. After you install your chosen version, go into Steam to specify compatibility tool for a game as usual. The installed community build will now be an option. Select that and try launching the game again.&lt;br /&gt;
&lt;br /&gt;
As your last resort, you can try installing [https://github.com/GloriousEggroll/proton-ge-custom proton-ge-custom], but please note that in order for this to be even detected by Steam, you will need to install Steam via Nix due to high level of isolation that Flatpaks utilize. This can however come at the expense of your [https://tosdr.org/en/service/180 privacy].&lt;br /&gt;
&lt;br /&gt;
=== Steam spams dmesg with x86/split lock detection entries ===&lt;br /&gt;
&lt;br /&gt;
Add the below line to {{path|/etc/sysctl.conf}}:&lt;br /&gt;
  kernel.split_lock_mitigate = 0&lt;br /&gt;
&lt;br /&gt;
=== Steam hangs on start with a steamwebhelper popup ===&lt;br /&gt;
&lt;br /&gt;
If this happens and {{path|~/.var/app/com.valvesoftware.Steam/.local/share/Steam/logs/steamwebhelper.log}} says that you are missing X server or &amp;lt;var&amp;gt;DISPLAY&amp;lt;/var&amp;gt;, it means your &amp;lt;var&amp;gt;DISPLAY&amp;lt;/var&amp;gt; is not present in the activation environment. For more information please see https://github.com/ValveSoftware/steam-for-linux/issues/10554 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;[[Sway]]&#039;&#039;&#039;: Go into your sway config file and ensure that &amp;lt;var&amp;gt;DISPLAY&amp;lt;/var&amp;gt; appears in the {{ic|dbus-update-activation environment}} line, as well as the [https://github.com/swaywm/sway/wiki#systemd-and-dbus-activation-environments others stated here], then restart:&lt;br /&gt;
&amp;lt;pre&amp;gt;exec dbus-update-activation-environment WAYLAND_DISPLAY DISPLAY XDG_CURRENT_DESKTOP=sway SWAYSOCK I3SOCK XCURSOR_SIZE XCURSOR_THEME&amp;lt;/pre&amp;gt;&lt;br /&gt;
For more information about this line, please see the [[Sway|Alpine Linux wiki entry]] on Sway&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hyprland&#039;&#039;&#039;: Add an exec-once to the configuration file at {{path|~/.config/hypr/hyprland}} to set &amp;lt;var&amp;gt;DISPLAY&amp;lt;/var&amp;gt;. Similarly to Sway you may already have a line that sets other variables. If so, add &amp;lt;var&amp;gt;DISPLAY&amp;lt;/var&amp;gt; to the line. The line should look similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;exec-once = dbus-update-activation-environment DISPLAY&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Game look blurry ===&lt;br /&gt;
&lt;br /&gt;
When using factional scaling, consider using [[gamescope]] to mediate sizes between the compositor and games, so that games render at a native resolution and are not scaled by the compositor:&lt;br /&gt;
&lt;br /&gt;
 gamescope -W 3440 -H 1440 -e flatpak run com.valvesoftware.Steam&lt;br /&gt;
&lt;br /&gt;
Replace 3440 and 1440 with your monitor&#039;s native resolution.&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[Gaming on Alpine|Gaming on Alpine Linux]]&lt;br /&gt;
* [[Flatpak]]&lt;br /&gt;
* [https://github.com/ValveSoftware/gamescope Gamescope] - SteamOS session compositing window manager, available on Alpine Linux as {{Pkg|gamescope}}&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/Steam Steam on postmarketOS]&lt;br /&gt;
&lt;br /&gt;
[[category:Gaming]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Steam&amp;diff=32189</id>
		<title>Steam</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Steam&amp;diff=32189"/>
		<updated>2026-03-26T07:20:43Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: /* Troubleshooting */ controllers: cover other usage scenarios&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page explains how to run [https://store.steampowered.com/about/ Steam], a popular game distribution platform by Valve on Alpine Linux. Steam requires glibc to run, and thus won&#039;t run natively on Alpine Linux. The simplest approach is to run it as [[Flatpak]]. Other workarounds involve using a virtual machine, a chroot or a container. It is theoretically possible to run the windows version of Steam using {{Pkg|wine}}.&lt;br /&gt;
&lt;br /&gt;
== Installation via Flatpak ==&lt;br /&gt;
&lt;br /&gt;
# Follow the [[Flatpak#Installing_Flatpak|Flatpak]] wiki page and ensure that [[Flatpak#Installing_Flatpak|Flathub repository]] is enabled. &lt;br /&gt;
# Install the Steam flatpak package from Flathub.{{Cmd|$ flatpak --user install com.valvesoftware.Steam}}&lt;br /&gt;
# After installation Steam can be started either using its .desktop file or from the command line: {{Cmd|$ flatpak run com.valvesoftware.Steam}}&lt;br /&gt;
&lt;br /&gt;
== Installation via Rootfs ==&lt;br /&gt;
&lt;br /&gt;
The [https://git.sr.ht/~whynothugo/steam-container steam-container] project provides a Makefile to provision a rootfs with Arch Linux and runs Steam in a [[Bubblewrap]] container.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== My controllers aren&#039;t detected ===&lt;br /&gt;
&lt;br /&gt;
By default regular desktop users don&#039;t have permission to interact with controllers&#039; device nodes. The exact solution varies depending on whether udev, logind or mdevd are being used:&lt;br /&gt;
&lt;br /&gt;
==== With udev and logind ====&lt;br /&gt;
&lt;br /&gt;
On systems with [[udev]] and [[Elogind]], the rules from the official Steam package address this. They are available as an Alpine package.&lt;br /&gt;
&lt;br /&gt;
  # apk add {{pkg|steam-devices|arch=x86_64}}&lt;br /&gt;
&lt;br /&gt;
These udev rules rely on the &amp;lt;code&amp;gt;TAG+=&amp;quot;uaccess&amp;quot;&amp;lt;/code&amp;gt;, and will not work without [[Elogind]].&lt;br /&gt;
&lt;br /&gt;
==== With udev without logind ====&lt;br /&gt;
&lt;br /&gt;
On systems with [[udev]] and without logind, the above rules can be used as reference, modifying them to change device ownership to a user or group of your choosing (typically, plugdev).&lt;br /&gt;
&lt;br /&gt;
==== With mdevd ====&lt;br /&gt;
&lt;br /&gt;
With mdevd, you&#039;ll need to write your own rules. Be sure that they precede te generic input rule, since the first match wins. The following example sets changes group ownership for a &amp;quot;Nintendo Switch Pro Controller&amp;quot; to the &amp;quot;plugdev&amp;quot; group, and sets permissions so that any member of the group may access the device:&lt;br /&gt;
&lt;br /&gt;
 # Nintendo Switch Pro Controller (must precede generic input rule)&lt;br /&gt;
 DEVPATH=/devices/virtual/misc/uhid/0005:057E:2009\.[0-9A-F]{4}/input/input[0-9]+;.* root:plugdev 660&lt;br /&gt;
&lt;br /&gt;
=== SteamVR won&#039;t launch ===&lt;br /&gt;
&lt;br /&gt;
Out of the box SteamVR might not be able to launch and give you various errors. Steam tries to fix this itself by setting the right capabilities on the SteamVR binary, but this doesn&#039;t work in the Flatpak. Instead we&#039;ll have do it manually.&lt;br /&gt;
&lt;br /&gt;
  # setcap CAP_SYS_NICE+ep ~/.var/app/com.valvesoftware.Steam/data/Steam/steamapps/common/SteamVR/bin/linux64/vrcompositor-launcher&lt;br /&gt;
&lt;br /&gt;
Then restart Steam.&lt;br /&gt;
&lt;br /&gt;
There is an issue for this [https://github.com/flathub/com.valvesoftware.Steam/issues/636#issuecomment-779763326 on the Flathub repository].&lt;br /&gt;
&lt;br /&gt;
=== Steam - Error: OpenGL GLX extension not supported by display ===&lt;br /&gt;
&lt;br /&gt;
Add the Mesa gallium driver and reboot your system.&lt;br /&gt;
&lt;br /&gt;
 # apk add {{pkg|mesa-dri-gallium|arch=x86_64}}&lt;br /&gt;
&lt;br /&gt;
=== eventfd: Too many open files ===&lt;br /&gt;
&lt;br /&gt;
Due to a low amount of allowed open file descriptors, Proton games may crash shortly after launching. This can be worked around by disabling esync but many games will perform measurably worse without it. Instead, user limits should be increased. In order to do this, you will need [[PAM]] and a PAM enabled login.&lt;br /&gt;
&lt;br /&gt;
Add the following to &amp;lt;code&amp;gt;/etc/security/limits.conf&amp;lt;/code&amp;gt;:&lt;br /&gt;
 @users hard nofile 524288&lt;br /&gt;
&lt;br /&gt;
{{Note|Although you should already belong to the users group, you can run &amp;lt;code&amp;gt;groups&amp;lt;/code&amp;gt; to check.}}&lt;br /&gt;
&lt;br /&gt;
Reboot and run &amp;lt;code&amp;gt;ulimit -Hn&amp;lt;/code&amp;gt; to verify the new limits are applied.&lt;br /&gt;
&lt;br /&gt;
=== dbus-launch: no such file or directory ===&lt;br /&gt;
&lt;br /&gt;
Set up [[D-Bus|dbus]] for your session.&lt;br /&gt;
&lt;br /&gt;
=== Steam games launched via Proton crash before creating a window ===&lt;br /&gt;
&lt;br /&gt;
Instead of just using the in-Steam menu to install and select a Proton version, try installing the flatpak community build for Proton onto your system. There are several versions, depending on your desired stability, and the experimental version available in Flathub is called &amp;quot;com.valvesoftware.Steam.CompatibilityTool.Proton-Exp&amp;quot;. After you install your chosen version, go into Steam to specify compatibility tool for a game as usual. The installed community build will now be an option. Select that and try launching the game again.&lt;br /&gt;
&lt;br /&gt;
As your last resort, you can try installing [https://github.com/GloriousEggroll/proton-ge-custom proton-ge-custom], but please note that in order for this to be even detected by Steam, you will need to install Steam via Nix due to high level of isolation that Flatpaks utilize. This can however come at the expense of your [https://tosdr.org/en/service/180 privacy].&lt;br /&gt;
&lt;br /&gt;
=== Steam spams dmesg with x86/split lock detection entries ===&lt;br /&gt;
&lt;br /&gt;
Add the below line to {{path|/etc/sysctl.conf}}:&lt;br /&gt;
  kernel.split_lock_mitigate = 0&lt;br /&gt;
&lt;br /&gt;
=== Steam hangs on start with a steamwebhelper popup ===&lt;br /&gt;
&lt;br /&gt;
If this happens and {{path|~/.var/app/com.valvesoftware.Steam/.local/share/Steam/logs/steamwebhelper.log}} says that you are missing X server or &amp;lt;var&amp;gt;DISPLAY&amp;lt;/var&amp;gt;, it means your &amp;lt;var&amp;gt;DISPLAY&amp;lt;/var&amp;gt; is not present in the activation environment. For more information please see https://github.com/ValveSoftware/steam-for-linux/issues/10554 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;[[Sway]]&#039;&#039;&#039;: Go into your sway config file and ensure that &amp;lt;var&amp;gt;DISPLAY&amp;lt;/var&amp;gt; appears in the {{ic|dbus-update-activation environment}} line, as well as the [https://github.com/swaywm/sway/wiki#systemd-and-dbus-activation-environments others stated here], then restart:&lt;br /&gt;
&amp;lt;pre&amp;gt;exec dbus-update-activation-environment WAYLAND_DISPLAY DISPLAY XDG_CURRENT_DESKTOP=sway SWAYSOCK I3SOCK XCURSOR_SIZE XCURSOR_THEME&amp;lt;/pre&amp;gt;&lt;br /&gt;
For more information about this line, please see the [[Sway|Alpine Linux wiki entry]] on Sway&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hyprland&#039;&#039;&#039;: Add an exec-once to the configuration file at {{path|~/.config/hypr/hyprland}} to set &amp;lt;var&amp;gt;DISPLAY&amp;lt;/var&amp;gt;. Similarly to Sway you may already have a line that sets other variables. If so, add &amp;lt;var&amp;gt;DISPLAY&amp;lt;/var&amp;gt; to the line. The line should look similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;exec-once = dbus-update-activation-environment DISPLAY&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[Gaming on Alpine|Gaming on Alpine Linux]]&lt;br /&gt;
* [[Flatpak]]&lt;br /&gt;
* [https://github.com/ValveSoftware/gamescope Gamescope] - SteamOS session compositing window manager, available on Alpine Linux as {{Pkg|gamescope}}&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/Steam Steam on postmarketOS]&lt;br /&gt;
&lt;br /&gt;
[[category:Gaming]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Steam&amp;diff=32188</id>
		<title>Steam</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Steam&amp;diff=32188"/>
		<updated>2026-03-26T07:13:54Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: Mention my steam-container script&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page explains how to run [https://store.steampowered.com/about/ Steam], a popular game distribution platform by Valve on Alpine Linux. Steam requires glibc to run, and thus won&#039;t run natively on Alpine Linux. The simplest approach is to run it as [[Flatpak]]. Other workarounds involve using a virtual machine, a chroot or a container. It is theoretically possible to run the windows version of Steam using {{Pkg|wine}}.&lt;br /&gt;
&lt;br /&gt;
== Installation via Flatpak ==&lt;br /&gt;
&lt;br /&gt;
# Follow the [[Flatpak#Installing_Flatpak|Flatpak]] wiki page and ensure that [[Flatpak#Installing_Flatpak|Flathub repository]] is enabled. &lt;br /&gt;
# Install the Steam flatpak package from Flathub.{{Cmd|$ flatpak --user install com.valvesoftware.Steam}}&lt;br /&gt;
# After installation Steam can be started either using its .desktop file or from the command line: {{Cmd|$ flatpak run com.valvesoftware.Steam}}&lt;br /&gt;
&lt;br /&gt;
== Installation via Rootfs ==&lt;br /&gt;
&lt;br /&gt;
The [https://git.sr.ht/~whynothugo/steam-container steam-container] project provides a Makefile to provision a rootfs with Arch Linux and runs Steam in a [[Bubblewrap]] container.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== My controllers aren&#039;t detected ===&lt;br /&gt;
&lt;br /&gt;
By default Steam doesn&#039;t have permission to read your controllers.&lt;br /&gt;
This can be fixed by installing an [[udev]] rule from the official Steam package, but the udev rules are also available as an Alpine package.&lt;br /&gt;
&lt;br /&gt;
  # apk add {{pkg|steam-devices|arch=x86_64}}&lt;br /&gt;
&lt;br /&gt;
These udev rules rely on the &amp;lt;code&amp;gt;TAG+=&amp;quot;uaccess&amp;quot;&amp;lt;/code&amp;gt;, and are therefore only expected to work reliably when using [[Elogind]].&lt;br /&gt;
&lt;br /&gt;
=== SteamVR won&#039;t launch ===&lt;br /&gt;
&lt;br /&gt;
Out of the box SteamVR might not be able to launch and give you various errors. Steam tries to fix this itself by setting the right capabilities on the SteamVR binary, but this doesn&#039;t work in the Flatpak. Instead we&#039;ll have do it manually.&lt;br /&gt;
&lt;br /&gt;
  # setcap CAP_SYS_NICE+ep ~/.var/app/com.valvesoftware.Steam/data/Steam/steamapps/common/SteamVR/bin/linux64/vrcompositor-launcher&lt;br /&gt;
&lt;br /&gt;
Then restart Steam.&lt;br /&gt;
&lt;br /&gt;
There is an issue for this [https://github.com/flathub/com.valvesoftware.Steam/issues/636#issuecomment-779763326 on the Flathub repository].&lt;br /&gt;
&lt;br /&gt;
=== Steam - Error: OpenGL GLX extension not supported by display ===&lt;br /&gt;
&lt;br /&gt;
Add the Mesa gallium driver and reboot your system.&lt;br /&gt;
&lt;br /&gt;
 # apk add {{pkg|mesa-dri-gallium|arch=x86_64}}&lt;br /&gt;
&lt;br /&gt;
=== eventfd: Too many open files ===&lt;br /&gt;
&lt;br /&gt;
Due to a low amount of allowed open file descriptors, Proton games may crash shortly after launching. This can be worked around by disabling esync but many games will perform measurably worse without it. Instead, user limits should be increased. In order to do this, you will need [[PAM]] and a PAM enabled login.&lt;br /&gt;
&lt;br /&gt;
Add the following to &amp;lt;code&amp;gt;/etc/security/limits.conf&amp;lt;/code&amp;gt;:&lt;br /&gt;
 @users hard nofile 524288&lt;br /&gt;
&lt;br /&gt;
{{Note|Although you should already belong to the users group, you can run &amp;lt;code&amp;gt;groups&amp;lt;/code&amp;gt; to check.}}&lt;br /&gt;
&lt;br /&gt;
Reboot and run &amp;lt;code&amp;gt;ulimit -Hn&amp;lt;/code&amp;gt; to verify the new limits are applied.&lt;br /&gt;
&lt;br /&gt;
=== dbus-launch: no such file or directory ===&lt;br /&gt;
&lt;br /&gt;
Set up [[D-Bus|dbus]] for your session.&lt;br /&gt;
&lt;br /&gt;
=== Steam games launched via Proton crash before creating a window ===&lt;br /&gt;
&lt;br /&gt;
Instead of just using the in-Steam menu to install and select a Proton version, try installing the flatpak community build for Proton onto your system. There are several versions, depending on your desired stability, and the experimental version available in Flathub is called &amp;quot;com.valvesoftware.Steam.CompatibilityTool.Proton-Exp&amp;quot;. After you install your chosen version, go into Steam to specify compatibility tool for a game as usual. The installed community build will now be an option. Select that and try launching the game again.&lt;br /&gt;
&lt;br /&gt;
As your last resort, you can try installing [https://github.com/GloriousEggroll/proton-ge-custom proton-ge-custom], but please note that in order for this to be even detected by Steam, you will need to install Steam via Nix due to high level of isolation that Flatpaks utilize. This can however come at the expense of your [https://tosdr.org/en/service/180 privacy].&lt;br /&gt;
&lt;br /&gt;
=== Steam spams dmesg with x86/split lock detection entries ===&lt;br /&gt;
&lt;br /&gt;
Add the below line to {{path|/etc/sysctl.conf}}:&lt;br /&gt;
  kernel.split_lock_mitigate = 0&lt;br /&gt;
&lt;br /&gt;
=== Steam hangs on start with a steamwebhelper popup ===&lt;br /&gt;
&lt;br /&gt;
If this happens and {{path|~/.var/app/com.valvesoftware.Steam/.local/share/Steam/logs/steamwebhelper.log}} says that you are missing X server or &amp;lt;var&amp;gt;DISPLAY&amp;lt;/var&amp;gt;, it means your &amp;lt;var&amp;gt;DISPLAY&amp;lt;/var&amp;gt; is not present in the activation environment. For more information please see https://github.com/ValveSoftware/steam-for-linux/issues/10554 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;[[Sway]]&#039;&#039;&#039;: Go into your sway config file and ensure that &amp;lt;var&amp;gt;DISPLAY&amp;lt;/var&amp;gt; appears in the {{ic|dbus-update-activation environment}} line, as well as the [https://github.com/swaywm/sway/wiki#systemd-and-dbus-activation-environments others stated here], then restart:&lt;br /&gt;
&amp;lt;pre&amp;gt;exec dbus-update-activation-environment WAYLAND_DISPLAY DISPLAY XDG_CURRENT_DESKTOP=sway SWAYSOCK I3SOCK XCURSOR_SIZE XCURSOR_THEME&amp;lt;/pre&amp;gt;&lt;br /&gt;
For more information about this line, please see the [[Sway|Alpine Linux wiki entry]] on Sway&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hyprland&#039;&#039;&#039;: Add an exec-once to the configuration file at {{path|~/.config/hypr/hyprland}} to set &amp;lt;var&amp;gt;DISPLAY&amp;lt;/var&amp;gt;. Similarly to Sway you may already have a line that sets other variables. If so, add &amp;lt;var&amp;gt;DISPLAY&amp;lt;/var&amp;gt; to the line. The line should look similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;exec-once = dbus-update-activation-environment DISPLAY&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[Gaming on Alpine|Gaming on Alpine Linux]]&lt;br /&gt;
* [[Flatpak]]&lt;br /&gt;
* [https://github.com/ValveSoftware/gamescope Gamescope] - SteamOS session compositing window manager, available on Alpine Linux as {{Pkg|gamescope}}&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/Steam Steam on postmarketOS]&lt;br /&gt;
&lt;br /&gt;
[[category:Gaming]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Talk:OpenRC&amp;diff=32172</id>
		<title>Talk:OpenRC</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Talk:OpenRC&amp;diff=32172"/>
		<updated>2026-03-24T16:37:32Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: /* User Services -&amp;gt; Runlevels */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The [https://wiki.alpinelinux.org/wiki/OpenRC#Preventing_slow_services_from_delaying_boot Preventing slow services from delaying boot] passage currently uses &#039;&#039;&#039;chronyd&#039;&#039;&#039; as an example of a service that may delay boot.  The passage could be improved:-&lt;br /&gt;
&lt;br /&gt;
1. There is another, simpler and safer method to prevent a slow startup by &#039;&#039;&#039;chronyd&#039;&#039;&#039; that could be listed first and avoids dealing with the expressed danger of editing {{Path|/etc/inittab}} wrongly and its implied stunting of system boot. &lt;br /&gt;
&lt;br /&gt;
The method has been suggested helpfully in various places:&lt;br /&gt;
* In the second paragraph of the file to be edited:  {{Path|/etc/conf.d/chronyd}}&lt;br /&gt;
* https://whynothugo.nl/journal/2023/11/19/setting-up-an-alpine-linux-workstation/#chronyd-blocks-at-startup&lt;br /&gt;
* https://gist.github.com/c0m4r/e38d41d0e31f6adda4b4c5a88ba0a453#NTP&lt;br /&gt;
 &lt;br /&gt;
The method is to edit {{Path|/etc/conf.d/chronyd}} and to change the line {{Codeline|1=FAST_STARTUP=no}} to {{Codeline|1=FAST_STARTUP=yes}}.&lt;br /&gt;
&lt;br /&gt;
2. Technically, &#039;&#039;&#039;chronyd&#039;&#039;&#039; is not a boot service but rather launches at the default level ({{Codeline|rc-update add chronyd default}}), so the subheading may need to be improved.  There is [https://wiki.alpinelinux.org/w/index.php?search=%22%5B%5B%23Preventing+slow+services+from+delaying+boot%7C%22&amp;amp;title=Special%3ASearch&amp;amp;profile=default&amp;amp;fulltext=1 only one wiki page] that links to that subheading, and it is in this very same OpenRC wiki page, so it should be easy to change the subheading title, say, from &#039;&#039;&amp;quot;Preventing slow services from delaying boot&amp;quot;&#039;&#039; to &#039;&#039;&amp;quot;Preventing slow services from delaying system launch&amp;quot;&#039;&#039; or &#039;&#039;...system startup&#039;&#039;.   The link is mentioned twice in this wiki page, so those passages could be reviewed:&lt;br /&gt;
* https://wiki.alpinelinux.org/wiki/OpenRC#Stacked_runlevels&lt;br /&gt;
* https://wiki.alpinelinux.org/wiki/OpenRC#Configuration&lt;br /&gt;
&lt;br /&gt;
Alternatively, an &#039;&#039;Include:Chronyd - Startup Speed Enhancement&#039;&#039; page could be started for inclusion here and wherever else (Any future &#039;&#039;Chrony&#039;&#039; page, for example) that would include the current inittab method and the FAST_STARTUP method.&lt;br /&gt;
[[User:John3-16|John3-16]] ([[User talk:John3-16|talk]]) 16:21, 8 August 2025 (UTC)&lt;br /&gt;
&lt;br /&gt;
:Please note also that the external link about the {{Path|inittab}} method, [https://ptrcnull.me/posts/openrc-async-services/ OpenRC: Start services after login prompt], is now broken.  Please consider whether perhaps the reference/attribution is suitable, as it stands. [[User:John3-16|John3-16]] ([[User talk:John3-16|talk]]) 16:33, 8 August 2025 (UTC) &lt;br /&gt;
:[[User:John3-16|John3-16]] ([[User talk:John3-16|talk]])&lt;br /&gt;
&lt;br /&gt;
:: Thanks for submitting a thorough feedback. Highly appreciated. I have fixed the external links and internal links and updated section heading as per your suggestion. Service &#039;&#039;&#039;chrony&#039;&#039;&#039; was meant to be example to explain the concept. For now i&#039;ve removed the word chrony. Regarding adding {{Codeline|1=FAST_STARTUP=yes}} to Chrony page, i&#039;m quite hesitant to touch pages where i lack knowledge. -[[User:Prabuanand|Prabuanand]] ([[User talk:Prabuanand|talk]]) 20:02, 8 August 2025 (UTC)&lt;br /&gt;
&lt;br /&gt;
The below Note may add confusion to users. Please consider rewording or removal. &lt;br /&gt;
{{Note|The upstream OpenRC User Guide for user services considers [https://github.com/OpenRC/openrc/blob/master/user-guide.md#auto-starting configuring  pam] in the management of user service sessions;  as an experimental branch of OpenRC, this facility, including its autostart configuration, may be fluid.  Many Alpine Linux installations typically may not run pam.}}&lt;br /&gt;
* The experimental is already there &amp;quot;User services are currently experimental &amp;quot;. If necessary that can be &#039;&#039;&#039;highlighted&#039;&#039;&#039;.&lt;br /&gt;
* I request a rewording to tell user on what he&#039;s supposed to do for pam. In the current form, the Note does not help the user on how to proceed.&lt;br /&gt;
- [[User:Prabuanand|Prabuanand]] ([[User talk:Prabuanand|talk]]) 11:03, 11 August 2025 (UTC)&lt;br /&gt;
&lt;br /&gt;
::- Thank you for your kind attention on the wiki. I have tried to address your concern by removing the note plus the reference to it under [[OpenRC#PAM_support|PAM support]] instead of elaborating on the upstream OpenRC configuration user guide passage regarding pam. &lt;br /&gt;
 &lt;br /&gt;
::- On a different topic, while hoping to keep the wiki a clear user guide, do we want to simultaneously reference more in-depth examinations about user services that may be significant to developers? For example, consider a possible closing passage under &#039;&#039;User Services&#039;&#039;, or under a new &#039;&#039;Further reading&#039;&#039; section, or perhaps in a briefer form under &#039;&#039;See also&#039;&#039;:  &lt;br /&gt;
&lt;br /&gt;
:::&#039;For a more in-depth examination of OpenRC user services, consider useful discussions regarding DE-dependent (&#039;&#039;desktop environment&#039;&#039;) vs DE-independent environment variables discussed in an [https://github.com/OpenRC/openrc/pull/723 upstream thread] about user services, and whether the variables ought to be passed on filtered (not in whole) or not.  Other useful assessments were laid out in an excellent though now [https://wiki.gentoo.org/wiki/OpenRC/Legacy_user_services outdated Gentoo wiki page] about legacy user services that furthermore had examined {{pkg|wlsunset}} when used as a user service in Wayland;  their current [https://wiki.gentoo.org/wiki/OpenRC#User_services User Services page] adds further useful and more up-to-date contributions.&#039;  &lt;br /&gt;
&lt;br /&gt;
::This passage could be left here for any further discussion or added to the wiki with or without any edits, as may be seen to be suitable;  I am grateful either way.&lt;br /&gt;
 &lt;br /&gt;
::- Perhaps one should consider moving the paragraph about allowing parallel services into the section &#039;&#039;&#039;Preventing slow services from delaying system startup&#039;&#039;&#039;, as a subheading called &amp;quot;Parallel services&amp;quot;.  It could be placed after the introductory paragraph, &amp;quot;Services that take a while to start will block ...&amp;quot;.  This &#039;&#039;parallel services&#039;&#039; passage is not immediately relevant in its current location as the second paragraph about OpenRC configuration.  It may simply appear there from early days in the preparation of the page.&lt;br /&gt;
&lt;br /&gt;
::The suggestion that currently appears there could then be listed as a second subheading (after the &amp;quot;Parallel services&amp;quot; subheading suggested above), to be titled, say, &amp;quot;Async runlevel method&amp;quot;, &amp;quot;Stacked runlevel method&amp;quot;, &amp;quot;Inittab method&amp;quot; or as suitable.&lt;br /&gt;
&lt;br /&gt;
::- Are we satisfied to keep the [[OpenRC#Command_usage|Command usage]] section where it is, deep down on this page, or would it be more pertinent to give command usage examples nearer to the introductory section of the wiki page, perhaps at the beginning of [OpenRC#Quickstart|Quickstart] table or immediately after it (retaining the &#039;&#039;Command usage&#039;&#039; subheading or not)?  Perhaps this &#039;&#039;Command usage&#039;&#039; passage has suffered displacement from newer passages.&lt;br /&gt;
&lt;br /&gt;
::This passage could additionally illustrate the most commonly used OpenRC commands at the beginning of the Quickstart section with a handful of complete {{ic|rc-service}} and {{ic|rc-update}} command line instructions;  otherwise, full examples of common OpenRC clis first appear in the disproportionally long &#039;&#039;User Services&#039;&#039; section, and  OpenRC instructions are otherwise introduced quickly, with no complete cli example, in the current &#039;&#039;QuickStart&#039;&#039; table:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Commonly-used OpenRC commands&#039;&#039;&#039;&lt;br /&gt;
Start, stop (or {ic|restart}}) a service, for example, at the boot runlevel (do not use employ the &#039;&amp;lt;&#039; nor &#039;&amp;gt;&#039;):&lt;br /&gt;
{{cmd|doas rc-service &amp;lt;serviceName&amp;gt; start boot}}&lt;br /&gt;
{{cmd|doas rc-service &amp;lt;serviceName&amp;gt; stop boot}}&lt;br /&gt;
Add or delete a service to/from the sequence of services that need to start automatically in future sessions at the {{ic|default}} runlevel;  note that the &#039;&#039;&#039;default&#039;&#039;&#039; runlevel is assumed, so it does not need to be stated explicitly:&lt;br /&gt;
{{cmd|doas rc-update add &amp;lt;serviceName&amp;gt; default}}&lt;br /&gt;
{{cmd|doas rc-update del &amp;lt;serviceName&amp;gt;}}&lt;br /&gt;
List the current statuses of all services;  however, do not use {{ic|doas}} nor the equivalent command as root to display the statuses of any &#039;&#039;user service&#039;&#039;:&lt;br /&gt;
{{cmd|doas rc-status}}&lt;br /&gt;
List the assigned runlevels of all services;  likewise, do not use {{ic|doas}} nor root to display the runlevels of user services:&lt;br /&gt;
{{cmd|doas rc-update}}&lt;br /&gt;
&lt;br /&gt;
::Alternatively, the above &#039;&#039;Commonly-used OpenRC commands&#039;&#039; passage, with or without any edits as may be seen to be suitable, could simply not be included.&lt;br /&gt;
&lt;br /&gt;
::-  The current passage in [[OpenRC#Command_usage|Command usage]], &amp;quot;To view the command usage for all OpenRC commands (rc-update, rc-service, rc-status, openrc etc.) use the --help or -h flag [...]&amp;quot; could be moved into the Quickstart section instead of leaving it near the end of the page.&lt;br /&gt;
&lt;br /&gt;
::- The &#039;&#039;Command usage&#039;&#039; section further contains a paragraph that is irrelevant to OpenRC: &#039;The busybox command equivalent for traditional GNU/Linux systems is as follows [...]&#039;.  This paragraph would be more relevant, if at all, for example:-&lt;br /&gt;
::* In the [[BusyBox]] page, if suitable;  or&lt;br /&gt;
::* In the [[Comparison_with_other_distros &#039;Rosetta Stone&#039;]] page, perhaps under a new heading there, say, &#039;&#039;Userspace commands&#039;&#039; or &#039;&#039;Command line instructions&#039;&#039;, seeing how, currently, there are only sections for &#039;&#039;Package management&#039;&#039;, &#039;&#039;Runlevel &amp;amp; Initscripts&#039;&#039; and &#039;&#039;Config files&#039;&#039;; or &lt;br /&gt;
::* Being culled from this page.&lt;br /&gt;
&lt;br /&gt;
::Thank you. [[User:John3-16|John3-16]] ([[User talk:John3-16|talk]]) 21:44, 11 August 2025 (UTC)&lt;br /&gt;
::: Thanks once again for the detailed suggestions. Hope i&#039;ve done everything as suggested. Please make necessary amends, if i have missed out something. Highly appreciated. -[[User:Prabuanand|Prabuanand]] ([[User talk:Prabuanand|talk]]) 10:03, 12 August 2025 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Warning in PAM support ==&lt;br /&gt;
&lt;br /&gt;
Dear [[User:WhyNotHugo]], I&#039;m not sure about the need for warning in the PAM support section. I have been using User services with PAM support for the past few months without any issues and i have not seen any bug reports filed regarding this. btw:i&#039;m using pamrundir and i tested dwm with the manual XDG_RUNTIME_DIR script as added there. I believe Warning should be sparingly used in Wiki, if there are unresolved/known issues. - [[User:Prabuanand|Prabuanand]] ([[User talk:Prabuanand|talk]]) 15:59, 5 September 2025 (UTC)&lt;br /&gt;
&lt;br /&gt;
:[[User:Prabuanand]] This was solved shortly after your comment, thanks. Feel free to remove this talk subsection. [[User:WhyNotHugo|WhyNotHugo]] ([[User talk:WhyNotHugo|talk]]) 16:32, 24 March 2026 (UTC)&lt;br /&gt;
&lt;br /&gt;
== User Services -&amp;gt; Runlevels ==&lt;br /&gt;
&lt;br /&gt;
Dear [[User:WhyNotHugo]], This section probably requires some rewriting.&lt;br /&gt;
* I&#039;m not sure when this sysinit runlevel is used/required &amp;quot;mkdir -p ${XDG_CONFIG_HOME:-~/.config}/rc/runlevels/sysinit&amp;quot;.&lt;br /&gt;
* in the command openrc -U $RUNLEVEL. Instead of $RUNLEVEL, consider using &amp;lt;&amp;gt; as [[Help:Reading#Placeholder|placeholder]].&lt;br /&gt;
* Will adding &amp;quot;exec openrc -U gui&amp;quot; to ~/.profile support both Wayland and Xorg? Shouldn&#039;t the Compositor startup file be used for this for wayland?  --[[User:Prabuanand|Prabuanand]] ([[User talk:Prabuanand|talk]]) 16:13, 5 September 2025 (UTC)&lt;br /&gt;
:I just now tested adding &amp;quot;exec openrc -U gui&amp;quot; to ~/.profile and i got locked out with &amp;quot;XDG_RUNTIME_DIR unset&amp;quot;. Only after removing this, i could login to tty. Sway too did not start with this option. Here are my [git.sr.ht:~prabuanand/dotfiles dotfiles] for reference. -[[User:Prabuanand|Prabuanand]] ([[User talk:Prabuanand|talk]]) 16:55, 5 September 2025 (UTC)&lt;br /&gt;
&lt;br /&gt;
::[[User:Prabuanand]]: Using &#039;&#039;&#039;exec openrc -U gui&#039;&#039;&#039; in &#039;&#039;&#039;~/.profile&#039;&#039;&#039; would be too early, DISPLAY or WAYLAND_DISPLAY would not be set, and services which rely on those would fail to start. We might want to clarify this explicitly. XDG_RUNTIME_DIR needs to be set before any service that relies on it (including the compositor) [[User:WhyNotHugo|WhyNotHugo]] ([[User talk:WhyNotHugo|talk]]) 16:37, 24 March 2026 (UTC)&lt;br /&gt;
&lt;br /&gt;
::Dear [[User:WhyNotHugo]], Thank you for your excellent contributions to Linux, and to Alpine Linux in particular. I support [[User:Prabuanand|Prabuanand]]&#039;s excellent and extensive impressions/observations above however, including those further above in the &#039;Warning in PAM support&#039; discussion.  I would be grateful for your input about them. &lt;br /&gt;
&lt;br /&gt;
::Additionally, I suspect that two further points of guidance in your edits warrant review or elaboration on the wiki page:- &lt;br /&gt;
::*Your claim that &#039;&#039;&#039;sysinit&#039;&#039;&#039; is the default level;  please elaborate why &#039;&#039;&#039;default&#039;&#039;&#039; would not be the default runlevel here, for my better understanding and for the sake of newcomers to Alpine Linux&#039;s wiki.  &lt;br /&gt;
::*Note also that your instruction did not revert the runlevel back to &#039;&#039;&#039;sysinit&#039;&#039;&#039; on my system, even with the user (&#039;&#039;&#039;-U &#039;&#039;&#039;) switch:  {{Cmd|$ openrc -U}}&lt;br /&gt;
::*Your edit proposing a command to revert to the sysinit runlevel appears to run contrary to the guidance [[OpenRC#Runlevels|currently in the wiki]], that &#039;&#039;&amp;quot;sysinit always runs when the host first starts and should not be run again.&amp;quot;&#039;&#039;&lt;br /&gt;
::Thanks again for your help addressing our concerns. [[User:John3-16|John3-16]] ([[User talk:John3-16|talk]]) 17:43, 12 September 2025 (UTC)&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;sysinit&#039;&#039;&#039; is used by default when you don&#039;t explicitly specify another runlevel. My statement describes the behaviour of OpenRC itself, it&#039;s not my decision. I&#039;ve talked to navi about it, and it seems to not be intentional, but it&#039;s still the current behaviour. [[User:WhyNotHugo|WhyNotHugo]] ([[User talk:WhyNotHugo|talk]]) 16:37, 24 March 2026 (UTC)&lt;br /&gt;
&lt;br /&gt;
Dear [[User:StruanR]],  &lt;br /&gt;
I am grateful for your improvements of the wiki, kindly continue them!  Please note that certain edits, however, changing a root prompt to a user prompt, were in various cases inaccurate, and I have reverted those.  Perhaps the wiki could be made clearer that to modify &#039;&#039;system&#039;&#039; services or runlevels, one generally requires a root prompt or doas/sudo;  to display/check those, a user prompt may suffice.  Note, on the other hand, that to modify &#039;&#039;user&#039;&#039; services (using the &#039;&#039;&#039;-U&#039;&#039;&#039; switch), a root prompt or doas/sudo would not generally be used.  I hope this helps.&lt;br /&gt;
Your other edits were helpful, thank you!  &lt;br /&gt;
I took the chance to amend some previous passages made by other helpful contributors while I was at it.  Please continue helping out with the wiki! [[User:John3-16|John3-16]] ([[User talk:John3-16|talk]]) 17:43, 12 September 2025 (UTC)&lt;br /&gt;
&lt;br /&gt;
:: +1, we should have a dedicated page for OpenRC User services. [[User:WhyNotHugo|WhyNotHugo]] ([[User talk:WhyNotHugo|talk]]) 16:37, 24 March 2026 (UTC)&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Talk:OpenRC&amp;diff=32171</id>
		<title>Talk:OpenRC</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Talk:OpenRC&amp;diff=32171"/>
		<updated>2026-03-24T16:32:16Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: /* Warning in PAM support */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The [https://wiki.alpinelinux.org/wiki/OpenRC#Preventing_slow_services_from_delaying_boot Preventing slow services from delaying boot] passage currently uses &#039;&#039;&#039;chronyd&#039;&#039;&#039; as an example of a service that may delay boot.  The passage could be improved:-&lt;br /&gt;
&lt;br /&gt;
1. There is another, simpler and safer method to prevent a slow startup by &#039;&#039;&#039;chronyd&#039;&#039;&#039; that could be listed first and avoids dealing with the expressed danger of editing {{Path|/etc/inittab}} wrongly and its implied stunting of system boot. &lt;br /&gt;
&lt;br /&gt;
The method has been suggested helpfully in various places:&lt;br /&gt;
* In the second paragraph of the file to be edited:  {{Path|/etc/conf.d/chronyd}}&lt;br /&gt;
* https://whynothugo.nl/journal/2023/11/19/setting-up-an-alpine-linux-workstation/#chronyd-blocks-at-startup&lt;br /&gt;
* https://gist.github.com/c0m4r/e38d41d0e31f6adda4b4c5a88ba0a453#NTP&lt;br /&gt;
 &lt;br /&gt;
The method is to edit {{Path|/etc/conf.d/chronyd}} and to change the line {{Codeline|1=FAST_STARTUP=no}} to {{Codeline|1=FAST_STARTUP=yes}}.&lt;br /&gt;
&lt;br /&gt;
2. Technically, &#039;&#039;&#039;chronyd&#039;&#039;&#039; is not a boot service but rather launches at the default level ({{Codeline|rc-update add chronyd default}}), so the subheading may need to be improved.  There is [https://wiki.alpinelinux.org/w/index.php?search=%22%5B%5B%23Preventing+slow+services+from+delaying+boot%7C%22&amp;amp;title=Special%3ASearch&amp;amp;profile=default&amp;amp;fulltext=1 only one wiki page] that links to that subheading, and it is in this very same OpenRC wiki page, so it should be easy to change the subheading title, say, from &#039;&#039;&amp;quot;Preventing slow services from delaying boot&amp;quot;&#039;&#039; to &#039;&#039;&amp;quot;Preventing slow services from delaying system launch&amp;quot;&#039;&#039; or &#039;&#039;...system startup&#039;&#039;.   The link is mentioned twice in this wiki page, so those passages could be reviewed:&lt;br /&gt;
* https://wiki.alpinelinux.org/wiki/OpenRC#Stacked_runlevels&lt;br /&gt;
* https://wiki.alpinelinux.org/wiki/OpenRC#Configuration&lt;br /&gt;
&lt;br /&gt;
Alternatively, an &#039;&#039;Include:Chronyd - Startup Speed Enhancement&#039;&#039; page could be started for inclusion here and wherever else (Any future &#039;&#039;Chrony&#039;&#039; page, for example) that would include the current inittab method and the FAST_STARTUP method.&lt;br /&gt;
[[User:John3-16|John3-16]] ([[User talk:John3-16|talk]]) 16:21, 8 August 2025 (UTC)&lt;br /&gt;
&lt;br /&gt;
:Please note also that the external link about the {{Path|inittab}} method, [https://ptrcnull.me/posts/openrc-async-services/ OpenRC: Start services after login prompt], is now broken.  Please consider whether perhaps the reference/attribution is suitable, as it stands. [[User:John3-16|John3-16]] ([[User talk:John3-16|talk]]) 16:33, 8 August 2025 (UTC) &lt;br /&gt;
:[[User:John3-16|John3-16]] ([[User talk:John3-16|talk]])&lt;br /&gt;
&lt;br /&gt;
:: Thanks for submitting a thorough feedback. Highly appreciated. I have fixed the external links and internal links and updated section heading as per your suggestion. Service &#039;&#039;&#039;chrony&#039;&#039;&#039; was meant to be example to explain the concept. For now i&#039;ve removed the word chrony. Regarding adding {{Codeline|1=FAST_STARTUP=yes}} to Chrony page, i&#039;m quite hesitant to touch pages where i lack knowledge. -[[User:Prabuanand|Prabuanand]] ([[User talk:Prabuanand|talk]]) 20:02, 8 August 2025 (UTC)&lt;br /&gt;
&lt;br /&gt;
The below Note may add confusion to users. Please consider rewording or removal. &lt;br /&gt;
{{Note|The upstream OpenRC User Guide for user services considers [https://github.com/OpenRC/openrc/blob/master/user-guide.md#auto-starting configuring  pam] in the management of user service sessions;  as an experimental branch of OpenRC, this facility, including its autostart configuration, may be fluid.  Many Alpine Linux installations typically may not run pam.}}&lt;br /&gt;
* The experimental is already there &amp;quot;User services are currently experimental &amp;quot;. If necessary that can be &#039;&#039;&#039;highlighted&#039;&#039;&#039;.&lt;br /&gt;
* I request a rewording to tell user on what he&#039;s supposed to do for pam. In the current form, the Note does not help the user on how to proceed.&lt;br /&gt;
- [[User:Prabuanand|Prabuanand]] ([[User talk:Prabuanand|talk]]) 11:03, 11 August 2025 (UTC)&lt;br /&gt;
&lt;br /&gt;
::- Thank you for your kind attention on the wiki. I have tried to address your concern by removing the note plus the reference to it under [[OpenRC#PAM_support|PAM support]] instead of elaborating on the upstream OpenRC configuration user guide passage regarding pam. &lt;br /&gt;
 &lt;br /&gt;
::- On a different topic, while hoping to keep the wiki a clear user guide, do we want to simultaneously reference more in-depth examinations about user services that may be significant to developers? For example, consider a possible closing passage under &#039;&#039;User Services&#039;&#039;, or under a new &#039;&#039;Further reading&#039;&#039; section, or perhaps in a briefer form under &#039;&#039;See also&#039;&#039;:  &lt;br /&gt;
&lt;br /&gt;
:::&#039;For a more in-depth examination of OpenRC user services, consider useful discussions regarding DE-dependent (&#039;&#039;desktop environment&#039;&#039;) vs DE-independent environment variables discussed in an [https://github.com/OpenRC/openrc/pull/723 upstream thread] about user services, and whether the variables ought to be passed on filtered (not in whole) or not.  Other useful assessments were laid out in an excellent though now [https://wiki.gentoo.org/wiki/OpenRC/Legacy_user_services outdated Gentoo wiki page] about legacy user services that furthermore had examined {{pkg|wlsunset}} when used as a user service in Wayland;  their current [https://wiki.gentoo.org/wiki/OpenRC#User_services User Services page] adds further useful and more up-to-date contributions.&#039;  &lt;br /&gt;
&lt;br /&gt;
::This passage could be left here for any further discussion or added to the wiki with or without any edits, as may be seen to be suitable;  I am grateful either way.&lt;br /&gt;
 &lt;br /&gt;
::- Perhaps one should consider moving the paragraph about allowing parallel services into the section &#039;&#039;&#039;Preventing slow services from delaying system startup&#039;&#039;&#039;, as a subheading called &amp;quot;Parallel services&amp;quot;.  It could be placed after the introductory paragraph, &amp;quot;Services that take a while to start will block ...&amp;quot;.  This &#039;&#039;parallel services&#039;&#039; passage is not immediately relevant in its current location as the second paragraph about OpenRC configuration.  It may simply appear there from early days in the preparation of the page.&lt;br /&gt;
&lt;br /&gt;
::The suggestion that currently appears there could then be listed as a second subheading (after the &amp;quot;Parallel services&amp;quot; subheading suggested above), to be titled, say, &amp;quot;Async runlevel method&amp;quot;, &amp;quot;Stacked runlevel method&amp;quot;, &amp;quot;Inittab method&amp;quot; or as suitable.&lt;br /&gt;
&lt;br /&gt;
::- Are we satisfied to keep the [[OpenRC#Command_usage|Command usage]] section where it is, deep down on this page, or would it be more pertinent to give command usage examples nearer to the introductory section of the wiki page, perhaps at the beginning of [OpenRC#Quickstart|Quickstart] table or immediately after it (retaining the &#039;&#039;Command usage&#039;&#039; subheading or not)?  Perhaps this &#039;&#039;Command usage&#039;&#039; passage has suffered displacement from newer passages.&lt;br /&gt;
&lt;br /&gt;
::This passage could additionally illustrate the most commonly used OpenRC commands at the beginning of the Quickstart section with a handful of complete {{ic|rc-service}} and {{ic|rc-update}} command line instructions;  otherwise, full examples of common OpenRC clis first appear in the disproportionally long &#039;&#039;User Services&#039;&#039; section, and  OpenRC instructions are otherwise introduced quickly, with no complete cli example, in the current &#039;&#039;QuickStart&#039;&#039; table:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Commonly-used OpenRC commands&#039;&#039;&#039;&lt;br /&gt;
Start, stop (or {ic|restart}}) a service, for example, at the boot runlevel (do not use employ the &#039;&amp;lt;&#039; nor &#039;&amp;gt;&#039;):&lt;br /&gt;
{{cmd|doas rc-service &amp;lt;serviceName&amp;gt; start boot}}&lt;br /&gt;
{{cmd|doas rc-service &amp;lt;serviceName&amp;gt; stop boot}}&lt;br /&gt;
Add or delete a service to/from the sequence of services that need to start automatically in future sessions at the {{ic|default}} runlevel;  note that the &#039;&#039;&#039;default&#039;&#039;&#039; runlevel is assumed, so it does not need to be stated explicitly:&lt;br /&gt;
{{cmd|doas rc-update add &amp;lt;serviceName&amp;gt; default}}&lt;br /&gt;
{{cmd|doas rc-update del &amp;lt;serviceName&amp;gt;}}&lt;br /&gt;
List the current statuses of all services;  however, do not use {{ic|doas}} nor the equivalent command as root to display the statuses of any &#039;&#039;user service&#039;&#039;:&lt;br /&gt;
{{cmd|doas rc-status}}&lt;br /&gt;
List the assigned runlevels of all services;  likewise, do not use {{ic|doas}} nor root to display the runlevels of user services:&lt;br /&gt;
{{cmd|doas rc-update}}&lt;br /&gt;
&lt;br /&gt;
::Alternatively, the above &#039;&#039;Commonly-used OpenRC commands&#039;&#039; passage, with or without any edits as may be seen to be suitable, could simply not be included.&lt;br /&gt;
&lt;br /&gt;
::-  The current passage in [[OpenRC#Command_usage|Command usage]], &amp;quot;To view the command usage for all OpenRC commands (rc-update, rc-service, rc-status, openrc etc.) use the --help or -h flag [...]&amp;quot; could be moved into the Quickstart section instead of leaving it near the end of the page.&lt;br /&gt;
&lt;br /&gt;
::- The &#039;&#039;Command usage&#039;&#039; section further contains a paragraph that is irrelevant to OpenRC: &#039;The busybox command equivalent for traditional GNU/Linux systems is as follows [...]&#039;.  This paragraph would be more relevant, if at all, for example:-&lt;br /&gt;
::* In the [[BusyBox]] page, if suitable;  or&lt;br /&gt;
::* In the [[Comparison_with_other_distros &#039;Rosetta Stone&#039;]] page, perhaps under a new heading there, say, &#039;&#039;Userspace commands&#039;&#039; or &#039;&#039;Command line instructions&#039;&#039;, seeing how, currently, there are only sections for &#039;&#039;Package management&#039;&#039;, &#039;&#039;Runlevel &amp;amp; Initscripts&#039;&#039; and &#039;&#039;Config files&#039;&#039;; or &lt;br /&gt;
::* Being culled from this page.&lt;br /&gt;
&lt;br /&gt;
::Thank you. [[User:John3-16|John3-16]] ([[User talk:John3-16|talk]]) 21:44, 11 August 2025 (UTC)&lt;br /&gt;
::: Thanks once again for the detailed suggestions. Hope i&#039;ve done everything as suggested. Please make necessary amends, if i have missed out something. Highly appreciated. -[[User:Prabuanand|Prabuanand]] ([[User talk:Prabuanand|talk]]) 10:03, 12 August 2025 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Warning in PAM support ==&lt;br /&gt;
&lt;br /&gt;
Dear [[User:WhyNotHugo]], I&#039;m not sure about the need for warning in the PAM support section. I have been using User services with PAM support for the past few months without any issues and i have not seen any bug reports filed regarding this. btw:i&#039;m using pamrundir and i tested dwm with the manual XDG_RUNTIME_DIR script as added there. I believe Warning should be sparingly used in Wiki, if there are unresolved/known issues. - [[User:Prabuanand|Prabuanand]] ([[User talk:Prabuanand|talk]]) 15:59, 5 September 2025 (UTC)&lt;br /&gt;
&lt;br /&gt;
:[[User:Prabuanand]] This was solved shortly after your comment, thanks. Feel free to remove this talk subsection. [[User:WhyNotHugo|WhyNotHugo]] ([[User talk:WhyNotHugo|talk]]) 16:32, 24 March 2026 (UTC)&lt;br /&gt;
&lt;br /&gt;
== User Services -&amp;gt; Runlevels ==&lt;br /&gt;
&lt;br /&gt;
Dear [[User:WhyNotHugo]], This section probably requires some rewriting.&lt;br /&gt;
* I&#039;m not sure when this sysinit runlevel is used/required &amp;quot;mkdir -p ${XDG_CONFIG_HOME:-~/.config}/rc/runlevels/sysinit&amp;quot;.&lt;br /&gt;
* in the command openrc -U $RUNLEVEL. Instead of $RUNLEVEL, consider using &amp;lt;&amp;gt; as [[Help:Reading#Placeholder|placeholder]].&lt;br /&gt;
* Will adding &amp;quot;exec openrc -U gui&amp;quot; to ~/.profile support both Wayland and Xorg? Shouldn&#039;t the Compositor startup file be used for this for wayland?  --[[User:Prabuanand|Prabuanand]] ([[User talk:Prabuanand|talk]]) 16:13, 5 September 2025 (UTC)&lt;br /&gt;
:I just now tested adding &amp;quot;exec openrc -U gui&amp;quot; to ~/.profile and i got locked out with &amp;quot;XDG_RUNTIME_DIR unset&amp;quot;. Only after removing this, i could login to tty. Sway too did not start with this option. Here are my [git.sr.ht:~prabuanand/dotfiles dotfiles] for reference. -[[User:Prabuanand|Prabuanand]] ([[User talk:Prabuanand|talk]]) 16:55, 5 September 2025 (UTC)&lt;br /&gt;
&lt;br /&gt;
::Dear [[User:WhyNotHugo]], Thank you for your excellent contributions to Linux, and to Alpine Linux in particular. I support [[User:Prabuanand|Prabuanand]]&#039;s excellent and extensive impressions/observations above however, including those further above in the &#039;Warning in PAM support&#039; discussion.  I would be grateful for your input about them. &lt;br /&gt;
&lt;br /&gt;
::Additionally, I suspect that two further points of guidance in your edits warrant review or elaboration on the wiki page:- &lt;br /&gt;
::*Your claim that &#039;&#039;&#039;sysinit&#039;&#039;&#039; is the default level;  please elaborate why &#039;&#039;&#039;default&#039;&#039;&#039; would not be the default runlevel here, for my better understanding and for the sake of newcomers to Alpine Linux&#039;s wiki.  &lt;br /&gt;
::*Note also that your instruction did not revert the runlevel back to &#039;&#039;&#039;sysinit&#039;&#039;&#039; on my system, even with the user (&#039;&#039;&#039;-U &#039;&#039;&#039;) switch:  {{Cmd|$ openrc -U}}&lt;br /&gt;
::*Your edit proposing a command to revert to the sysinit runlevel appears to run contrary to the guidance [[OpenRC#Runlevels|currently in the wiki]], that &#039;&#039;&amp;quot;sysinit always runs when the host first starts and should not be run again.&amp;quot;&#039;&#039;&lt;br /&gt;
::Thanks again for your help addressing our concerns. [[User:John3-16|John3-16]] ([[User talk:John3-16|talk]]) 17:43, 12 September 2025 (UTC)&lt;br /&gt;
&lt;br /&gt;
Dear [[User:StruanR]],  &lt;br /&gt;
I am grateful for your improvements of the wiki, kindly continue them!  Please note that certain edits, however, changing a root prompt to a user prompt, were in various cases inaccurate, and I have reverted those.  Perhaps the wiki could be made clearer that to modify &#039;&#039;system&#039;&#039; services or runlevels, one generally requires a root prompt or doas/sudo;  to display/check those, a user prompt may suffice.  Note, on the other hand, that to modify &#039;&#039;user&#039;&#039; services (using the &#039;&#039;&#039;-U&#039;&#039;&#039; switch), a root prompt or doas/sudo would not generally be used.  I hope this helps.&lt;br /&gt;
Your other edits were helpful, thank you!  &lt;br /&gt;
I took the chance to amend some previous passages made by other helpful contributors while I was at it.  Please continue helping out with the wiki! [[User:John3-16|John3-16]] ([[User talk:John3-16|talk]]) 17:43, 12 September 2025 (UTC)&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Sway&amp;diff=32097</id>
		<title>Sway</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Sway&amp;diff=32097"/>
		<updated>2026-03-01T01:30:48Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: /* Setup-desktop */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://swaywm.org Sway] is a tiling [[Wayland]] compositor and a drop-in replacement for the [[i3wm |i3 window manager]]. It works with your existing i3 configuration and supports most of i3&#039;s features, plus a few extras.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* Internet [[Configure_Networking#Connectivity_testing|connectivity]], unless the packages have been pre-fetched into a local cache.&lt;br /&gt;
* Install appropriate [[Graphics driver]] drivers for your hardware. Without graphics drivers [[#Video Driver Issues|errors]] are likely to occur.&lt;br /&gt;
* A [[Setting_up_a_new_user#Creating_a_new_user|non-root user account]].&lt;br /&gt;
* The [[Repositories#Managing_repositories|community repositories must be enabled]].&lt;br /&gt;
* Wayland compositors need raw access to input and output devices, typically mediated by a [[seat manager]]. Either [[seatd]] or [[elogind]] work fine, but installing both leads to conflicts.&lt;br /&gt;
{{Tip|Except for the first two [[#Prerequisites|prerequisites]], all of the others are automatically handled if the desktop is [[#Setup-desktop|installed using the following setup-desktop]] script.}}&lt;br /&gt;
&lt;br /&gt;
== Setup-desktop ==&lt;br /&gt;
&lt;br /&gt;
{{Todo|Sway doesn&#039;t require elogind, and is commonly used without it. Installing it is a distraction.}}&lt;br /&gt;
&lt;br /&gt;
The [[setup-desktop]] command automates the Sway desktop installation with [[eudev]] and [[elogind]]. &lt;br /&gt;
&lt;br /&gt;
{{cmd|# setup-desktop sway}}   &lt;br /&gt;
&lt;br /&gt;
Proceed to the [[Sway#Starting Sway|Starting Sway]] section, as no [[Display manager|display manager]] is being installed nor configured by the script that would boot into a graphical login screen.&lt;br /&gt;
&lt;br /&gt;
== Manual Installation ==&lt;br /&gt;
&lt;br /&gt;
The installation steps below allow you to pick and choose various components for your Sway desktop.&lt;br /&gt;
&lt;br /&gt;
=== Install Fonts ===&lt;br /&gt;
&lt;br /&gt;
Install [https://dejavu-fonts.github.io/ DejaVu] fonts ({{Pkg|font-dejavu}}), which have good [https://home.unicode.org/ Unicode] coverage:&lt;br /&gt;
&lt;br /&gt;
{{cmd|# apk add font-dejavu}}   &lt;br /&gt;
 &lt;br /&gt;
=== Install Sway ===&lt;br /&gt;
&lt;br /&gt;
{{cmd|# apk add sway \&lt;br /&gt;
    xwayland             \ # if you need the xserver&lt;br /&gt;
    foot                 \ # default terminal emulator. Modify $term in config for a different one.&lt;br /&gt;
    wmenu                \ # default Wayland native menu for choosing program and screensharing monitor&lt;br /&gt;
    swaylock swaylockd   \ # lockscreen tool&lt;br /&gt;
    swaybg               \ # display wallpaper&lt;br /&gt;
    grim                 \ # screenshot tool&lt;br /&gt;
    wl-clipboard         \ # clipboard management&lt;br /&gt;
    i3status             \ # simple status bar&lt;br /&gt;
    swayidle               # idle management (DPMS) daemon&lt;br /&gt;
}} &lt;br /&gt;
&lt;br /&gt;
For complimentary software alternatives, see [https://github.com/swaywm/sway/wiki/Useful-add-ons-for-sway Sway&#039;s wiki] or [https://wiki.gentoo.org/wiki/List_of_software_for_Wayland Gentoo&#039;s wiki].&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Sway config file ===&lt;br /&gt;
&lt;br /&gt;
Copy the default Sway configuration file to {{Path|~/.config/sway/config}} so that it can be customized as per each user&#039;s choices:&lt;br /&gt;
&lt;br /&gt;
{{cmd|$ mkdir -p ~/.config/sway&lt;br /&gt;
$ cp /etc/sway/config ~/.config/sway/}}&lt;br /&gt;
&lt;br /&gt;
Read through it to learn the default keybindings. Refer to the [[Sway customization guide|Sway customization guide]] as well as the [[#See also|See also]] section for Tips on customizing this config file. Sway&#039;s configuration is mostly backward compatible with that of [[I3wm|i3]]&#039;s, and if you are looking for a solution for a specific issue, you could try checking whether it hasn&#039;t been provided for the i3 window manager.&lt;br /&gt;
&lt;br /&gt;
For additional information, start at &amp;lt;code&amp;gt;man 5 sway&amp;lt;/code&amp;gt; and read the [https://github.com/swaywm/sway/wiki upstream wiki].&lt;br /&gt;
&lt;br /&gt;
=== PipeWire and Screensharing ===&lt;br /&gt;
&lt;br /&gt;
The Sway compositor has no involvement with audio playback. In order for screensharing to work, [[PipeWire]] is required. Therefore, installing [[PipeWire#Installation|PipeWire]] is recommended for audio playback too. &lt;br /&gt;
&lt;br /&gt;
Since v3.22, Alpine Linux provides the necessary scripts to start PipeWire as a [[OpenRC#user services|user service]] in OpenRC.&lt;br /&gt;
&lt;br /&gt;
From a screensharing perspective, applications are split into two categories:-&lt;br /&gt;
&lt;br /&gt;
* Those which use the native Wayland [https://wayland.app/protocols/wlr-screencopy-unstable-v1 wlr-screencopy] protocol&lt;br /&gt;
* Those which use the API from Flatpak&#039;s &amp;lt;code&amp;gt;xdg-desktop-portal&amp;lt;/code&amp;gt; (this portal is also used by native non-Flatpak applications).&lt;br /&gt;
&lt;br /&gt;
Applications in the first group require no additional setup. Applications in the second group (which include Firefox and Chromium) require setting up &#039;&#039;xdg portals&#039;&#039; in addition to [[PipeWire#Installation|PipeWire]]. &lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add xdg-desktop-portal xdg-desktop-portal-wlr}}&lt;br /&gt;
&lt;br /&gt;
If you are using a &amp;lt;code&amp;gt;dbus-run-session&amp;lt;/code&amp;gt; wrapper to launch Sway, you will also need to set D-Bus variables in order for the portal and for [[#PipeWire and Screensharing|screensharing]] features to work;  add the following line to the beginning of Sway&#039;s {{Path|config}} file:&lt;br /&gt;
&lt;br /&gt;
 exec dbus-update-activation-environment WAYLAND_DISPLAY DISPLAY XDG_CURRENT_DESKTOP SWAYSOCK I3SOCK XCURSOR_SIZE XCURSOR_THEME&lt;br /&gt;
&lt;br /&gt;
The {{ic|XDG_CURRENT_DESKTOP}} environment variable may be set by various methods, including:-&lt;br /&gt;
* by amending its mention in that {{ic|dbus-update-activation-environment}} line, editing it to specify {{ic|XDG_CURRENT_DESKTOP{{=}}sway}} ; or&lt;br /&gt;
* by exporting it from within an applicable environment configuration file, such as:&lt;br /&gt;
&lt;br /&gt;
:{{Cat| $XDG_CONFIG_HOME/.profile|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
export XDG_CURRENT_DESKTOP=sway&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
:However, this method is not universal, as it would require resetting the {{ic|XDG_CURRENT_DESKTOP}} variable for any different desktop/compositor/window manager that may be launched afterwards, possibly by employing a launcher similar to the wrapper script alternative described for &#039;&#039;&#039;Sway&#039;&#039;&#039; [[Sway#Automatically_Launch_Sway_on_tty1|below]];  or&lt;br /&gt;
* by being set automatically by the display manager, as is commonplace, but none is supplied by &#039;&#039;&#039;Sway&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Screen Lock and suspend-to-RAM ===&lt;br /&gt;
&lt;br /&gt;
{{Tip| For a seat manager-agnostic and DE-/WM-agnostic tool, consider installing the {{Pkg|zzz}} utility, available in the [[Repositories#Community|community]] repository, or the {{Pkg|powerctl}} utility from the [[Repositories#Testing|testing]] repository, in order to manage suspend and hibernation.}}&lt;br /&gt;
&lt;br /&gt;
For usage of the &amp;lt;Code&amp;gt;loginctl suspend&amp;lt;/Code&amp;gt; command, see [[Elogind]].&lt;br /&gt;
&lt;br /&gt;
To put the system to sleep after 600 seconds, use:&lt;br /&gt;
&lt;br /&gt;
 exec swayidle -w timeout 600 &#039;doas /usr/bin/powerctl mem&#039;&lt;br /&gt;
&lt;br /&gt;
Do not lock the screen if program is running in full screen:&lt;br /&gt;
&lt;br /&gt;
==== Idle inhibition ====&lt;br /&gt;
&lt;br /&gt;
 for_window [app_id=&amp;quot;^.*&amp;quot;] inhibit_idle fullscreen&lt;br /&gt;
&lt;br /&gt;
{{Todo|The option below, related to &amp;lt;Code&amp;gt;wayland-pipewire-idle-inhibit&amp;lt;/Code&amp;gt;, needs to be tested. If you find the option below to be working, please remove this Todo.}}&lt;br /&gt;
&lt;br /&gt;
If you do not want to lock the screen while media is being played through [[PipeWire]], then install the {{pkg|wayland-pipewire-idle-inhibit}} package, and add the following to Sway&#039;s {{Path|config}} file:&lt;br /&gt;
&lt;br /&gt;
 exec wayland-pipewire-idle-inhibit&lt;br /&gt;
&lt;br /&gt;
Make changes to the {{Path|~/.config/wayland-pipewire-idle-inhibit/config.toml}} configuration file or to whichever configuration file you may have referenced instead through the &amp;lt;Code&amp;gt; --config &amp;lt;PATH&amp;gt;&amp;lt;/Code&amp;gt;, if required, as per the [https://github.com/rafaelrc7/wayland-pipewire-idle-inhibit?tab=readme-ov-file#config project&#039;s website].&lt;br /&gt;
&lt;br /&gt;
=== Elogind and swayidle ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;swayidle&amp;lt;/code&amp;gt; has integration with &amp;lt;code&amp;gt;elogind&amp;lt;/code&amp;gt;, and it can handle &#039;&#039;before-sleep&#039;&#039; events.&lt;br /&gt;
&lt;br /&gt;
If using &amp;lt;code&amp;gt;swayidle before-sleep&amp;lt;/code&amp;gt;, then there will be a race condition, so that when you resume the computer from &#039;&#039;suspend&#039;&#039;, the screen will show the contents of the unlocked screen for a second before showing the actual lock screen.  This can be a privacy concern.&lt;br /&gt;
&lt;br /&gt;
To solve this issue, do the following.&lt;br /&gt;
&lt;br /&gt;
Create the &amp;lt;code&amp;gt;/etc/elogind/system-sleep/10-swaylock.sh&amp;lt;/code&amp;gt; file, and then add the following script to this file:&lt;br /&gt;
{{Cat|/etc/elogind/system-sleep/10-swaylock.sh|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 if [ &amp;quot;${1}&amp;quot; == &amp;quot;pre&amp;quot; ]; then&lt;br /&gt;
   touch /tmp/swaylock-sleep&lt;br /&gt;
   sleep 1&lt;br /&gt;
 fi&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Then set it to executable.&lt;br /&gt;
&lt;br /&gt;
Later, once Sway is installed, add the following line to its {{Path|config}} file:&lt;br /&gt;
&lt;br /&gt;
 exec touch /tmp/swaylock-sleep &amp;amp;&amp;amp; inotifyd swaylock /tmp/swaylock-sleep&lt;br /&gt;
&lt;br /&gt;
With this line, the screen will be promptly locked before &#039;&#039;suspend-to-RAM&#039;&#039; starts.&lt;br /&gt;
&lt;br /&gt;
=== Brightness Control ===&lt;br /&gt;
&lt;br /&gt;
Refer to [[Backlight]] for information on brightness control.&lt;br /&gt;
&lt;br /&gt;
=== Output Scaling for High Resolution Displays ===&lt;br /&gt;
&lt;br /&gt;
Without further configuration, program interfaces may be too small to use on high resolution displays.&lt;br /&gt;
&lt;br /&gt;
Sway supports the per-display configuration of:-&lt;br /&gt;
&lt;br /&gt;
* fractional (e.g. 1.5x);  and&lt;br /&gt;
* integer scaling (e.g. 2x) &lt;br /&gt;
&lt;br /&gt;
However, fractional scaling is discouraged due both to the performance impact and to the blurry output it produces. In this case, where 1x scaling is too small and 2x scaling is too large, program-specific GTK/QT-based toolkit scaling is recommended.  See [[Sway#Toolkit Scaling|See below]].&lt;br /&gt;
&lt;br /&gt;
==== Scaling with wdisplays ====&lt;br /&gt;
&lt;br /&gt;
To enable Sway scaling, the user can first preview different scaling factors with the {{Pkg|wdisplays}} package.  Note the output name (&#039;&#039;eDP-1&#039;&#039;, &#039;&#039;LVDS-1&#039;&#039;) and try apply scaling factors such as 1 and 2.  To make changes permanent, add the following line, completed with your settings, to Sway&#039;s {{Path|config}} file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
output &amp;lt;name&amp;gt; scale &amp;lt;factor&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Toolkit Scaling ====&lt;br /&gt;
&lt;br /&gt;
To use toolkit scaling, say, at x2, add the following, for instance, to your {{Path|~/.profile}}: &lt;br /&gt;
&lt;br /&gt;
 # for GTK-based programs such as firefox and emacs:&lt;br /&gt;
 export GDK_DPI_SCALE{{=}}2&lt;br /&gt;
&lt;br /&gt;
 # for QT-based programs&lt;br /&gt;
 export QT_WAYLAND_FORCE_DPI{{=}}&amp;quot;physical&amp;quot;&lt;br /&gt;
 # or if still too small, use a custom DPI&lt;br /&gt;
 export QT_WAYLAND_FORCE_DPI{{=}}192 # 2x scaling&lt;br /&gt;
 export QT_QPA_PLATFORM{{=}}&amp;quot;wayland-egl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Notification Daemon ===&lt;br /&gt;
&lt;br /&gt;
[[mako]] is a lightweight notification daemon that works seamlessly with Sway. &lt;br /&gt;
&lt;br /&gt;
=== Screenshots ===&lt;br /&gt;
&lt;br /&gt;
A simple tool that works well under Wayland is {{pkg|grimshot}}. Example keybindings:-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bindsym Print exec grimshot copy area&lt;br /&gt;
bindsym Shift+Print exec grimshot copy screen&lt;br /&gt;
bindsym Control+Print exec grimshot save area ~/Pictures/$(date +%d-%m-%Y-%H-%M-%S).png&lt;br /&gt;
bindsym Control+Shift+Print exec grimshot save screen ~/Pictures/$(date +%d-%m-%Y-%H-%M-%S).png&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See Sway&#039;s [https://github.com/swaywm/sway/wiki/Useful-add-ons-for-sway wiki article] for a listing of further screenshot tools.&lt;br /&gt;
&lt;br /&gt;
=== Make Clipboard Content Persistent ===&lt;br /&gt;
&lt;br /&gt;
By default, the clipboard content does not persist after terminating the program: if you copy some text from Firefox and then exit Firefox, then the copied text is also lost.&lt;br /&gt;
&lt;br /&gt;
Install {{Pkg|clipman}} from the community repo, and then add the following to Sway&#039;s {{Path|config}} file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
exec wl-paste --type text/plain --watch clipman store --histpath=&amp;quot;~/.local/state/clipman-primary.json&amp;quot;&lt;br /&gt;
bindsym $mod+h exec clipman pick --tool wofi --histpath=&amp;quot;~/.local/state/clipman-primary.json&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Firefox Picture-in-Picture Mode/Floating Windows ===&lt;br /&gt;
&lt;br /&gt;
Add this to your Sway configuration file (modify the numeric values to suit your needs and your display):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
for_window [app_id=&amp;quot;firefox&amp;quot; title=&amp;quot;^Picture-in-Picture$&amp;quot;] floating enable, move position 877 450, sticky enable, border none&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Start with NumLock Enabled ===&lt;br /&gt;
&lt;br /&gt;
Add the following to your Sway {{Path|config}} file:&lt;br /&gt;
&lt;br /&gt;
 input type:keyboard xkb_numlock enabled&lt;br /&gt;
&lt;br /&gt;
=== Change mouse cursor theme and size ===&lt;br /&gt;
&lt;br /&gt;
Add to your Sway {{Path|config}} file:&lt;br /&gt;
&lt;br /&gt;
 seat seat0 xcursor_theme my_cursor_theme my_cursor_size&lt;br /&gt;
&lt;br /&gt;
For example, set a mouse cursor using the &#039;&#039;&#039;GNOME Adwaita&#039;&#039;&#039; theme:&lt;br /&gt;
&lt;br /&gt;
 seat seat0 xcursor_theme Adwaita 16&lt;br /&gt;
&lt;br /&gt;
You can inspect their values with &amp;lt;code&amp;gt;echo $XCURSOR_SIZE&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;echo $XCURSOR_THEME&amp;lt;/code&amp;gt;. If reloading your configuration does not result in change, try logging out and in.&lt;br /&gt;
&lt;br /&gt;
{{Note|Wayland allows for client-side cursors. It is possible that applications do not evaluate the values of &amp;lt;code&amp;gt;$XCURSOR_SIZE&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;$XCURSOR_THEME&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
&lt;br /&gt;
=== Custom Keyboard Layout ===&lt;br /&gt;
&lt;br /&gt;
To use a custom keyboard layout, just use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
input type:keyboard {&lt;br /&gt;
  xkb_file /path/to/my/custom/layout&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Flatpaks ===&lt;br /&gt;
&lt;br /&gt;
{{main|Flatpak}}&lt;br /&gt;
&lt;br /&gt;
As mentioned in [[Flatpak#Portals|Flatpak]] page, install the minimal required portal related packages i.e {{pkg|xdg-desktop-portal}}, {{pkg|xdg-desktop-portal-gtk}} and {{pkg|xdg-desktop-portal-wlr}}. After installing the packages, add the following to the &#039;&#039;autostart&#039;&#039; section in your Sway {{Path|config}} file to avoid [[Flatpak#GDBus_Error|GDBus errors]]. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
exec /usr/libexec/xdg-desktop-portal&lt;br /&gt;
exec /usr/libexec/xdg-desktop-portal-gtk&lt;br /&gt;
exec /usr/libexec/xdg-desktop-portal-wlr&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These startup instructions are only needed, if these are not started automatically via other means.&lt;br /&gt;
&lt;br /&gt;
== Starting Sway ==&lt;br /&gt;
&lt;br /&gt;
=== Manually Launch Sway ===&lt;br /&gt;
&lt;br /&gt;
You can launch Sway manually by issuing the &amp;lt;Code&amp;gt;sway&amp;lt;/Code&amp;gt; command from a TTY.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ sway}} &lt;br /&gt;
&lt;br /&gt;
{{Tip|When using [[Wayland]], for [[PipeWire]] and screensharing to work in Firefox and Chromium, a [[D-Bus]] is required. In the absence of a [[OpenRC#User_services|user service manager]], consider running &amp;lt;Code&amp;gt;sway&amp;lt;/Code&amp;gt; with &amp;lt;code&amp;gt;dbus-run-session&amp;lt;/code&amp;gt;, a convenient wrapper that will explicitly export the path of the session bus.{{Cmd|$ dbus-run-session sway}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Automatically Launch Sway on tty1 ===&lt;br /&gt;
&lt;br /&gt;
Adding the following lines to {{Path|~/.profile}} or to its equivalent will ensure that &amp;lt;Code&amp;gt;sway&amp;lt;/Code&amp;gt; launches automatically, with a D-Bus, &#039;&#039;only&#039;&#039; from &#039;&#039;tty1&#039;&#039;.  This is handy for troubleshooting, because if the Sway configuration ever falters, one could troubleshoot by logging into a different TTY (&#039;&#039;tty2&#039;&#039;-&#039;&#039;tty6&#039;&#039;), and your startup script then will not attempt to launch the faulty Sway environment from there also. &lt;br /&gt;
{{Cat| ~/.profile|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$(tty)&amp;quot; = &amp;quot;/dev/tty1&amp;quot; ]; then&lt;br /&gt;
     exec dbus-run-session sway &lt;br /&gt;
fi&lt;br /&gt;
...&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
=== Using a Wrapper Script to Launch Sway ===&lt;br /&gt;
&lt;br /&gt;
Instead of using {{Path|~/.profile}} or its equivalent file, a [https://man.sr.ht/~kennylevinsen/greetd/#how-to-set-xdg_session_typewayland wrapper script] can be placed at {{Path|/usr/local/bin/sway-run}}. This script can be used to launch &amp;lt;Code&amp;gt;sway&amp;lt;/Code&amp;gt; from either a TTY or by [[greetd]], a lightweight [[Display manager|display manager]], as follows: {{Cat|/usr/local/bin/sway-run|&amp;lt;nowiki&amp;gt;#!/bin/sh&lt;br /&gt;
# Session&lt;br /&gt;
export XDG_SESSION_TYPE=wayland&lt;br /&gt;
export XDG_SESSION_DESKTOP=sway&lt;br /&gt;
export XDG_CURRENT_DESKTOP=sway&lt;br /&gt;
&lt;br /&gt;
# Wayland stuff&lt;br /&gt;
export MOZ_ENABLE_WAYLAND=1&lt;br /&gt;
export QT_QPA_PLATFORM=wayland&lt;br /&gt;
export SDL_VIDEODRIVER=wayland&lt;br /&gt;
export _JAVA_AWT_WM_NONREPARENTING=1&lt;br /&gt;
&lt;br /&gt;
# Launch Sway with a D-Bus server&lt;br /&gt;
exec dbus-run-session sway &amp;quot;$@&amp;quot; &amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Make the file executable:&lt;br /&gt;
{{Cmd|# chmod +x /usr/local/bin/sway-run}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
If you encounter any issues, try running &amp;lt;Code&amp;gt;sway -Vc /etc/sway/config&amp;lt;/Code&amp;gt;. It will run &amp;lt;Code&amp;gt;sway&amp;lt;/Code&amp;gt; with the default config file and set the output to be more verbose. It is generally a good idea to track your configuration files with &#039;&#039;git&#039;&#039; (if and when you use a remote repository for them, keep it private, for security reasons). &lt;br /&gt;
&lt;br /&gt;
To capture the Sway error log in a file for troubleshooting, replace &amp;lt;code&amp;gt;sway&amp;lt;/code&amp;gt; in your startup file by:&lt;br /&gt;
&lt;br /&gt;
 sway -d 2&amp;gt; ~/sway_error.log&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can also issue the below command from TTY.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ sway -d 2&amp;gt; ~/sway_error.log}} &lt;br /&gt;
&lt;br /&gt;
=== Video Driver Issues === &lt;br /&gt;
&lt;br /&gt;
After installing Sway, and while launching it for the first time, a lack of appropriate [[#Install Graphics Drivers|video drivers]] may cause various error messages such as:&lt;br /&gt;
&lt;br /&gt;
* &amp;quot;unable to create backend&amp;quot;&lt;br /&gt;
* &amp;quot;Failed to create renderer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Install the necessary drivers in order for your [[#Install Graphics Drivers|graphics card]] to work with Sway. &lt;br /&gt;
&lt;br /&gt;
=== XDG_RUNTIME_DIR is not set in the environment. Aborting ===&lt;br /&gt;
&lt;br /&gt;
If [[seatd]] is used instead of [[elogind]], the error message &#039;&#039;&#039;XDG_RUNTIME_DIR is not set in the environment. Aborting&#039;&#039;&#039; might be encountered.&lt;br /&gt;
&lt;br /&gt;
Ensure that the mandatory steps outlined in the [[Seatd]] wiki page are completed in order to set the [[XDG_RUNTIME_DIR]] variable.&lt;br /&gt;
&lt;br /&gt;
=== No backend was able to open a seat ===&lt;br /&gt;
&lt;br /&gt;
If no [[seat manager]] is available, then the error below will appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
[libseat] [libseat/libseat.c:73] libseat_open_seat : No backend was able to open a seat&lt;br /&gt;
[backend/session/libseat.c:102] Unable to create seat : Function not implemented&lt;br /&gt;
[backend/backend.c:303] Failed to open any DRM device&lt;br /&gt;
[sway/server.c:49] Unable to create backend&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ensure that either [[Elogind]] or [[Seatd]] is properly configured and running. &lt;br /&gt;
&lt;br /&gt;
=== Firefox (Flatpak) and/or GTK Apps ===&lt;br /&gt;
&lt;br /&gt;
==== Disappearing Cursor ====&lt;br /&gt;
&lt;br /&gt;
You may need to get an icon pack and possibly a theme from [https://www.pling.com/browse?cat=107&amp;amp;ord=latest Pling store] and set &amp;lt;code&amp;gt;GTK_THEME&amp;lt;/code&amp;gt; environmental variable. Alternatively, one could install an [https://pkgs.alpinelinux.org/packages?name=*-icon-theme&amp;amp;branch=edge&amp;amp;repo=&amp;amp;arch=x86_64&amp;amp;origin=&amp;amp;flagged=&amp;amp;maintainer= icon theme] package for all users.&lt;br /&gt;
&lt;br /&gt;
==== Missing file picker/cannot download ====&lt;br /&gt;
&lt;br /&gt;
Go to &#039;&#039;about:config&#039;&#039; and set &amp;lt;code&amp;gt;widget.use-xdg-desktop-portal.file-picker&amp;lt;/code&amp;gt; to 0.&lt;br /&gt;
&lt;br /&gt;
=== Nvidia Issues ===&lt;br /&gt;
&lt;br /&gt;
{{Draft|This section is partly outdated and could benefit from contributions in view of Nvidia&#039;s [https://docs.nvidia.com/drive/drive-os-5.2.3.0L/drive-os/index.html#page/DRIVE_OS_Linux_SDK_Development_Guide/Windows%20Systems/window_system_wayland.html current support] of Wayland. Help is encouraged.}}&lt;br /&gt;
{{Main|NVIDIA}}&lt;br /&gt;
As of Dec 31 2022, [https://developer.nvidia.com/docs/drive/drive-os/latest/linux/sdk/common/topics/window_system_stub/Gnome-WaylandDesktopShellSupport136.html Nvidia still doesn&#039;t fully support Wayland]. Therefore, the possible solutions are as outlined in the link, or setting your &amp;lt;Code&amp;gt;WLR_BACKENDS&amp;lt;/Code&amp;gt; environmental variables to &amp;lt;code&amp;gt;drm,libinput&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;x11&amp;lt;/code&amp;gt; (add {{Pkg|libinput}} here as well if you cannot use your mouse and keyboard after starting Sway). The latter also works for AMD/ATI cards (&#039;&#039;&#039;make sure to install {{Pkg|libinput}} first&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/swaywm/sway/wiki/ Sway Wiki]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Sway Archwiki]&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/Sway Gentoo Wiki]&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/Sway PostmarketOS Wiki]&lt;br /&gt;
&lt;br /&gt;
[[Category:Compositor]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Sway&amp;diff=32043</id>
		<title>Sway</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Sway&amp;diff=32043"/>
		<updated>2026-02-11T20:34:02Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: /* Prerequisites */ eudev is not required for any of sway&amp;#039;s functionality&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://swaywm.org Sway] is a tiling [[Wayland]] compositor and a drop-in replacement for the [[i3wm |i3 window manager]]. It works with your existing i3 configuration and supports most of i3&#039;s features, plus a few extras.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* Internet [[Configure_Networking#Connectivity_testing|connectivity]], unless the packages have been pre-fetched into a local cache.&lt;br /&gt;
* Install appropriate [[Graphics driver]] drivers for your hardware. Without graphics drivers [[#Video Driver Issues|errors]] are likely to occur.&lt;br /&gt;
* A [[Setting_up_a_new_user#Creating_a_new_user|non-root user account]].&lt;br /&gt;
* The [[Repositories#Managing_repositories|community repositories must be enabled]].&lt;br /&gt;
* Wayland compositors need raw access to input and output devices, typically mediated by a [[seat manager]]. Either [[seatd]] or [[elogind]] work fine, but installing both leads to conflicts.&lt;br /&gt;
{{Tip|Except for the first two [[#Prerequisites|prerequisites]], all of the others are automatically handled if the desktop is [[#Setup-desktop|installed using the following setup-desktop]] script.}}&lt;br /&gt;
&lt;br /&gt;
== Setup-desktop ==&lt;br /&gt;
&lt;br /&gt;
The [[setup-desktop]] command automates the Sway desktop installation with [[eudev]] and [[elogind]]. &lt;br /&gt;
&lt;br /&gt;
{{cmd|# setup-desktop sway}}   &lt;br /&gt;
&lt;br /&gt;
Proceed to the [[Sway#Starting Sway|Starting Sway]] section, as no [[Display manager|display manager]] is being installed nor configured by the script that would boot into a graphical login screen.&lt;br /&gt;
&lt;br /&gt;
== Manual Installation ==&lt;br /&gt;
&lt;br /&gt;
The installation steps below allow you to pick and choose various components for your Sway desktop.&lt;br /&gt;
&lt;br /&gt;
=== Install Fonts ===&lt;br /&gt;
&lt;br /&gt;
Install [https://dejavu-fonts.github.io/ DejaVu] fonts ({{Pkg|font-dejavu}}), which have good [https://home.unicode.org/ Unicode] coverage:&lt;br /&gt;
&lt;br /&gt;
{{cmd|# apk add font-dejavu}}   &lt;br /&gt;
 &lt;br /&gt;
=== Install Sway ===&lt;br /&gt;
&lt;br /&gt;
{{cmd|# apk add sway \&lt;br /&gt;
    xwayland             \ # if you need the xserver&lt;br /&gt;
    foot                 \ # default terminal emulator. Modify $term in config for a different one.&lt;br /&gt;
    wmenu                \ # default Wayland native menu for choosing program and screensharing monitor&lt;br /&gt;
    swaylock swaylockd   \ # lockscreen tool&lt;br /&gt;
    swaybg               \ # display wallpaper&lt;br /&gt;
    grim                 \ # screenshot tool&lt;br /&gt;
    wl-clipboard         \ # clipboard management&lt;br /&gt;
    i3status             \ # simple status bar&lt;br /&gt;
    swayidle               # idle management (DPMS) daemon&lt;br /&gt;
}} &lt;br /&gt;
&lt;br /&gt;
For complimentary software alternatives, see [https://github.com/swaywm/sway/wiki/Useful-add-ons-for-sway Sway&#039;s wiki] or [https://wiki.gentoo.org/wiki/List_of_software_for_Wayland Gentoo&#039;s wiki].&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Sway config file ===&lt;br /&gt;
&lt;br /&gt;
Copy the default Sway configuration file to {{Path|~/.config/sway/config}} so that it can be customized as per each user&#039;s choices:&lt;br /&gt;
&lt;br /&gt;
{{cmd|$ mkdir -p ~/.config/sway&lt;br /&gt;
$ cp /etc/sway/config ~/.config/sway/}}&lt;br /&gt;
&lt;br /&gt;
Read through it to learn the default keybindings. Refer to the [[Sway customization guide|Sway customization guide]] as well as the [[#See also|See also]] section for Tips on customizing this config file. Sway&#039;s configuration is mostly backward compatible with that of [[I3wm|i3]]&#039;s, and if you are looking for a solution for a specific issue, you could try checking whether it hasn&#039;t been provided for the i3 window manager.&lt;br /&gt;
&lt;br /&gt;
For additional information, start at &amp;lt;code&amp;gt;man 5 sway&amp;lt;/code&amp;gt; and read the [https://github.com/swaywm/sway/wiki upstream wiki].&lt;br /&gt;
&lt;br /&gt;
=== PipeWire and Screensharing ===&lt;br /&gt;
&lt;br /&gt;
The Sway compositor has no involvement with audio playback. In order for screensharing to work, [[PipeWire]] is required. Therefore, installing [[PipeWire#Installation|PipeWire]] is recommended for audio playback too. &lt;br /&gt;
&lt;br /&gt;
Since v3.22, Alpine Linux provides the necessary scripts to start PipeWire as a [[OpenRC#user services|user service]] in OpenRC.&lt;br /&gt;
&lt;br /&gt;
From a screensharing perspective, applications are split into two categories:-&lt;br /&gt;
&lt;br /&gt;
* Those which use the native Wayland [https://wayland.app/protocols/wlr-screencopy-unstable-v1 wlr-screencopy] protocol&lt;br /&gt;
* Those which use the API from Flatpak&#039;s &amp;lt;code&amp;gt;xdg-desktop-portal&amp;lt;/code&amp;gt; (this portal is also used by native non-Flatpak applications).&lt;br /&gt;
&lt;br /&gt;
Applications in the first group require no additional setup. Applications in the second group (which include Firefox and Chromium) require setting up &#039;&#039;xdg portals&#039;&#039; in addition to [[PipeWire#Installation|PipeWire]]. &lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add xdg-desktop-portal xdg-desktop-portal-wlr}}&lt;br /&gt;
&lt;br /&gt;
If you are using a &amp;lt;code&amp;gt;dbus-run-session&amp;lt;/code&amp;gt; wrapper to launch Sway, you will also need to set D-Bus variables in order for the portal and for [[#PipeWire and Screensharing|screensharing]] features to work;  add the following line to the beginning of Sway&#039;s {{Path|config}} file:&lt;br /&gt;
&lt;br /&gt;
 exec dbus-update-activation-environment WAYLAND_DISPLAY DISPLAY XDG_CURRENT_DESKTOP SWAYSOCK I3SOCK XCURSOR_SIZE XCURSOR_THEME&lt;br /&gt;
&lt;br /&gt;
The {{ic|XDG_CURRENT_DESKTOP}} environment variable may be set by various methods, including:-&lt;br /&gt;
* by amending its mention in that {{ic|dbus-update-activation-environment}} line, editing it to specify {{ic|XDG_CURRENT_DESKTOP{{=}}sway}} ; or&lt;br /&gt;
* by exporting it from within an applicable environment configuration file, such as:&lt;br /&gt;
&lt;br /&gt;
:{{Cat| $XDG_CONFIG_HOME/.profile|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
export XDG_CURRENT_DESKTOP=sway&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
:However, this method is not universal, as it would require resetting the {{ic|XDG_CURRENT_DESKTOP}} variable for any different desktop/compositor/window manager that may be launched afterwards, possibly by employing a launcher similar to the wrapper script alternative described for &#039;&#039;&#039;Sway&#039;&#039;&#039; [[Sway#Automatically_Launch_Sway_on_tty1|below]];  or&lt;br /&gt;
* by being set automatically by the display manager, as is commonplace, but none is supplied by &#039;&#039;&#039;Sway&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Screen Lock and suspend-to-RAM ===&lt;br /&gt;
&lt;br /&gt;
{{Tip| For a seat manager-agnostic and DE-/WM-agnostic tool, consider installing the {{Pkg|zzz}} utility, available in the [[Repositories#Community|community]] repository, or the {{Pkg|powerctl}} utility from the [[Repositories#Testing|testing]] repository, in order to manage suspend and hibernation.}}&lt;br /&gt;
&lt;br /&gt;
For usage of the &amp;lt;Code&amp;gt;loginctl suspend&amp;lt;/Code&amp;gt; command, see [[Elogind]].&lt;br /&gt;
&lt;br /&gt;
To put the system to sleep after 600 seconds, use:&lt;br /&gt;
&lt;br /&gt;
 exec swayidle -w timeout 600 &#039;doas /usr/bin/powerctl mem&#039;&lt;br /&gt;
&lt;br /&gt;
Do not lock the screen if program is running in full screen:&lt;br /&gt;
&lt;br /&gt;
==== Idle inhibition ====&lt;br /&gt;
&lt;br /&gt;
 for_window [app_id=&amp;quot;^.*&amp;quot;] inhibit_idle fullscreen&lt;br /&gt;
&lt;br /&gt;
{{Todo|The option below, related to &amp;lt;Code&amp;gt;wayland-pipewire-idle-inhibit&amp;lt;/Code&amp;gt;, needs to be tested. If you find the option below to be working, please remove this Todo.}}&lt;br /&gt;
&lt;br /&gt;
If you do not want to lock the screen while media is being played through [[PipeWire]], then install the {{pkg|wayland-pipewire-idle-inhibit}} package, and add the following to Sway&#039;s {{Path|config}} file:&lt;br /&gt;
&lt;br /&gt;
 exec wayland-pipewire-idle-inhibit&lt;br /&gt;
&lt;br /&gt;
Make changes to the {{Path|~/.config/wayland-pipewire-idle-inhibit/config.toml}} configuration file or to whichever configuration file you may have referenced instead through the &amp;lt;Code&amp;gt; --config &amp;lt;PATH&amp;gt;&amp;lt;/Code&amp;gt;, if required, as per the [https://github.com/rafaelrc7/wayland-pipewire-idle-inhibit?tab=readme-ov-file#config project&#039;s website].&lt;br /&gt;
&lt;br /&gt;
=== Elogind and swayidle ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;swayidle&amp;lt;/code&amp;gt; has integration with &amp;lt;code&amp;gt;elogind&amp;lt;/code&amp;gt;, and it can handle &#039;&#039;before-sleep&#039;&#039; events.&lt;br /&gt;
&lt;br /&gt;
If using &amp;lt;code&amp;gt;swayidle before-sleep&amp;lt;/code&amp;gt;, then there will be a race condition, so that when you resume the computer from &#039;&#039;suspend&#039;&#039;, the screen will show the contents of the unlocked screen for a second before showing the actual lock screen.  This can be a privacy concern.&lt;br /&gt;
&lt;br /&gt;
To solve this issue, do the following.&lt;br /&gt;
&lt;br /&gt;
Create the &amp;lt;code&amp;gt;/etc/elogind/system-sleep/10-swaylock.sh&amp;lt;/code&amp;gt; file, and then add the following script to this file:&lt;br /&gt;
{{Cat|/etc/elogind/system-sleep/10-swaylock.sh|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 if [ &amp;quot;${1}&amp;quot; == &amp;quot;pre&amp;quot; ]; then&lt;br /&gt;
   touch /tmp/swaylock-sleep&lt;br /&gt;
   sleep 1&lt;br /&gt;
 fi&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Then set it to executable.&lt;br /&gt;
&lt;br /&gt;
Later, once Sway is installed, add the following line to its {{Path|config}} file:&lt;br /&gt;
&lt;br /&gt;
 exec touch /tmp/swaylock-sleep &amp;amp;&amp;amp; inotifyd swaylock /tmp/swaylock-sleep&lt;br /&gt;
&lt;br /&gt;
With this line, the screen will be promptly locked before &#039;&#039;suspend-to-RAM&#039;&#039; starts.&lt;br /&gt;
&lt;br /&gt;
=== Brightness Control ===&lt;br /&gt;
&lt;br /&gt;
Refer to [[Backlight]] for information on brightness control.&lt;br /&gt;
&lt;br /&gt;
=== Output Scaling for High Resolution Displays ===&lt;br /&gt;
&lt;br /&gt;
Without further configuration, program interfaces may be too small to use on high resolution displays.&lt;br /&gt;
&lt;br /&gt;
Sway supports the per-display configuration of:-&lt;br /&gt;
&lt;br /&gt;
* fractional (e.g. 1.5x);  and&lt;br /&gt;
* integer scaling (e.g. 2x) &lt;br /&gt;
&lt;br /&gt;
However, fractional scaling is discouraged due both to the performance impact and to the blurry output it produces. In this case, where 1x scaling is too small and 2x scaling is too large, program-specific GTK/QT-based toolkit scaling is recommended.  See [[Sway#Toolkit Scaling|See below]].&lt;br /&gt;
&lt;br /&gt;
==== Scaling with wdisplays ====&lt;br /&gt;
&lt;br /&gt;
To enable Sway scaling, the user can first preview different scaling factors with the {{Pkg|wdisplays}} package.  Note the output name (&#039;&#039;eDP-1&#039;&#039;, &#039;&#039;LVDS-1&#039;&#039;) and try apply scaling factors such as 1 and 2.  To make changes permanent, add the following line, completed with your settings, to Sway&#039;s {{Path|config}} file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
output &amp;lt;name&amp;gt; scale &amp;lt;factor&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Toolkit Scaling ====&lt;br /&gt;
&lt;br /&gt;
To use toolkit scaling, say, at x2, add the following, for instance, to your {{Path|~/.profile}}: &lt;br /&gt;
&lt;br /&gt;
 # for GTK-based programs such as firefox and emacs:&lt;br /&gt;
 export GDK_DPI_SCALE{{=}}2&lt;br /&gt;
&lt;br /&gt;
 # for QT-based programs&lt;br /&gt;
 export QT_WAYLAND_FORCE_DPI{{=}}&amp;quot;physical&amp;quot;&lt;br /&gt;
 # or if still too small, use a custom DPI&lt;br /&gt;
 export QT_WAYLAND_FORCE_DPI{{=}}192 # 2x scaling&lt;br /&gt;
 export QT_QPA_PLATFORM{{=}}&amp;quot;wayland-egl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Notification Daemon ===&lt;br /&gt;
&lt;br /&gt;
[[mako]] is a lightweight notification daemon that works seamlessly with Sway. &lt;br /&gt;
&lt;br /&gt;
=== Screenshots ===&lt;br /&gt;
&lt;br /&gt;
A simple tool that works well under Wayland is {{pkg|grimshot}}. Example keybindings:-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bindsym Print exec grimshot copy area&lt;br /&gt;
bindsym Shift+Print exec grimshot copy screen&lt;br /&gt;
bindsym Control+Print exec grimshot save area ~/Pictures/$(date +%d-%m-%Y-%H-%M-%S).png&lt;br /&gt;
bindsym Control+Shift+Print exec grimshot save screen ~/Pictures/$(date +%d-%m-%Y-%H-%M-%S).png&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See Sway&#039;s [https://github.com/swaywm/sway/wiki/Useful-add-ons-for-sway wiki article] for a listing of further screenshot tools.&lt;br /&gt;
&lt;br /&gt;
=== Make Clipboard Content Persistent ===&lt;br /&gt;
&lt;br /&gt;
By default, the clipboard content does not persist after terminating the program: if you copy some text from Firefox and then exit Firefox, then the copied text is also lost.&lt;br /&gt;
&lt;br /&gt;
Install {{Pkg|clipman}} from the community repo, and then add the following to Sway&#039;s {{Path|config}} file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
exec wl-paste --type text/plain --watch clipman store --histpath=&amp;quot;~/.local/state/clipman-primary.json&amp;quot;&lt;br /&gt;
bindsym $mod+h exec clipman pick --tool wofi --histpath=&amp;quot;~/.local/state/clipman-primary.json&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Firefox Picture-in-Picture Mode/Floating Windows ===&lt;br /&gt;
&lt;br /&gt;
Add this to your Sway configuration file (modify the numeric values to suit your needs and your display):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
for_window [app_id=&amp;quot;firefox&amp;quot; title=&amp;quot;^Picture-in-Picture$&amp;quot;] floating enable, move position 877 450, sticky enable, border none&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Start with NumLock Enabled ===&lt;br /&gt;
&lt;br /&gt;
Add the following to your Sway {{Path|config}} file:&lt;br /&gt;
&lt;br /&gt;
 input type:keyboard xkb_numlock enabled&lt;br /&gt;
&lt;br /&gt;
=== Change mouse cursor theme and size ===&lt;br /&gt;
&lt;br /&gt;
Add to your Sway {{Path|config}} file:&lt;br /&gt;
&lt;br /&gt;
 seat seat0 xcursor_theme my_cursor_theme my_cursor_size&lt;br /&gt;
&lt;br /&gt;
For example, set a mouse cursor using the &#039;&#039;&#039;GNOME Adwaita&#039;&#039;&#039; theme:&lt;br /&gt;
&lt;br /&gt;
 seat seat0 xcursor_theme Adwaita 16&lt;br /&gt;
&lt;br /&gt;
You can inspect their values with &amp;lt;code&amp;gt;echo $XCURSOR_SIZE&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;echo $XCURSOR_THEME&amp;lt;/code&amp;gt;. If reloading your configuration does not result in change, try logging out and in.&lt;br /&gt;
&lt;br /&gt;
{{Note|Wayland allows for client-side cursors. It is possible that applications do not evaluate the values of &amp;lt;code&amp;gt;$XCURSOR_SIZE&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;$XCURSOR_THEME&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
&lt;br /&gt;
=== Custom Keyboard Layout ===&lt;br /&gt;
&lt;br /&gt;
To use a custom keyboard layout, just use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
input type:keyboard {&lt;br /&gt;
  xkb_file /path/to/my/custom/layout&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Flatpaks ===&lt;br /&gt;
&lt;br /&gt;
{{main|Flatpak}}&lt;br /&gt;
&lt;br /&gt;
As mentioned in [[Flatpak#Portals|Flatpak]] page, install the minimal required portal related packages i.e {{pkg|xdg-desktop-portal}}, {{pkg|xdg-desktop-portal-gtk}} and {{pkg|xdg-desktop-portal-wlr}}. After installing the packages, add the following to the &#039;&#039;autostart&#039;&#039; section in your Sway {{Path|config}} file to avoid [[Flatpak#GDBus_Error|GDBus errors]]. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
exec /usr/libexec/xdg-desktop-portal&lt;br /&gt;
exec /usr/libexec/xdg-desktop-portal-gtk&lt;br /&gt;
exec /usr/libexec/xdg-desktop-portal-wlr&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These startup instructions are only needed, if these are not started automatically via other means.&lt;br /&gt;
&lt;br /&gt;
== Starting Sway ==&lt;br /&gt;
&lt;br /&gt;
=== Manually Launch Sway ===&lt;br /&gt;
&lt;br /&gt;
You can launch Sway manually by issuing the &amp;lt;Code&amp;gt;sway&amp;lt;/Code&amp;gt; command from a TTY.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ sway}} &lt;br /&gt;
&lt;br /&gt;
{{Tip|When using [[Wayland]], for [[PipeWire]] and screensharing to work in Firefox and Chromium, a [[D-Bus]] is required. In the absence of a [[OpenRC#User_services|user service manager]], consider running &amp;lt;Code&amp;gt;sway&amp;lt;/Code&amp;gt; with &amp;lt;code&amp;gt;dbus-run-session&amp;lt;/code&amp;gt;, a convenient wrapper that will explicitly export the path of the session bus.{{Cmd|$ dbus-run-session sway}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Automatically Launch Sway on tty1 ===&lt;br /&gt;
&lt;br /&gt;
Adding the following lines to {{Path|~/.profile}} or to its equivalent will ensure that &amp;lt;Code&amp;gt;sway&amp;lt;/Code&amp;gt; launches automatically, with a D-Bus, &#039;&#039;only&#039;&#039; from &#039;&#039;tty1&#039;&#039;.  This is handy for troubleshooting, because if the Sway configuration ever falters, one could troubleshoot by logging into a different TTY (&#039;&#039;tty2&#039;&#039;-&#039;&#039;tty6&#039;&#039;), and your startup script then will not attempt to launch the faulty Sway environment from there also. &lt;br /&gt;
{{Cat| ~/.profile|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$(tty)&amp;quot; = &amp;quot;/dev/tty1&amp;quot; ]; then&lt;br /&gt;
     exec dbus-run-session sway &lt;br /&gt;
fi&lt;br /&gt;
...&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
=== Using a Wrapper Script to Launch Sway ===&lt;br /&gt;
&lt;br /&gt;
Instead of using {{Path|~/.profile}} or its equivalent file, a [https://man.sr.ht/~kennylevinsen/greetd/#how-to-set-xdg_session_typewayland wrapper script] can be placed at {{Path|/usr/local/bin/sway-run}}. This script can be used to launch &amp;lt;Code&amp;gt;sway&amp;lt;/Code&amp;gt; from either a TTY or by [[greetd]], a lightweight [[Display manager|display manager]], as follows: {{Cat|/usr/local/bin/sway-run|&amp;lt;nowiki&amp;gt;#!/bin/sh&lt;br /&gt;
# Session&lt;br /&gt;
export XDG_SESSION_TYPE=wayland&lt;br /&gt;
export XDG_SESSION_DESKTOP=sway&lt;br /&gt;
export XDG_CURRENT_DESKTOP=sway&lt;br /&gt;
&lt;br /&gt;
# Wayland stuff&lt;br /&gt;
export MOZ_ENABLE_WAYLAND=1&lt;br /&gt;
export QT_QPA_PLATFORM=wayland&lt;br /&gt;
export SDL_VIDEODRIVER=wayland&lt;br /&gt;
export _JAVA_AWT_WM_NONREPARENTING=1&lt;br /&gt;
&lt;br /&gt;
# Launch Sway with a D-Bus server&lt;br /&gt;
exec dbus-run-session sway &amp;quot;$@&amp;quot; &amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Make the file executable:&lt;br /&gt;
{{Cmd|# chmod +x /usr/local/bin/sway-run}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
If you encounter any issues, try running &amp;lt;Code&amp;gt;sway -Vc /etc/sway/config&amp;lt;/Code&amp;gt;. It will run &amp;lt;Code&amp;gt;sway&amp;lt;/Code&amp;gt; with the default config file and set the output to be more verbose. It is generally a good idea to track your configuration files with &#039;&#039;git&#039;&#039; (if and when you use a remote repository for them, keep it private, for security reasons). &lt;br /&gt;
&lt;br /&gt;
To capture the Sway error log in a file for troubleshooting, replace &amp;lt;code&amp;gt;sway&amp;lt;/code&amp;gt; in your startup file by:&lt;br /&gt;
&lt;br /&gt;
 sway -d 2&amp;gt; ~/sway_error.log&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can also issue the below command from TTY.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ sway -d 2&amp;gt; ~/sway_error.log}} &lt;br /&gt;
&lt;br /&gt;
=== Video Driver Issues === &lt;br /&gt;
&lt;br /&gt;
After installing Sway, and while launching it for the first time, a lack of appropriate [[#Install Graphics Drivers|video drivers]] may cause various error messages such as:&lt;br /&gt;
&lt;br /&gt;
* &amp;quot;unable to create backend&amp;quot;&lt;br /&gt;
* &amp;quot;Failed to create renderer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Install the necessary drivers in order for your [[#Install Graphics Drivers|graphics card]] to work with Sway. &lt;br /&gt;
&lt;br /&gt;
=== XDG_RUNTIME_DIR is not set in the environment. Aborting ===&lt;br /&gt;
&lt;br /&gt;
If [[seatd]] is used instead of [[elogind]], the error message &#039;&#039;&#039;XDG_RUNTIME_DIR is not set in the environment. Aborting&#039;&#039;&#039; might be encountered.&lt;br /&gt;
&lt;br /&gt;
Ensure that the mandatory steps outlined in the [[Seatd]] wiki page are completed in order to set the [[XDG_RUNTIME_DIR]] variable.&lt;br /&gt;
&lt;br /&gt;
=== No backend was able to open a seat ===&lt;br /&gt;
&lt;br /&gt;
If no [[seat manager]] is available, then the error below will appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
[libseat] [libseat/libseat.c:73] libseat_open_seat : No backend was able to open a seat&lt;br /&gt;
[backend/session/libseat.c:102] Unable to create seat : Function not implemented&lt;br /&gt;
[backend/backend.c:303] Failed to open any DRM device&lt;br /&gt;
[sway/server.c:49] Unable to create backend&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ensure that either [[Elogind]] or [[Seatd]] is properly configured and running. &lt;br /&gt;
&lt;br /&gt;
=== Firefox (Flatpak) and/or GTK Apps ===&lt;br /&gt;
&lt;br /&gt;
==== Disappearing Cursor ====&lt;br /&gt;
&lt;br /&gt;
You may need to get an icon pack and possibly a theme from [https://www.pling.com/browse?cat=107&amp;amp;ord=latest Pling store] and set &amp;lt;code&amp;gt;GTK_THEME&amp;lt;/code&amp;gt; environmental variable. Alternatively, one could install an [https://pkgs.alpinelinux.org/packages?name=*-icon-theme&amp;amp;branch=edge&amp;amp;repo=&amp;amp;arch=x86_64&amp;amp;origin=&amp;amp;flagged=&amp;amp;maintainer= icon theme] package for all users.&lt;br /&gt;
&lt;br /&gt;
==== Missing file picker/cannot download ====&lt;br /&gt;
&lt;br /&gt;
Go to &#039;&#039;about:config&#039;&#039; and set &amp;lt;code&amp;gt;widget.use-xdg-desktop-portal.file-picker&amp;lt;/code&amp;gt; to 0.&lt;br /&gt;
&lt;br /&gt;
=== Nvidia Issues ===&lt;br /&gt;
&lt;br /&gt;
{{Draft|This section is partly outdated and could benefit from contributions in view of Nvidia&#039;s [https://docs.nvidia.com/drive/drive-os-5.2.3.0L/drive-os/index.html#page/DRIVE_OS_Linux_SDK_Development_Guide/Windows%20Systems/window_system_wayland.html current support] of Wayland. Help is encouraged.}}&lt;br /&gt;
{{Main|NVIDIA}}&lt;br /&gt;
As of Dec 31 2022, [https://developer.nvidia.com/docs/drive/drive-os/latest/linux/sdk/common/topics/window_system_stub/Gnome-WaylandDesktopShellSupport136.html Nvidia still doesn&#039;t fully support Wayland]. Therefore, the possible solutions are as outlined in the link, or setting your &amp;lt;Code&amp;gt;WLR_BACKENDS&amp;lt;/Code&amp;gt; environmental variables to &amp;lt;code&amp;gt;drm,libinput&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;x11&amp;lt;/code&amp;gt; (add {{Pkg|libinput}} here as well if you cannot use your mouse and keyboard after starting Sway). The latter also works for AMD/ATI cards (&#039;&#039;&#039;make sure to install {{Pkg|libinput}} first&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/swaywm/sway/wiki/ Sway Wiki]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Sway Archwiki]&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/Sway Gentoo Wiki]&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/Sway PostmarketOS Wiki]&lt;br /&gt;
&lt;br /&gt;
[[Category:Compositor]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Wayland&amp;diff=32042</id>
		<title>Wayland</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Wayland&amp;diff=32042"/>
		<updated>2026-02-11T20:33:11Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: /* error: XDG_RUNTIME_DIR is invalid or not set in the environment */ Update link to XDG_RUNTIME_DIR&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://en.wikipedia.org/wiki/Wayland%20(protocol) Wayland] is a new display protocol that aims to replace [[Xorg|X11]]. Wayland requires a [[Seat manager|seat manager]] to work.  &lt;br /&gt;
&lt;br /&gt;
The {{ic|setup-wayland-base}} script installs and enables [[elogind]] as [[Seat manager|seat manager]] besides enabling [[Repositories#Community|community repository]] and [[eudev]].&lt;br /&gt;
&lt;br /&gt;
== Compositors ==&lt;br /&gt;
&lt;br /&gt;
Display servers that implement the Wayland display server protocol are also called Wayland compositors because they additionally perform the task of a compositing window manager. &lt;br /&gt;
&lt;br /&gt;
Multiple compositor implementations exist, including [[Sway]], [https://en.wikipedia.org/wiki/Mutter%20(software) Mutter] ([[GNOME]]&#039;s compositor) and [https://en.wikipedia.org/wiki/KWin Kwin] ([[KDE]]&#039;s compositor). The following [[:Category:Compositor|compositors]] are available in Alpine Linux. &lt;br /&gt;
&lt;br /&gt;
== XWayland ==&lt;br /&gt;
&lt;br /&gt;
XWayland is an X server that can be instructed to run under Wayland so as to enable certain native X11 applications that have not been fully upgraded for Wayland.  However, XWayland is a compatibility layer that is still not sufficiently effective to run native X11 graphical applications that still require running as root without advanced configuration, such as &#039;&#039;&#039;gparted&#039;&#039;&#039;, as XWayland does not have root permissions as per Wayland protocols and for the sake of enhanced security.&lt;br /&gt;
&lt;br /&gt;
Although the X11 protocol design seeks to include flexibility and network transparency, consider that the use of XWayland reintroduces certain [https://biggo.com/news/202511040138_X11-Wayland-Security-Debate X11 design vulnerabilities] into a Wayland session that was originally designed to avoid them, potentially including &#039;&#039;keylogging&#039;&#039; (capturing keystrokes)/taking screenshots/moving/resizing of other windows, although patches are applied where possible.&lt;br /&gt;
&lt;br /&gt;
{{Pkg|xwayland}} is typically bundled with compositors.  To check performance without XWayland, attempt to disable it on the compositor first (this can be achieved, for example, in [[Sway]], by adding the line {{ic|xwayland disable}}, say, near the top of the {{Path|~/.config/sway/config}} file).  If performance for your packages appears satisfactory, the package could be attempted to be removed in various compositors, including &#039;&#039;&#039;Sway&#039;&#039;&#039;, but it is a dependency on others, such as &#039;&#039;&#039;Labwc&#039;&#039;&#039;, &#039;&#039;&#039;river-classic&#039;&#039;&#039;, &#039;&#039;&#039;Cagebreak&#039;&#039;&#039;;   ensure that &#039;&#039;&#039;apk&#039;&#039;&#039; does not indicate that it is a dependency to a given package when removing it:&lt;br /&gt;
{{Cmd|$ doas apk del xwayland}}&lt;br /&gt;
&lt;br /&gt;
== Wayback ==&lt;br /&gt;
{{Main|Wayback}}&lt;br /&gt;
&lt;br /&gt;
Wayback is another X11 compatibility layer, but unlike XWayland, it enables hosting a full X11 desktop environment on Wayland by enabling XWayland to run in rootful mode (future plans include enabling Wayback rootless mode).  This enables [[Xfce]] and [[MATE]] to run fully under Wayland.  However, as of December 2025, Wayback is still in alpha quality and thus not recommended for production.&lt;br /&gt;
&lt;br /&gt;
== XDG_RUNTIME_DIR ==&lt;br /&gt;
&lt;br /&gt;
As per the protocol specifications, Wayland compositors require the &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; variable to be set. When setting paths for {{ic|XDG_RUNTIME_DIR}}, at all times they should follow [https://specifications.freedesktop.org/basedir/latest/#variables &#039;&#039;&#039;XDG specifications&#039;&#039;&#039;]. &lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; MUST be initialised before the Wayland compositor and the D-Bus session instances are started.}}&lt;br /&gt;
&lt;br /&gt;
For techniques on properly initialising this variable, see [[XDG_RUNTIME_DIR]].&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== error: XDG_RUNTIME_DIR is invalid or not set in the environment ===&lt;br /&gt;
&lt;br /&gt;
The above error message appears when starting services/applications that require the environment variable [[XDG_RUNTIME_DIR]] to be set. Fix it using one of the above methods before proceeding.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Kodi]]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Wayland Wayland - Arch Wiki]&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/Wayland Wayland - Gentoo Wiki]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Wayland_(protocol) Wayland (protocol) - Wikipedia]&lt;br /&gt;
&lt;br /&gt;
[[Category:Desktop]]&lt;br /&gt;
[[Category:Wayland]]&lt;br /&gt;
[[Category:Compositor]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=PipeWire&amp;diff=32041</id>
		<title>PipeWire</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=PipeWire&amp;diff=32041"/>
		<updated>2026-02-11T20:32:40Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: /* Prerequisites */ XDG_RUNTIME_DIR&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
[https://pipewire.org/ PipeWire] is a multimedia processing engine that aims to improve audio and video handling on Linux. PipeWire can act as a replacement for both [[PulseAudio]] and [[ALSA]] servers.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* [[XDG_RUNTIME_DIR]] must be set in the running environment.&lt;br /&gt;
* [[D-Bus#D-Bus_session_bus|D-Bus session bus]] must be running.&lt;br /&gt;
* [[Setting_up_a_new_user#Creating_a_new_user|Non-root user accounts]] require appropriate [[Setting_up_a_new_user#Groups_for_desktop_usage|groups for desktop usage]].&lt;br /&gt;
* WirePlumber requires [[eudev]] for ALSA device discovery.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
Install {{Pkg|pipewire}} and {{Pkg|wireplumber}} (session manager).&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add pipewire wireplumber}}&lt;br /&gt;
&lt;br /&gt;
=== Pulseaudio interface ===&lt;br /&gt;
&lt;br /&gt;
The package {{Pkg|pipewire-pulse}} allows pulseaudio applications and [[#GUI_tools|GUI tools]] to use PipeWire as audio server in the backend.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add pipewire-pulse}}&lt;br /&gt;
&lt;br /&gt;
=== JACK compatibility ===&lt;br /&gt;
&lt;br /&gt;
Since PipeWire replaces JACK, Install {{Pkg|pipewire-jack}} package, so it provides ABI-compatible libraries for JACK applications.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add pipewire-jack}}&lt;br /&gt;
&lt;br /&gt;
=== ALSA support ===&lt;br /&gt;
&lt;br /&gt;
Install {{Pkg|pipewire-alsa}} package to provide support for ALSA applications.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add pipewire-alsa}}&lt;br /&gt;
&lt;br /&gt;
=== GUI tools ===&lt;br /&gt;
&lt;br /&gt;
* {{Pkg|pavucontrol}}: simple GUI app for controlling sound, outputs, etc. Consider using {{Pkg|pavucontrol-qt}} when using [[KDE|Plasma]]. &lt;br /&gt;
&lt;br /&gt;
: [[#Pulseaudio_interface|Pulseaudio interface]] is mandatory for {{Ic|pavucontrol}} to work with PipeWire.&lt;br /&gt;
&lt;br /&gt;
* {{Pkg|xfce4-mixer}}: XFCE Audio mixer.&lt;br /&gt;
&lt;br /&gt;
: Currently available in the [[Repositories#Testing|testing]] repository.&lt;br /&gt;
&lt;br /&gt;
* {{Pkg|qpwgraph}}: graph manager dedicated to PipeWire with Qt GUI Interface.&lt;br /&gt;
&lt;br /&gt;
== Launch PipeWire ==&lt;br /&gt;
&lt;br /&gt;
Most [[Desktop_environments_and_Window_managers#Desktop_environments|desktop environments]] launch PipeWire automatically in Alpine Linux upon relogging (i.e. logging out and logging in) after [[#Installation|installing the above packages]]. Proceed with the section below only if PipeWire is [[#Testing|not launched]] after a relogin/reboot.&lt;br /&gt;
&lt;br /&gt;
{{Note|[[#PipeWire_user_service|PipeWire user service]] is the recommended method to launch PipeWire and will replace [[#pipewire-launcher|pipewire-launcher]]. Do &#039;&#039;&#039;NOT&#039;&#039;&#039; use both methods to avoid running multiple instances of PipeWire.}}&lt;br /&gt;
&lt;br /&gt;
=== PipeWire user service ===&lt;br /&gt;
&lt;br /&gt;
Since [[Release_Notes_for_Alpine_3.22.0#OpenRC_User_services|Alpine 3.22]], PipeWire can be launched as a user service.&lt;br /&gt;
&lt;br /&gt;
==== User service prerequisites ====&lt;br /&gt;
&lt;br /&gt;
* Ensure the [[OpenRC#Prerequisites|OpenRC User service Prerequisites]] are met and [[OpenRC#Configure environment variables|environment variables are configured]].&lt;br /&gt;
* PipeWire will fail to start, if [[#Realtime scheduling|realtime scheduling]] is not configured. &lt;br /&gt;
* Issue the command {{ic|$ rc-status -Ur}} to view and verify the current user runlevel as &#039;&#039;&#039;gui&#039;&#039;&#039; and &#039;&#039;&#039;default&#039;&#039;&#039; for Wayland and Xorg respectively.&lt;br /&gt;
&lt;br /&gt;
==== User service management ====&lt;br /&gt;
&lt;br /&gt;
To start the {{Ic|pipewire}} user service and its {{Ic|wireplumber}} session manager:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ rc-service -U pipewire start&lt;br /&gt;
$ rc-service -U wireplumber start}}&lt;br /&gt;
&lt;br /&gt;
To enable the {{Ic|pipewire}} and {{Ic|wireplumber}} user services in [[Wayland]], in [[Xorg]] change {{Ic|gui}} to {{Ic|default}}:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ rc-update -U add pipewire gui&lt;br /&gt;
$ rc-update -U add wireplumber gui}}&lt;br /&gt;
&lt;br /&gt;
The above steps may be repeated for {{Ic|pipewire-pulse}} user service.&lt;br /&gt;
&lt;br /&gt;
{{Note|The {{ic|pipewire-pulse}} user service would be required to enable various functions, including setting audio levels with {{ic|pactl}}, when [[PulseAudio#PulseAudio_Utils|running pulseaudio with pulseaudio-utils]] and to enable associated volume user keys.}}&lt;br /&gt;
&lt;br /&gt;
=== pipewire-launcher ===&lt;br /&gt;
&lt;br /&gt;
{{Note|The {{Ic|pipewire-launcher}} script will be removed in the future to be replaced with the [[#PipeWire_user_service|PipeWire user service]].}}&lt;br /&gt;
&lt;br /&gt;
Launch PipeWire by using the &amp;lt;code&amp;gt;pipewire-launcher&amp;lt;/code&amp;gt; script. You&#039;ll probably get quite a few errors but just ignore them for now.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ /usr/libexec/pipewire-launcher}}&lt;br /&gt;
&lt;br /&gt;
If xinitrc is used, add {{Path|/usr/libexec/pipewire-launcher}} to your {{Path|~/.xinitrc}}.&lt;br /&gt;
&lt;br /&gt;
If you do not use GUI by default, add the following stanza to your shell configuration file:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|export $(dbus-launch) &lt;br /&gt;
/usr/libexec/pipewire-launcher}}&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
PipeWire and WirePlumber store their default configuration in {{Path|/usr/share/pipewire}} and {{Path|/usr/share/wireplumber}} respectively. If you want to edit the configuration, you need to move it to {{Path|/etc}}:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;# cp -a /usr/share/pipewire /etc&lt;br /&gt;
# cp -a /usr/share/wireplumber /etc&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
=== Screen sharing on Wayland ===&lt;br /&gt;
&lt;br /&gt;
Applications which don&#039;t implement native Wayland screensharing rely on [https://github.com/flatpak/xdg-desktop-portal xdg-desktop-portal] plus the correct backend for your compositor. Screen sharing is known to work on:&lt;br /&gt;
* GNOME with &amp;lt;code&amp;gt;xdg-desktop-portal-gtk&amp;lt;/code&amp;gt;&lt;br /&gt;
* KDE Plasma with &amp;lt;code&amp;gt;xdg-desktop-portal-kde&amp;lt;/code&amp;gt; and Firefox&lt;br /&gt;
* Sway with &amp;lt;code&amp;gt;xdg-desktop-portal-wlr&amp;lt;/code&amp;gt; and Firefox, see [[Sway]] for details&lt;br /&gt;
&lt;br /&gt;
=== Bluetooth audio ===&lt;br /&gt;
{{Main|Bluetooth}}&lt;br /&gt;
* Enable PulseAudio support as described above&lt;br /&gt;
* Install bluetooth service packages: &amp;lt;code&amp;gt;bluez bluez-openrc pipewire-spa-bluez&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: install GUI manager for bluetooth &amp;lt;code&amp;gt;blueman&amp;lt;/code&amp;gt;&lt;br /&gt;
* Enable and start bluetooth service: &amp;lt;code&amp;gt;rc-update add bluetooth; rc-service bluetooth start&amp;lt;/code&amp;gt;&lt;br /&gt;
* Restart PipeWire&lt;br /&gt;
* Use commandline program &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; or GUI program &amp;lt;code&amp;gt;blueman-manager&amp;lt;/code&amp;gt; to scan and pair bluetooth audio devices.&lt;br /&gt;
* Use pavucontrol to adjust volume and manually select high definition bluetooth codecs.&lt;br /&gt;
&lt;br /&gt;
=== Video ===&lt;br /&gt;
&lt;br /&gt;
Video should work out-of-the-box with v4l2 devices (e.g. a lot of webcams) and [https://gstreamer.freedesktop.org/ GStreamer] applications.&lt;br /&gt;
&lt;br /&gt;
=== Realtime scheduling ===&lt;br /&gt;
&lt;br /&gt;
Realtime scheduling will increase certain threads priorities to assist with low latency audio processing.  By default, PipeWire tries to enable realtime scheduling with the [https://docs.pipewire.org/page_module_rt.html rt module]. &lt;br /&gt;
&lt;br /&gt;
==== Option1 ====&lt;br /&gt;
&lt;br /&gt;
Since [https://gitlab.freedesktop.org/pipewire/pipewire/-/releases/0.3.66 PipeWire 0.3.66], when you have a [[PAM]] login session, you should add your user to the {{Ic|pipewire}} group.&lt;br /&gt;
&lt;br /&gt;
==== option2 ====&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t have [[PAM]] but [[D-Bus]] is available, the rt module will try to use {{Pkg|rtkit}}; if this is the case, add your user to the {{Ic|rtkit}} group.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The default system wide settings are defined in {{Path|/etc/security/limits.d/25-pw-rlimits.conf}}. You may want to adjust settings for parameters like &amp;lt;var&amp;gt;rt.prio&amp;lt;/var&amp;gt;, if required. Alternatively, it can be set at [https://docs.pipewire.org/page_module_rt.html  user level] within the ceiling set by the system&#039;s rlimits.&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.config/pipewire/pipewire.conf.d/my-rt-args.conf|&amp;lt;nowiki&amp;gt;context.modules = [&lt;br /&gt;
{   name = libpipewire-module-rt&lt;br /&gt;
    args = {&lt;br /&gt;
        #nice.level   = 20&lt;br /&gt;
        #rt.prio      = 88&lt;br /&gt;
    }&lt;br /&gt;
    flags = [ ifexists nofail ]&lt;br /&gt;
}&lt;br /&gt;
]&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
Use the &amp;lt;code&amp;gt;wpctl&amp;lt;/code&amp;gt; utility from {{Pkg|wireplumber}} to test the working of PipeWire:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ wpctl status}}&lt;br /&gt;
&lt;br /&gt;
=== pw-cat playback ===&lt;br /&gt;
&lt;br /&gt;
Test sound is working using an audio file in a format supported by [http://www.mega-nerd.com/libsndfile/ libsndfile]{{insecure url|Server refuses HTTPS connections}} (e.g. flac, opus, ogg, wav). Use &amp;lt;code&amp;gt;pw-cat&amp;lt;/code&amp;gt; utility from {{Pkg|pipewire-tools}}:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ pw-cat -p test.flac&lt;br /&gt;
$ pw-play /usr/share/sounds/alsa/Front_Center.wav&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== pw-cat recording ===&lt;br /&gt;
&lt;br /&gt;
If you have a microphone test audio recording is working.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ pw-cat -r --list-targets&lt;br /&gt;
$ pw-cat -r recording.flac&lt;br /&gt;
(Speak for a while then stop it with Ctrl+c)&lt;br /&gt;
$ pw-cat -p recording.flac&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== PulseAudio ===&lt;br /&gt;
&lt;br /&gt;
Test PulseAudio clients using a media player, as most use PulseAudio.&lt;br /&gt;
&lt;br /&gt;
=== JACK ===&lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;jack_simple_client&amp;lt;/code&amp;gt; from {{Pkg|jack-simple-clients}}:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ jack_simple_client}}&lt;br /&gt;
&lt;br /&gt;
You should hear a sustained beep.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== `wpctl status` shows no targets ===&lt;br /&gt;
&lt;br /&gt;
First, check whether ALSA knows about your sound card using the &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; utility from {{pkg|alsa-utils}} package:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ aplay -l}}&lt;br /&gt;
&lt;br /&gt;
If sound devices are found, the issue is likely with your PipeWire configuration.  Ensure that [[eudev]] is installed, and consider double-checking the instructions above.&lt;br /&gt;
&lt;br /&gt;
If no sound devices are found, your sound card may not be supported in the version of the Linux Kernel you&#039;re running.  You should search online for fixes relating to your current kernel version and the codec of your sound card.  You can find each of these with:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ uname -r&lt;br /&gt;
$ cat /proc/asound/card0/codec* {{!}} grep Codec}}&lt;br /&gt;
&lt;br /&gt;
Modern devices might require {{Pkg|sof-firmware}}, which is the case if you get &amp;lt;code&amp;gt;sof firmware file is missing&amp;lt;/code&amp;gt; errors in dmesg.&lt;br /&gt;
&lt;br /&gt;
=== Error acquiring bus address: Cannot autolaunch D-Bus without X11 $DISPLAY ===&lt;br /&gt;
&lt;br /&gt;
Check and ensure that [[D-Bus#D-Bus session bus|D-Bus session bus]] is started along with your GUI session i.e. you are in a tty.&lt;br /&gt;
&lt;br /&gt;
=== Connection failure: Connection refused ===&lt;br /&gt;
&lt;br /&gt;
When using [[Wayland]], ensure that [[Wayland#XDG_RUNTIME_DIR|XDG_RUNTIME_DIR]] is configured correctly. If this is not set, PipeWire will create a directory in your home folder instead, called {{Path|~/pulse}}, and on attempting to run {{Ic|pavucontrol}} or {{Ic|pactl}}, you will get the following error:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ pactl list&lt;br /&gt;
Connection failure: Connection refused&lt;br /&gt;
pa_context_connect() failed: Connection refused}}&lt;br /&gt;
&lt;br /&gt;
If you are running Alpine 3.22+ and continue to experience this error after verifying that [[Wayland#XDG_RUNTIME_DIR|XDG_RUNTIME_DIR]] is correctly set, ensure that the &amp;lt;code&amp;gt;pipewire-pulse&amp;lt;/code&amp;gt; [[#PipeWire_user_service|user service is running]].&lt;br /&gt;
&lt;br /&gt;
=== Bluetooth connect failed: br-connection-profile-unavailable === &lt;br /&gt;
&lt;br /&gt;
Ensure {{Ic|wireplumber}}, the session manager, is running.&lt;br /&gt;
&lt;br /&gt;
=== Play/Pause buttons not working on bluetooth headphones ===&lt;br /&gt;
&lt;br /&gt;
Check {{Path|/var/log/messages}} for lines similar to:&lt;br /&gt;
&lt;br /&gt;
{{Cat|/var/log/messages|bluetoothd[3463]: profiles/audio/avctp.c:uinput_create() Can&#039;t open input device: No such file or directory (2)&lt;br /&gt;
bluetoothd[3463]: profiles/audio/avctp.c:init_uinput() AVRCP: failed to init uinput for WH-1000XM5}}&lt;br /&gt;
&lt;br /&gt;
Then {{Ic|bluez}} is trying to register the headphones buttons as an input devices, but &amp;lt;code&amp;gt;uinput&amp;lt;/code&amp;gt; is not loaded. Try &amp;lt;code&amp;gt;modprobe uinput&amp;lt;/code&amp;gt;. If this works, see [[Architecture#Loading_of_Kernel_Modules|Loading of Kernel Modules]] for instructions on how to make sure this module is loaded automatically on each startup.&lt;br /&gt;
&lt;br /&gt;
=== RTKit error: org.freedesktop.DBus.Error.ServiceUnknown ===&lt;br /&gt;
&lt;br /&gt;
 mod.rt ../src/modules/module-rt.c:330:translate_error: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown&lt;br /&gt;
 mod.rt ../src/modules/module-rt.c:995:do_rtkit_setup: RTKit does not give us MaxRealtimePriority, using 1&lt;br /&gt;
 mod.rt ../src/modules/module-rt.c:330:translate_error: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown&lt;br /&gt;
 mod.rt ../src/modules/module-rt.c:1000:do_rtkit_setup: RTKit does not give us MinNiceLevel, using 0&lt;br /&gt;
 mod.rt ../src/modules/module-rt.c:330:translate_error: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown&lt;br /&gt;
 mod.rt ../src/modules/module-rt.c:1005:do_rtkit_setup: RTKit does not give us RTTimeUSecMax, using -1&lt;br /&gt;
&lt;br /&gt;
Follow [[#Realtime scheduling|Realtime scheduling]] section to resolve the above error message.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Bluetooth]]&lt;br /&gt;
* Official PipeWire links &lt;br /&gt;
** [https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/home Wiki]&lt;br /&gt;
** [https://docs.pipewire.org Documentation site]&lt;br /&gt;
** [https://gitlab.freedesktop.org/pipewire/pipewire Source repository]&lt;br /&gt;
* [https://wiki.archlinux.org/index.php/PipeWire PipeWire on the ArchWiki]&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/PipeWire PipeWire on the Gentoo Wiki]&lt;br /&gt;
&lt;br /&gt;
[[Category:Sound]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=XDG_RUNTIME_DIR&amp;diff=32040</id>
		<title>XDG RUNTIME DIR</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=XDG_RUNTIME_DIR&amp;diff=32040"/>
		<updated>2026-02-11T20:30:16Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: Typos, wording&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Various daemons and applications depend on &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; being set, including [[Wayland]], [[PipeWire]] and others.&lt;br /&gt;
&lt;br /&gt;
A few mechanisms exist to properly initialise this variable and its corresponding directory, as described below. Only one should be used for a user&#039;s session; configuring multiple of these mechanisms will lead to misbehaviours.&lt;br /&gt;
&lt;br /&gt;
== Initialising via elogind ==&lt;br /&gt;
&lt;br /&gt;
When using [[elogind]] as a seat manager, it exports &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; and other XDG environment variables automatically for each session. No further configuration is required. &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; would be set as {{Path|/run/user/$(id -u)}} by &#039;&#039;&#039;elogind&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Initialising via pam_rundir ==&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jjk-jacky/pam_rundir pam_rundir] is a [[PAM]] module that provides the runtime directory variable. Installing the package {{pkg|pam-rundir}} takes care of dependencies and no further configuration is required. &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; would be set as  {{Path|/run/user/$(id -u)}} by pam_rundir. &lt;br /&gt;
&lt;br /&gt;
== Initialising via mkrundir ==&lt;br /&gt;
&lt;br /&gt;
[https://git.sr.ht/~whynothugo/mkrundir mkrundir] is an executable that can be used to initialise the runtime directory explicitly by each user. To use &amp;lt;code&amp;gt;mkrundir&amp;lt;/Code&amp;gt;, install the package {{pkg|mkrundir}} available in [[Repositories#Testing|testing]] repository. &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; would be set as {{Path|/run/user-$UID}} by mkrundir.  In your shell init script (e.g.: {{Path|~/.profile}} include an entry as follows at the &#039;&#039;&#039;top&#039;&#039;&#039; of the file {{Cat|~/.profile|...&lt;br /&gt;
export XDG_RUNTIME_DIR{{=}}$(mkrundir)&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
As per [https://git.sr.ht/~whynothugo/mkrundir mkrundir] website, this might have issues inside containers, due to privilege escalation.&lt;br /&gt;
&lt;br /&gt;
== Initialising manually in /tmp ==&lt;br /&gt;
&lt;br /&gt;
Generally, care should be taken when configuring the &amp;lt;code&amp;gt;XDG_*&amp;lt;/code&amp;gt; variables manually as this configuration may have errors or conflict with other utilities that do this automatically. Use this only on a system that&#039;s not using [[elogind]] and other solutions outlined above cannot handle this. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; can be initialised manually by adding below snippet to shell init scripts (e.g.: {{Path|~/.profile}}):&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.profile|&amp;lt;nowiki&amp;gt;if test -z &amp;quot;${XDG_RUNTIME_DIR}&amp;quot;; then&lt;br /&gt;
  export XDG_RUNTIME_DIR=/tmp/xdg/&amp;quot;${UID}&amp;quot;-xdg-runtime-dir&lt;br /&gt;
    if ! test -d &amp;quot;${XDG_RUNTIME_DIR}&amp;quot;; then&lt;br /&gt;
      mkdir -p &amp;quot;${XDG_RUNTIME_DIR}&amp;quot;&lt;br /&gt;
      chmod 0700 &amp;quot;${XDG_RUNTIME_DIR}&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
fi &lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Wayland&amp;diff=32039</id>
		<title>Wayland</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Wayland&amp;diff=32039"/>
		<updated>2026-02-11T20:29:42Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: /* XDG_RUNTIME_DIR */ move into standalone article&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://en.wikipedia.org/wiki/Wayland%20(protocol) Wayland] is a new display protocol that aims to replace [[Xorg|X11]]. Wayland requires a [[Seat manager|seat manager]] to work.  &lt;br /&gt;
&lt;br /&gt;
The {{ic|setup-wayland-base}} script installs and enables [[elogind]] as [[Seat manager|seat manager]] besides enabling [[Repositories#Community|community repository]] and [[eudev]].&lt;br /&gt;
&lt;br /&gt;
== Compositors ==&lt;br /&gt;
&lt;br /&gt;
Display servers that implement the Wayland display server protocol are also called Wayland compositors because they additionally perform the task of a compositing window manager. &lt;br /&gt;
&lt;br /&gt;
Multiple compositor implementations exist, including [[Sway]], [https://en.wikipedia.org/wiki/Mutter%20(software) Mutter] ([[GNOME]]&#039;s compositor) and [https://en.wikipedia.org/wiki/KWin Kwin] ([[KDE]]&#039;s compositor). The following [[:Category:Compositor|compositors]] are available in Alpine Linux. &lt;br /&gt;
&lt;br /&gt;
== XWayland ==&lt;br /&gt;
&lt;br /&gt;
XWayland is an X server that can be instructed to run under Wayland so as to enable certain native X11 applications that have not been fully upgraded for Wayland.  However, XWayland is a compatibility layer that is still not sufficiently effective to run native X11 graphical applications that still require running as root without advanced configuration, such as &#039;&#039;&#039;gparted&#039;&#039;&#039;, as XWayland does not have root permissions as per Wayland protocols and for the sake of enhanced security.&lt;br /&gt;
&lt;br /&gt;
Although the X11 protocol design seeks to include flexibility and network transparency, consider that the use of XWayland reintroduces certain [https://biggo.com/news/202511040138_X11-Wayland-Security-Debate X11 design vulnerabilities] into a Wayland session that was originally designed to avoid them, potentially including &#039;&#039;keylogging&#039;&#039; (capturing keystrokes)/taking screenshots/moving/resizing of other windows, although patches are applied where possible.&lt;br /&gt;
&lt;br /&gt;
{{Pkg|xwayland}} is typically bundled with compositors.  To check performance without XWayland, attempt to disable it on the compositor first (this can be achieved, for example, in [[Sway]], by adding the line {{ic|xwayland disable}}, say, near the top of the {{Path|~/.config/sway/config}} file).  If performance for your packages appears satisfactory, the package could be attempted to be removed in various compositors, including &#039;&#039;&#039;Sway&#039;&#039;&#039;, but it is a dependency on others, such as &#039;&#039;&#039;Labwc&#039;&#039;&#039;, &#039;&#039;&#039;river-classic&#039;&#039;&#039;, &#039;&#039;&#039;Cagebreak&#039;&#039;&#039;;   ensure that &#039;&#039;&#039;apk&#039;&#039;&#039; does not indicate that it is a dependency to a given package when removing it:&lt;br /&gt;
{{Cmd|$ doas apk del xwayland}}&lt;br /&gt;
&lt;br /&gt;
== Wayback ==&lt;br /&gt;
{{Main|Wayback}}&lt;br /&gt;
&lt;br /&gt;
Wayback is another X11 compatibility layer, but unlike XWayland, it enables hosting a full X11 desktop environment on Wayland by enabling XWayland to run in rootful mode (future plans include enabling Wayback rootless mode).  This enables [[Xfce]] and [[MATE]] to run fully under Wayland.  However, as of December 2025, Wayback is still in alpha quality and thus not recommended for production.&lt;br /&gt;
&lt;br /&gt;
== XDG_RUNTIME_DIR ==&lt;br /&gt;
&lt;br /&gt;
As per the protocol specifications, Wayland compositors require the &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; variable to be set. When setting paths for {{ic|XDG_RUNTIME_DIR}}, at all times they should follow [https://specifications.freedesktop.org/basedir/latest/#variables &#039;&#039;&#039;XDG specifications&#039;&#039;&#039;]. &lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; MUST be initialised before the Wayland compositor and the D-Bus session instances are started.}}&lt;br /&gt;
&lt;br /&gt;
For techniques on properly initialising this variable, see [[XDG_RUNTIME_DIR]].&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== error: XDG_RUNTIME_DIR is invalid or not set in the environment ===&lt;br /&gt;
&lt;br /&gt;
The above error message appears when starting services/applications that require the environment variable [[#XDG_RUNTIME_DIR|XDG_RUNTIME_DIR]] to be set. Fix it using one of the above methods before proceeding. &lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Kodi]]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Wayland Wayland - Arch Wiki]&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/Wayland Wayland - Gentoo Wiki]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Wayland_(protocol) Wayland (protocol) - Wikipedia]&lt;br /&gt;
&lt;br /&gt;
[[Category:Desktop]]&lt;br /&gt;
[[Category:Wayland]]&lt;br /&gt;
[[Category:Compositor]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=XDG_RUNTIME_DIR&amp;diff=32038</id>
		<title>XDG RUNTIME DIR</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=XDG_RUNTIME_DIR&amp;diff=32038"/>
		<updated>2026-02-11T20:29:32Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: New article (mostly moved over from Wayland).&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Various daemons and applications depend on &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; being set, including [[Wayland]], [[PipeWire] and others.&lt;br /&gt;
&lt;br /&gt;
A few mechanisms exist to initialise this directory, as described below. Only one should be used for a user&#039;s session; configuring multiple of these mechanisms will lead to misbehaviours.&lt;br /&gt;
&lt;br /&gt;
== Initialising via elogind ==&lt;br /&gt;
&lt;br /&gt;
When using [[elogind]] as a seat manager, it exports &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; and other XDG environment variables automatically for each session. No further configuration is required. &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; would be set as {{Path|/run/user/$(id -u)}} by &#039;&#039;&#039;elogind&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Initialising via pam_rundir ==&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jjk-jacky/pam_rundir pam_rundir] is a [[PAM]] module that provides the runtime directory variable. Installing the package {{pkg|pam-rundir}} takes care of dependencies and no further configuration is required. &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; would be set as  {{Path|/run/user/$(id -u)}} by pam_rundir. &lt;br /&gt;
&lt;br /&gt;
== Initialising via mkrundir ==&lt;br /&gt;
&lt;br /&gt;
[https://git.sr.ht/~whynothugo/mkrundir mkrundir] is an executable that can be used to initialise the runtime directory explicitly by each user. To use &amp;lt;code&amp;gt;mkrundir&amp;lt;/Code&amp;gt;, install the package {{pkg|mkrundir}} available in [[Repositories#Testing|testing]] repository. &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; would be set as {{Path|/run/user-$UID}} by mkrundir.  In your shell init script (e.g.: {{Path|~/.profile}} include an entry as follows at the &#039;&#039;&#039;top&#039;&#039;&#039; of the file {{Cat|~/.profile|...&lt;br /&gt;
export XDG_RUNTIME_DIR{{=}}$(mkrundir)&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
As per [https://git.sr.ht/~whynothugo/mkrundir mkrundir] website, this might have issues inside containers, due to privilege escalation.&lt;br /&gt;
&lt;br /&gt;
== Initialising manually in /tmp ==&lt;br /&gt;
&lt;br /&gt;
Generally, care should be taken when configuring the &amp;lt;code&amp;gt;XDG_*&amp;lt;/code&amp;gt; variables manually as this configuration may have errors or conflict with other utilities that do this automatically. Use this only on a system that&#039;s not using [[elogind]] and other solutions outlined above cannot handle this. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; can be initialised manually by adding below snippet to shell init scripts (e.g.: {{Path|~/.profile}}):&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.profile|&amp;lt;nowiki&amp;gt;if test -z &amp;quot;${XDG_RUNTIME_DIR}&amp;quot;; then&lt;br /&gt;
  export XDG_RUNTIME_DIR=/tmp/xdg/&amp;quot;${UID}&amp;quot;-xdg-runtime-dir&lt;br /&gt;
    if ! test -d &amp;quot;${XDG_RUNTIME_DIR}&amp;quot;; then&lt;br /&gt;
      mkdir -p &amp;quot;${XDG_RUNTIME_DIR}&amp;quot;&lt;br /&gt;
      chmod 0700 &amp;quot;${XDG_RUNTIME_DIR}&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
fi &lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Nftables&amp;diff=31995</id>
		<title>Nftables</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Nftables&amp;diff=31995"/>
		<updated>2026-01-28T00:21:29Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: /* See also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:nftables}}The [https://netfilter.org/projects/nftables nftables] project provides userspace tools to control the Linux nftables subsystem.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
To use the {{ic|nft}} command from the {{Pkg|nftables}} package, install it first:{{Cmd|# apk add {{Pkg|nftables}}}}&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
The default {{ic|nftables}}-shipped rules will block all incoming connections. The service that loads the rules from the {{Path|/etc/nftables.d}} folder can be enabled with: {{Cmd|# rc-service nftables start}}&lt;br /&gt;
Make it start on future sessions also:&lt;br /&gt;
{{Cmd|# rc-update add nftables boot}}&lt;br /&gt;
However, there may be further packaged rules shipped with additional installed packages.&lt;br /&gt;
&lt;br /&gt;
=== Packaged rules ===&lt;br /&gt;
&lt;br /&gt;
==== Downloading and enabling rules ====&lt;br /&gt;
&lt;br /&gt;
If there are {{ic|nftables}} rules elsewhere, in the {{Path|/usr/share/nftables.avail}} folder, then they must be enabled:  server software packages that are accompanied by an &amp;lt;code&amp;gt;-nftrules&amp;lt;/code&amp;gt; package, for example, include the typical default rules to expose the server, but the rules are only downloaded and must then be enabled e.g. the {{pkg|openssh-nftrules}} package will only download rules to open the default port(s) used by {{pkg|openssh}}. &lt;br /&gt;
&lt;br /&gt;
{{Tip|On Alpine Linux Edge and from v3.23 onwards, all &amp;lt;code&amp;gt;-nftrules&amp;lt;/code&amp;gt; that are available for your current installation, as well as for any future package to be installed, can be &#039;&#039;downloaded&#039;&#039; by installing {{Pkg|nftables-rulesets}} from the main repo:&lt;br /&gt;
{{Cmd|# apk add nftables-rulesets}}&lt;br /&gt;
}}&lt;br /&gt;
These rules are &#039;&#039;&#039;&#039;&#039;not&#039;&#039;&#039;&#039;&#039; active upon package installation:  they are only downloaded into that {{Path|/usr/share/nftables.avail/}} directory. The user can then enable them, either by:&lt;br /&gt;
* symlinking them individually to {{Path|/etc/nftables.d/}}.  For example, if there is the rule {{Path|/usr/share/nftables.avail/sshd.nft}}, then issue the command below:{{Cmd|# ln -s /usr/share/nftables.avail/sshd.nft /etc/nftables.d/sshd.nft}}  or by&lt;br /&gt;
* adding the configuration line &amp;lt;code&amp;gt;include &amp;quot;/usr/share/nftables.avail/*.nft&amp;quot;&amp;lt;/code&amp;gt; into {{Path|/etc/nftables.nft}}.&lt;br /&gt;
&lt;br /&gt;
==== Reloading rules ====&lt;br /&gt;
&lt;br /&gt;
The new ruleset can then be applied by simply &#039;&#039;reloading&#039;&#039; the service, or by rebooting.  Reloading preserves the connections (the connection-tracking &#039;&#039;&amp;quot;conntrack&amp;quot;&#039;&#039; state), so it is preferable to &#039;&#039;restarting&#039;&#039; the service:&lt;br /&gt;
{{Cmd|# rc-service nftables reload}}&lt;br /&gt;
or, alternatively, load the new ruleset with:&lt;br /&gt;
{{Cmd|# nft -f /etc/nftables.nft}}&lt;br /&gt;
The &#039;&#039;&#039;nftables&#039;&#039;&#039; service is an init script that, when started or reloaded, runs once to load the rules and then exits.  It is not a daemon, so it will not appear afterwards under {{ic|# rc-status}}.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [https://wiki.nftables.org/wiki-nftables/index.php/Main_Page nftables project Wiki]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Nftables ArchWiki - nftables]&lt;br /&gt;
* [[Uncomplicated Firewall]] - Firewall program with higher level abstractions&lt;br /&gt;
* [[Tutorials_and_Howtos#Firewall|Tutorials and Howtos - Firewall]]&lt;br /&gt;
* [[Configure a Wireguard interface (wg)]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Firewall]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Configure_a_Wireguard_interface_(wg)&amp;diff=31994</id>
		<title>Configure a Wireguard interface (wg)</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Configure_a_Wireguard_interface_(wg)&amp;diff=31994"/>
		<updated>2026-01-28T00:20:31Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: Document how to prevent leaks from private networks.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/WireGuard WireGuard] multiple platform vpn solution. WireGuard itself is now integrated into the linux kernel since v5.6. Only the userland configuration tools are required.&lt;br /&gt;
&lt;br /&gt;
== Installation  ==&lt;br /&gt;
&lt;br /&gt;
The most straightforward method to configure WireGuard is to use the tool &amp;lt;code&amp;gt;wg-quick&amp;lt;/code&amp;gt; available in the package {{pkg|wireguard-tools-wg-quick}}. &lt;br /&gt;
&lt;br /&gt;
Install the meta package {{pkg|wireguard-tools}} to install the necessary WireGuard packages  and {{pkg|iptables}} as follows: {{Cmd|# apk add wireguard-tools iptables}}&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Create Server Keys and Interface Config ===&lt;br /&gt;
&lt;br /&gt;
Create a server private and public key: {{Cmd|&amp;lt;nowiki&amp;gt;# wg genkey | tee server.privatekey | wg pubkey &amp;gt; server.publickey&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Then, we create a new config file {{Path|/etc/wireguard/wg0.conf}} using these new keys as follows:{{Cat|/etc/wireguard/wg0.conf|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
[Interface]&lt;br /&gt;
Address = 192.168.2.1/24, fddd::ffff/64&lt;br /&gt;
ListenPort = 45340&lt;br /&gt;
PrivateKey = &amp;lt;server private key value&amp;gt; # the key from the previously generated privatekey file&lt;br /&gt;
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE;iptables -A FORWARD -o %i -j ACCEPT; ip6tables -A FORWARD -i %i -j ACCEPT; ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE;ip6tables -A FORWARD -o %i -j ACCEPT&lt;br /&gt;
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE;iptables -D FORWARD -o %i -j ACCEPT; ip6tables -D FORWARD -i %i -j ACCEPT; ip6tables -t nat -D POSTROUTING -o eth0 -j MASQUERADE;ip6tables -D FORWARD -o %i -j ACCEPT&lt;br /&gt;
 &lt;br /&gt;
[Peer]&lt;br /&gt;
PublicKey = &amp;lt;client public key value&amp;gt; # obtained from client device via wireguard connection setup process&lt;br /&gt;
AllowedIPs = 192.168.2.2/32, fddd::1/128&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
The PostUp and PostDown iptable rules forward traffic from the wg0 subnet (192.168.2.1/24) to the lan subnet on interface eth0. Refer to [https://github.com/pirate/wireguard-docs#user-content-config-reference this WireGuard documentation] for information on adding peers to the config file.&lt;br /&gt;
&lt;br /&gt;
Bring up the new {{ic|wg0}} interface:{{Cmd|# wg-quick up wg0}}&lt;br /&gt;
&lt;br /&gt;
To take it down, we can use &amp;lt;code&amp;gt;wg-quick down wg0&amp;lt;/code&amp;gt; which will clean up the interface and remove the iptables rules.&lt;br /&gt;
&lt;br /&gt;
{{Note|If running in a Docker container, you will need to run with &amp;lt;code&amp;gt;--cap-add{{=}}NET_ADMIN&amp;lt;/code&amp;gt; to modify your interfaces.}}&lt;br /&gt;
&lt;br /&gt;
=== Use with network interfaces ===&lt;br /&gt;
&lt;br /&gt;
To enable connecting with Wireguard on boot, open your {{Path|/etc/network/interfaces}} and add this information after your auto other network interfaces as follows:{{Cat|/etc/network/interfaces|&amp;lt;nowiki&amp;gt;...&lt;br /&gt;
auto wg0&lt;br /&gt;
iface wg0 inet static&lt;br /&gt;
pre-up wg-quick up /etc/wireguard/wg0.conf&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
=== Service configuration ===&lt;br /&gt;
&lt;br /&gt;
Since Alpine 3.20, {{pkg|wireguard-tools-openrc}} package provides an OpenRC initd service file. &lt;br /&gt;
&lt;br /&gt;
To use this, install the package:{{Cmd|# apk add wireguard-tools-openrc }}&lt;br /&gt;
&lt;br /&gt;
To use the WireGuard OpenRC script with {{ic|wg-quick.wg0}}, create a symbolic link to it with the configuration name as follows:{{Cmd|# ln -s /etc/init.d/wg-quick /etc/init.d/wg-quick.wg0}}&lt;br /&gt;
&lt;br /&gt;
Add the {{ic|wg-quick.wg0}} service to the default runlevel:{{Cmd|# rc-update add wg-quick.wg0}}&lt;br /&gt;
To start|stop|restart the [[OpenRC]] service:{{Cmd|# rc-service wg-quick.wg0 start}}&lt;br /&gt;
&lt;br /&gt;
=== Enable IP Forwarding ===&lt;br /&gt;
&lt;br /&gt;
With a NAT destination rule in place on your router, you should be able connect to the wireguard instance and access the host. However, if you intend for peers to be able to access external resources (including the internet), you will need to enable ip forwarding.&lt;br /&gt;
&lt;br /&gt;
Edit the file {{Path|/etc/sysctl.conf}} or a &amp;lt;code&amp;gt;.conf&amp;lt;/code&amp;gt; file under {{Path|/etc/sysctl.d/}} folder add the following line as follows:{{Cat|/etc/sysctl.conf|&lt;br /&gt;
net.ipv4.ip_forward {{=}} 1&lt;br /&gt;
net.ipv6.conf.all.forwarding {{=}} 1&lt;br /&gt;
net.ipv6.conf.default.forwarding {{=}} 1}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Add the sysctl service to run at boot:{{Cmd|# rc-update add sysctl}}&lt;br /&gt;
&lt;br /&gt;
Then either reboot or run {{ic|# sysctl -p /etc/sysctl.conf}} to reload the settings. To ensure forwarding is turned on, run {{ic|# sysctl -a | grep ip_forward}} and ensure &amp;lt;Code&amp;gt;net.ipv4.ip_forward&amp;lt;/code&amp;gt; is set to &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In the file {{Path|/etc/conf.d/iptables}}, Change the setting as follows:{{Cat|/etc/conf.d/iptables|...&lt;br /&gt;
IPFORWARD{{=}}&amp;quot;yes&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
== Running with modloop ==&lt;br /&gt;
&lt;br /&gt;
If you are running [[Diskless Mode]] i.e from a RAM disk, you can&#039;t modify the modloop. &lt;br /&gt;
&lt;br /&gt;
You can get around it by unpacking the modloop, mounting the unpacked modules folder, then installing WireGuard. &lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 apk add squashfs-tools # install squashfs tools to unpack modloop&lt;br /&gt;
 unsquashfs -d /root/squash /lib/modloop-lts # unpack modloop to root dir&lt;br /&gt;
 umount /.modloop # unmount existing modloop&lt;br /&gt;
 mount /root/squash/ /.modloop/ # mount unpacked modloop&lt;br /&gt;
 apk del wireguard-lts # uninstall previous WireGuard install&lt;br /&gt;
 apk add wireguard-lts&lt;br /&gt;
 apk add wireguard-tools&lt;br /&gt;
&lt;br /&gt;
You can repack the squash filesystem or put this script in the /etc/local.d/ path so it runs at boot-up.&lt;br /&gt;
&lt;br /&gt;
== Preventing leaks ==&lt;br /&gt;
&lt;br /&gt;
When using a private network over Wireguard, it may be desirable to prevent traffic from leaking onto other networks with the same range (e.g.: a Wi-Fi network using the same range).&lt;br /&gt;
&lt;br /&gt;
Suppose we are using the network &amp;lt;code&amp;gt;fd00:feed:c0de::&amp;lt;/code&amp;gt; over Wireguard. To prevent leaks using [[nftables]], use the following &amp;lt;code&amp;gt;/etc/nftables.d/private-network.nft&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 #!/usr/sbin/nft -f&lt;br /&gt;
 &lt;br /&gt;
 table inet filter {&lt;br /&gt;
   chain output {&lt;br /&gt;
     type filter hook output priority 0;&lt;br /&gt;
 &lt;br /&gt;
     # Allow traffic to fd00:feed:c0de::1 only via wg0.&lt;br /&gt;
     ip6 daddr fd00:feed:c0de::1 oifname &amp;quot;wg0&amp;quot; accept&lt;br /&gt;
 &lt;br /&gt;
     # Drop all other attempts to reach fd00:feed:c0de::1.&lt;br /&gt;
     ip6 daddr fd00:feed:c0de::1 drop&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/pirate/wireguard-docs WireGuard documentation]&lt;br /&gt;
&lt;br /&gt;
[[Category:Networking]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=How_to_get_regular_stuff_working&amp;diff=31817</id>
		<title>How to get regular stuff working</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=How_to_get_regular_stuff_working&amp;diff=31817"/>
		<updated>2025-12-14T19:55:18Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: /* Core utilities */ s/original/GNU&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Alpine Linux is built around [[Musl]] libc and [[BusyBox]] and software packages are thinned out and split into [[#Subpackages and missing functionality|subpackages]]. This makes it small and very resource efficient. The [[BusyBox#BusyBox applets|utilities in BusyBox]] tend to only implement standard options and lack GNU-specific extensions. This page explains how to get the utilities typically found in GNU/Linux distributions. &lt;br /&gt;
&lt;br /&gt;
== Core utilities ==&lt;br /&gt;
{{Main|GNU core utilities}}&lt;br /&gt;
&lt;br /&gt;
Most of the basic file, shell and text manipulation utilities commonly grouped under [https://en.wikipedia.org/wiki/List_of_GNU_Core_Utilities_commands Core Utilities] are provided by [[BusyBox]]. To replace it with GNU {{pkg|coreutils}} package:{{Cmd|# apk add {{pkg|coreutils}}}}&lt;br /&gt;
&lt;br /&gt;
== Util-linux ==&lt;br /&gt;
&lt;br /&gt;
A set of approximately 100 basic Linux system utilities not included in GNU Core Utilities, such as &amp;lt;code&amp;gt;mount&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;cfdisk&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;more&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;lsblk&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;kill&amp;lt;/code&amp;gt; are maintained under [https://en.wikipedia.org/wiki/Util-linux Util-linux]. The {{pkg|util-linux}} package is split into multiple subpackages, so it is possible to install only some of them individually. To have the complete {{pkg|util-linux}} package:{{Cmd|# apk add {{pkg|util-linux}}}}&lt;br /&gt;
&lt;br /&gt;
The full featured file pager utility &amp;lt;code&amp;gt;less&amp;lt;/code&amp;gt; can be installed from the {{pkg|less}} package.&lt;br /&gt;
&lt;br /&gt;
== Search utilities  ==&lt;br /&gt;
&lt;br /&gt;
Standard search tools &amp;lt;code&amp;gt;xargs&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;find&amp;lt;/code&amp;gt; can be installed by via the {{pkg|findutils}} package as follows:{{Cmd|# apk add {{pkg|findutils}} }}&lt;br /&gt;
&lt;br /&gt;
GNU Grep is also available as the {{pkg|grep}} package.&lt;br /&gt;
&lt;br /&gt;
== Shell management == &lt;br /&gt;
{{Main|Shell management}}&lt;br /&gt;
The default shell used by Alpine Linux is the Busybox variant of the [[Shell_management#Ash_shell|ash shell]]. This is a POSIX compliant shell. All popular shells are available in Alpine Linux and the [[Shell_management#Change_default_shell|default shell can be changed]], if desired.&lt;br /&gt;
&lt;br /&gt;
== Hardware management ==&lt;br /&gt;
&lt;br /&gt;
Install {{pkg|pciutils}} and {{pkg|usbutils}} for identifying and configuring PCI and USB hardware using the full featured version of &amp;lt;code&amp;gt;lspci&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;lsusb&amp;lt;/code&amp;gt; commands respectively. {{Cmd|# apk add {{pkg|pciutils}} {{pkg|usbutils}}}}&lt;br /&gt;
&lt;br /&gt;
The packages {{pkg|hwdata-pci}} and {{pkg|hwdata-usb}} are dependencies for the above utilities and they are installed automatically. These packages can be removed once the hardware configuration has been completed.&lt;br /&gt;
&lt;br /&gt;
== Disk management ==&lt;br /&gt;
{{Main|File management}}&lt;br /&gt;
Managing disks including removable disks is much easier with udisks.{{Cmd|# apk add {{pkg|udisks2}}}} To see the mounted disks:{{Cmd|# udisksctl status}}&lt;br /&gt;
&lt;br /&gt;
== Network management ==&lt;br /&gt;
{{Main|Configure Networking}}&lt;br /&gt;
For network, you may want to install {{pkg|iproute2}}. {{Cmd|# apk add {{pkg|iproute2}}}} &lt;br /&gt;
&lt;br /&gt;
== Subpackages and missing functionality  ==&lt;br /&gt;
&lt;br /&gt;
When a package is installed in Alpine Linux, no assumption is made on what features the user wants, so [[Alpine_Package_Keeper#Subpackages|subpackages]] are not installed by default. The user might get a false impression of missing functionality.&lt;br /&gt;
&lt;br /&gt;
For eg: The {{pkg|networkmanager}} package for [[NetworkManager]], the standard network configuration tool has 20+ subpackages based on features. If the user installs {{pkg|networkmanager}} package or {{pkg|network-manager-applet}} only the NetworkManager utility and the applet will get installed. To manage Wifi networks or to use commands like &amp;lt;Code&amp;gt;nmcli&amp;lt;/Code&amp;gt; and &amp;lt;Code&amp;gt;nmtui&amp;lt;/Code&amp;gt; the user is expected to add the required subpackages {{pkg|networkmanager-wifi}}, {{pkg|networkmanager-cli}} and {{pkg|networkmanager-tui}} respectively. &lt;br /&gt;
&lt;br /&gt;
In other Linux distributions when NetworkManager is installed, all the above features plus bluetooth, adsl, wwan, vpn, l2tp, ppp etc are automatically installed along with their dependencies.&lt;br /&gt;
&lt;br /&gt;
== Development environment ==&lt;br /&gt;
{{Main|Developer_Documentation}}&lt;br /&gt;
Compiling in Alpine Linux may be more challenging because it uses [Musl] instead of glibc. The {{pkg|build-base}} meta package provides regular compiler stuff such as {{pkg|binutils}}, {{pkg|gcc}}, {{pkg|g++}}, {{pkg|make}} etc..&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add {{pkg|build-base}}}}&lt;br /&gt;
&lt;br /&gt;
The {{pkg|alpine-sdk}} meta package is provided to build packages for Alpine Linux.  It includes {{pkg|abuild}}, {{pkg|build-base}}, and {{pkg|git}}.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add {{pkg|alpine-sdk}}}}&lt;br /&gt;
&lt;br /&gt;
To install CMake:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add {{pkg|cmake}} {{pkg|extra-cmake-modules}}}}&lt;br /&gt;
&lt;br /&gt;
{{pkg|ccache}} and a lot other tools are also available in Alpine Linux. &lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[category: System Administration]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=How_to_get_regular_stuff_working&amp;diff=31816</id>
		<title>How to get regular stuff working</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=How_to_get_regular_stuff_working&amp;diff=31816"/>
		<updated>2025-12-14T19:54:35Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: Remove baseless reference&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Alpine Linux is built around [[Musl]] libc and [[BusyBox]] and software packages are thinned out and split into [[#Subpackages and missing functionality|subpackages]]. This makes it small and very resource efficient. The [[BusyBox#BusyBox applets|utilities in BusyBox]] tend to only implement standard options and lack GNU-specific extensions. This page explains how to get the utilities typically found in GNU/Linux distributions. &lt;br /&gt;
&lt;br /&gt;
== Core utilities ==&lt;br /&gt;
{{Main|GNU core utilities}}&lt;br /&gt;
&lt;br /&gt;
Most of the basic file, shell and text manipulation utilities commonly grouped under [https://en.wikipedia.org/wiki/List_of_GNU_Core_Utilities_commands Core Utilities] are provided by [[BusyBox]]. To replace it with original {{pkg|coreutils}} package:{{Cmd|# apk add {{pkg|coreutils}}}}&lt;br /&gt;
&lt;br /&gt;
== Util-linux ==&lt;br /&gt;
&lt;br /&gt;
A set of approximately 100 basic Linux system utilities not included in GNU Core Utilities, such as &amp;lt;code&amp;gt;mount&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;cfdisk&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;more&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;lsblk&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;kill&amp;lt;/code&amp;gt; are maintained under [https://en.wikipedia.org/wiki/Util-linux Util-linux]. The {{pkg|util-linux}} package is split into multiple subpackages, so it is possible to install only some of them individually. To have the complete {{pkg|util-linux}} package:{{Cmd|# apk add {{pkg|util-linux}}}}&lt;br /&gt;
&lt;br /&gt;
The full featured file pager utility &amp;lt;code&amp;gt;less&amp;lt;/code&amp;gt; can be installed from the {{pkg|less}} package.&lt;br /&gt;
&lt;br /&gt;
== Search utilities  ==&lt;br /&gt;
&lt;br /&gt;
Standard search tools &amp;lt;code&amp;gt;xargs&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;find&amp;lt;/code&amp;gt; can be installed by via the {{pkg|findutils}} package as follows:{{Cmd|# apk add {{pkg|findutils}} }}&lt;br /&gt;
&lt;br /&gt;
GNU Grep is also available as the {{pkg|grep}} package.&lt;br /&gt;
&lt;br /&gt;
== Shell management == &lt;br /&gt;
{{Main|Shell management}}&lt;br /&gt;
The default shell used by Alpine Linux is the Busybox variant of the [[Shell_management#Ash_shell|ash shell]]. This is a POSIX compliant shell. All popular shells are available in Alpine Linux and the [[Shell_management#Change_default_shell|default shell can be changed]], if desired.&lt;br /&gt;
&lt;br /&gt;
== Hardware management ==&lt;br /&gt;
&lt;br /&gt;
Install {{pkg|pciutils}} and {{pkg|usbutils}} for identifying and configuring PCI and USB hardware using the full featured version of &amp;lt;code&amp;gt;lspci&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;lsusb&amp;lt;/code&amp;gt; commands respectively. {{Cmd|# apk add {{pkg|pciutils}} {{pkg|usbutils}}}}&lt;br /&gt;
&lt;br /&gt;
The packages {{pkg|hwdata-pci}} and {{pkg|hwdata-usb}} are dependencies for the above utilities and they are installed automatically. These packages can be removed once the hardware configuration has been completed.&lt;br /&gt;
&lt;br /&gt;
== Disk management ==&lt;br /&gt;
{{Main|File management}}&lt;br /&gt;
Managing disks including removable disks is much easier with udisks.{{Cmd|# apk add {{pkg|udisks2}}}} To see the mounted disks:{{Cmd|# udisksctl status}}&lt;br /&gt;
&lt;br /&gt;
== Network management ==&lt;br /&gt;
{{Main|Configure Networking}}&lt;br /&gt;
For network, you may want to install {{pkg|iproute2}}. {{Cmd|# apk add {{pkg|iproute2}}}} &lt;br /&gt;
&lt;br /&gt;
== Subpackages and missing functionality  ==&lt;br /&gt;
&lt;br /&gt;
When a package is installed in Alpine Linux, no assumption is made on what features the user wants, so [[Alpine_Package_Keeper#Subpackages|subpackages]] are not installed by default. The user might get a false impression of missing functionality.&lt;br /&gt;
&lt;br /&gt;
For eg: The {{pkg|networkmanager}} package for [[NetworkManager]], the standard network configuration tool has 20+ subpackages based on features. If the user installs {{pkg|networkmanager}} package or {{pkg|network-manager-applet}} only the NetworkManager utility and the applet will get installed. To manage Wifi networks or to use commands like &amp;lt;Code&amp;gt;nmcli&amp;lt;/Code&amp;gt; and &amp;lt;Code&amp;gt;nmtui&amp;lt;/Code&amp;gt; the user is expected to add the required subpackages {{pkg|networkmanager-wifi}}, {{pkg|networkmanager-cli}} and {{pkg|networkmanager-tui}} respectively. &lt;br /&gt;
&lt;br /&gt;
In other Linux distributions when NetworkManager is installed, all the above features plus bluetooth, adsl, wwan, vpn, l2tp, ppp etc are automatically installed along with their dependencies.&lt;br /&gt;
&lt;br /&gt;
== Development environment ==&lt;br /&gt;
{{Main|Developer_Documentation}}&lt;br /&gt;
Compiling in Alpine Linux may be more challenging because it uses [Musl] instead of glibc. The {{pkg|build-base}} meta package provides regular compiler stuff such as {{pkg|binutils}}, {{pkg|gcc}}, {{pkg|g++}}, {{pkg|make}} etc..&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add {{pkg|build-base}}}}&lt;br /&gt;
&lt;br /&gt;
The {{pkg|alpine-sdk}} meta package is provided to build packages for Alpine Linux.  It includes {{pkg|abuild}}, {{pkg|build-base}}, and {{pkg|git}}.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add {{pkg|alpine-sdk}}}}&lt;br /&gt;
&lt;br /&gt;
To install CMake:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add {{pkg|cmake}} {{pkg|extra-cmake-modules}}}}&lt;br /&gt;
&lt;br /&gt;
{{pkg|ccache}} and a lot other tools are also available in Alpine Linux. &lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[category: System Administration]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Kodi&amp;diff=31806</id>
		<title>Kodi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Kodi&amp;diff=31806"/>
		<updated>2025-12-13T16:39:16Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: Wording&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://kodi.tv/ Kodi] (formerly XBMC) is a software media centre available in the Alpine community repositories.&lt;br /&gt;
&lt;br /&gt;
Kodi can run under [[Xorg]], [[Wayland]] or any other graphical environment.&lt;br /&gt;
&lt;br /&gt;
= kodi-gbm =&lt;br /&gt;
&lt;br /&gt;
{{Pkg|kodi-gbm}} runs without any Xorg or Wayland environment, managing hardware input/output itself. It support HDR, and is most suitable for dedicated devices or sessions.&lt;br /&gt;
&lt;br /&gt;
In order for keyboard input to work, at least one of the following conditions must be met:&lt;br /&gt;
&lt;br /&gt;
* {{Pkg|libudev-zero}} is installed (simplest approach).&lt;br /&gt;
* eudev is running (untested).&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Wayland&amp;diff=31805</id>
		<title>Wayland</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Wayland&amp;diff=31805"/>
		<updated>2025-12-13T16:38:41Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: /* See also */ Backlink to Kodi&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://en.wikipedia.org/wiki/Wayland%20(protocol) Wayland] is a new display protocol that aims to replace [[Xorg|X11]]. Wayland requires a [[Seat manager|seat manager]] to work.  &lt;br /&gt;
&lt;br /&gt;
The {{ic|setup-wayland-base}} script installs and enables [[elogind]] as [[Seat manager|seat manager]] besides enabling [[Repositories#Community|community repository]] and [[eudev]].&lt;br /&gt;
&lt;br /&gt;
== Compositors ==&lt;br /&gt;
&lt;br /&gt;
Display servers that implement the Wayland display server protocol are also called Wayland compositors because they additionally perform the task of a compositing window manager. &lt;br /&gt;
&lt;br /&gt;
Multiple compositor implementations exist, including [[Sway]], [https://en.wikipedia.org/wiki/Mutter%20(software) Mutter] ([[GNOME]]&#039;s compositor) and [https://en.wikipedia.org/wiki/KWin Kwin] ([[KDE]]&#039;s compositor). The following [[:Category:Compositor|compositors]] are available in Alpine Linux. &lt;br /&gt;
&lt;br /&gt;
== XDG_RUNTIME_DIR ==&lt;br /&gt;
&lt;br /&gt;
As per the protocol specifications, Wayland compositors require the &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; variable to be set. When setting paths for {{ic|XDG_RUNTIME_DIR}}, at all times they should follow [https://specifications.freedesktop.org/basedir/latest/#variables &#039;&#039;&#039;XDG specifications&#039;&#039;&#039;]. &lt;br /&gt;
&lt;br /&gt;
{{Note|If &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; variable is set inside startup script/file, it MUST be initialised before the Wayland compositor and the D-Bus session instances are started.}}&lt;br /&gt;
&lt;br /&gt;
=== With elogind ===&lt;br /&gt;
&lt;br /&gt;
When using [[elogind]] as a seat manager, it exports &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; and other XDG environment variables automatically for each session. No further configuration is required. &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; would be set as {{Path|/run/user/$(id -u)}} by &#039;&#039;&#039;elogind&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== With pam_rundir === &lt;br /&gt;
&lt;br /&gt;
[https://github.com/jjk-jacky/pam_rundir pam_rundir] is a [[PAM]] module that provides the runtime directory variable. Installing the package {{pkg|pam-rundir}} takes care of dependencies and no further configuration is required. &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; would be set as  {{Path|/run/user/$(id -u)}} by pam_rundir. &lt;br /&gt;
&lt;br /&gt;
=== With mkrundir ===&lt;br /&gt;
&lt;br /&gt;
[https://git.sr.ht/~whynothugo/mkrundir mkrundir] is an executable that can be used to initialise the runtime directory explicitly by each user. To use &amp;lt;code&amp;gt;mkrundir&amp;lt;/Code&amp;gt;, install the package {{pkg|mkrundir}} available in [[Repositories#Testing|testing]] repository. &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; would be set as {{Path|/run/user-$UID}} by mkrundir.  In your shell init script (e.g.: {{Path|~/.profile}} include an entry as follows at the &#039;&#039;&#039;top&#039;&#039;&#039; of the file {{Cat|~/.profile|...&lt;br /&gt;
export XDG_RUNTIME_DIR{{=}}$(mkrundir)&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
As per [https://git.sr.ht/~whynothugo/mkrundir mkrundir] website, this might have issues inside containers, due to privilege escalation.&lt;br /&gt;
&lt;br /&gt;
=== Creating and exporting XDG_RUNTIME_DIR manually ===&lt;br /&gt;
&lt;br /&gt;
Generally, care should be taken when configuring the &amp;lt;code&amp;gt;XDG_*&amp;lt;/code&amp;gt; variables manually as this configuration may have errors or conflict with other utilities that do this automatically. Use this only on a system that&#039;s not using [[elogind]] and other solutions outlined above cannot handle this. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt; can be initialised manually by adding below snippet to shell init scripts (e.g.: {{Path|~/.profile}}):&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.profile|&amp;lt;nowiki&amp;gt;if [ -z &amp;quot;$XDG_RUNTIME_DIR&amp;quot; ]; then&lt;br /&gt;
	XDG_RUNTIME_DIR=&amp;quot;/run/user/$(id -u)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	mkdir -pm 0700 &amp;quot;$XDG_RUNTIME_DIR&amp;quot;&lt;br /&gt;
	export XDG_RUNTIME_DIR&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== error: XDG_RUNTIME_DIR is invalid or not set in the environment ===&lt;br /&gt;
&lt;br /&gt;
The above error message appears when starting services/applications that require the environment variable [[#XDG_RUNTIME_DIR|XDG_RUNTIME_DIR]] to be set. Fix it using one of the above methods before proceeding. &lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Kodi]]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Wayland Wayland - Arch Wiki]&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/Wayland Wayland - Gentoo Wiki]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Wayland_(protocol) Wayland (protocol) - Wikipedia]&lt;br /&gt;
&lt;br /&gt;
[[Category:Desktop]]&lt;br /&gt;
[[Category:Wayland]]&lt;br /&gt;
[[Category:Compositor]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Xorg&amp;diff=31804</id>
		<title>Xorg</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Xorg&amp;diff=31804"/>
		<updated>2025-12-13T16:38:27Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: /* See also */ Backlink to Kodi&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://www.x.org/wiki/ Xorg] is an open source implementation of the X Window System. It used to be the de-facto standard way to launch graphical applications. [[Wayland]] is its recent alternative. [https://gitlab.freedesktop.org/wayback/wayback Wayback] is a X11 compatibility layer which allows for running full X11 desktop environments using Wayland components.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
Xorg can be installed automatically by running the [[Alpine_setup_scripts#setup-xorg-base|setup-xorg-base]] script as follows:{{Cmd|# setup-xorg-base}}&lt;br /&gt;
&lt;br /&gt;
The above command installs the following packages {{pkg|xorg-server}}, {{pkg|xf86-input-libinput}}, {{pkg|xinit}}, {{pkg|eudev}}, {{pkg|mesa-dri-gallium}} and Sets up [[Include:Setup Device Manager|eudev]]&lt;br /&gt;
&lt;br /&gt;
Install atleast one X11 based [[Desktop environments and Window managers|desktop]] before proceeding further.&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
You may also want per-user configuration. Create the {{Path|~/.xinitrc}} file to start the window manager with &amp;lt;code&amp;gt;startx&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;xinit&amp;lt;/code&amp;gt;. If you installed {{pkg|cwm}} desktop, the {{Path|~/.xinitrc}} file should be as follows:{{Cat|~/.xinitrc|exec cwm}}&lt;br /&gt;
&lt;br /&gt;
If [[D-Bus#Installation|D-Bus]] is installed and enabled along with {{pkg|cwm}} desktop, the {{Path|~/.xinitrc}} file should be as follows:{{Cat|~/.xinitrc|exec dbus-launch --exit-with-session cwm}}&lt;br /&gt;
&lt;br /&gt;
Xorg sessions can be started via [[Display_manager|display manager]] or manually with command: {{Cmd|$ startx }}&lt;br /&gt;
&lt;br /&gt;
== Video drivers ==&lt;br /&gt;
&lt;br /&gt;
Most basic X features should work fine with just using the default [[#Kernel Modesetting|kernel video-modesetting]] drivers. For better performance or in case of errors, install legacy [[Xf86 Video]] drivers or [[Graphics driver|graphics drivers]].&lt;br /&gt;
&lt;br /&gt;
== Input packages ==&lt;br /&gt;
&lt;br /&gt;
You probably at least want {{pkg|xf86-input-libinput}} or {{pkg|xf86-input-evdev}}. The former is for Wayland with wrapper for Xorg and is installed by the [[#Installation|setup-xorg-base]] script. The {{pkg|xf86-input-evdev}} package is Xorg only. &lt;br /&gt;
&lt;br /&gt;
For touchpad tapping support on many laptops:{{Cmd|# apk add xf86-input-synaptics}}&lt;br /&gt;
&lt;br /&gt;
If the &amp;lt;b&amp;gt;Numlock&amp;lt;/b&amp;gt; settings are not working, or getting &amp;lt;b&amp;gt;&#039;setleds not found&#039;&amp;lt;/b&amp;gt; errors: {{cmd|# apk add kbd}}&lt;br /&gt;
&lt;br /&gt;
If some input device is not working at all, the available xf86-input drivers can be listed with: {{cmd|$ apk search xf86-input}}&lt;br /&gt;
&lt;br /&gt;
The following legacy drivers are not packaged at least as of 2/2022: &lt;br /&gt;
* xf86-input-mouse &lt;br /&gt;
* xf86-input-keyboard&lt;br /&gt;
&lt;br /&gt;
== Configure xorg-server (optional) ==&lt;br /&gt;
&lt;br /&gt;
On most systems, xorg should be able to autodetect all devices. However you can still configure xorg-server by hand by launching: {{Cmd|# Xorg -configure}}&lt;br /&gt;
&lt;br /&gt;
This will create a {{Path|/root/xorg.conf.new}} file. You can modify this file to fit your needs.  When finished modifying and testing the above configuration file, move it to {{Path|/etc/X11/xorg.conf}} for normal usage.&lt;br /&gt;
&lt;br /&gt;
== Keyboard Layout (optional) ==&lt;br /&gt;
&lt;br /&gt;
If you use a keyboard layout different than &amp;quot;us&amp;quot;, and you are using a window manager or desktop environment that does not support to configure the keyboard layout itself, then you need to install {{pkg|setxkbmap}} package: {{Cmd|# apk add setxkbmap}}&lt;br /&gt;
&lt;br /&gt;
Then try {{Cmd|# setxkbmap &amp;lt;%a language layout from /usr/share/X11/xkb/rules/xorg.lst%&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
In order to make it persistent add this section to {{Path|/etc/X11/xorg.conf}}:&lt;br /&gt;
{{Cmd|Section &amp;quot;InputClass&amp;quot;&lt;br /&gt;
	Identifier	&amp;quot;Keyboard Default&amp;quot;&lt;br /&gt;
	MatchIsKeyboard	&amp;quot;yes&amp;quot;&lt;br /&gt;
	Option		&amp;quot;XkbLayout&amp;quot; &amp;quot;&amp;lt;%a language layout from /usr/share/X11/xkb/rules/xorg.lst%&amp;gt;&amp;quot;&lt;br /&gt;
EndSection&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Another way to change the keymap when logging into X is to use {{Path|~/.xinitrc}}. The following example loads a British keymap, simply add this line to the beginning of the file as follows :{{Cat|~/.xinitrc|setxkbmap gb &amp;amp;&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [https://www.x.org/wiki/ Xorg Wiki]&lt;br /&gt;
* [[Wayland]]&lt;br /&gt;
* [[Kodi]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[category: Desktop]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Kodi&amp;diff=31803</id>
		<title>Kodi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Kodi&amp;diff=31803"/>
		<updated>2025-12-13T16:38:05Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://kodi.tv/ Kodi] (formerly XBMC) is a software media centre available in the Alpine community repositories.&lt;br /&gt;
&lt;br /&gt;
Kodi can run under [[Xorg]], [[Wayland]] or without a graphical environment.&lt;br /&gt;
&lt;br /&gt;
= kodi-gbm =&lt;br /&gt;
&lt;br /&gt;
{{Pkg|kodi-gbm}} runs without any Xorg or Wayland environment, managing hardware input/output itself. It support HDR, and is most suitable for dedicated devices or sessions.&lt;br /&gt;
&lt;br /&gt;
In order for keyboard input to work, at least one of the following conditions must be met:&lt;br /&gt;
&lt;br /&gt;
* {{Pkg|libudev-zero}} is installed (simplest approach).&lt;br /&gt;
* eudev is running (untested).&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Kodi&amp;diff=31800</id>
		<title>Kodi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Kodi&amp;diff=31800"/>
		<updated>2025-12-13T16:31:32Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: Formatting&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://kodi.tv/ Kodi] (formerly XBMC) is a software media centre available in the Alpine community repositories.&lt;br /&gt;
&lt;br /&gt;
Kodi can run under Xorg, Wayland or without a graphical environment.&lt;br /&gt;
&lt;br /&gt;
= kodi-gbm =&lt;br /&gt;
&lt;br /&gt;
{{Pkg|kodi-gbm}} runs without any Xorg or Wayland environment, managing hardware input/output itself. It support HDR, and is most suitable for dedicated devices or sessions.&lt;br /&gt;
&lt;br /&gt;
In order for keyboard input to work, at least one of the following conditions must be met:&lt;br /&gt;
&lt;br /&gt;
* {{Pkg|libudev-zero}} is installed (simplest approach).&lt;br /&gt;
* eudev is running (untested).&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Kodi&amp;diff=31799</id>
		<title>Kodi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Kodi&amp;diff=31799"/>
		<updated>2025-12-13T16:31:10Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: Initial writeup&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://kodi.tv/ Kodi] (formerly XBMC) is a software media centre available in the Alpine community repositories.&lt;br /&gt;
&lt;br /&gt;
Kodi can run under Xorg, Wayland or without a graphical environment.&lt;br /&gt;
&lt;br /&gt;
# kodi-gbm&lt;br /&gt;
&lt;br /&gt;
{{Pkg|kodi-gbm}} runs without any Xorg or Wayland environment, managing hardware input/output itself. It support HDR, and is most suitable for dedicated devices or sessions.&lt;br /&gt;
&lt;br /&gt;
In order for keyboard input to work, at least one of the following conditions must be met:&lt;br /&gt;
&lt;br /&gt;
- {{Pkg|libudev-zero}} is installed (simplest approach).&lt;br /&gt;
- eudev is running (untested).&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Syslog&amp;diff=31669</id>
		<title>Syslog</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Syslog&amp;diff=31669"/>
		<updated>2025-12-05T23:15:54Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: Move other distributions further down&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Syslog collects log data from multiple programs either to RAM or to a file, and handles log rotation. Alpine installs &amp;lt;code&amp;gt;syslog&amp;lt;/code&amp;gt; as provided by {{pkg|busybox}} per default, but it also packages [https://pkgs.alpinelinux.org/packages?name=*syslog* other implementations], such as {{pkg|rsyslog}}, {{pkg|syslog-ng}}, [https://skarnet.org/software/s6/s6-socklog.html s6-socklog] (from {{pkg|s6}}) and [[logbookd]]. This role is typically fulfilled by &amp;lt;code&amp;gt;journald&amp;lt;/code&amp;gt; on systemd-based systems.&lt;br /&gt;
&lt;br /&gt;
== busybox syslog ==&lt;br /&gt;
=== Running syslogd ===&lt;br /&gt;
Depending on how you have installed Alpine, it is already running (check with &amp;lt;code&amp;gt;ps a | grep syslogd&amp;lt;/code&amp;gt;). Otherwise enable it at boot and start it with the following commands:&lt;br /&gt;
&lt;br /&gt;
{{cmd|&amp;lt;nowiki&amp;gt;# rc-update add syslog boot&lt;br /&gt;
# rc-service syslog start&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
Edit {{path|/etc/conf.d/syslog}} to change the options used when running &amp;lt;code&amp;gt;syslogd&amp;lt;/code&amp;gt;. All available options can be looked up with &amp;lt;code&amp;gt;syslogd --help&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Reading logs ===&lt;br /&gt;
{{cmd|&amp;lt;nowiki&amp;gt;# tail -f /var/log/messages&lt;br /&gt;
Shows all messages and follows the log&lt;br /&gt;
# tail -f /var/log/messages | grep ssh&lt;br /&gt;
Only shows SSH related messages, also follows the log&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;code&amp;gt;-C&amp;lt;/code&amp;gt; is enabled in the configuration:&lt;br /&gt;
{{cmd|&amp;lt;nowiki&amp;gt;# logread -f&lt;br /&gt;
# logread -f | grep ssh&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
== Writing logs ==&lt;br /&gt;
Many applications are able to write to the syslog by default (e.g. &amp;lt;code&amp;gt;sshd&amp;lt;/code&amp;gt;). If you wish to write manually to it, use the &amp;lt;code&amp;gt;logger&amp;lt;/code&amp;gt; program.&lt;br /&gt;
&lt;br /&gt;
{{cmd|$ logger &amp;quot;hello world&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/Logging Gentoo Wiki - Logging]&lt;br /&gt;
&lt;br /&gt;
[[category:System Administration]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Install_Alpine_on_LXC&amp;diff=31256</id>
		<title>Install Alpine on LXC</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Install_Alpine_on_LXC&amp;diff=31256"/>
		<updated>2025-10-20T18:09:57Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: Typo, grammar&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== LXC ==&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/LXC LXC] is an operating-system-level virtualization method for running multiple isolated Linux systems (containers) on a control host using a single Linux kernel.&lt;br /&gt;
&lt;br /&gt;
This article contains instructions for installing Alpine Linux on LXC container. For using LXC on an Alpine host, see [[LXC]].&lt;br /&gt;
&lt;br /&gt;
With LXC you can run Alpine Linux on container and start services in it using native Alpine Linux&#039; init system (openrc).&lt;br /&gt;
&lt;br /&gt;
== Preparation ==&lt;br /&gt;
&lt;br /&gt;
=== LXC installation ===&lt;br /&gt;
You have to install &amp;quot;lxc&amp;quot; package on your host system. For example, in Arch Linux you can install it by running:&lt;br /&gt;
{{Cmd|# pacman -S lxc}}&lt;br /&gt;
&lt;br /&gt;
=== Bridge creation ===&lt;br /&gt;
You also have to create network bridge on your host.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Network_bridge Setting up bridge in Arch Linux or Arch Linux based systems]&lt;br /&gt;
&lt;br /&gt;
[https://help.ubuntu.com/community/NetworkConnectionBridge Setting up bridge in Ubuntu or Ubuntu based systems]&lt;br /&gt;
&lt;br /&gt;
Here is example, how to setup bridge with netctl:&lt;br /&gt;
&lt;br /&gt;
Copy sample file &amp;quot;bridge&amp;quot;&lt;br /&gt;
{{Cmd|# cp /etc/netctl/examples/bridge /etc/netctl/myBridge}}&lt;br /&gt;
&lt;br /&gt;
Modify your bridge configuration file as needed (network interfaces: eno1 and tap0 are, of cource, according to your needs)&lt;br /&gt;
{{cat|/etc/netctl/myBridge|Description{{=}}&amp;quot;Bridge connection&amp;quot;&lt;br /&gt;
Interface{{=}}br0&lt;br /&gt;
Connection{{=}}bridge&lt;br /&gt;
BindsToInterfaces{{=}}(eno1 tap0)&lt;br /&gt;
IP{{=}}dhcp&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Stop active connection&lt;br /&gt;
{{Cmd|# systemctl stop dhcpcd}}&lt;br /&gt;
&lt;br /&gt;
Start your bridge	&lt;br /&gt;
{{Cmd|# netctl start myBridge}}&lt;br /&gt;
&lt;br /&gt;
Perhaps you may wish to setup your system to start your bridge automatically at boot time.&lt;br /&gt;
&lt;br /&gt;
== Container creation ==&lt;br /&gt;
&lt;br /&gt;
To install Alpine Linux edge version run:&lt;br /&gt;
{{Cmd|# lxc-create --name alpine-edge -t alpine -- --release edge}}&lt;br /&gt;
&lt;br /&gt;
You can also configure shared directory which will be accessible from both host and container. In this example we make host&#039;s /media/d directory available in container&lt;br /&gt;
{{Cmd|# mkdir /var/lib/lxc/alpine-edge/rootfs/media/d}}&lt;br /&gt;
&lt;br /&gt;
Add the following lines to the container&#039;s configuration file:&lt;br /&gt;
{{Cat|/var/lib/lxc/alpine-edge/config|...&lt;br /&gt;
lxc.network.type {{=}} veth&lt;br /&gt;
lxc.network.flags {{=}} up&lt;br /&gt;
lxc.network.link {{=}} br0&lt;br /&gt;
lxc.mount.entry{{=}}/media/d media/d none bind 0 0&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Booting container:&lt;br /&gt;
{{cmd|# lxc-start -n alpine-edge}}&lt;br /&gt;
&lt;br /&gt;
Shutting down container:&lt;br /&gt;
{{cmd|# lxc-stop -n alpine-edge}}&lt;br /&gt;
&lt;br /&gt;
Going to Alpine Linux console:&lt;br /&gt;
{{cmd|# lxc-attach -n alpine-edge}}&lt;br /&gt;
&lt;br /&gt;
== Container setup ==&lt;br /&gt;
&lt;br /&gt;
Modify your apk/repositories configuration file. It is recommended to include &amp;quot;main&amp;quot;, &amp;quot;testing&amp;quot; and &amp;quot;community&amp;quot; repositories.&lt;br /&gt;
{{Cat|/etc/apk/repositories|http://dl-cdn.alpinelinux.org/alpine/edge/main&lt;br /&gt;
http://dl-cdn.alpinelinux.org/alpine/edge/testing&lt;br /&gt;
http://dl-cdn.alpinelinux.org/alpine/edge/community&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Upgrading your Alpine Linux system:&lt;br /&gt;
{{cmd|# apk update &amp;amp;&amp;amp; apk upgrade -a}}&lt;br /&gt;
&lt;br /&gt;
Starting services:&lt;br /&gt;
{{Cmd|# /etc/init.d/service_name start}}&lt;br /&gt;
or&lt;br /&gt;
{{Cmd|# rc-service service_name start}}&lt;br /&gt;
&lt;br /&gt;
Adding services to autostart&lt;br /&gt;
{{Cmd|# rc-update add service_name}}&lt;br /&gt;
&lt;br /&gt;
Restarting your container:&lt;br /&gt;
{{Cmd|reboot}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Virtualization]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Install_Alpine_on_LXC&amp;diff=31255</id>
		<title>Install Alpine on LXC</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Install_Alpine_on_LXC&amp;diff=31255"/>
		<updated>2025-10-20T18:09:35Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: Link to LXC&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== LXC ==&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/LXC LXC] is an operating-system-level virtualization method for running multiple isolated Linux systems (containers) on a control host using a single Linux kernel.&lt;br /&gt;
&lt;br /&gt;
This article contains instruction to install Alpine Linux on LXC container. For using LXC on an Alpine host, see [[LXC]].&lt;br /&gt;
&lt;br /&gt;
With LXC you can run Alpine Linux on container and start services in it using native Alpine Linux&#039; init system (openrc).&lt;br /&gt;
&lt;br /&gt;
== Preparation ==&lt;br /&gt;
&lt;br /&gt;
=== LXC installation ===&lt;br /&gt;
You have to install &amp;quot;lxc&amp;quot; package on your host system. For example, in Arch Linux you can install it by running:&lt;br /&gt;
{{Cmd|# pacman -S lxc}}&lt;br /&gt;
&lt;br /&gt;
=== Bridge creation ===&lt;br /&gt;
You also have to create network bridge on your host.&lt;br /&gt;
&lt;br /&gt;
[https://wiki.archlinux.org/index.php/Network_bridge Setting up bridge in Arch Linux or Arch Linux based systems]&lt;br /&gt;
&lt;br /&gt;
[https://help.ubuntu.com/community/NetworkConnectionBridge Setting up bridge in Ubuntu or Ubuntu based systems]&lt;br /&gt;
&lt;br /&gt;
Here is example, how to setup bridge with netctl:&lt;br /&gt;
&lt;br /&gt;
Copy sample file &amp;quot;bridge&amp;quot;&lt;br /&gt;
{{Cmd|# cp /etc/netctl/examples/bridge /etc/netctl/myBridge}}&lt;br /&gt;
&lt;br /&gt;
Modify your bridge configuration file as needed (network interfaces: eno1 and tap0 are, of cource, according to your needs)&lt;br /&gt;
{{cat|/etc/netctl/myBridge|Description{{=}}&amp;quot;Bridge connection&amp;quot;&lt;br /&gt;
Interface{{=}}br0&lt;br /&gt;
Connection{{=}}bridge&lt;br /&gt;
BindsToInterfaces{{=}}(eno1 tap0)&lt;br /&gt;
IP{{=}}dhcp&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Stop active connection&lt;br /&gt;
{{Cmd|# systemctl stop dhcpcd}}&lt;br /&gt;
&lt;br /&gt;
Start your bridge	&lt;br /&gt;
{{Cmd|# netctl start myBridge}}&lt;br /&gt;
&lt;br /&gt;
Perhaps you may wish to setup your system to start your bridge automatically at boot time.&lt;br /&gt;
&lt;br /&gt;
== Container creation ==&lt;br /&gt;
&lt;br /&gt;
To install Alpine Linux edge version run:&lt;br /&gt;
{{Cmd|# lxc-create --name alpine-edge -t alpine -- --release edge}}&lt;br /&gt;
&lt;br /&gt;
You can also configure shared directory which will be accessible from both host and container. In this example we make host&#039;s /media/d directory available in container&lt;br /&gt;
{{Cmd|# mkdir /var/lib/lxc/alpine-edge/rootfs/media/d}}&lt;br /&gt;
&lt;br /&gt;
Add the following lines to the container&#039;s configuration file:&lt;br /&gt;
{{Cat|/var/lib/lxc/alpine-edge/config|...&lt;br /&gt;
lxc.network.type {{=}} veth&lt;br /&gt;
lxc.network.flags {{=}} up&lt;br /&gt;
lxc.network.link {{=}} br0&lt;br /&gt;
lxc.mount.entry{{=}}/media/d media/d none bind 0 0&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Booting container:&lt;br /&gt;
{{cmd|# lxc-start -n alpine-edge}}&lt;br /&gt;
&lt;br /&gt;
Shutting down container:&lt;br /&gt;
{{cmd|# lxc-stop -n alpine-edge}}&lt;br /&gt;
&lt;br /&gt;
Going to Alpine Linux console:&lt;br /&gt;
{{cmd|# lxc-attach -n alpine-edge}}&lt;br /&gt;
&lt;br /&gt;
== Container setup ==&lt;br /&gt;
&lt;br /&gt;
Modify your apk/repositories configuration file. It is recommended to include &amp;quot;main&amp;quot;, &amp;quot;testing&amp;quot; and &amp;quot;community&amp;quot; repositories.&lt;br /&gt;
{{Cat|/etc/apk/repositories|http://dl-cdn.alpinelinux.org/alpine/edge/main&lt;br /&gt;
http://dl-cdn.alpinelinux.org/alpine/edge/testing&lt;br /&gt;
http://dl-cdn.alpinelinux.org/alpine/edge/community&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Upgrading your Alpine Linux system:&lt;br /&gt;
{{cmd|# apk update &amp;amp;&amp;amp; apk upgrade -a}}&lt;br /&gt;
&lt;br /&gt;
Starting services:&lt;br /&gt;
{{Cmd|# /etc/init.d/service_name start}}&lt;br /&gt;
or&lt;br /&gt;
{{Cmd|# rc-service service_name start}}&lt;br /&gt;
&lt;br /&gt;
Adding services to autostart&lt;br /&gt;
{{Cmd|# rc-update add service_name}}&lt;br /&gt;
&lt;br /&gt;
Restarting your container:&lt;br /&gt;
{{Cmd|reboot}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Virtualization]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Sway&amp;diff=31232</id>
		<title>Sway</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Sway&amp;diff=31232"/>
		<updated>2025-10-14T22:09:00Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: /* Screen Lock and suspend-to-RAM */ Remove elogind instructions; link to dedicated page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://swaywm.org Sway] is a tiling [[Wayland]] compositor and a drop-in replacement for the [[i3wm |i3 window manager]]. It works with your existing i3 configuration and supports most of i3&#039;s features, plus a few extras.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* Internet [[Configure_Networking#Connectivity_testing|connectivity]], unless the packages have been pre-fetched into a local cache.&lt;br /&gt;
* Install appropriate [[Graphics driver]] drivers for your hardware. Without graphics drivers [[#Video Driver Issues|errors]] are likely to occur.&lt;br /&gt;
* A [[Setting_up_a_new_user#Creating_a_new_user|non-root user account]].&lt;br /&gt;
* The [[Repositories#Managing_repositories|community repositories must be enabled]].&lt;br /&gt;
* Set up [[eudev]].&lt;br /&gt;
* Wayland compositors need raw access to input and output devices, typically mediated by a [[seat manager]]. Either [[seatd]] or [[elogind]] work fine, but installing both leads to conflicts.&lt;br /&gt;
{{Tip|Except for the first two [[#Prerequisites|prerequisites]], all of the others are automatically handled if the desktop is [[#Setup-desktop|installed using the following setup-desktop]] script.}}&lt;br /&gt;
&lt;br /&gt;
== Setup-desktop ==&lt;br /&gt;
&lt;br /&gt;
The [[setup-desktop]] command automates the Sway desktop installation with [[eudev]] and [[elogind]]. &lt;br /&gt;
&lt;br /&gt;
{{cmd|# setup-desktop sway}}   &lt;br /&gt;
&lt;br /&gt;
Proceed to the [[Sway#Starting Sway|Starting Sway]] section, as no [[Display manager|display manager]] is being installed nor configured by the script that would boot into a graphical login screen.&lt;br /&gt;
&lt;br /&gt;
== Manual Installation ==&lt;br /&gt;
&lt;br /&gt;
The installation steps below allow you to pick and choose various components for your Sway desktop.&lt;br /&gt;
&lt;br /&gt;
=== Install Fonts ===&lt;br /&gt;
&lt;br /&gt;
Install [https://dejavu-fonts.github.io/ DejaVu] fonts ({{Pkg|font-dejavu}}), which have good [https://home.unicode.org/ Unicode] coverage:&lt;br /&gt;
&lt;br /&gt;
{{cmd|# apk add font-dejavu}}   &lt;br /&gt;
 &lt;br /&gt;
=== Install Sway ===&lt;br /&gt;
&lt;br /&gt;
{{cmd|# apk add sway \&lt;br /&gt;
    xwayland             \ # if you need the xserver&lt;br /&gt;
    foot                 \ # default terminal emulator. Modify $term in config for a different one.&lt;br /&gt;
    wmenu                \ # default Wayland native menu for choosing program and screensharing monitor&lt;br /&gt;
    swaylock swaylockd   \ # lockscreen tool&lt;br /&gt;
    swaybg               \ # display wallpaper&lt;br /&gt;
    grim                 \ # screenshot tool&lt;br /&gt;
    wl-clipboard         \ # clipboard management&lt;br /&gt;
    i3status             \ # simple status bar&lt;br /&gt;
    swayidle               # idle management (DPMS) daemon&lt;br /&gt;
}} &lt;br /&gt;
&lt;br /&gt;
For complimentary software alternatives, see [https://github.com/swaywm/sway/wiki/Useful-add-ons-for-sway Sway&#039;s wiki] or [https://wiki.gentoo.org/wiki/List_of_software_for_Wayland Gentoo&#039;s wiki].&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
===Sway config File ===&lt;br /&gt;
&lt;br /&gt;
Copy the default Sway configuration file to {{Path|~/.config/sway/config}} so that it can be customized as per each user&#039;s choices:&lt;br /&gt;
&lt;br /&gt;
{{cmd|$ mkdir -p ~/.config/sway&lt;br /&gt;
$ cp /etc/sway/config ~/.config/sway/}}&lt;br /&gt;
&lt;br /&gt;
Read through it to learn the default keybindings.&lt;br /&gt;
Sway&#039;s configuration is mostly backward compatible with that of [[I3wm|i3]]&#039;s, and if you are looking for a solution for a specific issue, you could try checking whether it hasn&#039;t been provided for the i3 window manager.&lt;br /&gt;
&lt;br /&gt;
====Quickstart - config File====&lt;br /&gt;
To set up an environment that launches applications full-sized and to {{Key|Alt}}+{{Key|Tab}} between these much as in [[Xfce|XFCE]] or in various other desktop environments, then a quick setup of the {{Path|config}} file could effect this.  This proposed setup may be of benefit for both desktop/non-technical and technical use. &#039;&#039;Step 4&#039;&#039; is indicated to be sidestepped by those electing an {{Pkg|i3}}-style, tiled default layout.&lt;br /&gt;
&lt;br /&gt;
A launchbar is not set up &amp;quot;out of the box&amp;quot;, nor here, so this section only reviews essential &#039;&#039;keybindings&#039;&#039; (or &amp;quot;shortcuts&amp;quot;), saving first-time users from immediately requiring to digest a longer &#039;&#039;&amp;quot;cheatsheet&amp;quot;&#039;&#039; of keybindings that might include resizing, moving and swapping windows (called &#039;&#039;&amp;quot;views&amp;quot;&#039;&#039;), say, from smaller tiles (called &#039;&#039;&amp;quot;containers&amp;quot;&#039;&#039;) into larger tiles;  these may be learned at a later stage.&lt;br /&gt;
&lt;br /&gt;
The quickstart configuration of the {{Path|config}} file &#039;&#039;may be prepared within or without &#039;&#039;&#039;Sway&#039;&#039;&#039;&#039;&#039; e.g. within an &#039;&#039;&#039;Xorg&#039;&#039;&#039; session or another compositor, or on another installation, before eventually copying over the finished {{Path|config}} file onto the target system – except:&lt;br /&gt;
* If one prefers alternative applications to those proposed initially in &#039;&#039;Step 6&#039;&#039; for assignment into specific workspaces.  Any such modifications (to be executed in &#039;&#039;Step 7&#039;&#039;) could be performed:  (a) simply during one&#039;s first &#039;&#039;&#039;Sway&#039;&#039;&#039; session; or (b) by determining what those applications&#039; {{ic|app_id}} / {{ic|class}} are (as detailed in &#039;&#039;Step 7&#039;&#039;), possibly in another &#039;&#039;&#039;Wayland&#039;&#039;&#039; session or externally e.g. from documentation. &lt;br /&gt;
* One will likewise require to verify at some point whether one&#039;s chosen applications are installed on the target system;  and to install those missing (last step, &#039;&#039;Step 12&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Step 1:&#039;&#039;  Assign the main modifier key&#039;&#039;&#039;.  In a text editor, open the {{Path|/home/&amp;lt;var&amp;gt;username&amp;lt;/var&amp;gt;/.config/sway/config}} file that had been copied over.  We will declare what would be the main modifier key for many of our keybindings:  {{Key|Window}}, {{Key|Alt}} or otherwise.  The {{Path|config}} file has already set the main modifier, called the {{ic|$mod}} key, to default as the {{ic|Mod4}} key, also known as the {{Key|Window}}, {{ic|Super}} or &#039;&#039;Logo&#039;&#039; key.  Verify this towards the beginning of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
# Logo key. Use Mod1 for Alt.&lt;br /&gt;
set $mod Mod4&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As proposed there, one could change that {{ic|$mod}} key to be the {{Key|Alt}} key a.k.a. the {{ic|Mod1}} key.  To change the {{ic|$mod}} key assignment, as with any line in this file, one could edit/delete the lines or comment such line out i.e. add a hashtag (&#039;&#039;&#039;&#039;&#039;#&#039;&#039;&#039;&#039;&#039;) at the start of any line that does not begin with a hashtag, so that such line would not be executed by &#039;&#039;&#039;Sway&#039;&#039;&#039; but would be left there for reference;  and then enter the customised version of that line below it.  Note that &#039;&#039;&#039;Sway&#039;&#039;&#039; [https://github.com/swaywm/sway/wiki#comments does not support] comments at the end of an executable line, following a hashtag.  &lt;br /&gt;
&lt;br /&gt;
According to the {{ic|man 5 sway}} page, &#039;&#039;XKB modifier names&#039;&#039; can be used to refer to modifier keys, plus certain aliases found among the following list, all of these &amp;quot;{{ic|codes}}&amp;quot; being acceptable for use throughout the configuration file:&lt;br /&gt;
&lt;br /&gt;
* {{ic|Mod1}} - {{Key|Alt}} - Alternatively expressed as {{ic|Alt}};&lt;br /&gt;
* {{ic|Mod2}} - Although not universally mapped, here it refers to the {{Key|Num Lock}} key;  &lt;br /&gt;
* {{ic|Mod3}} - It could be programmed, as an XKB modifier key;&lt;br /&gt;
* {{ic|Mod4}} - Alternatively expressed as the {{ic|Super}} key, a.k.a. the {{Key|Window}} or &#039;&#039;Logo&#039;&#039; key;&lt;br /&gt;
* {{ic|Mod5}} - {{Key|AltGr}};&lt;br /&gt;
* {{ic|Lock}} - {{Key|Caps Lock}};&lt;br /&gt;
* {{ic|Control}} - {{Key|Ctrl}} - Alternatively expressed as {{ic|Ctrl}};  and&lt;br /&gt;
* {{ic|Shift}} - {{Key|Shift}}.&lt;br /&gt;
&lt;br /&gt;
It might be best not to use the {{Key|Ctrl}} key as the &#039;&#039;main modifier&#039;&#039;, as it is often used in applications e.g. {{Key|Control}}+{{Key|c}} to &#039;&#039;copy&#039;&#039;, {{Key|Control}}+{{Key|b}} for &#039;&#039;bold&#039;&#039;, etc.  Similarly when considering the {{ic|Shift}} as main modifier.&lt;br /&gt;
&lt;br /&gt;
So, if one were to choose, say, the {{Key|Alt}} key as the main modifier, that {{ic|Mod4}} line could be changed to: {{ic|set $mod Alt}} or {{ic|set $mod Mod1}}.  We will preserve the default, {{ic|Mod4}} ({{Key|Window}}), as the main modifier.  Note that any modification will not be manifested until one chooses at any time to reload the {{Path|config}} file by hitting {{ic|$mod+Shift+c}} (cf. &#039;&#039;Step 10&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Step 2:&#039;&#039; Declare what your default terminal and menu launcher will be&#039;&#039;&#039;.  In this {{Path|config}} file, these are currently configured to be the {{Pkg|foot}} terminal;  and {{Pkg|wmenu}}, which supplies the {{ic|wmenu-run}} command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
# Your preferred terminal emulator&lt;br /&gt;
set $term foot&lt;br /&gt;
# Your preferred application launcher&lt;br /&gt;
set $menu wmenu-run&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could leave these &#039;as is&#039; if you are happy with these selections.  Otherwise, substitute any of them. &lt;br /&gt;
&lt;br /&gt;
A word to the wise regarding one&#039;s initial choice of &#039;&#039;terminal&#039;&#039; &#039;&#039;if not currently running &#039;&#039;&#039;Sway&#039;&#039;&#039;&#039;&#039;:   if a different terminal were to be chosen, then one would not be able to {{Key|Alt}}+{{Key|Tab}} back and forth from a launched &#039;&#039;&#039;foot&#039;&#039;&#039; terminal into other opened workspaces unless that terminal&#039;s {{ic|app_id}} / {{ic|class}} could somehow be determined and specified by the user in &#039;&#039;Step 7&#039;&#039;.  It may be more suitable therefore to leave &#039;&#039;&#039;foot&#039;&#039;&#039; as the default terminal until one of these could be determined once a &#039;&#039;&#039;Sway&#039;&#039;&#039; session is run, so that the terminal (&#039;&#039;&#039;foot&#039;&#039;&#039;) would land in a specified workspace when launched, and then easily {{Key|Alt}}+{{Key|Tab}} to and from it.  Alternatively, one could left-click on the chosen terminal&#039;s workspace button on the top {{Pkg|swaybar}} in order to switch to that workspace.  (Note also that &#039;&#039;&#039;foot&#039;&#039;&#039; would already be installed if &#039;&#039;&#039;Sway&#039;&#039;&#039; had been installed using {{ic|$ doas setup-desktop sway}}).  On the other hand, &#039;&#039;if one is currently running &#039;&#039;&#039;Sway&#039;&#039;&#039;&#039;&#039;, then it is straightforward to change this default terminal choice here, if so wished; a tweak for the preferred terminal could be made in &#039;&#039;Step 7&#039;&#039;.  &lt;br /&gt;
&lt;br /&gt;
One&#039;s choice of menu launcher here is more flexible, regardless of the compositor/window manager currently being used, as the launcher will appear in any workspace currently displayed on-screen – a.k.a. the workspace &#039;&#039;in focus&#039;&#039; – using the keybinding declared in the following step (&#039;&#039;Step 3&#039;&#039;).  Insert the preferred launcher&#039;s launch command here. For example, one may prefer {{Pkg|rofi}} over &#039;&#039;&#039;wmenu&#039;&#039;&#039;;  Alpine Linux&#039;s &#039;&#039;&#039;rofi&#039;&#039;&#039; port now supports &#039;&#039;&#039;Wayland&#039;&#039;&#039;, just as [https://github.com/davatorium/rofi rofi&#039;s mainline version] officially has since 2025.  If so, that {{ic|set $menu wmenu-run}} line could be changed as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
set $menu &#039;/usr/bin/rofi -combi-modi run,drun,window,filebrowser -show combi -sort&#039;&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that menu instruction, whenever &#039;&#039;&#039;rofi&#039;&#039;&#039; is launched using the keybinding reviewed in the next step, it would first offer a &#039;&#039;combi&#039;&#039; (combination) menu of all packages and of &amp;lt;code&amp;gt;.desktop&amp;lt;/code&amp;gt; files that match the the command name while it is being typed in;  alternatively, one could follows this on by hitting {{Key|Control}}+{{Key|Tab}}, which in turn would offer (a) a &#039;&#039;drun&#039;&#039; menu (a launcher strictly of &amp;lt;code&amp;gt;.desktop&amp;lt;/code&amp;gt; files);  (b) a listing of opened &#039;&#039;&amp;quot;window&amp;quot;&#039;&#039;/view selections; or (c) a simple &#039;&#039;filebrowser&#039;&#039;, etc.&lt;br /&gt;
&lt;br /&gt;
A tally of the chosen packages is being kept for any required installation later.  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Step 3:&#039;&#039; Choose key combinations to open the terminal and launcher and others&#039;&#039;&#039;.  From the configuration file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
bindsym $mod+Return exec $term&lt;br /&gt;
[...]&lt;br /&gt;
bindsym $mod+d exec $menu&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Modify these keybindings if so wished, which refer to the terminal and application launcher chosen in &#039;&#039;Step 2&#039;&#039;.  Ensure that any different chosen key combination(s) has/have not already been assigned elsewhere in this {{Path|config}} file.  Make note of your chosen terminal and menu keybindings so as to know how to launch them later.  As it stands:&lt;br /&gt;
* {{Key|Window}}+{{Key|Return}} for your terminal;  &lt;br /&gt;
* {{Key|Window}}+{{Key|m}} for your menu launcher;   &lt;br /&gt;
Substitute the {{Key|Window}} key for your assigned {{ic|$mod}} key, or with any other chosen combination that has not been used elsewhere in the configuration file.  &lt;br /&gt;
&lt;br /&gt;
Keybindings may also be made without requiring to define applications as variables that use the {{ic|set}} instruction and the {{ic|$}} variable prefix.  For example, having ensured that there was no previous binding for {{ic|Control+Alt+w}}, one could add the following keybinding:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
# LibreOffice Writer shortcut&lt;br /&gt;
bindsym Control+Alt+w exec &#039;/usr/bin/libreoffice --writer&#039;&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Step 4:&#039;&#039;  Applications to launch full-sized and in tabbed layout (Optional)&#039;&#039;&#039;.  At the beginning of the {{ic|# Layout stuff:}} section, Consider inserting:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
workspace_layout tabbed&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, each launched application will launch full-sized.  Each application will be named in a tab.  &lt;br /&gt;
If opting for a default tiled layout, this step is omitted.  Tiling sends applications by default into tiles/&amp;quot;containers&amp;quot;, splitting the screen, unless assigned to different workspaces in &#039;&#039;Steps 6-7&#039;&#039;.  A further alternative would be:  {{ic|workspace_layout stacking}}.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Step 5:&#039;&#039;  Focus when launched (Optional)&#039;&#039;&#039;.  Make &#039;&#039;&#039;Sway&#039;&#039;&#039; to immediately focus on any newly-opened application.  At the end of the {{ic|# Workspaces:}} section in this {{Path|config}} file, consider adding:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
for_window [app_id=.*] focus&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This may be suitable to avoid having to navigate to its tab/workspace.  It also ensures that dialog boxes such as &#039;&#039;&amp;quot;Open ...&amp;quot;&#039;&#039; and &#039;&#039;&amp;quot;Save as...&amp;quot;&#039;&#039; appear in the currently focused workspace.  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Step 6:&#039;&#039;  Assign workspaces&#039;&#039;&#039;.  This is proposed for your most oftenly-used applications, so that most applications will land into different workspaces, and then one could {{Key|Alt}}+{{Key|Tab}} between those applications/workspaces.&lt;br /&gt;
&lt;br /&gt;
Consider copying and pasting the following model in this same {{ic|# Workspaces:}} passage. Customise each line for user preferences.  These specify the {{ic|app_id}} for various applications, including that of the {{Pkg|keepassxc}} password vault, the lean {{Pkg|corepad}} text editor and {{Pkg|okular}} pdf viewer.  Then, one finishes off each line with a chosen workspace number. (There may be no documented upper limit of workspaces, but one would need two keystrokes to move applications into two-digit workspaces if and when such keybindings were eventually learned and used.) &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Pre&amp;gt;&lt;br /&gt;
# APPLICATIONS TO APPEAR IN SPECIFIC WORKSPACES&lt;br /&gt;
 assign [app_id=&amp;quot;foot&amp;quot;] 1&lt;br /&gt;
 assign [app_id=&amp;quot;chromium&amp;quot;] 2&lt;br /&gt;
 assign [app_id=&amp;quot;org.keepassxc.KeePassXC&amp;quot;] 3&lt;br /&gt;
 assign [app_id=&amp;quot;cc.cubocore.CorePad&amp;quot;] 4&lt;br /&gt;
 assign [app_id=&amp;quot;libreoffice-writer&amp;quot;] 5&lt;br /&gt;
 assign [app_id=&amp;quot;libreoffice-calc&amp;quot;] 6&lt;br /&gt;
 assign [app_id=&amp;quot;org.kde.okular&amp;quot;] 7&lt;br /&gt;
 assign [app_id=&amp;quot;thunar&amp;quot;] 8&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One could use workspace names instead of numbers, but then one would need to change their instances in the default {{Path|config}} file.  Some applications, not listed here, may require identification by their {{ic|class}} name instead of by {{ic|app_id}} – particularly, some that were originally designed for &#039;&#039;&#039;X11&#039;&#039;&#039; (such as &#039;&#039;&#039;xterm&#039;&#039;&#039;) – see &#039;&#039;Step 6&#039;&#039;.  &#039;&#039;&#039;Sway&#039;&#039;&#039; supplies the {{ic|swaymsg}} command that could determine the {{ic|app_id}} and/or {{ic|class}} name of one&#039;s chosen applications. &lt;br /&gt;
&lt;br /&gt;
{{Tip|The &#039;&#039;&#039;keepassxc&#039;&#039;&#039; password vault is assigned to appear in a different workspace than the &#039;&#039;&#039;chromium&#039;&#039;&#039; browser.  After both are launched, then one would be able to {{Key|Alt}}+{{Key|Tab}} between the two workspaces to fetch/paste password data without engaging a browser password extension, if preferred.}}&lt;br /&gt;
&lt;br /&gt;
If alternative applications are to be assigned workspaces, proceed to the next step.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Step 7:&#039;&#039;  Assign alternative application choices for specific workspaces (Optional)&#039;&#039;&#039;.  This may require being run in a &#039;&#039;&#039;Sway&#039;&#039;&#039; session.  &#039;&#039;If not currently running Sway&#039;&#039;, then consider conserving whichever part of the code block in &#039;&#039;Step 6&#039;&#039; that is applicable for user purposes in the configuration file and resuming this &#039;&#039;Step 7&#039;&#039; once the first &#039;&#039;&#039;Sway&#039;&#039;&#039; session is run.  &lt;br /&gt;
&lt;br /&gt;
This step may succeed alternatively in a different &#039;&#039;&#039;Wayland&#039;&#039;&#039; compositor provided that:  (a) &#039;&#039;&#039;Sway&#039;&#039;&#039; or {{Pkg|sway-bash-completion}} has been installed, seeing how either supply the required {{ic|swaymsg}} command;  or (b) one has a different means of determining the {{ic|app_id}} / {{ic|class}} of the alternative application(s).&lt;br /&gt;
&amp;lt;ol start=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Launch the alternative applications that are to be assigned to workspaces.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Run {{ic|&amp;lt;nowiki&amp;gt;swaymsg -t get_tree | grep &amp;quot;app_id&amp;quot;&amp;lt;/nowiki&amp;gt;}} in a terminal.  The command examines metadata for your opened windows, and the result is then whittled down (or &#039;&#039;&amp;quot;grepped&amp;quot;&#039;&#039;) to display {{ic|app_id}} values.  For example: &amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;pre&amp;gt; $ swaymsg -t get_tree | grep &amp;quot;app_id&amp;quot;&lt;br /&gt;
                  &amp;quot;app_id&amp;quot;: &amp;quot;Alacritty&amp;quot;,&lt;br /&gt;
                  &amp;quot;app_id&amp;quot;: &amp;quot;firefox-esr&amp;quot;,&lt;br /&gt;
                  &amp;quot;app_id&amp;quot;: &amp;quot;librewolf&amp;quot;,&lt;br /&gt;
                  &amp;quot;app_id&amp;quot;: &amp;quot;pavucontrol-qt&amp;quot;,&lt;br /&gt;
                  &amp;quot;app_id&amp;quot;: &amp;quot;featherpad&amp;quot;,&lt;br /&gt;
                  &amp;quot;app_id&amp;quot;: &amp;quot;audacious&amp;quot;,&lt;br /&gt;
                  &amp;quot;app_id&amp;quot;: &amp;quot;org.gnome.Epiphany&amp;quot;,&lt;br /&gt;
                  &amp;quot;app_id&amp;quot;: &amp;quot;org.qutebrowser.qutebrowser&amp;quot;,&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;ol start=&amp;quot;3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Plug the {{ic|app_id}} values for any preferred applications into the {{ic|assign}} listings code block above;  end each line with a chosen workspace number.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; In case any application name did not appear with an {{ic|app_id}}, then it is possible that the application was originally designed for &#039;&#039;&#039;Xorg&#039;&#039;&#039; and has not been fully adapted for &#039;&#039;&amp;quot;pure &#039;&#039;&#039;Wayland&#039;&#039;&#039;&amp;quot;&#039;&#039;:  for example, {{Pkg|xterm}}.  In that case, one would need to determine what its {{ic|class}} is instead:  &#039;&#039;with {{Pkg|xwayland}} installed and not disabled&#039;&#039; in &#039;&#039;&#039;Sway&#039;&#039;&#039;, launch &#039;&#039;&#039;xterm&#039;&#039;&#039;;  then, in a terminal, run:&amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
$ swaymsg -t get_tree | grep &amp;quot;class&amp;quot;&lt;br /&gt;
                    &amp;quot;class&amp;quot;: &amp;quot;XTerm&amp;quot;,&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Determine the {{ic|class}} values for the remainder of the preferred applications that required {{ic|class}} identifiers instead of {{ic|app_id}} and create lines for them in the {{ic|assign}} code block above.  For instance, for &#039;&#039;&#039;xterm&#039;&#039;&#039; to land in workspace 9, add a line to specify its &#039;&#039;class&#039;&#039; and its assigned workspace &#039;&#039;number&#039;&#039;:&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
 assign [class=&amp;quot;XTerm&amp;quot;] 9&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Step 8:&#039;&#039;  Navigating between applications in different workspaces&#039;&#039;&#039;.  Tell &#039;&#039;&#039;Sway&#039;&#039;&#039; what will be the chosen way to &#039;&#039;tab back&#039;&#039; through the workspaces that contain launched applications on a single monitor, say, {{Key|Alt}}+{{Key|Tab}}.  In the {{ic|# Moving around:}} passage, consider adding:-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
bindsym Alt+Tab workspace prev_on_output&lt;br /&gt;
bindsym Super+Tab workspace next_on_output&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have additionally assigned {{Key|Super}}+{{Key|Tab}} to tab &#039;&#039;forwards&#039;&#039; through workspaces, in case that this could be useful to the user (optional).&lt;br /&gt;
&lt;br /&gt;
As mentioned, one can alternatively focus a different workspace by left-clicking on its worskpace button in the &#039;&#039;&#039;swaybar&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Step 9:&#039;&#039;  Navigating between applications within the same workspace&#039;&#039;&#039;.  If two or more instances of the same application get launched (say, two instances of &#039;&#039;&#039;foot&#039;&#039;&#039;), then they will both appear in the same workspace that had been assigned to them, if any. In such case, {{Key|Alt}}+{{Key|Tab}} would not work to navigate between these because that keybinding navigates between applications being displayed in &#039;&#039;different&#039;&#039; workspaces.  Instead, one may navigate between those two instances/tabs within that same workspace in &#039;&#039;three alternative ways&#039;&#039;;  no edits need be done, but one may need to make note of these methods:-&lt;br /&gt;
&lt;br /&gt;
* The default {{Path|config}} file has already bound {{ic|$mod+Left}} and {{ic|$mod+Right}} to switch focus onto tabs shown to the left and right within the same workspace;  in our setup, that would be {{Key|Window}}+{{Key|←}} and {{Key|Window}}+{{Key|→}}.&lt;br /&gt;
* The default {{Path|config}} file has similarly bound {{ic|$mod+$left}} and {{ic|$mod+$right}} for these same commands;  the {{ic|$left}} and {{ic|$right}} &#039;&#039;&amp;quot;key variables&amp;quot;&#039;&#039;, along with two others, have been defined in a fashion that would be familiar to those using {{Pkg|vim}}:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
 set $left h&lt;br /&gt;
 set $down j&lt;br /&gt;
 set $up k&lt;br /&gt;
 set $right l &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Although the {{ic|Left}} key ({{Key|←}}) is distinct from the {{ic|$left}} key (assigned here to be the {{Key|h}} key), this {{Path|config}} file has &#039;&#039;bound them both&#039;&#039; to enact the same action when combined with the {{ic|$mod}} key, specifically, to move &#039;&#039;left&#039;&#039; through tabs in the same workspace (different users prefer alternative methods):&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
    bindsym $mod+$left focus left&lt;br /&gt;
 [...]&lt;br /&gt;
    bindsym $mod+Left focus left &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Similarly for the {{ic|$right}} and {{ic|Right}} keys.&lt;br /&gt;
&lt;br /&gt;
* Alternatively, one could &#039;&#039;left-click&#039;&#039; on a tab to focus on a specific application instance, similarly to how one might click on &#039;&#039;taskbar&#039;&#039; items in other desktop environments.&lt;br /&gt;
&lt;br /&gt;
Any applications that were not assigned into a workspace in the {{ic|assign}} &#039;&#039;Steps 6-7&#039;&#039; above will also launch into the workspace currently focused.  In such cases, therefore, their tabs would be created in the current workspace too, and one could navigate between such applications, within that same workspace, using any way reviewed in this step also.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Step 10:&#039;&#039; Floating, dragging, tiling, fullscreen, etc&#039;&#039;&#039;.  &lt;br /&gt;
* One may make a focused application to &#039;&#039;&#039;float&#039;&#039;&#039;, and to toggle &#039;&#039;&amp;quot;floating&amp;quot;&#039;&#039; off as-and-when needed, with:  {{ic|$mod+Shift+space}} .  In our setup:  {{Key|Window}}+{{Key|Shift}}+{{Key|Space}}. &lt;br /&gt;
&lt;br /&gt;
* The {{Path|config}} file points out that one may &#039;&#039;&amp;quot;drag floating windows by holding down $mod and left mouse button&amp;quot;&#039;&#039;.  Seeing how {{ic|$mod}} was kept assigned as the {{Key|Window}} key:  {{Key|Window}}+&#039;&#039;&#039;drag&#039;&#039;&#039;. The window needs to be floating first;  in some instances, one may need to drag at the tab.&lt;br /&gt;
&lt;br /&gt;
* One could make some applications to launch &amp;quot;floating&amp;quot; by default (optional).  An application that is sometimes made to float by default is the {{Pkg|galculator}} calculator pad;  just add:&lt;br /&gt;
:{{ic|&amp;lt;nowiki&amp;gt;for_window [app_id=&amp;quot;galculator&amp;quot;] floating enable&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
* To toggle through &#039;&#039;&#039;tiled layouts&#039;&#039;&#039; within a workspace:  {{ic|$mod+e}} / {{Key|Window}}+{{Key|e}}&lt;br /&gt;
&lt;br /&gt;
* To return to &#039;&#039;&#039;full-sized tabs&#039;&#039;&#039; i.e. window-sized after being in a tiled layout, yet not fullscreen, thereby retaining toolbars, etc:  {{ic|$mod+w}} / {{Key|Window}}+{{Key|w}} .  Floating windows and fullscreen windows need to be toggled off first.&lt;br /&gt;
&lt;br /&gt;
* To toggle in and out of &#039;&#039;&#039;fullscreen&#039;&#039;&#039;:  {{ic|$mod+f}} / {{Key|Window}}+{{Key|f}}  &lt;br /&gt;
&lt;br /&gt;
Take note of two final keybindings, or modify these first: &lt;br /&gt;
&lt;br /&gt;
* To &#039;&#039;&#039;reload&#039;&#039;&#039; the &#039;&#039;&#039;Sway&#039;&#039;&#039; configuration file after editing it during a session: {{ic|$mod+Shift+c}} / {{Key|Window}}+{{Key|Shift}}+{{Key|c}}&lt;br /&gt;
&lt;br /&gt;
* To &#039;&#039;&#039;exit&#039;&#039;&#039; &#039;&#039;&#039;Sway&#039;&#039;&#039; and the login session (save your work first):  {{ic|$mod+Shift+e}} / {{Key|Window}}+{{Key|Shift}}+{{Key|e}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Step 11:&#039;&#039;  Add variables and autostart instructions&#039;&#039;&#039;.  These could be added to the beginning of this {{Path|config}} file.  Typically, various environment variables would require being set before launching a &#039;&#039;&#039;Wayland&#039;&#039;&#039; compositor, for example, in {{Path|~/.profile}} . Do not add ampersands (&#039;&#039;&#039;&amp;amp;&#039;&#039;&#039;) at the end of each line in {{Path|config}}, unlike with {{Path|.xinitrc}} syntax in &#039;&#039;&#039;Xorg&#039;&#039;&#039;.  &lt;br /&gt;
&lt;br /&gt;
{{Pkg|xwayland}}, if not required, can be disabled by inserting a line here to that effect.  Alternatively, omit that line or comment it out by using a hashtag, as in the following example of autostart instructions, where &#039;&#039;&#039;Sway&#039;&#039;&#039; is assumed to have been launched [[Sway#Starting_Sway|using a {{ic|dbus-run-session}}]];  gui runlevel is started now if &#039;&#039;&#039;PipeWire&#039;&#039;&#039; and associated services are being [[PipeWire#Pipewire_user_service|launched as user services]];  and where &#039;&#039;&#039;chromium&#039;&#039;&#039; is also autostarted:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
exec dbus-update-activation-environment WAYLAND_DISPLAY DISPLAY XDG_CURRENT_DESKTOP=sway SWAYSOCK I3SOCK XCURSOR_SIZE XCURSOR_THEME&lt;br /&gt;
# xwayland disable&lt;br /&gt;
# Start gui runlevel for PipeWire and associated services to launch now&lt;br /&gt;
exec openrc -U gui&lt;br /&gt;
exec /usr/bin/chromium&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Tip|Running &#039;&#039;&amp;quot;pure &#039;&#039;&#039;Wayland&#039;&#039;&#039;&amp;quot;&#039;&#039; – i.e. without the &#039;&#039;&#039;xwayland&#039;&#039;&#039; layer/package – may remove a possible attack surface.  &#039;&#039;&#039;Xwayland&#039;&#039;&#039; could be required, however, to run certain &#039;&#039;&#039;Xorg&#039;&#039;&#039;-designed software, such as {{Pkg|xterm}}.  One may also investigate &#039;&#039;&#039;libreoffice&#039;&#039;&#039; and &#039;&#039;&#039;okular&#039;&#039;&#039; functionality.}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Step 12:&#039;&#039;  Install selected packages&#039;&#039;&#039;.  Ensure that all mentioned applications have been installed:  {{ic|apk info -e &amp;lt;var&amp;gt;package1&amp;lt;/var&amp;gt; &amp;lt;var&amp;gt;package2&amp;lt;/var&amp;gt;}}.  Substitute entries in the following list with one&#039;s packages mentioned in the {{Path|config}} file:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ apk info -e foot wmenu chromium keepassxc corepad libreoffice okular thunar xterm galculator}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;wmenu&#039;&#039;&#039; was preserved for that listing;  swap it out for &#039;&#039;&#039;rofi&#039;&#039;&#039; or otherwise, if necessary.  One may have decided also not to include &#039;&#039;&#039;xterm&#039;&#039;&#039;, etc.&lt;br /&gt;
&lt;br /&gt;
Install any application not appearing in the output of that instruction.&lt;br /&gt;
&lt;br /&gt;
For additional information, start at &amp;lt;code&amp;gt;man 5 sway&amp;lt;/code&amp;gt; and read the [https://github.com/swaywm/sway/wiki upstream wiki].&lt;br /&gt;
&lt;br /&gt;
=== PipeWire and Screensharing ===&lt;br /&gt;
&lt;br /&gt;
The Sway compositor has no involvement with audio playback. In order for screensharing to work, [[PipeWire]] is required. Therefore, installing [[PipeWire#Installation|PipeWire]] is recommended for audio playback too. &lt;br /&gt;
&lt;br /&gt;
Since v3.22, Alpine Linux provides the necessary scripts to start PipeWire as a [[OpenRC#user services|user service]] in OpenRC.&lt;br /&gt;
&lt;br /&gt;
From a screensharing perspective, applications are split into two categories:-&lt;br /&gt;
&lt;br /&gt;
* Those which use the native Wayland [https://wayland.app/protocols/wlr-screencopy-unstable-v1 wlr-screencopy] protocol&lt;br /&gt;
* Those which use the API from Flatpak&#039;s &amp;lt;code&amp;gt;xdg-desktop-portal&amp;lt;/code&amp;gt; (this portal is also used by native non-Flatpak applications).&lt;br /&gt;
&lt;br /&gt;
Applications in the first group require no additional setup. Applications in the second group (which include Firefox and Chromium) require setting up &#039;&#039;xdg portals&#039;&#039; in addition to [[PipeWire#Installation|PipeWire]]. &lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add xdg-desktop-portal xdg-desktop-portal-wlr}}&lt;br /&gt;
&lt;br /&gt;
If you are using a &amp;lt;code&amp;gt;dbus-run-session&amp;lt;/code&amp;gt; wrapper to launch Sway, you will also need to set D-Bus variables in order for the portal and for [[#PipeWire and Screensharing|screensharing]] features to work;  add the following line to the beginning of Sway&#039;s {{Path|config}} file:&lt;br /&gt;
&lt;br /&gt;
 exec dbus-update-activation-environment WAYLAND_DISPLAY DISPLAY XDG_CURRENT_DESKTOP SWAYSOCK I3SOCK XCURSOR_SIZE XCURSOR_THEME&lt;br /&gt;
&lt;br /&gt;
The {{ic|XDG_CURRENT_DESKTOP}} environment variable may be set by various methods, including:-&lt;br /&gt;
* by amending its mention in that {{ic|dbus-update-activation-environment}} line, editing it to specify {{ic|XDG_CURRENT_DESKTOP{{=}}sway}} ; or&lt;br /&gt;
* by exporting it from within an applicable environment configuration file, such as:&lt;br /&gt;
&lt;br /&gt;
:{{Cat| $XDG_CONFIG_HOME/.profile|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
export XDG_CURRENT_DESKTOP=sway&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
:However, this method is not universal, as it would require resetting the {{ic|XDG_CURRENT_DESKTOP}} variable for any different desktop/compositor/window manager that may be launched afterwards, possibly by employing a launcher similar to the wrapper script alternative described for &#039;&#039;&#039;Sway&#039;&#039;&#039; [[Sway#Automatically_Launch_Sway_on_tty1|below]];  or&lt;br /&gt;
* by being set automatically by the display manager, as is commonplace, but none is supplied by &#039;&#039;&#039;Sway&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Screen Lock and suspend-to-RAM ===&lt;br /&gt;
&lt;br /&gt;
{{Tip| For a seat manager-agnostic and DE-/WM-agnostic tool, consider installing the {{Pkg|zzz}} utility, available in the [[Repositories#Community|community]] repository, or the {{Pkg|powerctl}} utility from the [[Repositories#Testing|testing]] repository, in order to manage suspend and hibernation.}}&lt;br /&gt;
&lt;br /&gt;
For usage of the &amp;lt;Code&amp;gt;loginctl suspend&amp;lt;/Code&amp;gt; command, see [[Elogind]].&lt;br /&gt;
&lt;br /&gt;
To put the system to sleep after 600 seconds, use:&lt;br /&gt;
&lt;br /&gt;
 exec swayidle -w timeout 600 &#039;doas /usr/bin/powerctl mem&#039;&lt;br /&gt;
&lt;br /&gt;
Do not lock the screen if program is running in full screen:&lt;br /&gt;
&lt;br /&gt;
==== Idle inhibition ====&lt;br /&gt;
&lt;br /&gt;
 for_window [app_id=&amp;quot;^.*&amp;quot;] inhibit_idle fullscreen&lt;br /&gt;
&lt;br /&gt;
{{Todo|The option below, related to &amp;lt;Code&amp;gt;wayland-pipewire-idle-inhibit&amp;lt;/Code&amp;gt;, needs to be tested. If you find the option below to be working, please remove this Todo.}}&lt;br /&gt;
&lt;br /&gt;
If you do not want to lock the screen while media is being played through [[PipeWire]], then install the {{pkg|wayland-pipewire-idle-inhibit}} package, and add the following to Sway&#039;s {{Path|config}} file:&lt;br /&gt;
&lt;br /&gt;
 exec wayland-pipewire-idle-inhibit&lt;br /&gt;
&lt;br /&gt;
Make changes to the {{Path|~/.config/wayland-pipewire-idle-inhibit/config.toml}} configuration file or to whichever configuration file you may have referenced instead through the &amp;lt;Code&amp;gt; --config &amp;lt;PATH&amp;gt;&amp;lt;/Code&amp;gt;, if required, as per the [https://github.com/rafaelrc7/wayland-pipewire-idle-inhibit?tab=readme-ov-file#config project&#039;s website].&lt;br /&gt;
&lt;br /&gt;
=== Elogind and swayidle ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;swayidle&amp;lt;/code&amp;gt; has integration with &amp;lt;code&amp;gt;elogind&amp;lt;/code&amp;gt;, and it can handle &#039;&#039;before-sleep&#039;&#039; events.&lt;br /&gt;
&lt;br /&gt;
If using &amp;lt;code&amp;gt;swayidle before-sleep&amp;lt;/code&amp;gt;, then there will be a race condition, so that when you resume the computer from &#039;&#039;suspend&#039;&#039;, the screen will show the contents of the unlocked screen for a second before showing the actual lock screen.  This can be a privacy concern.&lt;br /&gt;
&lt;br /&gt;
To solve this issue, do the following.&lt;br /&gt;
&lt;br /&gt;
Create the &amp;lt;code&amp;gt;/etc/elogind/system-sleep/10-swaylock.sh&amp;lt;/code&amp;gt; file, and then add the following script to this file:&lt;br /&gt;
{{Cat|/etc/elogind/system-sleep/10-swaylock.sh|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 if [ &amp;quot;${1}&amp;quot; == &amp;quot;pre&amp;quot; ]; then&lt;br /&gt;
   touch /tmp/swaylock-sleep&lt;br /&gt;
   sleep 1&lt;br /&gt;
 fi&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Then set it to executable.&lt;br /&gt;
&lt;br /&gt;
Later, once Sway is installed, add the following line to its {{Path|config}} file:&lt;br /&gt;
&lt;br /&gt;
 exec touch /tmp/swaylock-sleep &amp;amp;&amp;amp; inotifyd swaylock /tmp/swaylock-sleep&lt;br /&gt;
&lt;br /&gt;
With this line, the screen will be promptly locked before &#039;&#039;suspend-to-RAM&#039;&#039; starts.&lt;br /&gt;
&lt;br /&gt;
=== Brightness Control ===&lt;br /&gt;
&lt;br /&gt;
Refer to [[Backlight]] for information on brightness control.&lt;br /&gt;
&lt;br /&gt;
=== Output Scaling for High Resolution Displays ===&lt;br /&gt;
&lt;br /&gt;
Without further configuration, program interfaces may be too small to use on high resolution displays.&lt;br /&gt;
&lt;br /&gt;
Sway supports the per-display configuration of:-&lt;br /&gt;
&lt;br /&gt;
* fractional (e.g. 1.5x);  and&lt;br /&gt;
* integer scaling (e.g. 2x) &lt;br /&gt;
&lt;br /&gt;
However, fractional scaling is discouraged due both to the performance impact and to the blurry output it produces. In this case, where 1x scaling is too small and 2x scaling is too large, program-specific GTK/QT-based toolkit scaling is recommended.  See [[Sway#Toolkit Scaling|See below]].&lt;br /&gt;
&lt;br /&gt;
==== Scaling with wdisplays ====&lt;br /&gt;
&lt;br /&gt;
To enable Sway scaling, the user can first preview different scaling factors with the {{Pkg|wdisplays}} package.  Note the output name (&#039;&#039;eDP-1&#039;&#039;, &#039;&#039;LVDS-1&#039;&#039;) and try apply scaling factors such as 1 and 2.  To make changes permanent, add the following line, completed with your settings, to Sway&#039;s {{Path|config}} file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
output &amp;lt;name&amp;gt; scale &amp;lt;factor&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Toolkit Scaling ====&lt;br /&gt;
&lt;br /&gt;
To use toolkit scaling, say, at x2, add the following, for instance, to your {{Path|~/.profile}}: &lt;br /&gt;
&lt;br /&gt;
 # for GTK-based programs such as firefox and emacs:&lt;br /&gt;
 export GDK_DPI_SCALE{{=}}2&lt;br /&gt;
&lt;br /&gt;
 # for QT-based programs&lt;br /&gt;
 export QT_WAYLAND_FORCE_DPI{{=}}&amp;quot;physical&amp;quot;&lt;br /&gt;
 # or if still too small, use a custom DPI&lt;br /&gt;
 export QT_WAYLAND_FORCE_DPI{{=}}192 # 2x scaling&lt;br /&gt;
 export QT_QPA_PLATFORM{{=}}&amp;quot;wayland-egl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Notification Daemon ===&lt;br /&gt;
&lt;br /&gt;
[[mako]] is a lightweight notification daemon that works seamlessly with Sway. &lt;br /&gt;
&lt;br /&gt;
=== Screenshots ===&lt;br /&gt;
&lt;br /&gt;
A simple tool that works well under Wayland is {{pkg|grimshot}}. Example keybindings:-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bindsym Print exec grimshot copy area&lt;br /&gt;
bindsym Shift+Print exec grimshot copy screen&lt;br /&gt;
bindsym Control+Print exec grimshot save area ~/Pictures/$(date +%d-%m-%Y-%H-%M-%S).png&lt;br /&gt;
bindsym Control+Shift+Print exec grimshot save screen ~/Pictures/$(date +%d-%m-%Y-%H-%M-%S).png&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See Sway&#039;s [https://github.com/swaywm/sway/wiki/Useful-add-ons-for-sway wiki article] for a listing of further screenshot tools.&lt;br /&gt;
&lt;br /&gt;
=== Make Clipboard Content Persistent ===&lt;br /&gt;
&lt;br /&gt;
By default, the clipboard content does not persist after terminating the program: if you copy some text from Firefox and then exit Firefox, then the copied text is also lost.&lt;br /&gt;
&lt;br /&gt;
Install {{Pkg|clipman}} from the community repo, and then add the following to Sway&#039;s {{Path|config}} file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
exec wl-paste --type text/plain --watch clipman store --histpath=&amp;quot;~/.local/state/clipman-primary.json&amp;quot;&lt;br /&gt;
bindsym $mod+h exec clipman pick --tool wofi --histpath=&amp;quot;~/.local/state/clipman-primary.json&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Firefox Picture-in-Picture Mode/Floating Windows ===&lt;br /&gt;
&lt;br /&gt;
Add this to your Sway configuration file (modify the numeric values to suit your needs and your display):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
for_window [app_id=&amp;quot;firefox&amp;quot; title=&amp;quot;^Picture-in-Picture$&amp;quot;] floating enable, move position 877 450, sticky enable, border none&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Start with NumLock Enabled ===&lt;br /&gt;
&lt;br /&gt;
Add the following to your Sway {{Path|config}} file:&lt;br /&gt;
&lt;br /&gt;
 input type:keyboard xkb_numlock enabled&lt;br /&gt;
&lt;br /&gt;
=== Change mouse cursor theme and size ===&lt;br /&gt;
&lt;br /&gt;
Add to your Sway {{Path|config}} file:&lt;br /&gt;
&lt;br /&gt;
 seat seat0 xcursor_theme my_cursor_theme my_cursor_size&lt;br /&gt;
&lt;br /&gt;
For example, set a mouse cursor using the &#039;&#039;&#039;GNOME Adwaita&#039;&#039;&#039; theme:&lt;br /&gt;
&lt;br /&gt;
 seat seat0 xcursor_theme Adwaita 16&lt;br /&gt;
&lt;br /&gt;
You can inspect their values with &amp;lt;code&amp;gt;echo $XCURSOR_SIZE&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;echo $XCURSOR_THEME&amp;lt;/code&amp;gt;. If reloading your configuration does not result in change, try logging out and in.&lt;br /&gt;
&lt;br /&gt;
{{Note|Wayland allows for client-side cursors. It is possible that applications do not evaluate the values of &amp;lt;code&amp;gt;$XCURSOR_SIZE&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;$XCURSOR_THEME&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
&lt;br /&gt;
=== Custom Keyboard Layout ===&lt;br /&gt;
&lt;br /&gt;
To use a custom keyboard layout, just use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
input type:keyboard {&lt;br /&gt;
  xkb_file /path/to/my/custom/layout&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Flatpaks ===&lt;br /&gt;
&lt;br /&gt;
{{main|Flatpak}}&lt;br /&gt;
&lt;br /&gt;
As mentioned in [[Flatpak#Portals|Flatpak]] page, install the minimal required portal related packages i.e {{pkg|xdg-desktop-portal}}, {{pkg|xdg-desktop-portal-gtk}} and {{pkg|xdg-desktop-portal-wlr}}. After installing the packages, add the following to the &#039;&#039;autostart&#039;&#039; section in your Sway {{Path|config}} file to avoid [[Flatpak#GDBus_Error|GDBus errors]]. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
exec /usr/libexec/xdg-desktop-portal&lt;br /&gt;
exec /usr/libexec/xdg-desktop-portal-gtk&lt;br /&gt;
exec /usr/libexec/xdg-desktop-portal-wlr&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These startup instructions are only needed, if these are not started automatically via other means.&lt;br /&gt;
&lt;br /&gt;
== Starting Sway ==&lt;br /&gt;
&lt;br /&gt;
=== Manually Launch Sway ===&lt;br /&gt;
&lt;br /&gt;
You can launch Sway manually by issuing the &amp;lt;Code&amp;gt;sway&amp;lt;/Code&amp;gt; command from a TTY.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ sway}} &lt;br /&gt;
&lt;br /&gt;
{{Tip|When using [[Wayland]], for [[PipeWire]] and screensharing to work in Firefox and Chromium, a [[D-Bus]] is required. In the absence of a [[OpenRC#User_services|user service manager]], consider running &amp;lt;Code&amp;gt;sway&amp;lt;/Code&amp;gt; with &amp;lt;code&amp;gt;dbus-run-session&amp;lt;/code&amp;gt;, a convenient wrapper that will explicitly export the path of the session bus.{{Cmd|$ dbus-run-session sway}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Automatically Launch Sway on tty1 ===&lt;br /&gt;
&lt;br /&gt;
Adding the following lines to {{Path|~/.profile}} or to its equivalent will ensure that &amp;lt;Code&amp;gt;sway&amp;lt;/Code&amp;gt; launches automatically, with a D-Bus, &#039;&#039;only&#039;&#039; from &#039;&#039;tty1&#039;&#039;.  This is handy for troubleshooting, because if the Sway configuration ever falters, one could troubleshoot by logging into a different TTY (&#039;&#039;tty2&#039;&#039;-&#039;&#039;tty6&#039;&#039;), and your startup script then will not attempt to launch the faulty Sway environment from there also. &lt;br /&gt;
{{Cat| ~/.profile|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$(tty)&amp;quot; = &amp;quot;/dev/tty1&amp;quot; ]; then&lt;br /&gt;
     exec dbus-run-session sway &lt;br /&gt;
fi&lt;br /&gt;
...&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
=== Using a Wrapper Script to Launch Sway ===&lt;br /&gt;
&lt;br /&gt;
Instead of using {{Path|~/.profile}} or its equivalent file, a [https://man.sr.ht/~kennylevinsen/greetd/#how-to-set-xdg_session_typewayland wrapper script] can be placed at {{Path|/usr/local/bin/sway-run}}. This script can be used to launch &amp;lt;Code&amp;gt;sway&amp;lt;/Code&amp;gt; from either a TTY or by [[greetd]], a lightweight [[Display manager|display manager]], as follows: {{Cat|/usr/local/bin/sway-run|&amp;lt;nowiki&amp;gt;#!/bin/sh&lt;br /&gt;
# Session&lt;br /&gt;
export XDG_SESSION_TYPE=wayland&lt;br /&gt;
export XDG_SESSION_DESKTOP=sway&lt;br /&gt;
export XDG_CURRENT_DESKTOP=sway&lt;br /&gt;
&lt;br /&gt;
# Wayland stuff&lt;br /&gt;
export MOZ_ENABLE_WAYLAND=1&lt;br /&gt;
export QT_QPA_PLATFORM=wayland&lt;br /&gt;
export SDL_VIDEODRIVER=wayland&lt;br /&gt;
export _JAVA_AWT_WM_NONREPARENTING=1&lt;br /&gt;
&lt;br /&gt;
# Launch Sway with a D-Bus server&lt;br /&gt;
exec dbus-run-session sway &amp;quot;$@&amp;quot; &amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Make the file executable:&lt;br /&gt;
{{Cmd|# chmod +x /usr/local/bin/sway-run}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
If you encounter any issues, try running &amp;lt;Code&amp;gt;sway -Vc /etc/sway/config&amp;lt;/Code&amp;gt;. It will run &amp;lt;Code&amp;gt;sway&amp;lt;/Code&amp;gt; with the default config file and set the output to be more verbose. It is generally a good idea to track your configuration files with &#039;&#039;git&#039;&#039; (if and when you use a remote repository for them, keep it private, for security reasons). &lt;br /&gt;
&lt;br /&gt;
To capture the Sway error log in a file for troubleshooting, replace &amp;lt;code&amp;gt;sway&amp;lt;/code&amp;gt; in your startup file by:&lt;br /&gt;
&lt;br /&gt;
 sway -d 2&amp;gt; ~/sway_error.log&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can also issue the below command from TTY.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ sway -d 2&amp;gt; ~/sway_error.log}} &lt;br /&gt;
&lt;br /&gt;
=== Video Driver Issues === &lt;br /&gt;
&lt;br /&gt;
After installing Sway, and while launching it for the first time, a lack of appropriate [[#Install Graphics Drivers|video drivers]] may cause various error messages such as:&lt;br /&gt;
&lt;br /&gt;
* &amp;quot;unable to create backend&amp;quot;&lt;br /&gt;
* &amp;quot;Failed to create renderer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Install the necessary drivers in order for your [[#Install Graphics Drivers|graphics card]] to work with Sway. &lt;br /&gt;
&lt;br /&gt;
=== XDG_RUNTIME_DIR is not set in the environment. Aborting ===&lt;br /&gt;
&lt;br /&gt;
If [[seatd]] is used instead of [[elogind]], the error message &#039;&#039;&#039;XDG_RUNTIME_DIR is not set in the environment. Aborting&#039;&#039;&#039; might be encountered.&lt;br /&gt;
&lt;br /&gt;
Ensure that the mandatory steps outlined in the [[Seatd]] wiki page are completed in order to set the [[XDG_RUNTIME_DIR]] variable.&lt;br /&gt;
&lt;br /&gt;
=== No backend was able to open a seat ===&lt;br /&gt;
&lt;br /&gt;
If no [[seat manager]] is available, then the error below will appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
[libseat] [libseat/libseat.c:73] libseat_open_seat : No backend was able to open a seat&lt;br /&gt;
[backend/session/libseat.c:102] Unable to create seat : Function not implemented&lt;br /&gt;
[backend/backend.c:303] Failed to open any DRM device&lt;br /&gt;
[sway/server.c:49] Unable to create backend&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ensure that either [[Elogind]] or [[Seatd]] is properly configured and running. &lt;br /&gt;
&lt;br /&gt;
=== Firefox (Flatpak) and/or GTK Apps ===&lt;br /&gt;
&lt;br /&gt;
==== Disappearing Cursor ====&lt;br /&gt;
&lt;br /&gt;
You may need to get an icon pack and possibly a theme from [https://www.pling.com/browse?cat=107&amp;amp;ord=latest Pling store] and set &amp;lt;code&amp;gt;GTK_THEME&amp;lt;/code&amp;gt; environmental variable. Alternatively, one could install an [https://pkgs.alpinelinux.org/packages?name=*-icon-theme&amp;amp;branch=edge&amp;amp;repo=&amp;amp;arch=x86_64&amp;amp;origin=&amp;amp;flagged=&amp;amp;maintainer= icon theme] package for all users.&lt;br /&gt;
&lt;br /&gt;
==== Missing file picker/cannot download ====&lt;br /&gt;
&lt;br /&gt;
Go to &#039;&#039;about:config&#039;&#039; and set &amp;lt;code&amp;gt;widget.use-xdg-desktop-portal.file-picker&amp;lt;/code&amp;gt; to 0.&lt;br /&gt;
&lt;br /&gt;
=== Nvidia Issues ===&lt;br /&gt;
&lt;br /&gt;
{{Draft|This section is partly outdated and could benefit from contributions in view of Nvidia&#039;s [https://docs.nvidia.com/drive/drive-os-5.2.3.0L/drive-os/index.html#page/DRIVE_OS_Linux_SDK_Development_Guide/Windows%20Systems/window_system_wayland.html current support] of Wayland. Help is encouraged.}}&lt;br /&gt;
{{Main|NVIDIA}}&lt;br /&gt;
As of Dec 31 2022, [https://developer.nvidia.com/docs/drive/drive-os/latest/linux/sdk/common/topics/window_system_stub/Gnome-WaylandDesktopShellSupport136.html Nvidia still doesn&#039;t fully support Wayland]. Therefore, the possible solutions are as outlined in the link, or setting your &amp;lt;Code&amp;gt;WLR_BACKENDS&amp;lt;/Code&amp;gt; environmental variables to &amp;lt;code&amp;gt;drm,libinput&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;x11&amp;lt;/code&amp;gt; (add {{Pkg|libinput}} here as well if you cannot use your mouse and keyboard after starting Sway). The latter also works for AMD/ATI cards (&#039;&#039;&#039;make sure to install {{Pkg|libinput}} first&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/swaywm/sway/wiki/ Sway Wiki]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Sway Archwiki]&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/Sway Gentoo Wiki]&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/Sway PostmarketOS Wiki]&lt;br /&gt;
&lt;br /&gt;
[[Category:Compositor]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Sway&amp;diff=31231</id>
		<title>Sway</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Sway&amp;diff=31231"/>
		<updated>2025-10-14T22:06:18Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: /* PipeWire and Screensharing */ Remove reference to obsolete script&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://swaywm.org Sway] is a tiling [[Wayland]] compositor and a drop-in replacement for the [[i3wm |i3 window manager]]. It works with your existing i3 configuration and supports most of i3&#039;s features, plus a few extras.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* Internet [[Configure_Networking#Connectivity_testing|connectivity]], unless the packages have been pre-fetched into a local cache.&lt;br /&gt;
* Install appropriate [[Graphics driver]] drivers for your hardware. Without graphics drivers [[#Video Driver Issues|errors]] are likely to occur.&lt;br /&gt;
* A [[Setting_up_a_new_user#Creating_a_new_user|non-root user account]].&lt;br /&gt;
* The [[Repositories#Managing_repositories|community repositories must be enabled]].&lt;br /&gt;
* Set up [[eudev]].&lt;br /&gt;
* Wayland compositors need raw access to input and output devices, typically mediated by a [[seat manager]]. Either [[seatd]] or [[elogind]] work fine, but installing both leads to conflicts.&lt;br /&gt;
{{Tip|Except for the first two [[#Prerequisites|prerequisites]], all of the others are automatically handled if the desktop is [[#Setup-desktop|installed using the following setup-desktop]] script.}}&lt;br /&gt;
&lt;br /&gt;
== Setup-desktop ==&lt;br /&gt;
&lt;br /&gt;
The [[setup-desktop]] command automates the Sway desktop installation with [[eudev]] and [[elogind]]. &lt;br /&gt;
&lt;br /&gt;
{{cmd|# setup-desktop sway}}   &lt;br /&gt;
&lt;br /&gt;
Proceed to the [[Sway#Starting Sway|Starting Sway]] section, as no [[Display manager|display manager]] is being installed nor configured by the script that would boot into a graphical login screen.&lt;br /&gt;
&lt;br /&gt;
== Manual Installation ==&lt;br /&gt;
&lt;br /&gt;
The installation steps below allow you to pick and choose various components for your Sway desktop.&lt;br /&gt;
&lt;br /&gt;
=== Install Fonts ===&lt;br /&gt;
&lt;br /&gt;
Install [https://dejavu-fonts.github.io/ DejaVu] fonts ({{Pkg|font-dejavu}}), which have good [https://home.unicode.org/ Unicode] coverage:&lt;br /&gt;
&lt;br /&gt;
{{cmd|# apk add font-dejavu}}   &lt;br /&gt;
 &lt;br /&gt;
=== Install Sway ===&lt;br /&gt;
&lt;br /&gt;
{{cmd|# apk add sway \&lt;br /&gt;
    xwayland             \ # if you need the xserver&lt;br /&gt;
    foot                 \ # default terminal emulator. Modify $term in config for a different one.&lt;br /&gt;
    wmenu                \ # default Wayland native menu for choosing program and screensharing monitor&lt;br /&gt;
    swaylock swaylockd   \ # lockscreen tool&lt;br /&gt;
    swaybg               \ # display wallpaper&lt;br /&gt;
    grim                 \ # screenshot tool&lt;br /&gt;
    wl-clipboard         \ # clipboard management&lt;br /&gt;
    i3status             \ # simple status bar&lt;br /&gt;
    swayidle               # idle management (DPMS) daemon&lt;br /&gt;
}} &lt;br /&gt;
&lt;br /&gt;
For complimentary software alternatives, see [https://github.com/swaywm/sway/wiki/Useful-add-ons-for-sway Sway&#039;s wiki] or [https://wiki.gentoo.org/wiki/List_of_software_for_Wayland Gentoo&#039;s wiki].&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
===Sway config File ===&lt;br /&gt;
&lt;br /&gt;
Copy the default Sway configuration file to {{Path|~/.config/sway/config}} so that it can be customized as per each user&#039;s choices:&lt;br /&gt;
&lt;br /&gt;
{{cmd|$ mkdir -p ~/.config/sway&lt;br /&gt;
$ cp /etc/sway/config ~/.config/sway/}}&lt;br /&gt;
&lt;br /&gt;
Read through it to learn the default keybindings.&lt;br /&gt;
Sway&#039;s configuration is mostly backward compatible with that of [[I3wm|i3]]&#039;s, and if you are looking for a solution for a specific issue, you could try checking whether it hasn&#039;t been provided for the i3 window manager.&lt;br /&gt;
&lt;br /&gt;
====Quickstart - config File====&lt;br /&gt;
To set up an environment that launches applications full-sized and to {{Key|Alt}}+{{Key|Tab}} between these much as in [[Xfce|XFCE]] or in various other desktop environments, then a quick setup of the {{Path|config}} file could effect this.  This proposed setup may be of benefit for both desktop/non-technical and technical use. &#039;&#039;Step 4&#039;&#039; is indicated to be sidestepped by those electing an {{Pkg|i3}}-style, tiled default layout.&lt;br /&gt;
&lt;br /&gt;
A launchbar is not set up &amp;quot;out of the box&amp;quot;, nor here, so this section only reviews essential &#039;&#039;keybindings&#039;&#039; (or &amp;quot;shortcuts&amp;quot;), saving first-time users from immediately requiring to digest a longer &#039;&#039;&amp;quot;cheatsheet&amp;quot;&#039;&#039; of keybindings that might include resizing, moving and swapping windows (called &#039;&#039;&amp;quot;views&amp;quot;&#039;&#039;), say, from smaller tiles (called &#039;&#039;&amp;quot;containers&amp;quot;&#039;&#039;) into larger tiles;  these may be learned at a later stage.&lt;br /&gt;
&lt;br /&gt;
The quickstart configuration of the {{Path|config}} file &#039;&#039;may be prepared within or without &#039;&#039;&#039;Sway&#039;&#039;&#039;&#039;&#039; e.g. within an &#039;&#039;&#039;Xorg&#039;&#039;&#039; session or another compositor, or on another installation, before eventually copying over the finished {{Path|config}} file onto the target system – except:&lt;br /&gt;
* If one prefers alternative applications to those proposed initially in &#039;&#039;Step 6&#039;&#039; for assignment into specific workspaces.  Any such modifications (to be executed in &#039;&#039;Step 7&#039;&#039;) could be performed:  (a) simply during one&#039;s first &#039;&#039;&#039;Sway&#039;&#039;&#039; session; or (b) by determining what those applications&#039; {{ic|app_id}} / {{ic|class}} are (as detailed in &#039;&#039;Step 7&#039;&#039;), possibly in another &#039;&#039;&#039;Wayland&#039;&#039;&#039; session or externally e.g. from documentation. &lt;br /&gt;
* One will likewise require to verify at some point whether one&#039;s chosen applications are installed on the target system;  and to install those missing (last step, &#039;&#039;Step 12&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Step 1:&#039;&#039;  Assign the main modifier key&#039;&#039;&#039;.  In a text editor, open the {{Path|/home/&amp;lt;var&amp;gt;username&amp;lt;/var&amp;gt;/.config/sway/config}} file that had been copied over.  We will declare what would be the main modifier key for many of our keybindings:  {{Key|Window}}, {{Key|Alt}} or otherwise.  The {{Path|config}} file has already set the main modifier, called the {{ic|$mod}} key, to default as the {{ic|Mod4}} key, also known as the {{Key|Window}}, {{ic|Super}} or &#039;&#039;Logo&#039;&#039; key.  Verify this towards the beginning of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
# Logo key. Use Mod1 for Alt.&lt;br /&gt;
set $mod Mod4&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As proposed there, one could change that {{ic|$mod}} key to be the {{Key|Alt}} key a.k.a. the {{ic|Mod1}} key.  To change the {{ic|$mod}} key assignment, as with any line in this file, one could edit/delete the lines or comment such line out i.e. add a hashtag (&#039;&#039;&#039;&#039;&#039;#&#039;&#039;&#039;&#039;&#039;) at the start of any line that does not begin with a hashtag, so that such line would not be executed by &#039;&#039;&#039;Sway&#039;&#039;&#039; but would be left there for reference;  and then enter the customised version of that line below it.  Note that &#039;&#039;&#039;Sway&#039;&#039;&#039; [https://github.com/swaywm/sway/wiki#comments does not support] comments at the end of an executable line, following a hashtag.  &lt;br /&gt;
&lt;br /&gt;
According to the {{ic|man 5 sway}} page, &#039;&#039;XKB modifier names&#039;&#039; can be used to refer to modifier keys, plus certain aliases found among the following list, all of these &amp;quot;{{ic|codes}}&amp;quot; being acceptable for use throughout the configuration file:&lt;br /&gt;
&lt;br /&gt;
* {{ic|Mod1}} - {{Key|Alt}} - Alternatively expressed as {{ic|Alt}};&lt;br /&gt;
* {{ic|Mod2}} - Although not universally mapped, here it refers to the {{Key|Num Lock}} key;  &lt;br /&gt;
* {{ic|Mod3}} - It could be programmed, as an XKB modifier key;&lt;br /&gt;
* {{ic|Mod4}} - Alternatively expressed as the {{ic|Super}} key, a.k.a. the {{Key|Window}} or &#039;&#039;Logo&#039;&#039; key;&lt;br /&gt;
* {{ic|Mod5}} - {{Key|AltGr}};&lt;br /&gt;
* {{ic|Lock}} - {{Key|Caps Lock}};&lt;br /&gt;
* {{ic|Control}} - {{Key|Ctrl}} - Alternatively expressed as {{ic|Ctrl}};  and&lt;br /&gt;
* {{ic|Shift}} - {{Key|Shift}}.&lt;br /&gt;
&lt;br /&gt;
It might be best not to use the {{Key|Ctrl}} key as the &#039;&#039;main modifier&#039;&#039;, as it is often used in applications e.g. {{Key|Control}}+{{Key|c}} to &#039;&#039;copy&#039;&#039;, {{Key|Control}}+{{Key|b}} for &#039;&#039;bold&#039;&#039;, etc.  Similarly when considering the {{ic|Shift}} as main modifier.&lt;br /&gt;
&lt;br /&gt;
So, if one were to choose, say, the {{Key|Alt}} key as the main modifier, that {{ic|Mod4}} line could be changed to: {{ic|set $mod Alt}} or {{ic|set $mod Mod1}}.  We will preserve the default, {{ic|Mod4}} ({{Key|Window}}), as the main modifier.  Note that any modification will not be manifested until one chooses at any time to reload the {{Path|config}} file by hitting {{ic|$mod+Shift+c}} (cf. &#039;&#039;Step 10&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Step 2:&#039;&#039; Declare what your default terminal and menu launcher will be&#039;&#039;&#039;.  In this {{Path|config}} file, these are currently configured to be the {{Pkg|foot}} terminal;  and {{Pkg|wmenu}}, which supplies the {{ic|wmenu-run}} command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
# Your preferred terminal emulator&lt;br /&gt;
set $term foot&lt;br /&gt;
# Your preferred application launcher&lt;br /&gt;
set $menu wmenu-run&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could leave these &#039;as is&#039; if you are happy with these selections.  Otherwise, substitute any of them. &lt;br /&gt;
&lt;br /&gt;
A word to the wise regarding one&#039;s initial choice of &#039;&#039;terminal&#039;&#039; &#039;&#039;if not currently running &#039;&#039;&#039;Sway&#039;&#039;&#039;&#039;&#039;:   if a different terminal were to be chosen, then one would not be able to {{Key|Alt}}+{{Key|Tab}} back and forth from a launched &#039;&#039;&#039;foot&#039;&#039;&#039; terminal into other opened workspaces unless that terminal&#039;s {{ic|app_id}} / {{ic|class}} could somehow be determined and specified by the user in &#039;&#039;Step 7&#039;&#039;.  It may be more suitable therefore to leave &#039;&#039;&#039;foot&#039;&#039;&#039; as the default terminal until one of these could be determined once a &#039;&#039;&#039;Sway&#039;&#039;&#039; session is run, so that the terminal (&#039;&#039;&#039;foot&#039;&#039;&#039;) would land in a specified workspace when launched, and then easily {{Key|Alt}}+{{Key|Tab}} to and from it.  Alternatively, one could left-click on the chosen terminal&#039;s workspace button on the top {{Pkg|swaybar}} in order to switch to that workspace.  (Note also that &#039;&#039;&#039;foot&#039;&#039;&#039; would already be installed if &#039;&#039;&#039;Sway&#039;&#039;&#039; had been installed using {{ic|$ doas setup-desktop sway}}).  On the other hand, &#039;&#039;if one is currently running &#039;&#039;&#039;Sway&#039;&#039;&#039;&#039;&#039;, then it is straightforward to change this default terminal choice here, if so wished; a tweak for the preferred terminal could be made in &#039;&#039;Step 7&#039;&#039;.  &lt;br /&gt;
&lt;br /&gt;
One&#039;s choice of menu launcher here is more flexible, regardless of the compositor/window manager currently being used, as the launcher will appear in any workspace currently displayed on-screen – a.k.a. the workspace &#039;&#039;in focus&#039;&#039; – using the keybinding declared in the following step (&#039;&#039;Step 3&#039;&#039;).  Insert the preferred launcher&#039;s launch command here. For example, one may prefer {{Pkg|rofi}} over &#039;&#039;&#039;wmenu&#039;&#039;&#039;;  Alpine Linux&#039;s &#039;&#039;&#039;rofi&#039;&#039;&#039; port now supports &#039;&#039;&#039;Wayland&#039;&#039;&#039;, just as [https://github.com/davatorium/rofi rofi&#039;s mainline version] officially has since 2025.  If so, that {{ic|set $menu wmenu-run}} line could be changed as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
set $menu &#039;/usr/bin/rofi -combi-modi run,drun,window,filebrowser -show combi -sort&#039;&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that menu instruction, whenever &#039;&#039;&#039;rofi&#039;&#039;&#039; is launched using the keybinding reviewed in the next step, it would first offer a &#039;&#039;combi&#039;&#039; (combination) menu of all packages and of &amp;lt;code&amp;gt;.desktop&amp;lt;/code&amp;gt; files that match the the command name while it is being typed in;  alternatively, one could follows this on by hitting {{Key|Control}}+{{Key|Tab}}, which in turn would offer (a) a &#039;&#039;drun&#039;&#039; menu (a launcher strictly of &amp;lt;code&amp;gt;.desktop&amp;lt;/code&amp;gt; files);  (b) a listing of opened &#039;&#039;&amp;quot;window&amp;quot;&#039;&#039;/view selections; or (c) a simple &#039;&#039;filebrowser&#039;&#039;, etc.&lt;br /&gt;
&lt;br /&gt;
A tally of the chosen packages is being kept for any required installation later.  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Step 3:&#039;&#039; Choose key combinations to open the terminal and launcher and others&#039;&#039;&#039;.  From the configuration file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
bindsym $mod+Return exec $term&lt;br /&gt;
[...]&lt;br /&gt;
bindsym $mod+d exec $menu&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Modify these keybindings if so wished, which refer to the terminal and application launcher chosen in &#039;&#039;Step 2&#039;&#039;.  Ensure that any different chosen key combination(s) has/have not already been assigned elsewhere in this {{Path|config}} file.  Make note of your chosen terminal and menu keybindings so as to know how to launch them later.  As it stands:&lt;br /&gt;
* {{Key|Window}}+{{Key|Return}} for your terminal;  &lt;br /&gt;
* {{Key|Window}}+{{Key|m}} for your menu launcher;   &lt;br /&gt;
Substitute the {{Key|Window}} key for your assigned {{ic|$mod}} key, or with any other chosen combination that has not been used elsewhere in the configuration file.  &lt;br /&gt;
&lt;br /&gt;
Keybindings may also be made without requiring to define applications as variables that use the {{ic|set}} instruction and the {{ic|$}} variable prefix.  For example, having ensured that there was no previous binding for {{ic|Control+Alt+w}}, one could add the following keybinding:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
# LibreOffice Writer shortcut&lt;br /&gt;
bindsym Control+Alt+w exec &#039;/usr/bin/libreoffice --writer&#039;&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Step 4:&#039;&#039;  Applications to launch full-sized and in tabbed layout (Optional)&#039;&#039;&#039;.  At the beginning of the {{ic|# Layout stuff:}} section, Consider inserting:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
workspace_layout tabbed&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, each launched application will launch full-sized.  Each application will be named in a tab.  &lt;br /&gt;
If opting for a default tiled layout, this step is omitted.  Tiling sends applications by default into tiles/&amp;quot;containers&amp;quot;, splitting the screen, unless assigned to different workspaces in &#039;&#039;Steps 6-7&#039;&#039;.  A further alternative would be:  {{ic|workspace_layout stacking}}.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Step 5:&#039;&#039;  Focus when launched (Optional)&#039;&#039;&#039;.  Make &#039;&#039;&#039;Sway&#039;&#039;&#039; to immediately focus on any newly-opened application.  At the end of the {{ic|# Workspaces:}} section in this {{Path|config}} file, consider adding:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
for_window [app_id=.*] focus&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This may be suitable to avoid having to navigate to its tab/workspace.  It also ensures that dialog boxes such as &#039;&#039;&amp;quot;Open ...&amp;quot;&#039;&#039; and &#039;&#039;&amp;quot;Save as...&amp;quot;&#039;&#039; appear in the currently focused workspace.  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Step 6:&#039;&#039;  Assign workspaces&#039;&#039;&#039;.  This is proposed for your most oftenly-used applications, so that most applications will land into different workspaces, and then one could {{Key|Alt}}+{{Key|Tab}} between those applications/workspaces.&lt;br /&gt;
&lt;br /&gt;
Consider copying and pasting the following model in this same {{ic|# Workspaces:}} passage. Customise each line for user preferences.  These specify the {{ic|app_id}} for various applications, including that of the {{Pkg|keepassxc}} password vault, the lean {{Pkg|corepad}} text editor and {{Pkg|okular}} pdf viewer.  Then, one finishes off each line with a chosen workspace number. (There may be no documented upper limit of workspaces, but one would need two keystrokes to move applications into two-digit workspaces if and when such keybindings were eventually learned and used.) &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Pre&amp;gt;&lt;br /&gt;
# APPLICATIONS TO APPEAR IN SPECIFIC WORKSPACES&lt;br /&gt;
 assign [app_id=&amp;quot;foot&amp;quot;] 1&lt;br /&gt;
 assign [app_id=&amp;quot;chromium&amp;quot;] 2&lt;br /&gt;
 assign [app_id=&amp;quot;org.keepassxc.KeePassXC&amp;quot;] 3&lt;br /&gt;
 assign [app_id=&amp;quot;cc.cubocore.CorePad&amp;quot;] 4&lt;br /&gt;
 assign [app_id=&amp;quot;libreoffice-writer&amp;quot;] 5&lt;br /&gt;
 assign [app_id=&amp;quot;libreoffice-calc&amp;quot;] 6&lt;br /&gt;
 assign [app_id=&amp;quot;org.kde.okular&amp;quot;] 7&lt;br /&gt;
 assign [app_id=&amp;quot;thunar&amp;quot;] 8&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One could use workspace names instead of numbers, but then one would need to change their instances in the default {{Path|config}} file.  Some applications, not listed here, may require identification by their {{ic|class}} name instead of by {{ic|app_id}} – particularly, some that were originally designed for &#039;&#039;&#039;X11&#039;&#039;&#039; (such as &#039;&#039;&#039;xterm&#039;&#039;&#039;) – see &#039;&#039;Step 6&#039;&#039;.  &#039;&#039;&#039;Sway&#039;&#039;&#039; supplies the {{ic|swaymsg}} command that could determine the {{ic|app_id}} and/or {{ic|class}} name of one&#039;s chosen applications. &lt;br /&gt;
&lt;br /&gt;
{{Tip|The &#039;&#039;&#039;keepassxc&#039;&#039;&#039; password vault is assigned to appear in a different workspace than the &#039;&#039;&#039;chromium&#039;&#039;&#039; browser.  After both are launched, then one would be able to {{Key|Alt}}+{{Key|Tab}} between the two workspaces to fetch/paste password data without engaging a browser password extension, if preferred.}}&lt;br /&gt;
&lt;br /&gt;
If alternative applications are to be assigned workspaces, proceed to the next step.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Step 7:&#039;&#039;  Assign alternative application choices for specific workspaces (Optional)&#039;&#039;&#039;.  This may require being run in a &#039;&#039;&#039;Sway&#039;&#039;&#039; session.  &#039;&#039;If not currently running Sway&#039;&#039;, then consider conserving whichever part of the code block in &#039;&#039;Step 6&#039;&#039; that is applicable for user purposes in the configuration file and resuming this &#039;&#039;Step 7&#039;&#039; once the first &#039;&#039;&#039;Sway&#039;&#039;&#039; session is run.  &lt;br /&gt;
&lt;br /&gt;
This step may succeed alternatively in a different &#039;&#039;&#039;Wayland&#039;&#039;&#039; compositor provided that:  (a) &#039;&#039;&#039;Sway&#039;&#039;&#039; or {{Pkg|sway-bash-completion}} has been installed, seeing how either supply the required {{ic|swaymsg}} command;  or (b) one has a different means of determining the {{ic|app_id}} / {{ic|class}} of the alternative application(s).&lt;br /&gt;
&amp;lt;ol start=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Launch the alternative applications that are to be assigned to workspaces.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Run {{ic|&amp;lt;nowiki&amp;gt;swaymsg -t get_tree | grep &amp;quot;app_id&amp;quot;&amp;lt;/nowiki&amp;gt;}} in a terminal.  The command examines metadata for your opened windows, and the result is then whittled down (or &#039;&#039;&amp;quot;grepped&amp;quot;&#039;&#039;) to display {{ic|app_id}} values.  For example: &amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;pre&amp;gt; $ swaymsg -t get_tree | grep &amp;quot;app_id&amp;quot;&lt;br /&gt;
                  &amp;quot;app_id&amp;quot;: &amp;quot;Alacritty&amp;quot;,&lt;br /&gt;
                  &amp;quot;app_id&amp;quot;: &amp;quot;firefox-esr&amp;quot;,&lt;br /&gt;
                  &amp;quot;app_id&amp;quot;: &amp;quot;librewolf&amp;quot;,&lt;br /&gt;
                  &amp;quot;app_id&amp;quot;: &amp;quot;pavucontrol-qt&amp;quot;,&lt;br /&gt;
                  &amp;quot;app_id&amp;quot;: &amp;quot;featherpad&amp;quot;,&lt;br /&gt;
                  &amp;quot;app_id&amp;quot;: &amp;quot;audacious&amp;quot;,&lt;br /&gt;
                  &amp;quot;app_id&amp;quot;: &amp;quot;org.gnome.Epiphany&amp;quot;,&lt;br /&gt;
                  &amp;quot;app_id&amp;quot;: &amp;quot;org.qutebrowser.qutebrowser&amp;quot;,&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;ol start=&amp;quot;3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Plug the {{ic|app_id}} values for any preferred applications into the {{ic|assign}} listings code block above;  end each line with a chosen workspace number.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; In case any application name did not appear with an {{ic|app_id}}, then it is possible that the application was originally designed for &#039;&#039;&#039;Xorg&#039;&#039;&#039; and has not been fully adapted for &#039;&#039;&amp;quot;pure &#039;&#039;&#039;Wayland&#039;&#039;&#039;&amp;quot;&#039;&#039;:  for example, {{Pkg|xterm}}.  In that case, one would need to determine what its {{ic|class}} is instead:  &#039;&#039;with {{Pkg|xwayland}} installed and not disabled&#039;&#039; in &#039;&#039;&#039;Sway&#039;&#039;&#039;, launch &#039;&#039;&#039;xterm&#039;&#039;&#039;;  then, in a terminal, run:&amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
$ swaymsg -t get_tree | grep &amp;quot;class&amp;quot;&lt;br /&gt;
                    &amp;quot;class&amp;quot;: &amp;quot;XTerm&amp;quot;,&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Determine the {{ic|class}} values for the remainder of the preferred applications that required {{ic|class}} identifiers instead of {{ic|app_id}} and create lines for them in the {{ic|assign}} code block above.  For instance, for &#039;&#039;&#039;xterm&#039;&#039;&#039; to land in workspace 9, add a line to specify its &#039;&#039;class&#039;&#039; and its assigned workspace &#039;&#039;number&#039;&#039;:&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
 assign [class=&amp;quot;XTerm&amp;quot;] 9&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Step 8:&#039;&#039;  Navigating between applications in different workspaces&#039;&#039;&#039;.  Tell &#039;&#039;&#039;Sway&#039;&#039;&#039; what will be the chosen way to &#039;&#039;tab back&#039;&#039; through the workspaces that contain launched applications on a single monitor, say, {{Key|Alt}}+{{Key|Tab}}.  In the {{ic|# Moving around:}} passage, consider adding:-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
bindsym Alt+Tab workspace prev_on_output&lt;br /&gt;
bindsym Super+Tab workspace next_on_output&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have additionally assigned {{Key|Super}}+{{Key|Tab}} to tab &#039;&#039;forwards&#039;&#039; through workspaces, in case that this could be useful to the user (optional).&lt;br /&gt;
&lt;br /&gt;
As mentioned, one can alternatively focus a different workspace by left-clicking on its worskpace button in the &#039;&#039;&#039;swaybar&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Step 9:&#039;&#039;  Navigating between applications within the same workspace&#039;&#039;&#039;.  If two or more instances of the same application get launched (say, two instances of &#039;&#039;&#039;foot&#039;&#039;&#039;), then they will both appear in the same workspace that had been assigned to them, if any. In such case, {{Key|Alt}}+{{Key|Tab}} would not work to navigate between these because that keybinding navigates between applications being displayed in &#039;&#039;different&#039;&#039; workspaces.  Instead, one may navigate between those two instances/tabs within that same workspace in &#039;&#039;three alternative ways&#039;&#039;;  no edits need be done, but one may need to make note of these methods:-&lt;br /&gt;
&lt;br /&gt;
* The default {{Path|config}} file has already bound {{ic|$mod+Left}} and {{ic|$mod+Right}} to switch focus onto tabs shown to the left and right within the same workspace;  in our setup, that would be {{Key|Window}}+{{Key|←}} and {{Key|Window}}+{{Key|→}}.&lt;br /&gt;
* The default {{Path|config}} file has similarly bound {{ic|$mod+$left}} and {{ic|$mod+$right}} for these same commands;  the {{ic|$left}} and {{ic|$right}} &#039;&#039;&amp;quot;key variables&amp;quot;&#039;&#039;, along with two others, have been defined in a fashion that would be familiar to those using {{Pkg|vim}}:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
 set $left h&lt;br /&gt;
 set $down j&lt;br /&gt;
 set $up k&lt;br /&gt;
 set $right l &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Although the {{ic|Left}} key ({{Key|←}}) is distinct from the {{ic|$left}} key (assigned here to be the {{Key|h}} key), this {{Path|config}} file has &#039;&#039;bound them both&#039;&#039; to enact the same action when combined with the {{ic|$mod}} key, specifically, to move &#039;&#039;left&#039;&#039; through tabs in the same workspace (different users prefer alternative methods):&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
    bindsym $mod+$left focus left&lt;br /&gt;
 [...]&lt;br /&gt;
    bindsym $mod+Left focus left &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Similarly for the {{ic|$right}} and {{ic|Right}} keys.&lt;br /&gt;
&lt;br /&gt;
* Alternatively, one could &#039;&#039;left-click&#039;&#039; on a tab to focus on a specific application instance, similarly to how one might click on &#039;&#039;taskbar&#039;&#039; items in other desktop environments.&lt;br /&gt;
&lt;br /&gt;
Any applications that were not assigned into a workspace in the {{ic|assign}} &#039;&#039;Steps 6-7&#039;&#039; above will also launch into the workspace currently focused.  In such cases, therefore, their tabs would be created in the current workspace too, and one could navigate between such applications, within that same workspace, using any way reviewed in this step also.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Step 10:&#039;&#039; Floating, dragging, tiling, fullscreen, etc&#039;&#039;&#039;.  &lt;br /&gt;
* One may make a focused application to &#039;&#039;&#039;float&#039;&#039;&#039;, and to toggle &#039;&#039;&amp;quot;floating&amp;quot;&#039;&#039; off as-and-when needed, with:  {{ic|$mod+Shift+space}} .  In our setup:  {{Key|Window}}+{{Key|Shift}}+{{Key|Space}}. &lt;br /&gt;
&lt;br /&gt;
* The {{Path|config}} file points out that one may &#039;&#039;&amp;quot;drag floating windows by holding down $mod and left mouse button&amp;quot;&#039;&#039;.  Seeing how {{ic|$mod}} was kept assigned as the {{Key|Window}} key:  {{Key|Window}}+&#039;&#039;&#039;drag&#039;&#039;&#039;. The window needs to be floating first;  in some instances, one may need to drag at the tab.&lt;br /&gt;
&lt;br /&gt;
* One could make some applications to launch &amp;quot;floating&amp;quot; by default (optional).  An application that is sometimes made to float by default is the {{Pkg|galculator}} calculator pad;  just add:&lt;br /&gt;
:{{ic|&amp;lt;nowiki&amp;gt;for_window [app_id=&amp;quot;galculator&amp;quot;] floating enable&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
* To toggle through &#039;&#039;&#039;tiled layouts&#039;&#039;&#039; within a workspace:  {{ic|$mod+e}} / {{Key|Window}}+{{Key|e}}&lt;br /&gt;
&lt;br /&gt;
* To return to &#039;&#039;&#039;full-sized tabs&#039;&#039;&#039; i.e. window-sized after being in a tiled layout, yet not fullscreen, thereby retaining toolbars, etc:  {{ic|$mod+w}} / {{Key|Window}}+{{Key|w}} .  Floating windows and fullscreen windows need to be toggled off first.&lt;br /&gt;
&lt;br /&gt;
* To toggle in and out of &#039;&#039;&#039;fullscreen&#039;&#039;&#039;:  {{ic|$mod+f}} / {{Key|Window}}+{{Key|f}}  &lt;br /&gt;
&lt;br /&gt;
Take note of two final keybindings, or modify these first: &lt;br /&gt;
&lt;br /&gt;
* To &#039;&#039;&#039;reload&#039;&#039;&#039; the &#039;&#039;&#039;Sway&#039;&#039;&#039; configuration file after editing it during a session: {{ic|$mod+Shift+c}} / {{Key|Window}}+{{Key|Shift}}+{{Key|c}}&lt;br /&gt;
&lt;br /&gt;
* To &#039;&#039;&#039;exit&#039;&#039;&#039; &#039;&#039;&#039;Sway&#039;&#039;&#039; and the login session (save your work first):  {{ic|$mod+Shift+e}} / {{Key|Window}}+{{Key|Shift}}+{{Key|e}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Step 11:&#039;&#039;  Add variables and autostart instructions&#039;&#039;&#039;.  These could be added to the beginning of this {{Path|config}} file.  Typically, various environment variables would require being set before launching a &#039;&#039;&#039;Wayland&#039;&#039;&#039; compositor, for example, in {{Path|~/.profile}} . Do not add ampersands (&#039;&#039;&#039;&amp;amp;&#039;&#039;&#039;) at the end of each line in {{Path|config}}, unlike with {{Path|.xinitrc}} syntax in &#039;&#039;&#039;Xorg&#039;&#039;&#039;.  &lt;br /&gt;
&lt;br /&gt;
{{Pkg|xwayland}}, if not required, can be disabled by inserting a line here to that effect.  Alternatively, omit that line or comment it out by using a hashtag, as in the following example of autostart instructions, where &#039;&#039;&#039;Sway&#039;&#039;&#039; is assumed to have been launched [[Sway#Starting_Sway|using a {{ic|dbus-run-session}}]];  gui runlevel is started now if &#039;&#039;&#039;PipeWire&#039;&#039;&#039; and associated services are being [[PipeWire#Pipewire_user_service|launched as user services]];  and where &#039;&#039;&#039;chromium&#039;&#039;&#039; is also autostarted:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
exec dbus-update-activation-environment WAYLAND_DISPLAY DISPLAY XDG_CURRENT_DESKTOP=sway SWAYSOCK I3SOCK XCURSOR_SIZE XCURSOR_THEME&lt;br /&gt;
# xwayland disable&lt;br /&gt;
# Start gui runlevel for PipeWire and associated services to launch now&lt;br /&gt;
exec openrc -U gui&lt;br /&gt;
exec /usr/bin/chromium&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Tip|Running &#039;&#039;&amp;quot;pure &#039;&#039;&#039;Wayland&#039;&#039;&#039;&amp;quot;&#039;&#039; – i.e. without the &#039;&#039;&#039;xwayland&#039;&#039;&#039; layer/package – may remove a possible attack surface.  &#039;&#039;&#039;Xwayland&#039;&#039;&#039; could be required, however, to run certain &#039;&#039;&#039;Xorg&#039;&#039;&#039;-designed software, such as {{Pkg|xterm}}.  One may also investigate &#039;&#039;&#039;libreoffice&#039;&#039;&#039; and &#039;&#039;&#039;okular&#039;&#039;&#039; functionality.}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Step 12:&#039;&#039;  Install selected packages&#039;&#039;&#039;.  Ensure that all mentioned applications have been installed:  {{ic|apk info -e &amp;lt;var&amp;gt;package1&amp;lt;/var&amp;gt; &amp;lt;var&amp;gt;package2&amp;lt;/var&amp;gt;}}.  Substitute entries in the following list with one&#039;s packages mentioned in the {{Path|config}} file:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ apk info -e foot wmenu chromium keepassxc corepad libreoffice okular thunar xterm galculator}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;wmenu&#039;&#039;&#039; was preserved for that listing;  swap it out for &#039;&#039;&#039;rofi&#039;&#039;&#039; or otherwise, if necessary.  One may have decided also not to include &#039;&#039;&#039;xterm&#039;&#039;&#039;, etc.&lt;br /&gt;
&lt;br /&gt;
Install any application not appearing in the output of that instruction.&lt;br /&gt;
&lt;br /&gt;
For additional information, start at &amp;lt;code&amp;gt;man 5 sway&amp;lt;/code&amp;gt; and read the [https://github.com/swaywm/sway/wiki upstream wiki].&lt;br /&gt;
&lt;br /&gt;
=== PipeWire and Screensharing ===&lt;br /&gt;
&lt;br /&gt;
The Sway compositor has no involvement with audio playback. In order for screensharing to work, [[PipeWire]] is required. Therefore, installing [[PipeWire#Installation|PipeWire]] is recommended for audio playback too. &lt;br /&gt;
&lt;br /&gt;
Since v3.22, Alpine Linux provides the necessary scripts to start PipeWire as a [[OpenRC#user services|user service]] in OpenRC.&lt;br /&gt;
&lt;br /&gt;
From a screensharing perspective, applications are split into two categories:-&lt;br /&gt;
&lt;br /&gt;
* Those which use the native Wayland [https://wayland.app/protocols/wlr-screencopy-unstable-v1 wlr-screencopy] protocol&lt;br /&gt;
* Those which use the API from Flatpak&#039;s &amp;lt;code&amp;gt;xdg-desktop-portal&amp;lt;/code&amp;gt; (this portal is also used by native non-Flatpak applications).&lt;br /&gt;
&lt;br /&gt;
Applications in the first group require no additional setup. Applications in the second group (which include Firefox and Chromium) require setting up &#039;&#039;xdg portals&#039;&#039; in addition to [[PipeWire#Installation|PipeWire]]. &lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add xdg-desktop-portal xdg-desktop-portal-wlr}}&lt;br /&gt;
&lt;br /&gt;
If you are using a &amp;lt;code&amp;gt;dbus-run-session&amp;lt;/code&amp;gt; wrapper to launch Sway, you will also need to set D-Bus variables in order for the portal and for [[#PipeWire and Screensharing|screensharing]] features to work;  add the following line to the beginning of Sway&#039;s {{Path|config}} file:&lt;br /&gt;
&lt;br /&gt;
 exec dbus-update-activation-environment WAYLAND_DISPLAY DISPLAY XDG_CURRENT_DESKTOP SWAYSOCK I3SOCK XCURSOR_SIZE XCURSOR_THEME&lt;br /&gt;
&lt;br /&gt;
The {{ic|XDG_CURRENT_DESKTOP}} environment variable may be set by various methods, including:-&lt;br /&gt;
* by amending its mention in that {{ic|dbus-update-activation-environment}} line, editing it to specify {{ic|XDG_CURRENT_DESKTOP{{=}}sway}} ; or&lt;br /&gt;
* by exporting it from within an applicable environment configuration file, such as:&lt;br /&gt;
&lt;br /&gt;
:{{Cat| $XDG_CONFIG_HOME/.profile|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
export XDG_CURRENT_DESKTOP=sway&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
:However, this method is not universal, as it would require resetting the {{ic|XDG_CURRENT_DESKTOP}} variable for any different desktop/compositor/window manager that may be launched afterwards, possibly by employing a launcher similar to the wrapper script alternative described for &#039;&#039;&#039;Sway&#039;&#039;&#039; [[Sway#Automatically_Launch_Sway_on_tty1|below]];  or&lt;br /&gt;
* by being set automatically by the display manager, as is commonplace, but none is supplied by &#039;&#039;&#039;Sway&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Screen Lock and suspend-to-RAM ===&lt;br /&gt;
&lt;br /&gt;
{{Tip| For a seat manager-agnostic and DE-/WM-agnostic tool, consider installing the {{Pkg|zzz}} utility, available in the [[Repositories#Community|community]] repository, or the {{Pkg|powerctl}} utility from the [[Repositories#Testing|testing]] repository, in order to manage suspend and hibernation.}}&lt;br /&gt;
&lt;br /&gt;
Putting the system to sleep with the &amp;lt;Code&amp;gt;loginctl suspend&amp;lt;/Code&amp;gt; command from [[Elogind]] requires elevated privileges or additional configuration. &lt;br /&gt;
&lt;br /&gt;
To put the system to sleep after 600 seconds, use:&lt;br /&gt;
&lt;br /&gt;
 exec swayidle -w timeout 600 &#039;doas /bin/loginctl suspend&#039;&lt;br /&gt;
&lt;br /&gt;
Do not lock the screen if program is running in full screen:&lt;br /&gt;
&lt;br /&gt;
 for_window [app_id=&amp;quot;^.*&amp;quot;] inhibit_idle fullscreen&lt;br /&gt;
&lt;br /&gt;
{{Todo|The option below, related to &amp;lt;Code&amp;gt;wayland-pipewire-idle-inhibit&amp;lt;/Code&amp;gt;, needs to be tested. If you find the option below to be working, please remove this Todo.}}&lt;br /&gt;
&lt;br /&gt;
If you do not want to lock the screen while media is being played through [[PipeWire]], then install the {{pkg|wayland-pipewire-idle-inhibit}} package, and add the following to Sway&#039;s {{Path|config}} file:&lt;br /&gt;
&lt;br /&gt;
 exec wayland-pipewire-idle-inhibit&lt;br /&gt;
&lt;br /&gt;
Make changes to the {{Path|~/.config/wayland-pipewire-idle-inhibit/config.toml}} configuration file or to whichever configuration file you may have referenced instead through the &amp;lt;Code&amp;gt; --config &amp;lt;PATH&amp;gt;&amp;lt;/Code&amp;gt;, if required, as per the [https://github.com/rafaelrc7/wayland-pipewire-idle-inhibit?tab=readme-ov-file#config project&#039;s website].&lt;br /&gt;
&lt;br /&gt;
=== Elogind and swayidle ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;swayidle&amp;lt;/code&amp;gt; has integration with &amp;lt;code&amp;gt;elogind&amp;lt;/code&amp;gt;, and it can handle &#039;&#039;before-sleep&#039;&#039; events.&lt;br /&gt;
&lt;br /&gt;
If using &amp;lt;code&amp;gt;swayidle before-sleep&amp;lt;/code&amp;gt;, then there will be a race condition, so that when you resume the computer from &#039;&#039;suspend&#039;&#039;, the screen will show the contents of the unlocked screen for a second before showing the actual lock screen.  This can be a privacy concern.&lt;br /&gt;
&lt;br /&gt;
To solve this issue, do the following.&lt;br /&gt;
&lt;br /&gt;
Create the &amp;lt;code&amp;gt;/etc/elogind/system-sleep/10-swaylock.sh&amp;lt;/code&amp;gt; file, and then add the following script to this file:&lt;br /&gt;
{{Cat|/etc/elogind/system-sleep/10-swaylock.sh|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 if [ &amp;quot;${1}&amp;quot; == &amp;quot;pre&amp;quot; ]; then&lt;br /&gt;
   touch /tmp/swaylock-sleep&lt;br /&gt;
   sleep 1&lt;br /&gt;
 fi&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Then set it to executable.&lt;br /&gt;
&lt;br /&gt;
Later, once Sway is installed, add the following line to its {{Path|config}} file:&lt;br /&gt;
&lt;br /&gt;
 exec touch /tmp/swaylock-sleep &amp;amp;&amp;amp; inotifyd swaylock /tmp/swaylock-sleep&lt;br /&gt;
&lt;br /&gt;
With this line, the screen will be promptly locked before &#039;&#039;suspend-to-RAM&#039;&#039; starts.&lt;br /&gt;
&lt;br /&gt;
=== Brightness Control ===&lt;br /&gt;
&lt;br /&gt;
Refer to [[Backlight]] for information on brightness control.&lt;br /&gt;
&lt;br /&gt;
=== Output Scaling for High Resolution Displays ===&lt;br /&gt;
&lt;br /&gt;
Without further configuration, program interfaces may be too small to use on high resolution displays.&lt;br /&gt;
&lt;br /&gt;
Sway supports the per-display configuration of:-&lt;br /&gt;
&lt;br /&gt;
* fractional (e.g. 1.5x);  and&lt;br /&gt;
* integer scaling (e.g. 2x) &lt;br /&gt;
&lt;br /&gt;
However, fractional scaling is discouraged due both to the performance impact and to the blurry output it produces. In this case, where 1x scaling is too small and 2x scaling is too large, program-specific GTK/QT-based toolkit scaling is recommended.  See [[Sway#Toolkit Scaling|See below]].&lt;br /&gt;
&lt;br /&gt;
==== Scaling with wdisplays ====&lt;br /&gt;
&lt;br /&gt;
To enable Sway scaling, the user can first preview different scaling factors with the {{Pkg|wdisplays}} package.  Note the output name (&#039;&#039;eDP-1&#039;&#039;, &#039;&#039;LVDS-1&#039;&#039;) and try apply scaling factors such as 1 and 2.  To make changes permanent, add the following line, completed with your settings, to Sway&#039;s {{Path|config}} file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
output &amp;lt;name&amp;gt; scale &amp;lt;factor&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Toolkit Scaling ====&lt;br /&gt;
&lt;br /&gt;
To use toolkit scaling, say, at x2, add the following, for instance, to your {{Path|~/.profile}}: &lt;br /&gt;
&lt;br /&gt;
 # for GTK-based programs such as firefox and emacs:&lt;br /&gt;
 export GDK_DPI_SCALE{{=}}2&lt;br /&gt;
&lt;br /&gt;
 # for QT-based programs&lt;br /&gt;
 export QT_WAYLAND_FORCE_DPI{{=}}&amp;quot;physical&amp;quot;&lt;br /&gt;
 # or if still too small, use a custom DPI&lt;br /&gt;
 export QT_WAYLAND_FORCE_DPI{{=}}192 # 2x scaling&lt;br /&gt;
 export QT_QPA_PLATFORM{{=}}&amp;quot;wayland-egl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Notification Daemon ===&lt;br /&gt;
&lt;br /&gt;
[[mako]] is a lightweight notification daemon that works seamlessly with Sway. &lt;br /&gt;
&lt;br /&gt;
=== Screenshots ===&lt;br /&gt;
&lt;br /&gt;
A simple tool that works well under Wayland is {{pkg|grimshot}}. Example keybindings:-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bindsym Print exec grimshot copy area&lt;br /&gt;
bindsym Shift+Print exec grimshot copy screen&lt;br /&gt;
bindsym Control+Print exec grimshot save area ~/Pictures/$(date +%d-%m-%Y-%H-%M-%S).png&lt;br /&gt;
bindsym Control+Shift+Print exec grimshot save screen ~/Pictures/$(date +%d-%m-%Y-%H-%M-%S).png&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See Sway&#039;s [https://github.com/swaywm/sway/wiki/Useful-add-ons-for-sway wiki article] for a listing of further screenshot tools.&lt;br /&gt;
&lt;br /&gt;
=== Make Clipboard Content Persistent ===&lt;br /&gt;
&lt;br /&gt;
By default, the clipboard content does not persist after terminating the program: if you copy some text from Firefox and then exit Firefox, then the copied text is also lost.&lt;br /&gt;
&lt;br /&gt;
Install {{Pkg|clipman}} from the community repo, and then add the following to Sway&#039;s {{Path|config}} file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
exec wl-paste --type text/plain --watch clipman store --histpath=&amp;quot;~/.local/state/clipman-primary.json&amp;quot;&lt;br /&gt;
bindsym $mod+h exec clipman pick --tool wofi --histpath=&amp;quot;~/.local/state/clipman-primary.json&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Firefox Picture-in-Picture Mode/Floating Windows ===&lt;br /&gt;
&lt;br /&gt;
Add this to your Sway configuration file (modify the numeric values to suit your needs and your display):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
for_window [app_id=&amp;quot;firefox&amp;quot; title=&amp;quot;^Picture-in-Picture$&amp;quot;] floating enable, move position 877 450, sticky enable, border none&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Start with NumLock Enabled ===&lt;br /&gt;
&lt;br /&gt;
Add the following to your Sway {{Path|config}} file:&lt;br /&gt;
&lt;br /&gt;
 input type:keyboard xkb_numlock enabled&lt;br /&gt;
&lt;br /&gt;
=== Change mouse cursor theme and size ===&lt;br /&gt;
&lt;br /&gt;
Add to your Sway {{Path|config}} file:&lt;br /&gt;
&lt;br /&gt;
 seat seat0 xcursor_theme my_cursor_theme my_cursor_size&lt;br /&gt;
&lt;br /&gt;
For example, set a mouse cursor using the &#039;&#039;&#039;GNOME Adwaita&#039;&#039;&#039; theme:&lt;br /&gt;
&lt;br /&gt;
 seat seat0 xcursor_theme Adwaita 16&lt;br /&gt;
&lt;br /&gt;
You can inspect their values with &amp;lt;code&amp;gt;echo $XCURSOR_SIZE&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;echo $XCURSOR_THEME&amp;lt;/code&amp;gt;. If reloading your configuration does not result in change, try logging out and in.&lt;br /&gt;
&lt;br /&gt;
{{Note|Wayland allows for client-side cursors. It is possible that applications do not evaluate the values of &amp;lt;code&amp;gt;$XCURSOR_SIZE&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;$XCURSOR_THEME&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
&lt;br /&gt;
=== Custom Keyboard Layout ===&lt;br /&gt;
&lt;br /&gt;
To use a custom keyboard layout, just use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
input type:keyboard {&lt;br /&gt;
  xkb_file /path/to/my/custom/layout&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Flatpaks ===&lt;br /&gt;
&lt;br /&gt;
{{main|Flatpak}}&lt;br /&gt;
&lt;br /&gt;
As mentioned in [[Flatpak#Portals|Flatpak]] page, install the minimal required portal related packages i.e {{pkg|xdg-desktop-portal}}, {{pkg|xdg-desktop-portal-gtk}} and {{pkg|xdg-desktop-portal-wlr}}. After installing the packages, add the following to the &#039;&#039;autostart&#039;&#039; section in your Sway {{Path|config}} file to avoid [[Flatpak#GDBus_Error|GDBus errors]]. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
exec /usr/libexec/xdg-desktop-portal&lt;br /&gt;
exec /usr/libexec/xdg-desktop-portal-gtk&lt;br /&gt;
exec /usr/libexec/xdg-desktop-portal-wlr&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These startup instructions are only needed, if these are not started automatically via other means.&lt;br /&gt;
&lt;br /&gt;
== Starting Sway ==&lt;br /&gt;
&lt;br /&gt;
=== Manually Launch Sway ===&lt;br /&gt;
&lt;br /&gt;
You can launch Sway manually by issuing the &amp;lt;Code&amp;gt;sway&amp;lt;/Code&amp;gt; command from a TTY.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ sway}} &lt;br /&gt;
&lt;br /&gt;
{{Tip|When using [[Wayland]], for [[PipeWire]] and screensharing to work in Firefox and Chromium, a [[D-Bus]] is required. In the absence of a [[OpenRC#User_services|user service manager]], consider running &amp;lt;Code&amp;gt;sway&amp;lt;/Code&amp;gt; with &amp;lt;code&amp;gt;dbus-run-session&amp;lt;/code&amp;gt;, a convenient wrapper that will explicitly export the path of the session bus.{{Cmd|$ dbus-run-session sway}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Automatically Launch Sway on tty1 ===&lt;br /&gt;
&lt;br /&gt;
Adding the following lines to {{Path|~/.profile}} or to its equivalent will ensure that &amp;lt;Code&amp;gt;sway&amp;lt;/Code&amp;gt; launches automatically, with a D-Bus, &#039;&#039;only&#039;&#039; from &#039;&#039;tty1&#039;&#039;.  This is handy for troubleshooting, because if the Sway configuration ever falters, one could troubleshoot by logging into a different TTY (&#039;&#039;tty2&#039;&#039;-&#039;&#039;tty6&#039;&#039;), and your startup script then will not attempt to launch the faulty Sway environment from there also. &lt;br /&gt;
{{Cat| ~/.profile|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$(tty)&amp;quot; = &amp;quot;/dev/tty1&amp;quot; ]; then&lt;br /&gt;
     exec dbus-run-session sway &lt;br /&gt;
fi&lt;br /&gt;
...&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
=== Using a Wrapper Script to Launch Sway ===&lt;br /&gt;
&lt;br /&gt;
Instead of using {{Path|~/.profile}} or its equivalent file, a [https://man.sr.ht/~kennylevinsen/greetd/#how-to-set-xdg_session_typewayland wrapper script] can be placed at {{Path|/usr/local/bin/sway-run}}. This script can be used to launch &amp;lt;Code&amp;gt;sway&amp;lt;/Code&amp;gt; from either a TTY or by [[greetd]], a lightweight [[Display manager|display manager]], as follows: {{Cat|/usr/local/bin/sway-run|&amp;lt;nowiki&amp;gt;#!/bin/sh&lt;br /&gt;
# Session&lt;br /&gt;
export XDG_SESSION_TYPE=wayland&lt;br /&gt;
export XDG_SESSION_DESKTOP=sway&lt;br /&gt;
export XDG_CURRENT_DESKTOP=sway&lt;br /&gt;
&lt;br /&gt;
# Wayland stuff&lt;br /&gt;
export MOZ_ENABLE_WAYLAND=1&lt;br /&gt;
export QT_QPA_PLATFORM=wayland&lt;br /&gt;
export SDL_VIDEODRIVER=wayland&lt;br /&gt;
export _JAVA_AWT_WM_NONREPARENTING=1&lt;br /&gt;
&lt;br /&gt;
# Launch Sway with a D-Bus server&lt;br /&gt;
exec dbus-run-session sway &amp;quot;$@&amp;quot; &amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Make the file executable:&lt;br /&gt;
{{Cmd|# chmod +x /usr/local/bin/sway-run}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
If you encounter any issues, try running &amp;lt;Code&amp;gt;sway -Vc /etc/sway/config&amp;lt;/Code&amp;gt;. It will run &amp;lt;Code&amp;gt;sway&amp;lt;/Code&amp;gt; with the default config file and set the output to be more verbose. It is generally a good idea to track your configuration files with &#039;&#039;git&#039;&#039; (if and when you use a remote repository for them, keep it private, for security reasons). &lt;br /&gt;
&lt;br /&gt;
To capture the Sway error log in a file for troubleshooting, replace &amp;lt;code&amp;gt;sway&amp;lt;/code&amp;gt; in your startup file by:&lt;br /&gt;
&lt;br /&gt;
 sway -d 2&amp;gt; ~/sway_error.log&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can also issue the below command from TTY.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ sway -d 2&amp;gt; ~/sway_error.log}} &lt;br /&gt;
&lt;br /&gt;
=== Video Driver Issues === &lt;br /&gt;
&lt;br /&gt;
After installing Sway, and while launching it for the first time, a lack of appropriate [[#Install Graphics Drivers|video drivers]] may cause various error messages such as:&lt;br /&gt;
&lt;br /&gt;
* &amp;quot;unable to create backend&amp;quot;&lt;br /&gt;
* &amp;quot;Failed to create renderer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Install the necessary drivers in order for your [[#Install Graphics Drivers|graphics card]] to work with Sway. &lt;br /&gt;
&lt;br /&gt;
=== XDG_RUNTIME_DIR is not set in the environment. Aborting ===&lt;br /&gt;
&lt;br /&gt;
If [[seatd]] is used instead of [[elogind]], the error message &#039;&#039;&#039;XDG_RUNTIME_DIR is not set in the environment. Aborting&#039;&#039;&#039; might be encountered.&lt;br /&gt;
&lt;br /&gt;
Ensure that the mandatory steps outlined in the [[Seatd]] wiki page are completed in order to set the [[XDG_RUNTIME_DIR]] variable.&lt;br /&gt;
&lt;br /&gt;
=== No backend was able to open a seat ===&lt;br /&gt;
&lt;br /&gt;
If no [[seat manager]] is available, then the error below will appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
[libseat] [libseat/libseat.c:73] libseat_open_seat : No backend was able to open a seat&lt;br /&gt;
[backend/session/libseat.c:102] Unable to create seat : Function not implemented&lt;br /&gt;
[backend/backend.c:303] Failed to open any DRM device&lt;br /&gt;
[sway/server.c:49] Unable to create backend&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ensure that either [[Elogind]] or [[Seatd]] is properly configured and running. &lt;br /&gt;
&lt;br /&gt;
=== Firefox (Flatpak) and/or GTK Apps ===&lt;br /&gt;
&lt;br /&gt;
==== Disappearing Cursor ====&lt;br /&gt;
&lt;br /&gt;
You may need to get an icon pack and possibly a theme from [https://www.pling.com/browse?cat=107&amp;amp;ord=latest Pling store] and set &amp;lt;code&amp;gt;GTK_THEME&amp;lt;/code&amp;gt; environmental variable. Alternatively, one could install an [https://pkgs.alpinelinux.org/packages?name=*-icon-theme&amp;amp;branch=edge&amp;amp;repo=&amp;amp;arch=x86_64&amp;amp;origin=&amp;amp;flagged=&amp;amp;maintainer= icon theme] package for all users.&lt;br /&gt;
&lt;br /&gt;
==== Missing file picker/cannot download ====&lt;br /&gt;
&lt;br /&gt;
Go to &#039;&#039;about:config&#039;&#039; and set &amp;lt;code&amp;gt;widget.use-xdg-desktop-portal.file-picker&amp;lt;/code&amp;gt; to 0.&lt;br /&gt;
&lt;br /&gt;
=== Nvidia Issues ===&lt;br /&gt;
&lt;br /&gt;
{{Draft|This section is partly outdated and could benefit from contributions in view of Nvidia&#039;s [https://docs.nvidia.com/drive/drive-os-5.2.3.0L/drive-os/index.html#page/DRIVE_OS_Linux_SDK_Development_Guide/Windows%20Systems/window_system_wayland.html current support] of Wayland. Help is encouraged.}}&lt;br /&gt;
{{Main|NVIDIA}}&lt;br /&gt;
As of Dec 31 2022, [https://developer.nvidia.com/docs/drive/drive-os/latest/linux/sdk/common/topics/window_system_stub/Gnome-WaylandDesktopShellSupport136.html Nvidia still doesn&#039;t fully support Wayland]. Therefore, the possible solutions are as outlined in the link, or setting your &amp;lt;Code&amp;gt;WLR_BACKENDS&amp;lt;/Code&amp;gt; environmental variables to &amp;lt;code&amp;gt;drm,libinput&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;x11&amp;lt;/code&amp;gt; (add {{Pkg|libinput}} here as well if you cannot use your mouse and keyboard after starting Sway). The latter also works for AMD/ATI cards (&#039;&#039;&#039;make sure to install {{Pkg|libinput}} first&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/swaywm/sway/wiki/ Sway Wiki]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Sway Archwiki]&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/Sway Gentoo Wiki]&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/Sway PostmarketOS Wiki]&lt;br /&gt;
&lt;br /&gt;
[[Category:Compositor]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=APKBUILD_examples:Rust&amp;diff=31140</id>
		<title>APKBUILD examples:Rust</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=APKBUILD_examples:Rust&amp;diff=31140"/>
		<updated>2025-10-05T09:36:06Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: Document fetching of deps&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Considerations ==&lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;cargo-auditable&amp;lt;/code&amp;gt; to encode dependency information into binaries.&lt;br /&gt;
&lt;br /&gt;
Most Rust projects use &amp;lt;code&amp;gt;cargo&amp;lt;/code&amp;gt; to fetch Rust library dependencies. The current convention it to use &amp;lt;code&amp;gt;options=&amp;quot;net&amp;quot;&amp;lt;/code&amp;gt; fetch these during the &amp;lt;code&amp;gt;prepare()&amp;lt;/code&amp;gt; phase. Use the &amp;lt;code&amp;gt;--locked&amp;lt;/code&amp;gt; flag to ensure that the exact same versions of dependencies are fetched on each rebuild. If a package is missing a lockfile, include one with the aport and attempt to recommend upstream to include one.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
=== Basic example ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
maintainer=&amp;quot;Hugo Osvaldo Barrera &amp;lt;hugo@whynothugo.nl&amp;gt;&amp;quot;&lt;br /&gt;
pkgname=harper&lt;br /&gt;
pkgver=0.59.0&lt;br /&gt;
pkgrel=0&lt;br /&gt;
pkgdesc=&amp;quot;Grammar checker that respects your privacy&amp;quot;&lt;br /&gt;
url=&amp;quot;https://github.com/elijah-potter/harper&amp;quot;&lt;br /&gt;
arch=&amp;quot;all&amp;quot;&lt;br /&gt;
license=&amp;quot;Apache-2.0&amp;quot;&lt;br /&gt;
makedepends=&amp;quot;cargo-auditable rust&amp;quot;&lt;br /&gt;
source=&amp;quot;harper-$pkgver.tar.gz::https://github.com/elijah-potter/harper/archive/v$pkgver/harper-$pkgver.tar.gz&amp;quot;&lt;br /&gt;
options=&amp;quot;net&amp;quot;&lt;br /&gt;
&lt;br /&gt;
prepare() {&lt;br /&gt;
	default_prepare&lt;br /&gt;
&lt;br /&gt;
	cargo fetch --target=&amp;quot;$CTARGET&amp;quot; --locked&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
build() {&lt;br /&gt;
	cargo auditable build --release --frozen&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
check() {&lt;br /&gt;
	cargo test --frozen&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
package() {&lt;br /&gt;
	install -Dm755 target/release/harper-cli &amp;quot;$pkgdir&amp;quot;/usr/bin/harper-cli&lt;br /&gt;
	install -Dm755 target/release/harper-ls &amp;quot;$pkgdir&amp;quot;/usr/bin/harper-ls&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sha512sums=&amp;quot;&lt;br /&gt;
e5be781b33ba624e2447464a51ff8c0b565a42d7bf957c2fd6655f4bf312211fcf669bbb152b62a57494f89fd7fbee7eda37bbbaf7a61c5d4c8c9684ffe687bd  harper-0.48.0.tar.gz&lt;br /&gt;
&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[APKBUILD examples]]&lt;br /&gt;
* [[Creating an Alpine package]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]] [[Category:Rust]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=OpenRC&amp;diff=30872</id>
		<title>OpenRC</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=OpenRC&amp;diff=30872"/>
		<updated>2025-09-05T16:14:20Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: /* PAM support */ remove mistaken warning&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Alpine Linux uses [https://github.com/OpenRC/ OpenRC] for its [https://en.wikipedia.org/wiki/Init init] system. The init system manages the services, including the boot and shutdown of your system. OpenRC also supports managing [[#User services|services for users]]. &lt;br /&gt;
&lt;br /&gt;
To learn the basics of OpenRC quickly, refer to the [https://docs.alpinelinux.org/user-handbook/0.1a/Working/openrc.html working with OpenRC] guide from the Alpine Linux documentation project. &lt;br /&gt;
&lt;br /&gt;
== Quickstart  ==&lt;br /&gt;
&lt;br /&gt;
{|align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| width=&amp;quot;50%&amp;quot; |Action&lt;br /&gt;
|             |Command&lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039;Managing a service - start,stop and restart&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Start {{ic|ServiceName}} now || {{ic|# rc-service {{ic|ServiceName}} start}}&lt;br /&gt;
|-&lt;br /&gt;
| Stop {{ic|ServiceName}} now || {{ic|# rc-service {{ic|ServiceName}} stop}} &lt;br /&gt;
|-&lt;br /&gt;
| Restart {{ic|ServiceName}} now || {{ic|# rc-service {{ic|ServiceName}} restart}} &lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039;Adding and removing service from runlevels&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Add {{ic|ServiceName}} to {{ic|runlevel}} || {{ic|# rc-update add {{ic|ServiceName}} {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
| Remove {{ic|ServiceName}} from {{ic|runlevel}} || {{ic|# rc-update del {{ic|ServiceName}} {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039; Check services in a runlevel and their status&#039;&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| To check status of {{ic|ServiceName}} || {{ic|$ rc-service {{ic|ServiceName}} status}} &lt;br /&gt;
|-&lt;br /&gt;
| To view services configured at {{ic|runlevel}}  || {{ic|$ rc-update show {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
| To view currently active runlevels and state of services  || {{ic|$ rc-status}} &lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039; Check and manage runlevels&#039;&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| To view available runlevels || {{ic|$ rc-status -l}} &lt;br /&gt;
|-&lt;br /&gt;
| To change to a different {{ic|runlevel}} || {{ic|# openrc {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039; Stacked runlevels&#039;&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| To add {{ic|s-runlevel}} as a stacked {{ic|runlevel}} || {{ic|# rc-update add -s {{ic|s-runlevel}} {{ic|runlevel}}}} &lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |&#039;&#039;&#039;User Services&#039;&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| To view currently active User runlevels and state of User services || {{ic|$ rc-status -U}} &lt;br /&gt;
|-&lt;br /&gt;
| To change to a different user {{ic|runlevel}} || {{ic|$ openrc -U {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
| Add User {{ic|ServiceName}} to user {{ic|runlevel}} || {{ic|$ rc-update -U add {{ic|ServiceName}} {{ic|runlevel}}}} &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Runlevels ==&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;runlevel&#039;&#039; is basically a collection of services that needs to be started when certain conditions are met. Instead of using runlevel numbers, such as is used traditionally with &#039;&#039;SysV&#039;&#039; init, these are named, and users can create their own, if needed. The default startup uses the &#039;&#039;&#039;sysinit&#039;&#039;&#039;, &#039;&#039;&#039;boot&#039;&#039;&#039;, and &#039;&#039;&#039;default&#039;&#039;&#039; runlevels, in that order. Shutdown uses the &#039;&#039;&#039;shutdown&#039;&#039;&#039; runlevel.&lt;br /&gt;
&lt;br /&gt;
The available runlevels are:&lt;br /&gt;
* &#039;&#039;&#039;default&#039;&#039;&#039; - Used if no runlevel is specified. (This is generally the runlevel you want to add services to.)&lt;br /&gt;
* &#039;&#039;&#039;hotplugged&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;manual&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The special runlevels are:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;sysinit&#039;&#039;&#039; - Brings up system specific stuff such as &amp;lt;code&amp;gt;/dev&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/proc&amp;lt;/code&amp;gt; and optionally &amp;lt;code&amp;gt;/sys&amp;lt;/code&amp;gt; for Linux based systems. It also mounts &amp;lt;code&amp;gt;/lib/rc/init.d&amp;lt;/code&amp;gt; as a ramdisk using tmpfs where available unless &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; is mounted rw at boot. &amp;lt;code&amp;gt;&#039;&#039;&#039;rc&#039;&#039;&#039;&amp;lt;/code&amp;gt; uses &amp;lt;code&amp;gt;/lib/rc/init.d&amp;lt;/code&amp;gt; to hold state information about the services it runs. &#039;&#039;&#039;sysinit&#039;&#039;&#039; always runs when the host first starts and should not be run again.&lt;br /&gt;
* &#039;&#039;&#039;boot&#039;&#039;&#039; - Generally, the only services that one should add to the &#039;&#039;&#039;boot&#039;&#039;&#039; runlevel are those which deal with the mounting of filesystems, setting the initial state of attached peripherals, and logging. Hotplugged services are added to the &#039;&#039;&#039;boot&#039;&#039;&#039; runlevel by the system. All services in the &#039;&#039;&#039;boot&#039;&#039;&#039; and &#039;&#039;&#039;sysinit&#039;&#039;&#039; runlevels are automatically included in all other runlevels except for those listed here.&lt;br /&gt;
* &#039;&#039;&#039;single&#039;&#039;&#039; - Stops all services except for those in the &#039;&#039;&#039;sysinit&#039;&#039;&#039; runlevel.&lt;br /&gt;
* &#039;&#039;&#039;reboot&#039;&#039;&#039; - Changes to the &#039;&#039;&#039;shutdown&#039;&#039;&#039; runlevel, and then reboots the host.&lt;br /&gt;
* &#039;&#039;&#039;shutdown&#039;&#039;&#039; - Changes to the shutdown &#039;&#039;&#039;runlevel&#039;&#039;&#039;, and then halts the host.&lt;br /&gt;
&lt;br /&gt;
=== Stacked runlevels ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Stacked&#039;&#039; runlevels allows for the &amp;quot;inheritance&amp;quot; of services. A few use cases are given below:-&lt;br /&gt;
* [https://docs.alpinelinux.org/user-handbook/0.1a/Working/openrc.html#_runlevel_stacking Running an office runlevel with VPN service]&lt;br /&gt;
* [[#Preventing slow services from delaying system startup|Preventing slow services from delaying system startup]]&lt;br /&gt;
For more detailed information, refer [https://wiki.gentoo.org/wiki/OpenRC/Stacked%20runlevel Gentoo wiki].&lt;br /&gt;
&lt;br /&gt;
== Config files == &lt;br /&gt;
&lt;br /&gt;
The main configuration file for OpenRC is {{Path|/etc/rc.conf}}. The OpenRC service scripts for each service can be found at {{Path|/etc/init.d/}} and their respective service configuration files at {{Path|/etc/conf.d/}}.&lt;br /&gt;
&lt;br /&gt;
== Command usage ==&lt;br /&gt;
&lt;br /&gt;
OpenRC provides the following commands:&lt;br /&gt;
* {{ic|rc-update}} &lt;br /&gt;
* {{ic|rc-service}}&lt;br /&gt;
* {{ic|rc-status}}&lt;br /&gt;
* {{ic|openrc}}&lt;br /&gt;
&lt;br /&gt;
To view the command usage for all OpenRC commands, use the &#039;&#039;&#039;--help&#039;&#039;&#039; or &#039;&#039;&#039;-h&#039;&#039;&#039; flag.  For eg:{{ic|$ rc-update &#039;&#039;&#039;--help&#039;&#039;&#039;}} or {{ic|$ rc-update &#039;&#039;&#039;-h&#039;&#039;&#039;}} will show usage information for {{ic|rc-update}}.&lt;br /&gt;
&lt;br /&gt;
To {{ic|start}}, {{ic|stop}} or {{ic|restart}} a service {{ic|ServiceName}} immediately at the current runlevel:&lt;br /&gt;
{{cmd|$ doas rc-service {{ic|ServiceName}} start}}&lt;br /&gt;
{{cmd|$ doas rc-service {{ic|ServiceName}} stop}}&lt;br /&gt;
&lt;br /&gt;
To {{ic|add}} or {{ic|delete}} a service to/from the sequence of services that need to start automatically in future sessions at the {{ic|boot}} runlevel: &lt;br /&gt;
{{cmd|$ doas rc-update add {{ic|ServiceName}} boot}}&lt;br /&gt;
Note that the {{ic|&#039;&#039;&#039;default&#039;&#039;&#039;}} runlevel is assumed, so it does not need to be stated explicitly:&lt;br /&gt;
{{cmd|$ doas rc-update add {{ic|ServiceName}}}}&lt;br /&gt;
{{cmd|$ doas rc-update del {{ic|ServiceName}}}}&lt;br /&gt;
&lt;br /&gt;
List the current status of all services; to display the status of all &#039;&#039;user services&#039;&#039; add &#039;&#039;&#039;-U&#039;&#039;&#039; :&lt;br /&gt;
{{cmd|$ rc-status}}&lt;br /&gt;
List the assigned runlevels of all services; to display the runlevels of &#039;&#039;user services&#039;&#039; add &#039;&#039;&#039;-U&#039;&#039;&#039; :&lt;br /&gt;
{{cmd|$ rc-update}}&lt;br /&gt;
&lt;br /&gt;
Refer to the [https://github.com/OpenRC/openrc/blob/master/user-guide.md OpenRC user guide] for more detailed information.&lt;br /&gt;
&lt;br /&gt;
== Cgroups ==&lt;br /&gt;
&lt;br /&gt;
OpenRC supports [https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html cgroups v2] in the default configuration. To enable hybrid cgroups, edit the file {{Path|/etc/rc.conf}} and change the setting for {{ic|rc_cgroup_mode}} as follows:{{Cat|/etc/rc.conf|rc_cgroup_mode{{=}}&amp;quot;hybrid&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
Then, one should run {{Cmd|# rc-service cgroups start}}&lt;br /&gt;
to take effect and {{Cmd|# rc-update add cgroups}}&lt;br /&gt;
to auto mount the cgroup filesystem on boot.&lt;br /&gt;
&lt;br /&gt;
== Local service ==&lt;br /&gt;
&lt;br /&gt;
Use the {{Path|/etc/local.d/}} directory to place programs or scripts which are to be run when the {{ic|local}} service is started or stopped.&lt;br /&gt;
&lt;br /&gt;
If a file in this directory is executable and it has a .start extension, it will be run when the local service is started. If a file is executable and it has a .stop extension, it will be run when the local service is stopped. For more info refer [https://github.com/OpenRC/openrc/blob/master/local.d/README README]&lt;br /&gt;
&lt;br /&gt;
To enable the {{ic|local}} service, issue the command:{{Cmd|# rc-update add local}}&lt;br /&gt;
&lt;br /&gt;
== Preventing slow services from delaying system startup ==&lt;br /&gt;
&lt;br /&gt;
Services that take a while to start will block the boot process until they complete. E.g.: {{ic|iwd}},{{ic|networking}},{{ic|chrony}} etc... might delay startup of an interactive system rather than start in the background. &lt;br /&gt;
&lt;br /&gt;
=== Parallel services === &lt;br /&gt;
&lt;br /&gt;
If the setting {{Codeline|rc_parallel{{=}}&amp;quot;YES&amp;quot;}} is configured, the OpenRC system tries to start services in parallel for a slight speed improvement. &lt;br /&gt;
This setting however comes with a message from openRC developers:{{Warning|whilst we have improved parallel, it can still potentially lock the boot process. Don&#039;t file bugs about this.}} &lt;br /&gt;
&lt;br /&gt;
=== Stacked runlevel method === &lt;br /&gt;
&lt;br /&gt;
Slow services can also be [https://ptrcnull.me/posts/openrc-async-services.html started after login prompt] using [[#Stacked runlevels|stacked runlevels]]. &lt;br /&gt;
{{Warning|Editing the file {{Path|&#039;&#039;&#039;/etc/inittab&#039;&#039;&#039;}} wrongly will render the system unusable. Take backup and learn to restore it using rescue disk before proceeding.}}&lt;br /&gt;
&lt;br /&gt;
# Create a custom runlevel &#039;&#039;&#039;async&#039;&#039;&#039;:  {{Cmd|# mkdir /etc/runlevels/async}}&lt;br /&gt;
# Add &#039;&#039;&#039;default&#039;&#039;&#039; as a stacked runlevel {{Cmd|# rc-update add -s default async}}&lt;br /&gt;
# Remove slow service from &#039;&#039;&#039;default&#039;&#039;&#039; runlevel and add them to the &#039;&#039;&#039;async&#039;&#039;&#039; runlevel:{{Cmd|&amp;lt;nowiki&amp;gt;# rc-update del &amp;lt;servicename&amp;gt; default&lt;br /&gt;
# rc-update add &amp;lt;servicename&amp;gt; async &amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
# Enable the &#039;&#039;&#039;async&#039;&#039;&#039; runlevel by adding the line &#039;&#039;&#039;::once:/sbin/openrc async&#039;&#039;&#039; to {{Path|/etc/inittab}} file as follows: {{Cat|/etc/inittab|&amp;lt;nowiki&amp;gt;...&lt;br /&gt;
::wait:/sbin/openrc default&lt;br /&gt;
::once:/sbin/openrc async -q&lt;br /&gt;
&lt;br /&gt;
# Set up a couple of getty&#039;s&lt;br /&gt;
tty1::respawn:/sbin/getty 38400 tty1&lt;br /&gt;
...&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
After rebooting, services from &#039;&#039;&#039;async&#039;&#039;&#039; will start separately. Other services started in &#039;&#039;&#039;default&#039;&#039;&#039; runlevel may still block [[TTY_Autologin|agetty]] from running, due to the {{ic|wait}} label.&lt;br /&gt;
&lt;br /&gt;
== User services ==&lt;br /&gt;
&lt;br /&gt;
OpenRC supports managing services for users. User services are currently experimental and available from [[Release_Notes_for_Alpine_3.22.0#OpenRC_User_services|v3.22]]. Here is the [https://pkgs.alpinelinux.org/contents?file=*&amp;amp;path=%2Fetc%2Fuser%2Finit.d&amp;amp;name=&amp;amp;branch=edge&amp;amp;repo=&amp;amp;arch=x86_64 list of OpenRC User services] available currently.&lt;br /&gt;
&lt;br /&gt;
Such services are said to be running in &#039;&#039;user mode&#039;&#039; and are managed with usual OpenRC commands using the  &#039;&#039;&#039;-U&#039;&#039;&#039; option (as distinct from the &#039;&#039;-u&#039;&#039; option), and without &#039;&#039;&#039;doas&#039;&#039;&#039; (nor as root).  &lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
&lt;br /&gt;
* [[XDG_RUNTIME_DIR]] variable must be set &lt;br /&gt;
&lt;br /&gt;
=== Config files for user services ===&lt;br /&gt;
&lt;br /&gt;
OpenRC uses {{path|$XDG_CONFIG_HOME/rc}} for its user service configuration. &amp;lt;code&amp;gt;$XDG_CONFIG_HOME&amp;lt;/code&amp;gt;, the fallback {{path|~/.config}} is used. is unset.&lt;br /&gt;
&lt;br /&gt;
The main configuration file for OpenRC User services is {{path|~/.config/rc/rc.conf}}.&lt;br /&gt;
&lt;br /&gt;
==== Runlevels ====&lt;br /&gt;
&lt;br /&gt;
Runlevels are represented by directories in {{path|$XDG_CONFIG_HOME/rc/runlevels}}. The default runlevel is &amp;lt;code&amp;gt;sysinit&amp;lt;/code&amp;gt; and needs to be created explicitly in order to be enabled:&lt;br /&gt;
&lt;br /&gt;
 mkdir -p ${XDG_CONFIG_HOME:-~/.config}/rc/runlevels/sysinit&lt;br /&gt;
&lt;br /&gt;
To start the default runlevel (&amp;lt;code&amp;gt;sysinit&amp;lt;/code&amp;gt;), use:&lt;br /&gt;
&lt;br /&gt;
 openrc -U&lt;br /&gt;
&lt;br /&gt;
To start another runlevel, use:&lt;br /&gt;
&lt;br /&gt;
 openrc -U $RUNLEVEL&lt;br /&gt;
&lt;br /&gt;
Add the above line to &amp;lt;code&amp;gt;~/.profile&amp;lt;/code&amp;gt; to automatically start the runlevel after logging in.&lt;br /&gt;
&lt;br /&gt;
If automatic start-up of a runlevel needs to be enforced by the system administrator, see [[#PAM support|PAM support]] below.&lt;br /&gt;
&lt;br /&gt;
==== Services ====&lt;br /&gt;
&lt;br /&gt;
The service scripts for each OpenRC user service provided as part of official packages can be found at {{Path|/etc/user/init.d/}} and their respective service configuration files at {{Path|/etc/user/conf.d/}}. &lt;br /&gt;
&lt;br /&gt;
The folders {{path|~/.config/rc/init.d/}} and {{path|~/.config/rc/conf.d/}} can have user customized service scripts for User services and their respective configuration files. These scripts override official files at {{Path|/etc/user/}}, if their service names match.&lt;br /&gt;
&lt;br /&gt;
=== Configure environment variables ===&lt;br /&gt;
&lt;br /&gt;
==== For Wayland ====&lt;br /&gt;
{{Tip|User services like {{pkg|wlsunset}} depend on the {{ic|$WAYLAND_DISPLAY}} environment variable. Hence, it is [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17375#note_530383 recommended] to use &#039;&#039;&#039;gui&#039;&#039;&#039; runlevel for such services. Even though [[PipeWire]] can run at &#039;&#039;&#039;default&#039;&#039;&#039; runlevel, ensure that all your User services can run at the chosen runlevel.}} &lt;br /&gt;
* Allow propagation of the {{ic|$WAYLAND_DISPLAY}} and associated environment variables by adding the following lines to file {{path|~/.config/rc/rc.conf}} as follows:{{Cat|~/.config/rc/rc.conf|&amp;lt;nowiki&amp;gt;rc_env_allow=&amp;quot;WAYLAND_DISPLAY&amp;quot;&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
* Create a custom &#039;&#039;&#039;gui&#039;&#039;&#039; user runlevel:{{Cmd|$ mkdir -p ~/.config/rc/runlevels/gui}}&lt;br /&gt;
* To start &#039;&#039;&#039;gui&#039;&#039;&#039; user runlevel, add the line {{ic|openrc -U gui}} to the startup file of your compositor. For eg, for [[Sway]] add:{{Cat|~/.config/sway/config|...&lt;br /&gt;
exec openrc -U gui}}&lt;br /&gt;
&lt;br /&gt;
==== For Xorg ====&lt;br /&gt;
&lt;br /&gt;
If [[Elogind]] is not used, ensure that [[Wayland#Creating_and_exporting_XDG_RUNTIME_DIR_manually|XDG_RUNTIME_DIR]] is set manually in {{path|~/.xinitrc}}. For eg, for [[dwm]] add:{{Cat|~/.xinitrc|&amp;lt;nowiki&amp;gt;...&lt;br /&gt;
if [ -z &amp;quot;$XDG_RUNTIME_DIR&amp;quot; ]; then&lt;br /&gt;
	XDG_RUNTIME_DIR=&amp;quot;/tmp/$(id -u)-runtime-dir&amp;quot;&lt;br /&gt;
	mkdir -pm 0700 &amp;quot;$XDG_RUNTIME_DIR&amp;quot;&lt;br /&gt;
	export XDG_RUNTIME_DIR&lt;br /&gt;
fi&lt;br /&gt;
openrc -U default&lt;br /&gt;
exec dwm&amp;lt;/nowiki&amp;gt;}} &lt;br /&gt;
&lt;br /&gt;
{{Note|For both the above cases, logout and login for the OpenRC user services to be started, before proceeding further.}}&lt;br /&gt;
&lt;br /&gt;
=== User service management ===&lt;br /&gt;
&lt;br /&gt;
Issue the command {{ic|$ rc-status -Ur}} to view and verify the current user runlevel as &#039;&#039;&#039;gui&#039;&#039;&#039; and &#039;&#039;&#039;default&#039;&#039;&#039; for Wayland and Xorg, respectively, before proceeding. &lt;br /&gt;
&lt;br /&gt;
To start {{ic|ServiceName}} user service, issue the command:{{Cmd|$ rc-service -U {{ic|ServiceName}} start}}&lt;br /&gt;
Verify that the above OpenRC user service is started before proceeding further: {{Cmd|$ rc-status -U}} &lt;br /&gt;
To enable {{ic|ServiceName}} user service, issue the command: {{Cmd|$ rc-update -U add ServiceName}}&lt;br /&gt;
&lt;br /&gt;
{{Tip|Once a user service is configured, to prevent duplicate instance, remove them from {{Path|/etc/xdg/autostart}} folder or from the startup/config file.}}&lt;br /&gt;
&lt;br /&gt;
=== PAM support ===&lt;br /&gt;
&lt;br /&gt;
The default installation of OpenRC user services in Alpine Linux is without PAM support.&lt;br /&gt;
&lt;br /&gt;
In scenarios where services should not be allowed to [https://wiki.gentoo.org/wiki/OpenRC#lingering linger] on logout, PAM support for OpenRC user services can be enabled by installing the {{pkg|openrc-user-pam}} package.{{Cmd|# apk add {{pkg|openrc-user-pam}}}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
Whenever a openRC service fails to run, troubleshoot by enabling a debugging option, and then run the command. &lt;br /&gt;
&lt;br /&gt;
For example, if running the command {{ic|rc-service greetd start}} causes the [[Greetd|greetd]] service to immediately crash, then alter the command to enable debug and to view its output:{{Cmd|# rc-service -d greetd restart}}&lt;br /&gt;
&lt;br /&gt;
=== XDG_RUNTIME_DIR unset ===&lt;br /&gt;
&lt;br /&gt;
While configuring [[#User services|user services]], running the command {{ic|$ doas rc-update add -U pipewire gui}} will generate the above error {{ic|XDG_RUNTIME_DIR unset}}.  Always issue the command as normal user {{ic|$ rc-update add -U pipewire gui}} and do NOT use {{ic|doas}}. &lt;br /&gt;
&lt;br /&gt;
=== ERROR: user.greetd failed to start ===&lt;br /&gt;
&lt;br /&gt;
While using [[#User services|user services]] with [[greetd]], the above error message will appear. This failed error message for {{ic|user.greetd}} service is harmless as per {{MR|81612#note_492385}}.&lt;br /&gt;
&lt;br /&gt;
=== failed to create display ===&lt;br /&gt;
&lt;br /&gt;
When using openRC user services for {{ic|wlsunset}}, the following  error message may appear:{{Cmd|daemon.err wlsunset: failed to create display}}You will need the GUI runlevel for services that depend on {{ic|$WAYLAND_DISPLAY}}. Refer [[#For Wayland| Configure environment variables For Wayland]] section.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Writing Init Scripts]]&lt;br /&gt;
* [[Multiple Instances of Services]]&lt;br /&gt;
* [https://github.com/OpenRC/openrc/blob/master/user-guide.md OpenRC user Guide]&lt;br /&gt;
* [https://github.com/OpenRC/openrc/blob/master/service-script-guide.md OpenRC Service Script Writing Guide]&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/OpenRC Gentoo Wiki]&lt;br /&gt;
* [https://wiki.archlinux.org/title/OpenRC ArchWiki]&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/OpenRC PostmarketOS Wiki]&lt;br /&gt;
* [https://ptrcnull.me/posts/openrc-async-services.html Start services after login prompt]&lt;br /&gt;
&lt;br /&gt;
[[Category:Booting]] &lt;br /&gt;
[[Category:System Administration]]&lt;br /&gt;
[[Category:Services]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=OpenRC&amp;diff=30868</id>
		<title>OpenRC</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=OpenRC&amp;diff=30868"/>
		<updated>2025-09-05T12:54:13Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: /* Config files for user services */ hint on .profile&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Alpine Linux uses [https://github.com/OpenRC/ OpenRC] for its [https://en.wikipedia.org/wiki/Init init] system. The init system manages the services, including the boot and shutdown of your system. OpenRC also supports managing [[#User services|services for users]]. &lt;br /&gt;
&lt;br /&gt;
To learn the basics of OpenRC quickly, refer to the [https://docs.alpinelinux.org/user-handbook/0.1a/Working/openrc.html working with OpenRC] guide from the Alpine Linux documentation project. &lt;br /&gt;
&lt;br /&gt;
== Quickstart  ==&lt;br /&gt;
&lt;br /&gt;
{|align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| width=&amp;quot;50%&amp;quot; |Action&lt;br /&gt;
|             |Command&lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039;Managing a service - start,stop and restart&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Start {{ic|ServiceName}} now || {{ic|# rc-service {{ic|ServiceName}} start}}&lt;br /&gt;
|-&lt;br /&gt;
| Stop {{ic|ServiceName}} now || {{ic|# rc-service {{ic|ServiceName}} stop}} &lt;br /&gt;
|-&lt;br /&gt;
| Restart {{ic|ServiceName}} now || {{ic|# rc-service {{ic|ServiceName}} restart}} &lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039;Adding and removing service from runlevels&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Add {{ic|ServiceName}} to {{ic|runlevel}} || {{ic|# rc-update add {{ic|ServiceName}} {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
| Remove {{ic|ServiceName}} from {{ic|runlevel}} || {{ic|# rc-update del {{ic|ServiceName}} {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039; Check services in a runlevel and their status&#039;&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| To check status of {{ic|ServiceName}} || {{ic|$ rc-service {{ic|ServiceName}} status}} &lt;br /&gt;
|-&lt;br /&gt;
| To view services configured at {{ic|runlevel}}  || {{ic|$ rc-update show {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
| To view currently active runlevels and state of services  || {{ic|$ rc-status}} &lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039; Check and manage runlevels&#039;&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| To view available runlevels || {{ic|$ rc-status -l}} &lt;br /&gt;
|-&lt;br /&gt;
| To change to a different {{ic|runlevel}} || {{ic|# openrc {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039; Stacked runlevels&#039;&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| To add {{ic|s-runlevel}} as a stacked {{ic|runlevel}} || {{ic|# rc-update add -s {{ic|s-runlevel}} {{ic|runlevel}}}} &lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |&#039;&#039;&#039;User Services&#039;&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| To view currently active User runlevels and state of User services || {{ic|$ rc-status -U}} &lt;br /&gt;
|-&lt;br /&gt;
| To change to a different user {{ic|runlevel}} || {{ic|$ openrc -U {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
| Add User {{ic|ServiceName}} to user {{ic|runlevel}} || {{ic|$ rc-update -U add {{ic|ServiceName}} {{ic|runlevel}}}} &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Runlevels ==&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;runlevel&#039;&#039; is basically a collection of services that needs to be started when certain conditions are met. Instead of using runlevel numbers, such as is used traditionally with &#039;&#039;SysV&#039;&#039; init, these are named, and users can create their own, if needed. The default startup uses the &#039;&#039;&#039;sysinit&#039;&#039;&#039;, &#039;&#039;&#039;boot&#039;&#039;&#039;, and &#039;&#039;&#039;default&#039;&#039;&#039; runlevels, in that order. Shutdown uses the &#039;&#039;&#039;shutdown&#039;&#039;&#039; runlevel.&lt;br /&gt;
&lt;br /&gt;
The available runlevels are:&lt;br /&gt;
* &#039;&#039;&#039;default&#039;&#039;&#039; - Used if no runlevel is specified. (This is generally the runlevel you want to add services to.)&lt;br /&gt;
* &#039;&#039;&#039;hotplugged&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;manual&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The special runlevels are:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;sysinit&#039;&#039;&#039; - Brings up system specific stuff such as &amp;lt;code&amp;gt;/dev&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/proc&amp;lt;/code&amp;gt; and optionally &amp;lt;code&amp;gt;/sys&amp;lt;/code&amp;gt; for Linux based systems. It also mounts &amp;lt;code&amp;gt;/lib/rc/init.d&amp;lt;/code&amp;gt; as a ramdisk using tmpfs where available unless &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; is mounted rw at boot. &amp;lt;code&amp;gt;&#039;&#039;&#039;rc&#039;&#039;&#039;&amp;lt;/code&amp;gt; uses &amp;lt;code&amp;gt;/lib/rc/init.d&amp;lt;/code&amp;gt; to hold state information about the services it runs. &#039;&#039;&#039;sysinit&#039;&#039;&#039; always runs when the host first starts and should not be run again.&lt;br /&gt;
* &#039;&#039;&#039;boot&#039;&#039;&#039; - Generally, the only services that one should add to the &#039;&#039;&#039;boot&#039;&#039;&#039; runlevel are those which deal with the mounting of filesystems, setting the initial state of attached peripherals, and logging. Hotplugged services are added to the &#039;&#039;&#039;boot&#039;&#039;&#039; runlevel by the system. All services in the &#039;&#039;&#039;boot&#039;&#039;&#039; and &#039;&#039;&#039;sysinit&#039;&#039;&#039; runlevels are automatically included in all other runlevels except for those listed here.&lt;br /&gt;
* &#039;&#039;&#039;single&#039;&#039;&#039; - Stops all services except for those in the &#039;&#039;&#039;sysinit&#039;&#039;&#039; runlevel.&lt;br /&gt;
* &#039;&#039;&#039;reboot&#039;&#039;&#039; - Changes to the &#039;&#039;&#039;shutdown&#039;&#039;&#039; runlevel, and then reboots the host.&lt;br /&gt;
* &#039;&#039;&#039;shutdown&#039;&#039;&#039; - Changes to the shutdown &#039;&#039;&#039;runlevel&#039;&#039;&#039;, and then halts the host.&lt;br /&gt;
&lt;br /&gt;
=== Stacked runlevels ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Stacked&#039;&#039; runlevels allows for the &amp;quot;inheritance&amp;quot; of services. A few use cases are given below:-&lt;br /&gt;
* [https://docs.alpinelinux.org/user-handbook/0.1a/Working/openrc.html#_runlevel_stacking Running an office runlevel with VPN service]&lt;br /&gt;
* [[#Preventing slow services from delaying system startup|Preventing slow services from delaying system startup]]&lt;br /&gt;
For more detailed information, refer [https://wiki.gentoo.org/wiki/OpenRC/Stacked%20runlevel Gentoo wiki].&lt;br /&gt;
&lt;br /&gt;
== Config files == &lt;br /&gt;
&lt;br /&gt;
The main configuration file for OpenRC is {{Path|/etc/rc.conf}}. The OpenRC service scripts for each service can be found at {{Path|/etc/init.d/}} and their respective service configuration files at {{Path|/etc/conf.d/}}.&lt;br /&gt;
&lt;br /&gt;
== Command usage ==&lt;br /&gt;
&lt;br /&gt;
OpenRC provides the following commands:&lt;br /&gt;
* {{ic|rc-update}} &lt;br /&gt;
* {{ic|rc-service}}&lt;br /&gt;
* {{ic|rc-status}}&lt;br /&gt;
* {{ic|openrc}}&lt;br /&gt;
&lt;br /&gt;
To view the command usage for all OpenRC commands, use the &#039;&#039;&#039;--help&#039;&#039;&#039; or &#039;&#039;&#039;-h&#039;&#039;&#039; flag.  For eg:{{ic|$ rc-update &#039;&#039;&#039;--help&#039;&#039;&#039;}} or {{ic|$ rc-update &#039;&#039;&#039;-h&#039;&#039;&#039;}} will show usage information for {{ic|rc-update}}.&lt;br /&gt;
&lt;br /&gt;
To {{ic|start}}, {{ic|stop}} or {{ic|restart}} a service {{ic|ServiceName}} immediately at the current runlevel:&lt;br /&gt;
{{cmd|$ doas rc-service {{ic|ServiceName}} start}}&lt;br /&gt;
{{cmd|$ doas rc-service {{ic|ServiceName}} stop}}&lt;br /&gt;
&lt;br /&gt;
To {{ic|add}} or {{ic|delete}} a service to/from the sequence of services that need to start automatically in future sessions at the {{ic|boot}} runlevel: &lt;br /&gt;
{{cmd|$ doas rc-update add {{ic|ServiceName}} boot}}&lt;br /&gt;
Note that the {{ic|&#039;&#039;&#039;default&#039;&#039;&#039;}} runlevel is assumed, so it does not need to be stated explicitly:&lt;br /&gt;
{{cmd|$ doas rc-update add {{ic|ServiceName}}}}&lt;br /&gt;
{{cmd|$ doas rc-update del {{ic|ServiceName}}}}&lt;br /&gt;
&lt;br /&gt;
List the current status of all services; to display the status of all &#039;&#039;user services&#039;&#039; add &#039;&#039;&#039;-U&#039;&#039;&#039; :&lt;br /&gt;
{{cmd|$ rc-status}}&lt;br /&gt;
List the assigned runlevels of all services; to display the runlevels of &#039;&#039;user services&#039;&#039; add &#039;&#039;&#039;-U&#039;&#039;&#039; :&lt;br /&gt;
{{cmd|$ rc-update}}&lt;br /&gt;
&lt;br /&gt;
Refer to the [https://github.com/OpenRC/openrc/blob/master/user-guide.md OpenRC user guide] for more detailed information.&lt;br /&gt;
&lt;br /&gt;
== Cgroups ==&lt;br /&gt;
&lt;br /&gt;
OpenRC supports [https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html cgroups v2] in the default configuration. To enable hybrid cgroups, edit the file {{Path|/etc/rc.conf}} and change the setting for {{ic|rc_cgroup_mode}} as follows:{{Cat|/etc/rc.conf|rc_cgroup_mode{{=}}&amp;quot;hybrid&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
Then, one should run {{Cmd|# rc-service cgroups start}}&lt;br /&gt;
to take effect and {{Cmd|# rc-update add cgroups}}&lt;br /&gt;
to auto mount the cgroup filesystem on boot.&lt;br /&gt;
&lt;br /&gt;
== Local service ==&lt;br /&gt;
&lt;br /&gt;
Use the {{Path|/etc/local.d/}} directory to place programs or scripts which are to be run when the {{ic|local}} service is started or stopped.&lt;br /&gt;
&lt;br /&gt;
If a file in this directory is executable and it has a .start extension, it will be run when the local service is started. If a file is executable and it has a .stop extension, it will be run when the local service is stopped. For more info refer [https://github.com/OpenRC/openrc/blob/master/local.d/README README]&lt;br /&gt;
&lt;br /&gt;
To enable the {{ic|local}} service, issue the command:{{Cmd|# rc-update add local}}&lt;br /&gt;
&lt;br /&gt;
== Preventing slow services from delaying system startup ==&lt;br /&gt;
&lt;br /&gt;
Services that take a while to start will block the boot process until they complete. E.g.: {{ic|iwd}},{{ic|networking}},{{ic|chrony}} etc... might delay startup of an interactive system rather than start in the background. &lt;br /&gt;
&lt;br /&gt;
=== Parallel services === &lt;br /&gt;
&lt;br /&gt;
If the setting {{Codeline|rc_parallel{{=}}&amp;quot;YES&amp;quot;}} is configured, the OpenRC system tries to start services in parallel for a slight speed improvement. &lt;br /&gt;
This setting however comes with a message from openRC developers:{{Warning|whilst we have improved parallel, it can still potentially lock the boot process. Don&#039;t file bugs about this.}} &lt;br /&gt;
&lt;br /&gt;
=== Stacked runlevel method === &lt;br /&gt;
&lt;br /&gt;
Slow services can also be [https://ptrcnull.me/posts/openrc-async-services.html started after login prompt] using [[#Stacked runlevels|stacked runlevels]]. &lt;br /&gt;
{{Warning|Editing the file {{Path|&#039;&#039;&#039;/etc/inittab&#039;&#039;&#039;}} wrongly will render the system unusable. Take backup and learn to restore it using rescue disk before proceeding.}}&lt;br /&gt;
&lt;br /&gt;
# Create a custom runlevel &#039;&#039;&#039;async&#039;&#039;&#039;:  {{Cmd|# mkdir /etc/runlevels/async}}&lt;br /&gt;
# Add &#039;&#039;&#039;default&#039;&#039;&#039; as a stacked runlevel {{Cmd|# rc-update add -s default async}}&lt;br /&gt;
# Remove slow service from &#039;&#039;&#039;default&#039;&#039;&#039; runlevel and add them to the &#039;&#039;&#039;async&#039;&#039;&#039; runlevel:{{Cmd|&amp;lt;nowiki&amp;gt;# rc-update del &amp;lt;servicename&amp;gt; default&lt;br /&gt;
# rc-update add &amp;lt;servicename&amp;gt; async &amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
# Enable the &#039;&#039;&#039;async&#039;&#039;&#039; runlevel by adding the line &#039;&#039;&#039;::once:/sbin/openrc async&#039;&#039;&#039; to {{Path|/etc/inittab}} file as follows: {{Cat|/etc/inittab|&amp;lt;nowiki&amp;gt;...&lt;br /&gt;
::wait:/sbin/openrc default&lt;br /&gt;
::once:/sbin/openrc async -q&lt;br /&gt;
&lt;br /&gt;
# Set up a couple of getty&#039;s&lt;br /&gt;
tty1::respawn:/sbin/getty 38400 tty1&lt;br /&gt;
...&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
After rebooting, services from &#039;&#039;&#039;async&#039;&#039;&#039; will start separately. Other services started in &#039;&#039;&#039;default&#039;&#039;&#039; runlevel may still block [[TTY_Autologin|agetty]] from running, due to the {{ic|wait}} label.&lt;br /&gt;
&lt;br /&gt;
== User services ==&lt;br /&gt;
&lt;br /&gt;
OpenRC supports managing services for users. User services are currently experimental and available from [[Release_Notes_for_Alpine_3.22.0#OpenRC_User_services|v3.22]]. Here is the [https://pkgs.alpinelinux.org/contents?file=*&amp;amp;path=%2Fetc%2Fuser%2Finit.d&amp;amp;name=&amp;amp;branch=edge&amp;amp;repo=&amp;amp;arch=x86_64 list of OpenRC User services] available currently.&lt;br /&gt;
&lt;br /&gt;
Such services are said to be running in &#039;&#039;user mode&#039;&#039; and are managed with usual OpenRC commands using the  &#039;&#039;&#039;-U&#039;&#039;&#039; option (as distinct from the &#039;&#039;-u&#039;&#039; option), and without &#039;&#039;&#039;doas&#039;&#039;&#039; (nor as root).  &lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
&lt;br /&gt;
* [[XDG_RUNTIME_DIR]] variable must be set &lt;br /&gt;
&lt;br /&gt;
=== Config files for user services ===&lt;br /&gt;
&lt;br /&gt;
OpenRC uses {{path|$XDG_CONFIG_HOME/rc}} for its user service configuration. &amp;lt;code&amp;gt;$XDG_CONFIG_HOME&amp;lt;/code&amp;gt;, the fallback {{path|~/.config}} is used. is unset.&lt;br /&gt;
&lt;br /&gt;
The main configuration file for OpenRC User services is {{path|~/.config/rc/rc.conf}}.&lt;br /&gt;
&lt;br /&gt;
==== Runlevels ====&lt;br /&gt;
&lt;br /&gt;
Runlevels are represented by directories in {{path|$XDG_CONFIG_HOME/rc/runlevels}}. The default runlevel is &amp;lt;code&amp;gt;sysinit&amp;lt;/code&amp;gt; and needs to be created explicitly in order to be enabled:&lt;br /&gt;
&lt;br /&gt;
 mkdir -p ${XDG_CONFIG_HOME:-~/.config}/rc/runlevels/sysinit&lt;br /&gt;
&lt;br /&gt;
To start the default runlevel (&amp;lt;code&amp;gt;sysinit&amp;lt;/code&amp;gt;), use:&lt;br /&gt;
&lt;br /&gt;
 openrc -U&lt;br /&gt;
&lt;br /&gt;
To start another runlevel, use:&lt;br /&gt;
&lt;br /&gt;
 openrc -U $RUNLEVEL&lt;br /&gt;
&lt;br /&gt;
Add the above line to &amp;lt;code&amp;gt;~/.profile&amp;lt;/code&amp;gt; to automatically start the runlevel after logging in.&lt;br /&gt;
&lt;br /&gt;
If automatic start-up of a runlevel needs to be enforced by the system administrator, see [[#PAM support|PAM support]] below.&lt;br /&gt;
&lt;br /&gt;
==== Services ====&lt;br /&gt;
&lt;br /&gt;
The service scripts for each OpenRC user service provided as part of official packages can be found at {{Path|/etc/user/init.d/}} and their respective service configuration files at {{Path|/etc/user/conf.d/}}. &lt;br /&gt;
&lt;br /&gt;
The folders {{path|~/.config/rc/init.d/}} and {{path|~/.config/rc/conf.d/}} can have user customized service scripts for User services and their respective configuration files. These scripts override official files at {{Path|/etc/user/}}, if their service names match.&lt;br /&gt;
&lt;br /&gt;
=== Configure environment variables ===&lt;br /&gt;
&lt;br /&gt;
==== For Wayland ====&lt;br /&gt;
{{Tip|User services like {{pkg|wlsunset}} depend on the {{ic|$WAYLAND_DISPLAY}} environment variable. Hence, it is [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17375#note_530383 recommended] to use &#039;&#039;&#039;gui&#039;&#039;&#039; runlevel for such services. Even though [[PipeWire]] can run at &#039;&#039;&#039;default&#039;&#039;&#039; runlevel, ensure that all your User services can run at the chosen runlevel.}} &lt;br /&gt;
* Allow propagation of the {{ic|$WAYLAND_DISPLAY}} and associated environment variables by adding the following lines to file {{path|~/.config/rc/rc.conf}} as follows:{{Cat|~/.config/rc/rc.conf|&amp;lt;nowiki&amp;gt;rc_env_allow=&amp;quot;WAYLAND_DISPLAY&amp;quot;&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
* Create a custom &#039;&#039;&#039;gui&#039;&#039;&#039; user runlevel:{{Cmd|$ mkdir -p ~/.config/rc/runlevels/gui}}&lt;br /&gt;
* To start &#039;&#039;&#039;gui&#039;&#039;&#039; user runlevel, add the line {{ic|openrc -U gui}} to the startup file of your compositor. For eg, for [[Sway]] add:{{Cat|~/.config/sway/config|...&lt;br /&gt;
exec openrc -U gui}}&lt;br /&gt;
&lt;br /&gt;
==== For Xorg ====&lt;br /&gt;
&lt;br /&gt;
If [[Elogind]] is not used, ensure that [[Wayland#Creating_and_exporting_XDG_RUNTIME_DIR_manually|XDG_RUNTIME_DIR]] is set manually in {{path|~/.xinitrc}}. For eg, for [[dwm]] add:{{Cat|~/.xinitrc|&amp;lt;nowiki&amp;gt;...&lt;br /&gt;
if [ -z &amp;quot;$XDG_RUNTIME_DIR&amp;quot; ]; then&lt;br /&gt;
	XDG_RUNTIME_DIR=&amp;quot;/tmp/$(id -u)-runtime-dir&amp;quot;&lt;br /&gt;
	mkdir -pm 0700 &amp;quot;$XDG_RUNTIME_DIR&amp;quot;&lt;br /&gt;
	export XDG_RUNTIME_DIR&lt;br /&gt;
fi&lt;br /&gt;
openrc -U default&lt;br /&gt;
exec dwm&amp;lt;/nowiki&amp;gt;}} &lt;br /&gt;
&lt;br /&gt;
{{Note|For both the above cases, logout and login for the OpenRC user services to be started, before proceeding further.}}&lt;br /&gt;
&lt;br /&gt;
=== User service management ===&lt;br /&gt;
&lt;br /&gt;
Issue the command {{ic|$ rc-status -Ur}} to view and verify the current user runlevel as &#039;&#039;&#039;gui&#039;&#039;&#039; and &#039;&#039;&#039;default&#039;&#039;&#039; for Wayland and Xorg, respectively, before proceeding. &lt;br /&gt;
&lt;br /&gt;
To start {{ic|ServiceName}} user service, issue the command:{{Cmd|$ rc-service -U {{ic|ServiceName}} start}}&lt;br /&gt;
Verify that the above OpenRC user service is started before proceeding further: {{Cmd|$ rc-status -U}} &lt;br /&gt;
To enable {{ic|ServiceName}} user service, issue the command: {{Cmd|$ rc-update -U add ServiceName}}&lt;br /&gt;
&lt;br /&gt;
{{Tip|Once a user service is configured, to prevent duplicate instance, remove them from {{Path|/etc/xdg/autostart}} folder or from the startup/config file.}}&lt;br /&gt;
&lt;br /&gt;
=== PAM support ===&lt;br /&gt;
&lt;br /&gt;
The default installation of OpenRC user services in Alpine Linux is without PAM support.&lt;br /&gt;
&lt;br /&gt;
In scenarios where services should not be allowed to [https://wiki.gentoo.org/wiki/OpenRC#lingering linger] on logout, PAM support for OpenRC user services can be enabled by installing the {{pkg|openrc-user-pam}} package.{{Cmd|# apk add {{pkg|openrc-user-pam}}}}&lt;br /&gt;
&lt;br /&gt;
{{Warning|Starting services via PAM will start them before the user session initialises, which can lead them to fail in unexpected way due to missing preconditions. E.g.: because the [[XDG_RUNTIME_DIR]] is not yet initialised.}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
Whenever a openRC service fails to run, troubleshoot by enabling a debugging option, and then run the command. &lt;br /&gt;
&lt;br /&gt;
For example, if running the command {{ic|rc-service greetd start}} causes the [[Greetd|greetd]] service to immediately crash, then alter the command to enable debug and to view its output:{{Cmd|# rc-service -d greetd restart}}&lt;br /&gt;
&lt;br /&gt;
=== XDG_RUNTIME_DIR unset ===&lt;br /&gt;
&lt;br /&gt;
While configuring [[#User services|user services]], running the command {{ic|$ doas rc-update add -U pipewire gui}} will generate the above error {{ic|XDG_RUNTIME_DIR unset}}.  Always issue the command as normal user {{ic|$ rc-update add -U pipewire gui}} and do NOT use {{ic|doas}}. &lt;br /&gt;
&lt;br /&gt;
=== ERROR: user.greetd failed to start ===&lt;br /&gt;
&lt;br /&gt;
While using [[#User services|user services]] with [[greetd]], the above error message will appear. This failed error message for {{ic|user.greetd}} service is harmless as per {{MR|81612#note_492385}}.&lt;br /&gt;
&lt;br /&gt;
=== failed to create display ===&lt;br /&gt;
&lt;br /&gt;
When using openRC user services for {{ic|wlsunset}}, the following  error message may appear:{{Cmd|daemon.err wlsunset: failed to create display}}You will need the GUI runlevel for services that depend on {{ic|$WAYLAND_DISPLAY}}. Refer [[#For Wayland| Configure environment variables For Wayland]] section.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Writing Init Scripts]]&lt;br /&gt;
* [[Multiple Instances of Services]]&lt;br /&gt;
* [https://github.com/OpenRC/openrc/blob/master/user-guide.md OpenRC user Guide]&lt;br /&gt;
* [https://github.com/OpenRC/openrc/blob/master/service-script-guide.md OpenRC Service Script Writing Guide]&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/OpenRC Gentoo Wiki]&lt;br /&gt;
* [https://wiki.archlinux.org/title/OpenRC ArchWiki]&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/OpenRC PostmarketOS Wiki]&lt;br /&gt;
* [https://ptrcnull.me/posts/openrc-async-services.html Start services after login prompt]&lt;br /&gt;
&lt;br /&gt;
[[Category:Booting]] &lt;br /&gt;
[[Category:System Administration]]&lt;br /&gt;
[[Category:Services]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Writing_Init_Scripts&amp;diff=30867</id>
		<title>Writing Init Scripts</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Writing_Init_Scripts&amp;diff=30867"/>
		<updated>2025-09-05T12:52:41Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: /* Things to avoid */ this advice runs contrary to upstream advise, and users can still disable this by using &amp;#039;unset&amp;#039; in conf.d&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
Alpine Linux uses the [https://github.com/OpenRC/openrc OpenRC] init system to start services. Don&#039;t confuse OpenRC init with our system init (the first process that is executed aka pid 1). Many of the current init.d script found in Alpine Linux are taken from Gentoo. If you want to save time you could search [https://packages.gentoo.org/categories Gentoo&#039;s repository] for an existing initscript for your service. You can also check [https://wiki.gentoo.org/wiki/Handbook:X86/Working/Initscripts#Writing_initscripts Gentoo&#039;s wiki] for some additional OpenRC information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;NOTE&amp;lt;/strong&amp;gt;: OpenRC recently added [https://github.com/OpenRC/openrc/blob/master/service-script-guide.md documentation] on how to write proper Init scripts. Make sure you read it!&lt;br /&gt;
&lt;br /&gt;
If you cannot find an init.d script from Gentoo, or you just want to start to write your own init.d scripts, we provide you with some basic information on how to write simple OpenRC init scripts.&lt;br /&gt;
&lt;br /&gt;
Primary information about the OpenRC format can be found in the [https://manpages.org/openrc-run/8 OpenRC man page openrc-run].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apk add openrc-doc&lt;br /&gt;
man openrc-run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Things to avoid ==&lt;br /&gt;
&lt;br /&gt;
* Prefer standard OpenRC variables such as &amp;lt;code&amp;gt;command_args&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;command_user&amp;lt;/code&amp;gt; etc. (see [https://www.mankier.com/8/openrc-run openrc-run(8)]); do not create unnecessary config variables like &amp;lt;code&amp;gt;FOO_OPTS&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;FOO_USER&amp;lt;/code&amp;gt; etc. If you want to predefine the default value in init.d script, use common idiom &amp;lt;code&amp;gt;: ${command_user=foo}&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* Use snake_case for naming extra configuration variables (to be consistent with the OpenRC variables and other init scripts in Alpine). Do not prefix them with the service name, try to be consistent with existing init scripts (e.g. &amp;lt;code&amp;gt;cfgfile&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;cfgdir&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;logfile&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;cachedir&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;listen_on&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;start_wait&amp;lt;/code&amp;gt;, …).&lt;br /&gt;
&lt;br /&gt;
== Minimal Templates ==&lt;br /&gt;
&lt;br /&gt;
Every init.d script you write needs to start with a [https://en.wikipedia.org/wiki/Shebang_(Unix) shebang] like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;#!/sbin/openrc-run&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Services relying on OpenRC exclusively ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/sbin/openrc-run&lt;br /&gt;
&lt;br /&gt;
command=/path/to/command&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Services supervised by [https://www.skarnet.org/software/s6/ s6] ===&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* Install and configure the &amp;lt;code&amp;gt;s6-scan&amp;lt;/code&amp;gt; service to start on system boot&lt;br /&gt;
* Exclude &amp;lt;code&amp;gt;start()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;stop()&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;status()&amp;lt;/code&amp;gt; functions in order for s6 supervision to work reliably. OpenRC has built-in equivalent functions which invoke the necessary s6 commands.&lt;br /&gt;
* Include a &amp;lt;code&amp;gt;depend()&amp;lt;/code&amp;gt; stanza to ensure that the &amp;lt;code&amp;gt;s6-svscan&amp;lt;/code&amp;gt; service is already running.&lt;br /&gt;
* Add a &amp;lt;code&amp;gt;start_pre()&amp;lt;/code&amp;gt; stanza to symlink the service directory into the scan directory, because the &amp;lt;code&amp;gt;/etc/init.d/bootmisc&amp;lt;/code&amp;gt; scripts cleans out the &amp;lt;code&amp;gt;/run&amp;lt;/code&amp;gt; directory on system boot.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/sbin/openrc-run&lt;br /&gt;
&lt;br /&gt;
name=&amp;quot;foo&amp;quot;&lt;br /&gt;
supervisor=&amp;quot;s6&amp;quot;&lt;br /&gt;
s6_service_path=&amp;quot;${RC_SVCDIR}/s6-scan/${name}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
depend() {&lt;br /&gt;
    need s6-svscan&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
start_pre() {&lt;br /&gt;
    if [ ! -L &amp;quot;${RC_SVC_DIR}/s6-scan/${name}&amp;quot; ]; then&lt;br /&gt;
        ln -s &amp;quot;/path/to/${name}/service/dir&amp;quot; &amp;quot;${RC_SVCDIR}/s6-scan/${name}&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The rest of the below basic example could be omitted, but that would most probably leave you with an non working initd script.&lt;br /&gt;
&lt;br /&gt;
== Basic example ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/sbin/openrc-run&lt;br /&gt;
  &lt;br /&gt;
name=$RC_SVCNAME&lt;br /&gt;
cfgfile=&amp;quot;/etc/$RC_SVCNAME/$RC_SVCNAME.conf&amp;quot;&lt;br /&gt;
command=&amp;quot;/usr/bin/my_daemon&amp;quot;&lt;br /&gt;
command_args=&amp;quot;--my-daemon-args&amp;quot;&lt;br /&gt;
command_user=&amp;quot;my_system_user&amp;quot;&lt;br /&gt;
pidfile=&amp;quot;/run/$RC_SVCNAME/$RC_SVCNAME.pid&amp;quot;&lt;br /&gt;
start_stop_daemon_args=&amp;quot;--args-for-start-stop-daemon&amp;quot;&lt;br /&gt;
command_background=&amp;quot;yes&amp;quot;&lt;br /&gt;
&lt;br /&gt;
depend() {&lt;br /&gt;
        need net&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
start_pre() {&lt;br /&gt;
        checkpath --directory --owner $command_user:$command_user --mode 0775 \&lt;br /&gt;
                /run/$RC_SVCNAME /var/log/$RC_SVCNAME&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== start, stop, restart functions ==&lt;br /&gt;
&lt;br /&gt;
OpenRC defined a few basic functions ie: start, stop, restart. These functions are defined by default but can be overwritten by defining your own set of functions.&lt;br /&gt;
This is generally only necessary if you want to do something special which is not provided by the default start/stop/restart implementations.&lt;br /&gt;
&lt;br /&gt;
=== start ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
start() {&lt;br /&gt;
    ebegin &amp;quot;Starting mydaemon&amp;quot;&lt;br /&gt;
    start-stop-daemon --start \&lt;br /&gt;
        --exec /usr/sbin/mydaemon \&lt;br /&gt;
        --pidfile /var/run/mydaemon.pid \&lt;br /&gt;
        -- \&lt;br /&gt;
        --args-for-mydaemon&lt;br /&gt;
    eend $?&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== stop ===&lt;br /&gt;
&lt;br /&gt;
=== restart ===&lt;br /&gt;
&lt;br /&gt;
== Daemon, Forking, Logging ==&lt;br /&gt;
&lt;br /&gt;
TODO...&lt;br /&gt;
&lt;br /&gt;
[[Category:Booting]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=OpenRC&amp;diff=30866</id>
		<title>OpenRC</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=OpenRC&amp;diff=30866"/>
		<updated>2025-09-05T12:50:57Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: /* PAM support */ warn about pam initialising services&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Alpine Linux uses [https://github.com/OpenRC/ OpenRC] for its [https://en.wikipedia.org/wiki/Init init] system. The init system manages the services, including the boot and shutdown of your system. OpenRC also supports managing [[#User services|services for users]]. &lt;br /&gt;
&lt;br /&gt;
To learn the basics of OpenRC quickly, refer to the [https://docs.alpinelinux.org/user-handbook/0.1a/Working/openrc.html working with OpenRC] guide from the Alpine Linux documentation project. &lt;br /&gt;
&lt;br /&gt;
== Quickstart  ==&lt;br /&gt;
&lt;br /&gt;
{|align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| width=&amp;quot;50%&amp;quot; |Action&lt;br /&gt;
|             |Command&lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039;Managing a service - start,stop and restart&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Start {{ic|ServiceName}} now || {{ic|# rc-service {{ic|ServiceName}} start}}&lt;br /&gt;
|-&lt;br /&gt;
| Stop {{ic|ServiceName}} now || {{ic|# rc-service {{ic|ServiceName}} stop}} &lt;br /&gt;
|-&lt;br /&gt;
| Restart {{ic|ServiceName}} now || {{ic|# rc-service {{ic|ServiceName}} restart}} &lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039;Adding and removing service from runlevels&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Add {{ic|ServiceName}} to {{ic|runlevel}} || {{ic|# rc-update add {{ic|ServiceName}} {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
| Remove {{ic|ServiceName}} from {{ic|runlevel}} || {{ic|# rc-update del {{ic|ServiceName}} {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039; Check services in a runlevel and their status&#039;&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| To check status of {{ic|ServiceName}} || {{ic|$ rc-service {{ic|ServiceName}} status}} &lt;br /&gt;
|-&lt;br /&gt;
| To view services configured at {{ic|runlevel}}  || {{ic|$ rc-update show {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
| To view currently active runlevels and state of services  || {{ic|$ rc-status}} &lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039; Check and manage runlevels&#039;&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| To view available runlevels || {{ic|$ rc-status -l}} &lt;br /&gt;
|-&lt;br /&gt;
| To change to a different {{ic|runlevel}} || {{ic|# openrc {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039; Stacked runlevels&#039;&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| To add {{ic|s-runlevel}} as a stacked {{ic|runlevel}} || {{ic|# rc-update add -s {{ic|s-runlevel}} {{ic|runlevel}}}} &lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |&#039;&#039;&#039;User Services&#039;&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| To view currently active User runlevels and state of User services || {{ic|$ rc-status -U}} &lt;br /&gt;
|-&lt;br /&gt;
| To change to a different user {{ic|runlevel}} || {{ic|$ openrc -U {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
| Add User {{ic|ServiceName}} to user {{ic|runlevel}} || {{ic|$ rc-update -U add {{ic|ServiceName}} {{ic|runlevel}}}} &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Runlevels ==&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;runlevel&#039;&#039; is basically a collection of services that needs to be started when certain conditions are met. Instead of using runlevel numbers, such as is used traditionally with &#039;&#039;SysV&#039;&#039; init, these are named, and users can create their own, if needed. The default startup uses the &#039;&#039;&#039;sysinit&#039;&#039;&#039;, &#039;&#039;&#039;boot&#039;&#039;&#039;, and &#039;&#039;&#039;default&#039;&#039;&#039; runlevels, in that order. Shutdown uses the &#039;&#039;&#039;shutdown&#039;&#039;&#039; runlevel.&lt;br /&gt;
&lt;br /&gt;
The available runlevels are:&lt;br /&gt;
* &#039;&#039;&#039;default&#039;&#039;&#039; - Used if no runlevel is specified. (This is generally the runlevel you want to add services to.)&lt;br /&gt;
* &#039;&#039;&#039;hotplugged&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;manual&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The special runlevels are:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;sysinit&#039;&#039;&#039; - Brings up system specific stuff such as &amp;lt;code&amp;gt;/dev&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/proc&amp;lt;/code&amp;gt; and optionally &amp;lt;code&amp;gt;/sys&amp;lt;/code&amp;gt; for Linux based systems. It also mounts &amp;lt;code&amp;gt;/lib/rc/init.d&amp;lt;/code&amp;gt; as a ramdisk using tmpfs where available unless &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; is mounted rw at boot. &amp;lt;code&amp;gt;&#039;&#039;&#039;rc&#039;&#039;&#039;&amp;lt;/code&amp;gt; uses &amp;lt;code&amp;gt;/lib/rc/init.d&amp;lt;/code&amp;gt; to hold state information about the services it runs. &#039;&#039;&#039;sysinit&#039;&#039;&#039; always runs when the host first starts and should not be run again.&lt;br /&gt;
* &#039;&#039;&#039;boot&#039;&#039;&#039; - Generally, the only services that one should add to the &#039;&#039;&#039;boot&#039;&#039;&#039; runlevel are those which deal with the mounting of filesystems, setting the initial state of attached peripherals, and logging. Hotplugged services are added to the &#039;&#039;&#039;boot&#039;&#039;&#039; runlevel by the system. All services in the &#039;&#039;&#039;boot&#039;&#039;&#039; and &#039;&#039;&#039;sysinit&#039;&#039;&#039; runlevels are automatically included in all other runlevels except for those listed here.&lt;br /&gt;
* &#039;&#039;&#039;single&#039;&#039;&#039; - Stops all services except for those in the &#039;&#039;&#039;sysinit&#039;&#039;&#039; runlevel.&lt;br /&gt;
* &#039;&#039;&#039;reboot&#039;&#039;&#039; - Changes to the &#039;&#039;&#039;shutdown&#039;&#039;&#039; runlevel, and then reboots the host.&lt;br /&gt;
* &#039;&#039;&#039;shutdown&#039;&#039;&#039; - Changes to the shutdown &#039;&#039;&#039;runlevel&#039;&#039;&#039;, and then halts the host.&lt;br /&gt;
&lt;br /&gt;
=== Stacked runlevels ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Stacked&#039;&#039; runlevels allows for the &amp;quot;inheritance&amp;quot; of services. A few use cases are given below:-&lt;br /&gt;
* [https://docs.alpinelinux.org/user-handbook/0.1a/Working/openrc.html#_runlevel_stacking Running an office runlevel with VPN service]&lt;br /&gt;
* [[#Preventing slow services from delaying system startup|Preventing slow services from delaying system startup]]&lt;br /&gt;
For more detailed information, refer [https://wiki.gentoo.org/wiki/OpenRC/Stacked%20runlevel Gentoo wiki].&lt;br /&gt;
&lt;br /&gt;
== Config files == &lt;br /&gt;
&lt;br /&gt;
The main configuration file for OpenRC is {{Path|/etc/rc.conf}}. The OpenRC service scripts for each service can be found at {{Path|/etc/init.d/}} and their respective service configuration files at {{Path|/etc/conf.d/}}.&lt;br /&gt;
&lt;br /&gt;
== Command usage ==&lt;br /&gt;
&lt;br /&gt;
OpenRC provides the following commands:&lt;br /&gt;
* {{ic|rc-update}} &lt;br /&gt;
* {{ic|rc-service}}&lt;br /&gt;
* {{ic|rc-status}}&lt;br /&gt;
* {{ic|openrc}}&lt;br /&gt;
&lt;br /&gt;
To view the command usage for all OpenRC commands, use the &#039;&#039;&#039;--help&#039;&#039;&#039; or &#039;&#039;&#039;-h&#039;&#039;&#039; flag.  For eg:{{ic|$ rc-update &#039;&#039;&#039;--help&#039;&#039;&#039;}} or {{ic|$ rc-update &#039;&#039;&#039;-h&#039;&#039;&#039;}} will show usage information for {{ic|rc-update}}.&lt;br /&gt;
&lt;br /&gt;
To {{ic|start}}, {{ic|stop}} or {{ic|restart}} a service {{ic|ServiceName}} immediately at the current runlevel:&lt;br /&gt;
{{cmd|$ doas rc-service {{ic|ServiceName}} start}}&lt;br /&gt;
{{cmd|$ doas rc-service {{ic|ServiceName}} stop}}&lt;br /&gt;
&lt;br /&gt;
To {{ic|add}} or {{ic|delete}} a service to/from the sequence of services that need to start automatically in future sessions at the {{ic|boot}} runlevel: &lt;br /&gt;
{{cmd|$ doas rc-update add {{ic|ServiceName}} boot}}&lt;br /&gt;
Note that the {{ic|&#039;&#039;&#039;default&#039;&#039;&#039;}} runlevel is assumed, so it does not need to be stated explicitly:&lt;br /&gt;
{{cmd|$ doas rc-update add {{ic|ServiceName}}}}&lt;br /&gt;
{{cmd|$ doas rc-update del {{ic|ServiceName}}}}&lt;br /&gt;
&lt;br /&gt;
List the current status of all services; to display the status of all &#039;&#039;user services&#039;&#039; add &#039;&#039;&#039;-U&#039;&#039;&#039; :&lt;br /&gt;
{{cmd|$ rc-status}}&lt;br /&gt;
List the assigned runlevels of all services; to display the runlevels of &#039;&#039;user services&#039;&#039; add &#039;&#039;&#039;-U&#039;&#039;&#039; :&lt;br /&gt;
{{cmd|$ rc-update}}&lt;br /&gt;
&lt;br /&gt;
Refer to the [https://github.com/OpenRC/openrc/blob/master/user-guide.md OpenRC user guide] for more detailed information.&lt;br /&gt;
&lt;br /&gt;
== Cgroups ==&lt;br /&gt;
&lt;br /&gt;
OpenRC supports [https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html cgroups v2] in the default configuration. To enable hybrid cgroups, edit the file {{Path|/etc/rc.conf}} and change the setting for {{ic|rc_cgroup_mode}} as follows:{{Cat|/etc/rc.conf|rc_cgroup_mode{{=}}&amp;quot;hybrid&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
Then, one should run {{Cmd|# rc-service cgroups start}}&lt;br /&gt;
to take effect and {{Cmd|# rc-update add cgroups}}&lt;br /&gt;
to auto mount the cgroup filesystem on boot.&lt;br /&gt;
&lt;br /&gt;
== Local service ==&lt;br /&gt;
&lt;br /&gt;
Use the {{Path|/etc/local.d/}} directory to place programs or scripts which are to be run when the {{ic|local}} service is started or stopped.&lt;br /&gt;
&lt;br /&gt;
If a file in this directory is executable and it has a .start extension, it will be run when the local service is started. If a file is executable and it has a .stop extension, it will be run when the local service is stopped. For more info refer [https://github.com/OpenRC/openrc/blob/master/local.d/README README]&lt;br /&gt;
&lt;br /&gt;
To enable the {{ic|local}} service, issue the command:{{Cmd|# rc-update add local}}&lt;br /&gt;
&lt;br /&gt;
== Preventing slow services from delaying system startup ==&lt;br /&gt;
&lt;br /&gt;
Services that take a while to start will block the boot process until they complete. E.g.: {{ic|iwd}},{{ic|networking}},{{ic|chrony}} etc... might delay startup of an interactive system rather than start in the background. &lt;br /&gt;
&lt;br /&gt;
=== Parallel services === &lt;br /&gt;
&lt;br /&gt;
If the setting {{Codeline|rc_parallel{{=}}&amp;quot;YES&amp;quot;}} is configured, the OpenRC system tries to start services in parallel for a slight speed improvement. &lt;br /&gt;
This setting however comes with a message from openRC developers:{{Warning|whilst we have improved parallel, it can still potentially lock the boot process. Don&#039;t file bugs about this.}} &lt;br /&gt;
&lt;br /&gt;
=== Stacked runlevel method === &lt;br /&gt;
&lt;br /&gt;
Slow services can also be [https://ptrcnull.me/posts/openrc-async-services.html started after login prompt] using [[#Stacked runlevels|stacked runlevels]]. &lt;br /&gt;
{{Warning|Editing the file {{Path|&#039;&#039;&#039;/etc/inittab&#039;&#039;&#039;}} wrongly will render the system unusable. Take backup and learn to restore it using rescue disk before proceeding.}}&lt;br /&gt;
&lt;br /&gt;
# Create a custom runlevel &#039;&#039;&#039;async&#039;&#039;&#039;:  {{Cmd|# mkdir /etc/runlevels/async}}&lt;br /&gt;
# Add &#039;&#039;&#039;default&#039;&#039;&#039; as a stacked runlevel {{Cmd|# rc-update add -s default async}}&lt;br /&gt;
# Remove slow service from &#039;&#039;&#039;default&#039;&#039;&#039; runlevel and add them to the &#039;&#039;&#039;async&#039;&#039;&#039; runlevel:{{Cmd|&amp;lt;nowiki&amp;gt;# rc-update del &amp;lt;servicename&amp;gt; default&lt;br /&gt;
# rc-update add &amp;lt;servicename&amp;gt; async &amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
# Enable the &#039;&#039;&#039;async&#039;&#039;&#039; runlevel by adding the line &#039;&#039;&#039;::once:/sbin/openrc async&#039;&#039;&#039; to {{Path|/etc/inittab}} file as follows: {{Cat|/etc/inittab|&amp;lt;nowiki&amp;gt;...&lt;br /&gt;
::wait:/sbin/openrc default&lt;br /&gt;
::once:/sbin/openrc async -q&lt;br /&gt;
&lt;br /&gt;
# Set up a couple of getty&#039;s&lt;br /&gt;
tty1::respawn:/sbin/getty 38400 tty1&lt;br /&gt;
...&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
After rebooting, services from &#039;&#039;&#039;async&#039;&#039;&#039; will start separately. Other services started in &#039;&#039;&#039;default&#039;&#039;&#039; runlevel may still block [[TTY_Autologin|agetty]] from running, due to the {{ic|wait}} label.&lt;br /&gt;
&lt;br /&gt;
== User services ==&lt;br /&gt;
&lt;br /&gt;
OpenRC supports managing services for users. User services are currently experimental and available from [[Release_Notes_for_Alpine_3.22.0#OpenRC_User_services|v3.22]]. Here is the [https://pkgs.alpinelinux.org/contents?file=*&amp;amp;path=%2Fetc%2Fuser%2Finit.d&amp;amp;name=&amp;amp;branch=edge&amp;amp;repo=&amp;amp;arch=x86_64 list of OpenRC User services] available currently.&lt;br /&gt;
&lt;br /&gt;
Such services are said to be running in &#039;&#039;user mode&#039;&#039; and are managed with usual OpenRC commands using the  &#039;&#039;&#039;-U&#039;&#039;&#039; option (as distinct from the &#039;&#039;-u&#039;&#039; option), and without &#039;&#039;&#039;doas&#039;&#039;&#039; (nor as root).  &lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
&lt;br /&gt;
* [[XDG_RUNTIME_DIR]] variable must be set &lt;br /&gt;
&lt;br /&gt;
=== Config files for user services ===&lt;br /&gt;
&lt;br /&gt;
OpenRC uses {{path|$XDG_CONFIG_HOME/rc}} for its user service configuration. &amp;lt;code&amp;gt;$XDG_CONFIG_HOME&amp;lt;/code&amp;gt;, the fallback {{path|~/.config}} is used. is unset.&lt;br /&gt;
&lt;br /&gt;
The main configuration file for OpenRC User services is {{path|~/.config/rc/rc.conf}}.&lt;br /&gt;
&lt;br /&gt;
==== Runlevels ====&lt;br /&gt;
&lt;br /&gt;
Runlevels are represented by directories in {{path|$XDG_CONFIG_HOME/rc/runlevels}}. The default runlevel is &amp;lt;code&amp;gt;sysinit&amp;lt;/code&amp;gt; and needs to be created explicitly in order to be enabled:&lt;br /&gt;
&lt;br /&gt;
 mkdir -p ${XDG_CONFIG_HOME:-~/.config}/rc/runlevels/sysinit&lt;br /&gt;
&lt;br /&gt;
To start the default runlevel (&amp;lt;code&amp;gt;sysinit&amp;lt;/code&amp;gt;), use:&lt;br /&gt;
&lt;br /&gt;
 openrc -U&lt;br /&gt;
&lt;br /&gt;
To start another runlevel, use:&lt;br /&gt;
&lt;br /&gt;
 openrc -U $RUNLEVEL&lt;br /&gt;
&lt;br /&gt;
If automatic start-up of a runlevel needs to be enforced by the system administrator, see [[#PAM support|PAM support]] below.&lt;br /&gt;
&lt;br /&gt;
==== Services ====&lt;br /&gt;
&lt;br /&gt;
The service scripts for each OpenRC user service provided as part of official packages can be found at {{Path|/etc/user/init.d/}} and their respective service configuration files at {{Path|/etc/user/conf.d/}}. &lt;br /&gt;
&lt;br /&gt;
The folders {{path|~/.config/rc/init.d/}} and {{path|~/.config/rc/conf.d/}} can have user customized service scripts for User services and their respective configuration files. These scripts override official files at {{Path|/etc/user/}}, if their service names match.&lt;br /&gt;
&lt;br /&gt;
=== Configure environment variables ===&lt;br /&gt;
&lt;br /&gt;
==== For Wayland ====&lt;br /&gt;
{{Tip|User services like {{pkg|wlsunset}} depend on the {{ic|$WAYLAND_DISPLAY}} environment variable. Hence, it is [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17375#note_530383 recommended] to use &#039;&#039;&#039;gui&#039;&#039;&#039; runlevel for such services. Even though [[PipeWire]] can run at &#039;&#039;&#039;default&#039;&#039;&#039; runlevel, ensure that all your User services can run at the chosen runlevel.}} &lt;br /&gt;
* Allow propagation of the {{ic|$WAYLAND_DISPLAY}} and associated environment variables by adding the following lines to file {{path|~/.config/rc/rc.conf}} as follows:{{Cat|~/.config/rc/rc.conf|&amp;lt;nowiki&amp;gt;rc_env_allow=&amp;quot;WAYLAND_DISPLAY&amp;quot;&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
* Create a custom &#039;&#039;&#039;gui&#039;&#039;&#039; user runlevel:{{Cmd|$ mkdir -p ~/.config/rc/runlevels/gui}}&lt;br /&gt;
* To start &#039;&#039;&#039;gui&#039;&#039;&#039; user runlevel, add the line {{ic|openrc -U gui}} to the startup file of your compositor. For eg, for [[Sway]] add:{{Cat|~/.config/sway/config|...&lt;br /&gt;
exec openrc -U gui}}&lt;br /&gt;
&lt;br /&gt;
==== For Xorg ====&lt;br /&gt;
&lt;br /&gt;
If [[Elogind]] is not used, ensure that [[Wayland#Creating_and_exporting_XDG_RUNTIME_DIR_manually|XDG_RUNTIME_DIR]] is set manually in {{path|~/.xinitrc}}. For eg, for [[dwm]] add:{{Cat|~/.xinitrc|&amp;lt;nowiki&amp;gt;...&lt;br /&gt;
if [ -z &amp;quot;$XDG_RUNTIME_DIR&amp;quot; ]; then&lt;br /&gt;
	XDG_RUNTIME_DIR=&amp;quot;/tmp/$(id -u)-runtime-dir&amp;quot;&lt;br /&gt;
	mkdir -pm 0700 &amp;quot;$XDG_RUNTIME_DIR&amp;quot;&lt;br /&gt;
	export XDG_RUNTIME_DIR&lt;br /&gt;
fi&lt;br /&gt;
openrc -U default&lt;br /&gt;
exec dwm&amp;lt;/nowiki&amp;gt;}} &lt;br /&gt;
&lt;br /&gt;
{{Note|For both the above cases, logout and login for the OpenRC user services to be started, before proceeding further.}}&lt;br /&gt;
&lt;br /&gt;
=== User service management ===&lt;br /&gt;
&lt;br /&gt;
Issue the command {{ic|$ rc-status -Ur}} to view and verify the current user runlevel as &#039;&#039;&#039;gui&#039;&#039;&#039; and &#039;&#039;&#039;default&#039;&#039;&#039; for Wayland and Xorg, respectively, before proceeding. &lt;br /&gt;
&lt;br /&gt;
To start {{ic|ServiceName}} user service, issue the command:{{Cmd|$ rc-service -U {{ic|ServiceName}} start}}&lt;br /&gt;
Verify that the above OpenRC user service is started before proceeding further: {{Cmd|$ rc-status -U}} &lt;br /&gt;
To enable {{ic|ServiceName}} user service, issue the command: {{Cmd|$ rc-update -U add ServiceName}}&lt;br /&gt;
&lt;br /&gt;
{{Tip|Once a user service is configured, to prevent duplicate instance, remove them from {{Path|/etc/xdg/autostart}} folder or from the startup/config file.}}&lt;br /&gt;
&lt;br /&gt;
=== PAM support ===&lt;br /&gt;
&lt;br /&gt;
The default installation of OpenRC user services in Alpine Linux is without PAM support.&lt;br /&gt;
&lt;br /&gt;
In scenarios where services should not be allowed to [https://wiki.gentoo.org/wiki/OpenRC#lingering linger] on logout, PAM support for OpenRC user services can be enabled by installing the {{pkg|openrc-user-pam}} package.{{Cmd|# apk add {{pkg|openrc-user-pam}}}}&lt;br /&gt;
&lt;br /&gt;
{{Warning|Starting services via PAM will start them before the user session initialises, which can lead them to fail in unexpected way due to missing preconditions. E.g.: because the [[XDG_RUNTIME_DIR]] is not yet initialised.}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
Whenever a openRC service fails to run, troubleshoot by enabling a debugging option, and then run the command. &lt;br /&gt;
&lt;br /&gt;
For example, if running the command {{ic|rc-service greetd start}} causes the [[Greetd|greetd]] service to immediately crash, then alter the command to enable debug and to view its output:{{Cmd|# rc-service -d greetd restart}}&lt;br /&gt;
&lt;br /&gt;
=== XDG_RUNTIME_DIR unset ===&lt;br /&gt;
&lt;br /&gt;
While configuring [[#User services|user services]], running the command {{ic|$ doas rc-update add -U pipewire gui}} will generate the above error {{ic|XDG_RUNTIME_DIR unset}}.  Always issue the command as normal user {{ic|$ rc-update add -U pipewire gui}} and do NOT use {{ic|doas}}. &lt;br /&gt;
&lt;br /&gt;
=== ERROR: user.greetd failed to start ===&lt;br /&gt;
&lt;br /&gt;
While using [[#User services|user services]] with [[greetd]], the above error message will appear. This failed error message for {{ic|user.greetd}} service is harmless as per {{MR|81612#note_492385}}.&lt;br /&gt;
&lt;br /&gt;
=== failed to create display ===&lt;br /&gt;
&lt;br /&gt;
When using openRC user services for {{ic|wlsunset}}, the following  error message may appear:{{Cmd|daemon.err wlsunset: failed to create display}}You will need the GUI runlevel for services that depend on {{ic|$WAYLAND_DISPLAY}}. Refer [[#For Wayland| Configure environment variables For Wayland]] section.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Writing Init Scripts]]&lt;br /&gt;
* [[Multiple Instances of Services]]&lt;br /&gt;
* [https://github.com/OpenRC/openrc/blob/master/user-guide.md OpenRC user Guide]&lt;br /&gt;
* [https://github.com/OpenRC/openrc/blob/master/service-script-guide.md OpenRC Service Script Writing Guide]&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/OpenRC Gentoo Wiki]&lt;br /&gt;
* [https://wiki.archlinux.org/title/OpenRC ArchWiki]&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/OpenRC PostmarketOS Wiki]&lt;br /&gt;
* [https://ptrcnull.me/posts/openrc-async-services.html Start services after login prompt]&lt;br /&gt;
&lt;br /&gt;
[[Category:Booting]] &lt;br /&gt;
[[Category:System Administration]]&lt;br /&gt;
[[Category:Services]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=OpenRC&amp;diff=30865</id>
		<title>OpenRC</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=OpenRC&amp;diff=30865"/>
		<updated>2025-09-05T12:44:50Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: /* Runlevels */ also refer to pam as an option&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Alpine Linux uses [https://github.com/OpenRC/ OpenRC] for its [https://en.wikipedia.org/wiki/Init init] system. The init system manages the services, including the boot and shutdown of your system. OpenRC also supports managing [[#User services|services for users]]. &lt;br /&gt;
&lt;br /&gt;
To learn the basics of OpenRC quickly, refer to the [https://docs.alpinelinux.org/user-handbook/0.1a/Working/openrc.html working with OpenRC] guide from the Alpine Linux documentation project. &lt;br /&gt;
&lt;br /&gt;
== Quickstart  ==&lt;br /&gt;
&lt;br /&gt;
{|align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| width=&amp;quot;50%&amp;quot; |Action&lt;br /&gt;
|             |Command&lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039;Managing a service - start,stop and restart&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Start {{ic|ServiceName}} now || {{ic|# rc-service {{ic|ServiceName}} start}}&lt;br /&gt;
|-&lt;br /&gt;
| Stop {{ic|ServiceName}} now || {{ic|# rc-service {{ic|ServiceName}} stop}} &lt;br /&gt;
|-&lt;br /&gt;
| Restart {{ic|ServiceName}} now || {{ic|# rc-service {{ic|ServiceName}} restart}} &lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039;Adding and removing service from runlevels&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Add {{ic|ServiceName}} to {{ic|runlevel}} || {{ic|# rc-update add {{ic|ServiceName}} {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
| Remove {{ic|ServiceName}} from {{ic|runlevel}} || {{ic|# rc-update del {{ic|ServiceName}} {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039; Check services in a runlevel and their status&#039;&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| To check status of {{ic|ServiceName}} || {{ic|$ rc-service {{ic|ServiceName}} status}} &lt;br /&gt;
|-&lt;br /&gt;
| To view services configured at {{ic|runlevel}}  || {{ic|$ rc-update show {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
| To view currently active runlevels and state of services  || {{ic|$ rc-status}} &lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039; Check and manage runlevels&#039;&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| To view available runlevels || {{ic|$ rc-status -l}} &lt;br /&gt;
|-&lt;br /&gt;
| To change to a different {{ic|runlevel}} || {{ic|# openrc {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039; Stacked runlevels&#039;&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| To add {{ic|s-runlevel}} as a stacked {{ic|runlevel}} || {{ic|# rc-update add -s {{ic|s-runlevel}} {{ic|runlevel}}}} &lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |&#039;&#039;&#039;User Services&#039;&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| To view currently active User runlevels and state of User services || {{ic|$ rc-status -U}} &lt;br /&gt;
|-&lt;br /&gt;
| To change to a different user {{ic|runlevel}} || {{ic|$ openrc -U {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
| Add User {{ic|ServiceName}} to user {{ic|runlevel}} || {{ic|$ rc-update -U add {{ic|ServiceName}} {{ic|runlevel}}}} &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Runlevels ==&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;runlevel&#039;&#039; is basically a collection of services that needs to be started when certain conditions are met. Instead of using runlevel numbers, such as is used traditionally with &#039;&#039;SysV&#039;&#039; init, these are named, and users can create their own, if needed. The default startup uses the &#039;&#039;&#039;sysinit&#039;&#039;&#039;, &#039;&#039;&#039;boot&#039;&#039;&#039;, and &#039;&#039;&#039;default&#039;&#039;&#039; runlevels, in that order. Shutdown uses the &#039;&#039;&#039;shutdown&#039;&#039;&#039; runlevel.&lt;br /&gt;
&lt;br /&gt;
The available runlevels are:&lt;br /&gt;
* &#039;&#039;&#039;default&#039;&#039;&#039; - Used if no runlevel is specified. (This is generally the runlevel you want to add services to.)&lt;br /&gt;
* &#039;&#039;&#039;hotplugged&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;manual&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The special runlevels are:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;sysinit&#039;&#039;&#039; - Brings up system specific stuff such as &amp;lt;code&amp;gt;/dev&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/proc&amp;lt;/code&amp;gt; and optionally &amp;lt;code&amp;gt;/sys&amp;lt;/code&amp;gt; for Linux based systems. It also mounts &amp;lt;code&amp;gt;/lib/rc/init.d&amp;lt;/code&amp;gt; as a ramdisk using tmpfs where available unless &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; is mounted rw at boot. &amp;lt;code&amp;gt;&#039;&#039;&#039;rc&#039;&#039;&#039;&amp;lt;/code&amp;gt; uses &amp;lt;code&amp;gt;/lib/rc/init.d&amp;lt;/code&amp;gt; to hold state information about the services it runs. &#039;&#039;&#039;sysinit&#039;&#039;&#039; always runs when the host first starts and should not be run again.&lt;br /&gt;
* &#039;&#039;&#039;boot&#039;&#039;&#039; - Generally, the only services that one should add to the &#039;&#039;&#039;boot&#039;&#039;&#039; runlevel are those which deal with the mounting of filesystems, setting the initial state of attached peripherals, and logging. Hotplugged services are added to the &#039;&#039;&#039;boot&#039;&#039;&#039; runlevel by the system. All services in the &#039;&#039;&#039;boot&#039;&#039;&#039; and &#039;&#039;&#039;sysinit&#039;&#039;&#039; runlevels are automatically included in all other runlevels except for those listed here.&lt;br /&gt;
* &#039;&#039;&#039;single&#039;&#039;&#039; - Stops all services except for those in the &#039;&#039;&#039;sysinit&#039;&#039;&#039; runlevel.&lt;br /&gt;
* &#039;&#039;&#039;reboot&#039;&#039;&#039; - Changes to the &#039;&#039;&#039;shutdown&#039;&#039;&#039; runlevel, and then reboots the host.&lt;br /&gt;
* &#039;&#039;&#039;shutdown&#039;&#039;&#039; - Changes to the shutdown &#039;&#039;&#039;runlevel&#039;&#039;&#039;, and then halts the host.&lt;br /&gt;
&lt;br /&gt;
=== Stacked runlevels ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Stacked&#039;&#039; runlevels allows for the &amp;quot;inheritance&amp;quot; of services. A few use cases are given below:-&lt;br /&gt;
* [https://docs.alpinelinux.org/user-handbook/0.1a/Working/openrc.html#_runlevel_stacking Running an office runlevel with VPN service]&lt;br /&gt;
* [[#Preventing slow services from delaying system startup|Preventing slow services from delaying system startup]]&lt;br /&gt;
For more detailed information, refer [https://wiki.gentoo.org/wiki/OpenRC/Stacked%20runlevel Gentoo wiki].&lt;br /&gt;
&lt;br /&gt;
== Config files == &lt;br /&gt;
&lt;br /&gt;
The main configuration file for OpenRC is {{Path|/etc/rc.conf}}. The OpenRC service scripts for each service can be found at {{Path|/etc/init.d/}} and their respective service configuration files at {{Path|/etc/conf.d/}}.&lt;br /&gt;
&lt;br /&gt;
== Command usage ==&lt;br /&gt;
&lt;br /&gt;
OpenRC provides the following commands:&lt;br /&gt;
* {{ic|rc-update}} &lt;br /&gt;
* {{ic|rc-service}}&lt;br /&gt;
* {{ic|rc-status}}&lt;br /&gt;
* {{ic|openrc}}&lt;br /&gt;
&lt;br /&gt;
To view the command usage for all OpenRC commands, use the &#039;&#039;&#039;--help&#039;&#039;&#039; or &#039;&#039;&#039;-h&#039;&#039;&#039; flag.  For eg:{{ic|$ rc-update &#039;&#039;&#039;--help&#039;&#039;&#039;}} or {{ic|$ rc-update &#039;&#039;&#039;-h&#039;&#039;&#039;}} will show usage information for {{ic|rc-update}}.&lt;br /&gt;
&lt;br /&gt;
To {{ic|start}}, {{ic|stop}} or {{ic|restart}} a service {{ic|ServiceName}} immediately at the current runlevel:&lt;br /&gt;
{{cmd|$ doas rc-service {{ic|ServiceName}} start}}&lt;br /&gt;
{{cmd|$ doas rc-service {{ic|ServiceName}} stop}}&lt;br /&gt;
&lt;br /&gt;
To {{ic|add}} or {{ic|delete}} a service to/from the sequence of services that need to start automatically in future sessions at the {{ic|boot}} runlevel: &lt;br /&gt;
{{cmd|$ doas rc-update add {{ic|ServiceName}} boot}}&lt;br /&gt;
Note that the {{ic|&#039;&#039;&#039;default&#039;&#039;&#039;}} runlevel is assumed, so it does not need to be stated explicitly:&lt;br /&gt;
{{cmd|$ doas rc-update add {{ic|ServiceName}}}}&lt;br /&gt;
{{cmd|$ doas rc-update del {{ic|ServiceName}}}}&lt;br /&gt;
&lt;br /&gt;
List the current status of all services; to display the status of all &#039;&#039;user services&#039;&#039; add &#039;&#039;&#039;-U&#039;&#039;&#039; :&lt;br /&gt;
{{cmd|$ rc-status}}&lt;br /&gt;
List the assigned runlevels of all services; to display the runlevels of &#039;&#039;user services&#039;&#039; add &#039;&#039;&#039;-U&#039;&#039;&#039; :&lt;br /&gt;
{{cmd|$ rc-update}}&lt;br /&gt;
&lt;br /&gt;
Refer to the [https://github.com/OpenRC/openrc/blob/master/user-guide.md OpenRC user guide] for more detailed information.&lt;br /&gt;
&lt;br /&gt;
== Cgroups ==&lt;br /&gt;
&lt;br /&gt;
OpenRC supports [https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html cgroups v2] in the default configuration. To enable hybrid cgroups, edit the file {{Path|/etc/rc.conf}} and change the setting for {{ic|rc_cgroup_mode}} as follows:{{Cat|/etc/rc.conf|rc_cgroup_mode{{=}}&amp;quot;hybrid&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
Then, one should run {{Cmd|# rc-service cgroups start}}&lt;br /&gt;
to take effect and {{Cmd|# rc-update add cgroups}}&lt;br /&gt;
to auto mount the cgroup filesystem on boot.&lt;br /&gt;
&lt;br /&gt;
== Local service ==&lt;br /&gt;
&lt;br /&gt;
Use the {{Path|/etc/local.d/}} directory to place programs or scripts which are to be run when the {{ic|local}} service is started or stopped.&lt;br /&gt;
&lt;br /&gt;
If a file in this directory is executable and it has a .start extension, it will be run when the local service is started. If a file is executable and it has a .stop extension, it will be run when the local service is stopped. For more info refer [https://github.com/OpenRC/openrc/blob/master/local.d/README README]&lt;br /&gt;
&lt;br /&gt;
To enable the {{ic|local}} service, issue the command:{{Cmd|# rc-update add local}}&lt;br /&gt;
&lt;br /&gt;
== Preventing slow services from delaying system startup ==&lt;br /&gt;
&lt;br /&gt;
Services that take a while to start will block the boot process until they complete. E.g.: {{ic|iwd}},{{ic|networking}},{{ic|chrony}} etc... might delay startup of an interactive system rather than start in the background. &lt;br /&gt;
&lt;br /&gt;
=== Parallel services === &lt;br /&gt;
&lt;br /&gt;
If the setting {{Codeline|rc_parallel{{=}}&amp;quot;YES&amp;quot;}} is configured, the OpenRC system tries to start services in parallel for a slight speed improvement. &lt;br /&gt;
This setting however comes with a message from openRC developers:{{Warning|whilst we have improved parallel, it can still potentially lock the boot process. Don&#039;t file bugs about this.}} &lt;br /&gt;
&lt;br /&gt;
=== Stacked runlevel method === &lt;br /&gt;
&lt;br /&gt;
Slow services can also be [https://ptrcnull.me/posts/openrc-async-services.html started after login prompt] using [[#Stacked runlevels|stacked runlevels]]. &lt;br /&gt;
{{Warning|Editing the file {{Path|&#039;&#039;&#039;/etc/inittab&#039;&#039;&#039;}} wrongly will render the system unusable. Take backup and learn to restore it using rescue disk before proceeding.}}&lt;br /&gt;
&lt;br /&gt;
# Create a custom runlevel &#039;&#039;&#039;async&#039;&#039;&#039;:  {{Cmd|# mkdir /etc/runlevels/async}}&lt;br /&gt;
# Add &#039;&#039;&#039;default&#039;&#039;&#039; as a stacked runlevel {{Cmd|# rc-update add -s default async}}&lt;br /&gt;
# Remove slow service from &#039;&#039;&#039;default&#039;&#039;&#039; runlevel and add them to the &#039;&#039;&#039;async&#039;&#039;&#039; runlevel:{{Cmd|&amp;lt;nowiki&amp;gt;# rc-update del &amp;lt;servicename&amp;gt; default&lt;br /&gt;
# rc-update add &amp;lt;servicename&amp;gt; async &amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
# Enable the &#039;&#039;&#039;async&#039;&#039;&#039; runlevel by adding the line &#039;&#039;&#039;::once:/sbin/openrc async&#039;&#039;&#039; to {{Path|/etc/inittab}} file as follows: {{Cat|/etc/inittab|&amp;lt;nowiki&amp;gt;...&lt;br /&gt;
::wait:/sbin/openrc default&lt;br /&gt;
::once:/sbin/openrc async -q&lt;br /&gt;
&lt;br /&gt;
# Set up a couple of getty&#039;s&lt;br /&gt;
tty1::respawn:/sbin/getty 38400 tty1&lt;br /&gt;
...&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
After rebooting, services from &#039;&#039;&#039;async&#039;&#039;&#039; will start separately. Other services started in &#039;&#039;&#039;default&#039;&#039;&#039; runlevel may still block [[TTY_Autologin|agetty]] from running, due to the {{ic|wait}} label.&lt;br /&gt;
&lt;br /&gt;
== User services ==&lt;br /&gt;
&lt;br /&gt;
OpenRC supports managing services for users. User services are currently experimental and available from [[Release_Notes_for_Alpine_3.22.0#OpenRC_User_services|v3.22]]. Here is the [https://pkgs.alpinelinux.org/contents?file=*&amp;amp;path=%2Fetc%2Fuser%2Finit.d&amp;amp;name=&amp;amp;branch=edge&amp;amp;repo=&amp;amp;arch=x86_64 list of OpenRC User services] available currently.&lt;br /&gt;
&lt;br /&gt;
Such services are said to be running in &#039;&#039;user mode&#039;&#039; and are managed with usual OpenRC commands using the  &#039;&#039;&#039;-U&#039;&#039;&#039; option (as distinct from the &#039;&#039;-u&#039;&#039; option), and without &#039;&#039;&#039;doas&#039;&#039;&#039; (nor as root).  &lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
&lt;br /&gt;
* [[XDG_RUNTIME_DIR]] variable must be set &lt;br /&gt;
&lt;br /&gt;
=== Config files for user services ===&lt;br /&gt;
&lt;br /&gt;
OpenRC uses {{path|$XDG_CONFIG_HOME/rc}} for its user service configuration. &amp;lt;code&amp;gt;$XDG_CONFIG_HOME&amp;lt;/code&amp;gt;, the fallback {{path|~/.config}} is used. is unset.&lt;br /&gt;
&lt;br /&gt;
The main configuration file for OpenRC User services is {{path|~/.config/rc/rc.conf}}.&lt;br /&gt;
&lt;br /&gt;
==== Runlevels ====&lt;br /&gt;
&lt;br /&gt;
Runlevels are represented by directories in {{path|$XDG_CONFIG_HOME/rc/runlevels}}. The default runlevel is &amp;lt;code&amp;gt;sysinit&amp;lt;/code&amp;gt; and needs to be created explicitly in order to be enabled:&lt;br /&gt;
&lt;br /&gt;
 mkdir -p ${XDG_CONFIG_HOME:-~/.config}/rc/runlevels/sysinit&lt;br /&gt;
&lt;br /&gt;
To start the default runlevel (&amp;lt;code&amp;gt;sysinit&amp;lt;/code&amp;gt;), use:&lt;br /&gt;
&lt;br /&gt;
 openrc -U&lt;br /&gt;
&lt;br /&gt;
To start another runlevel, use:&lt;br /&gt;
&lt;br /&gt;
 openrc -U $RUNLEVEL&lt;br /&gt;
&lt;br /&gt;
If automatic start-up of a runlevel needs to be enforced by the system administrator, see [[#PAM support|PAM support]] below.&lt;br /&gt;
&lt;br /&gt;
==== Services ====&lt;br /&gt;
&lt;br /&gt;
The service scripts for each OpenRC user service provided as part of official packages can be found at {{Path|/etc/user/init.d/}} and their respective service configuration files at {{Path|/etc/user/conf.d/}}. &lt;br /&gt;
&lt;br /&gt;
The folders {{path|~/.config/rc/init.d/}} and {{path|~/.config/rc/conf.d/}} can have user customized service scripts for User services and their respective configuration files. These scripts override official files at {{Path|/etc/user/}}, if their service names match.&lt;br /&gt;
&lt;br /&gt;
=== Configure environment variables ===&lt;br /&gt;
&lt;br /&gt;
==== For Wayland ====&lt;br /&gt;
{{Tip|User services like {{pkg|wlsunset}} depend on the {{ic|$WAYLAND_DISPLAY}} environment variable. Hence, it is [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17375#note_530383 recommended] to use &#039;&#039;&#039;gui&#039;&#039;&#039; runlevel for such services. Even though [[PipeWire]] can run at &#039;&#039;&#039;default&#039;&#039;&#039; runlevel, ensure that all your User services can run at the chosen runlevel.}} &lt;br /&gt;
* Allow propagation of the {{ic|$WAYLAND_DISPLAY}} and associated environment variables by adding the following lines to file {{path|~/.config/rc/rc.conf}} as follows:{{Cat|~/.config/rc/rc.conf|&amp;lt;nowiki&amp;gt;rc_env_allow=&amp;quot;WAYLAND_DISPLAY&amp;quot;&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
* Create a custom &#039;&#039;&#039;gui&#039;&#039;&#039; user runlevel:{{Cmd|$ mkdir -p ~/.config/rc/runlevels/gui}}&lt;br /&gt;
* To start &#039;&#039;&#039;gui&#039;&#039;&#039; user runlevel, add the line {{ic|openrc -U gui}} to the startup file of your compositor. For eg, for [[Sway]] add:{{Cat|~/.config/sway/config|...&lt;br /&gt;
exec openrc -U gui}}&lt;br /&gt;
&lt;br /&gt;
==== For Xorg ====&lt;br /&gt;
&lt;br /&gt;
If [[Elogind]] is not used, ensure that [[Wayland#Creating_and_exporting_XDG_RUNTIME_DIR_manually|XDG_RUNTIME_DIR]] is set manually in {{path|~/.xinitrc}}. For eg, for [[dwm]] add:{{Cat|~/.xinitrc|&amp;lt;nowiki&amp;gt;...&lt;br /&gt;
if [ -z &amp;quot;$XDG_RUNTIME_DIR&amp;quot; ]; then&lt;br /&gt;
	XDG_RUNTIME_DIR=&amp;quot;/tmp/$(id -u)-runtime-dir&amp;quot;&lt;br /&gt;
	mkdir -pm 0700 &amp;quot;$XDG_RUNTIME_DIR&amp;quot;&lt;br /&gt;
	export XDG_RUNTIME_DIR&lt;br /&gt;
fi&lt;br /&gt;
openrc -U default&lt;br /&gt;
exec dwm&amp;lt;/nowiki&amp;gt;}} &lt;br /&gt;
&lt;br /&gt;
{{Note|For both the above cases, logout and login for the OpenRC user services to be started, before proceeding further.}}&lt;br /&gt;
&lt;br /&gt;
=== User service management ===&lt;br /&gt;
&lt;br /&gt;
Issue the command {{ic|$ rc-status -Ur}} to view and verify the current user runlevel as &#039;&#039;&#039;gui&#039;&#039;&#039; and &#039;&#039;&#039;default&#039;&#039;&#039; for Wayland and Xorg, respectively, before proceeding. &lt;br /&gt;
&lt;br /&gt;
To start {{ic|ServiceName}} user service, issue the command:{{Cmd|$ rc-service -U {{ic|ServiceName}} start}}&lt;br /&gt;
Verify that the above OpenRC user service is started before proceeding further: {{Cmd|$ rc-status -U}} &lt;br /&gt;
To enable {{ic|ServiceName}} user service, issue the command: {{Cmd|$ rc-update -U add ServiceName}}&lt;br /&gt;
&lt;br /&gt;
{{Tip|Once a user service is configured, to prevent duplicate instance, remove them from {{Path|/etc/xdg/autostart}} folder or from the startup/config file.}}&lt;br /&gt;
&lt;br /&gt;
=== PAM support ===&lt;br /&gt;
&lt;br /&gt;
The default installation of OpenRC user services in Alpine Linux is without PAM support.&lt;br /&gt;
&lt;br /&gt;
In scenarios where services should not be allowed to [https://wiki.gentoo.org/wiki/OpenRC#lingering linger] on logout, PAM support for OpenRC user services can be enabled by installing the {{pkg|openrc-user-pam}} package.{{Cmd|# apk add {{pkg|openrc-user-pam}}}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
Whenever a openRC service fails to run, troubleshoot by enabling a debugging option, and then run the command. &lt;br /&gt;
&lt;br /&gt;
For example, if running the command {{ic|rc-service greetd start}} causes the [[Greetd|greetd]] service to immediately crash, then alter the command to enable debug and to view its output:{{Cmd|# rc-service -d greetd restart}}&lt;br /&gt;
&lt;br /&gt;
=== XDG_RUNTIME_DIR unset ===&lt;br /&gt;
&lt;br /&gt;
While configuring [[#User services|user services]], running the command {{ic|$ doas rc-update add -U pipewire gui}} will generate the above error {{ic|XDG_RUNTIME_DIR unset}}.  Always issue the command as normal user {{ic|$ rc-update add -U pipewire gui}} and do NOT use {{ic|doas}}. &lt;br /&gt;
&lt;br /&gt;
=== ERROR: user.greetd failed to start ===&lt;br /&gt;
&lt;br /&gt;
While using [[#User services|user services]] with [[greetd]], the above error message will appear. This failed error message for {{ic|user.greetd}} service is harmless as per {{MR|81612#note_492385}}.&lt;br /&gt;
&lt;br /&gt;
=== failed to create display ===&lt;br /&gt;
&lt;br /&gt;
When using openRC user services for {{ic|wlsunset}}, the following  error message may appear:{{Cmd|daemon.err wlsunset: failed to create display}}You will need the GUI runlevel for services that depend on {{ic|$WAYLAND_DISPLAY}}. Refer [[#For Wayland| Configure environment variables For Wayland]] section.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Writing Init Scripts]]&lt;br /&gt;
* [[Multiple Instances of Services]]&lt;br /&gt;
* [https://github.com/OpenRC/openrc/blob/master/user-guide.md OpenRC user Guide]&lt;br /&gt;
* [https://github.com/OpenRC/openrc/blob/master/service-script-guide.md OpenRC Service Script Writing Guide]&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/OpenRC Gentoo Wiki]&lt;br /&gt;
* [https://wiki.archlinux.org/title/OpenRC ArchWiki]&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/OpenRC PostmarketOS Wiki]&lt;br /&gt;
* [https://ptrcnull.me/posts/openrc-async-services.html Start services after login prompt]&lt;br /&gt;
&lt;br /&gt;
[[Category:Booting]] &lt;br /&gt;
[[Category:System Administration]]&lt;br /&gt;
[[Category:Services]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=OpenRC&amp;diff=30864</id>
		<title>OpenRC</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=OpenRC&amp;diff=30864"/>
		<updated>2025-09-05T12:43:20Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: /* User services */ Fix improperly closed tag&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Alpine Linux uses [https://github.com/OpenRC/ OpenRC] for its [https://en.wikipedia.org/wiki/Init init] system. The init system manages the services, including the boot and shutdown of your system. OpenRC also supports managing [[#User services|services for users]]. &lt;br /&gt;
&lt;br /&gt;
To learn the basics of OpenRC quickly, refer to the [https://docs.alpinelinux.org/user-handbook/0.1a/Working/openrc.html working with OpenRC] guide from the Alpine Linux documentation project. &lt;br /&gt;
&lt;br /&gt;
== Quickstart  ==&lt;br /&gt;
&lt;br /&gt;
{|align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| width=&amp;quot;50%&amp;quot; |Action&lt;br /&gt;
|             |Command&lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039;Managing a service - start,stop and restart&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Start {{ic|ServiceName}} now || {{ic|# rc-service {{ic|ServiceName}} start}}&lt;br /&gt;
|-&lt;br /&gt;
| Stop {{ic|ServiceName}} now || {{ic|# rc-service {{ic|ServiceName}} stop}} &lt;br /&gt;
|-&lt;br /&gt;
| Restart {{ic|ServiceName}} now || {{ic|# rc-service {{ic|ServiceName}} restart}} &lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039;Adding and removing service from runlevels&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Add {{ic|ServiceName}} to {{ic|runlevel}} || {{ic|# rc-update add {{ic|ServiceName}} {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
| Remove {{ic|ServiceName}} from {{ic|runlevel}} || {{ic|# rc-update del {{ic|ServiceName}} {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039; Check services in a runlevel and their status&#039;&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| To check status of {{ic|ServiceName}} || {{ic|$ rc-service {{ic|ServiceName}} status}} &lt;br /&gt;
|-&lt;br /&gt;
| To view services configured at {{ic|runlevel}}  || {{ic|$ rc-update show {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
| To view currently active runlevels and state of services  || {{ic|$ rc-status}} &lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039; Check and manage runlevels&#039;&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| To view available runlevels || {{ic|$ rc-status -l}} &lt;br /&gt;
|-&lt;br /&gt;
| To change to a different {{ic|runlevel}} || {{ic|# openrc {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039; Stacked runlevels&#039;&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| To add {{ic|s-runlevel}} as a stacked {{ic|runlevel}} || {{ic|# rc-update add -s {{ic|s-runlevel}} {{ic|runlevel}}}} &lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |&#039;&#039;&#039;User Services&#039;&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| To view currently active User runlevels and state of User services || {{ic|$ rc-status -U}} &lt;br /&gt;
|-&lt;br /&gt;
| To change to a different user {{ic|runlevel}} || {{ic|$ openrc -U {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
| Add User {{ic|ServiceName}} to user {{ic|runlevel}} || {{ic|$ rc-update -U add {{ic|ServiceName}} {{ic|runlevel}}}} &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Runlevels ==&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;runlevel&#039;&#039; is basically a collection of services that needs to be started when certain conditions are met. Instead of using runlevel numbers, such as is used traditionally with &#039;&#039;SysV&#039;&#039; init, these are named, and users can create their own, if needed. The default startup uses the &#039;&#039;&#039;sysinit&#039;&#039;&#039;, &#039;&#039;&#039;boot&#039;&#039;&#039;, and &#039;&#039;&#039;default&#039;&#039;&#039; runlevels, in that order. Shutdown uses the &#039;&#039;&#039;shutdown&#039;&#039;&#039; runlevel.&lt;br /&gt;
&lt;br /&gt;
The available runlevels are:&lt;br /&gt;
* &#039;&#039;&#039;default&#039;&#039;&#039; - Used if no runlevel is specified. (This is generally the runlevel you want to add services to.)&lt;br /&gt;
* &#039;&#039;&#039;hotplugged&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;manual&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The special runlevels are:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;sysinit&#039;&#039;&#039; - Brings up system specific stuff such as &amp;lt;code&amp;gt;/dev&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/proc&amp;lt;/code&amp;gt; and optionally &amp;lt;code&amp;gt;/sys&amp;lt;/code&amp;gt; for Linux based systems. It also mounts &amp;lt;code&amp;gt;/lib/rc/init.d&amp;lt;/code&amp;gt; as a ramdisk using tmpfs where available unless &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; is mounted rw at boot. &amp;lt;code&amp;gt;&#039;&#039;&#039;rc&#039;&#039;&#039;&amp;lt;/code&amp;gt; uses &amp;lt;code&amp;gt;/lib/rc/init.d&amp;lt;/code&amp;gt; to hold state information about the services it runs. &#039;&#039;&#039;sysinit&#039;&#039;&#039; always runs when the host first starts and should not be run again.&lt;br /&gt;
* &#039;&#039;&#039;boot&#039;&#039;&#039; - Generally, the only services that one should add to the &#039;&#039;&#039;boot&#039;&#039;&#039; runlevel are those which deal with the mounting of filesystems, setting the initial state of attached peripherals, and logging. Hotplugged services are added to the &#039;&#039;&#039;boot&#039;&#039;&#039; runlevel by the system. All services in the &#039;&#039;&#039;boot&#039;&#039;&#039; and &#039;&#039;&#039;sysinit&#039;&#039;&#039; runlevels are automatically included in all other runlevels except for those listed here.&lt;br /&gt;
* &#039;&#039;&#039;single&#039;&#039;&#039; - Stops all services except for those in the &#039;&#039;&#039;sysinit&#039;&#039;&#039; runlevel.&lt;br /&gt;
* &#039;&#039;&#039;reboot&#039;&#039;&#039; - Changes to the &#039;&#039;&#039;shutdown&#039;&#039;&#039; runlevel, and then reboots the host.&lt;br /&gt;
* &#039;&#039;&#039;shutdown&#039;&#039;&#039; - Changes to the shutdown &#039;&#039;&#039;runlevel&#039;&#039;&#039;, and then halts the host.&lt;br /&gt;
&lt;br /&gt;
=== Stacked runlevels ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Stacked&#039;&#039; runlevels allows for the &amp;quot;inheritance&amp;quot; of services. A few use cases are given below:-&lt;br /&gt;
* [https://docs.alpinelinux.org/user-handbook/0.1a/Working/openrc.html#_runlevel_stacking Running an office runlevel with VPN service]&lt;br /&gt;
* [[#Preventing slow services from delaying system startup|Preventing slow services from delaying system startup]]&lt;br /&gt;
For more detailed information, refer [https://wiki.gentoo.org/wiki/OpenRC/Stacked%20runlevel Gentoo wiki].&lt;br /&gt;
&lt;br /&gt;
== Config files == &lt;br /&gt;
&lt;br /&gt;
The main configuration file for OpenRC is {{Path|/etc/rc.conf}}. The OpenRC service scripts for each service can be found at {{Path|/etc/init.d/}} and their respective service configuration files at {{Path|/etc/conf.d/}}.&lt;br /&gt;
&lt;br /&gt;
== Command usage ==&lt;br /&gt;
&lt;br /&gt;
OpenRC provides the following commands:&lt;br /&gt;
* {{ic|rc-update}} &lt;br /&gt;
* {{ic|rc-service}}&lt;br /&gt;
* {{ic|rc-status}}&lt;br /&gt;
* {{ic|openrc}}&lt;br /&gt;
&lt;br /&gt;
To view the command usage for all OpenRC commands, use the &#039;&#039;&#039;--help&#039;&#039;&#039; or &#039;&#039;&#039;-h&#039;&#039;&#039; flag.  For eg:{{ic|$ rc-update &#039;&#039;&#039;--help&#039;&#039;&#039;}} or {{ic|$ rc-update &#039;&#039;&#039;-h&#039;&#039;&#039;}} will show usage information for {{ic|rc-update}}.&lt;br /&gt;
&lt;br /&gt;
To {{ic|start}}, {{ic|stop}} or {{ic|restart}} a service {{ic|ServiceName}} immediately at the current runlevel:&lt;br /&gt;
{{cmd|$ doas rc-service {{ic|ServiceName}} start}}&lt;br /&gt;
{{cmd|$ doas rc-service {{ic|ServiceName}} stop}}&lt;br /&gt;
&lt;br /&gt;
To {{ic|add}} or {{ic|delete}} a service to/from the sequence of services that need to start automatically in future sessions at the {{ic|boot}} runlevel: &lt;br /&gt;
{{cmd|$ doas rc-update add {{ic|ServiceName}} boot}}&lt;br /&gt;
Note that the {{ic|&#039;&#039;&#039;default&#039;&#039;&#039;}} runlevel is assumed, so it does not need to be stated explicitly:&lt;br /&gt;
{{cmd|$ doas rc-update add {{ic|ServiceName}}}}&lt;br /&gt;
{{cmd|$ doas rc-update del {{ic|ServiceName}}}}&lt;br /&gt;
&lt;br /&gt;
List the current status of all services; to display the status of all &#039;&#039;user services&#039;&#039; add &#039;&#039;&#039;-U&#039;&#039;&#039; :&lt;br /&gt;
{{cmd|$ rc-status}}&lt;br /&gt;
List the assigned runlevels of all services; to display the runlevels of &#039;&#039;user services&#039;&#039; add &#039;&#039;&#039;-U&#039;&#039;&#039; :&lt;br /&gt;
{{cmd|$ rc-update}}&lt;br /&gt;
&lt;br /&gt;
Refer to the [https://github.com/OpenRC/openrc/blob/master/user-guide.md OpenRC user guide] for more detailed information.&lt;br /&gt;
&lt;br /&gt;
== Cgroups ==&lt;br /&gt;
&lt;br /&gt;
OpenRC supports [https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html cgroups v2] in the default configuration. To enable hybrid cgroups, edit the file {{Path|/etc/rc.conf}} and change the setting for {{ic|rc_cgroup_mode}} as follows:{{Cat|/etc/rc.conf|rc_cgroup_mode{{=}}&amp;quot;hybrid&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
Then, one should run {{Cmd|# rc-service cgroups start}}&lt;br /&gt;
to take effect and {{Cmd|# rc-update add cgroups}}&lt;br /&gt;
to auto mount the cgroup filesystem on boot.&lt;br /&gt;
&lt;br /&gt;
== Local service ==&lt;br /&gt;
&lt;br /&gt;
Use the {{Path|/etc/local.d/}} directory to place programs or scripts which are to be run when the {{ic|local}} service is started or stopped.&lt;br /&gt;
&lt;br /&gt;
If a file in this directory is executable and it has a .start extension, it will be run when the local service is started. If a file is executable and it has a .stop extension, it will be run when the local service is stopped. For more info refer [https://github.com/OpenRC/openrc/blob/master/local.d/README README]&lt;br /&gt;
&lt;br /&gt;
To enable the {{ic|local}} service, issue the command:{{Cmd|# rc-update add local}}&lt;br /&gt;
&lt;br /&gt;
== Preventing slow services from delaying system startup ==&lt;br /&gt;
&lt;br /&gt;
Services that take a while to start will block the boot process until they complete. E.g.: {{ic|iwd}},{{ic|networking}},{{ic|chrony}} etc... might delay startup of an interactive system rather than start in the background. &lt;br /&gt;
&lt;br /&gt;
=== Parallel services === &lt;br /&gt;
&lt;br /&gt;
If the setting {{Codeline|rc_parallel{{=}}&amp;quot;YES&amp;quot;}} is configured, the OpenRC system tries to start services in parallel for a slight speed improvement. &lt;br /&gt;
This setting however comes with a message from openRC developers:{{Warning|whilst we have improved parallel, it can still potentially lock the boot process. Don&#039;t file bugs about this.}} &lt;br /&gt;
&lt;br /&gt;
=== Stacked runlevel method === &lt;br /&gt;
&lt;br /&gt;
Slow services can also be [https://ptrcnull.me/posts/openrc-async-services.html started after login prompt] using [[#Stacked runlevels|stacked runlevels]]. &lt;br /&gt;
{{Warning|Editing the file {{Path|&#039;&#039;&#039;/etc/inittab&#039;&#039;&#039;}} wrongly will render the system unusable. Take backup and learn to restore it using rescue disk before proceeding.}}&lt;br /&gt;
&lt;br /&gt;
# Create a custom runlevel &#039;&#039;&#039;async&#039;&#039;&#039;:  {{Cmd|# mkdir /etc/runlevels/async}}&lt;br /&gt;
# Add &#039;&#039;&#039;default&#039;&#039;&#039; as a stacked runlevel {{Cmd|# rc-update add -s default async}}&lt;br /&gt;
# Remove slow service from &#039;&#039;&#039;default&#039;&#039;&#039; runlevel and add them to the &#039;&#039;&#039;async&#039;&#039;&#039; runlevel:{{Cmd|&amp;lt;nowiki&amp;gt;# rc-update del &amp;lt;servicename&amp;gt; default&lt;br /&gt;
# rc-update add &amp;lt;servicename&amp;gt; async &amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
# Enable the &#039;&#039;&#039;async&#039;&#039;&#039; runlevel by adding the line &#039;&#039;&#039;::once:/sbin/openrc async&#039;&#039;&#039; to {{Path|/etc/inittab}} file as follows: {{Cat|/etc/inittab|&amp;lt;nowiki&amp;gt;...&lt;br /&gt;
::wait:/sbin/openrc default&lt;br /&gt;
::once:/sbin/openrc async -q&lt;br /&gt;
&lt;br /&gt;
# Set up a couple of getty&#039;s&lt;br /&gt;
tty1::respawn:/sbin/getty 38400 tty1&lt;br /&gt;
...&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
After rebooting, services from &#039;&#039;&#039;async&#039;&#039;&#039; will start separately. Other services started in &#039;&#039;&#039;default&#039;&#039;&#039; runlevel may still block [[TTY_Autologin|agetty]] from running, due to the {{ic|wait}} label.&lt;br /&gt;
&lt;br /&gt;
== User services ==&lt;br /&gt;
&lt;br /&gt;
OpenRC supports managing services for users. User services are currently experimental and available from [[Release_Notes_for_Alpine_3.22.0#OpenRC_User_services|v3.22]]. Here is the [https://pkgs.alpinelinux.org/contents?file=*&amp;amp;path=%2Fetc%2Fuser%2Finit.d&amp;amp;name=&amp;amp;branch=edge&amp;amp;repo=&amp;amp;arch=x86_64 list of OpenRC User services] available currently.&lt;br /&gt;
&lt;br /&gt;
Such services are said to be running in &#039;&#039;user mode&#039;&#039; and are managed with usual OpenRC commands using the  &#039;&#039;&#039;-U&#039;&#039;&#039; option (as distinct from the &#039;&#039;-u&#039;&#039; option), and without &#039;&#039;&#039;doas&#039;&#039;&#039; (nor as root).  &lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
&lt;br /&gt;
* [[XDG_RUNTIME_DIR]] variable must be set &lt;br /&gt;
&lt;br /&gt;
=== Config files for user services ===&lt;br /&gt;
&lt;br /&gt;
OpenRC uses {{path|$XDG_CONFIG_HOME/rc}} for its user service configuration. &amp;lt;code&amp;gt;$XDG_CONFIG_HOME&amp;lt;/code&amp;gt;, the fallback {{path|~/.config}} is used. is unset.&lt;br /&gt;
&lt;br /&gt;
The main configuration file for OpenRC User services is {{path|~/.config/rc/rc.conf}}.&lt;br /&gt;
&lt;br /&gt;
==== Runlevels ====&lt;br /&gt;
&lt;br /&gt;
Runlevels are represented by directories in {{path|$XDG_CONFIG_HOME/rc/runlevels}}. The default runlevel is &amp;lt;code&amp;gt;sysinit&amp;lt;/code&amp;gt; and needs to be created explicitly in order to be enabled:&lt;br /&gt;
&lt;br /&gt;
 mkdir -p ${XDG_CONFIG_HOME:-~/.config}/rc/runlevels/sysinit&lt;br /&gt;
&lt;br /&gt;
To start the default runlevel (&amp;lt;code&amp;gt;sysinit&amp;lt;/code&amp;gt;), use:&lt;br /&gt;
&lt;br /&gt;
 openrc -U&lt;br /&gt;
&lt;br /&gt;
To start another runlevel, use:&lt;br /&gt;
&lt;br /&gt;
 openrc -U $RUNLEVEL&lt;br /&gt;
&lt;br /&gt;
==== Services ====&lt;br /&gt;
&lt;br /&gt;
The service scripts for each OpenRC user service provided as part of official packages can be found at {{Path|/etc/user/init.d/}} and their respective service configuration files at {{Path|/etc/user/conf.d/}}. &lt;br /&gt;
&lt;br /&gt;
The folders {{path|~/.config/rc/init.d/}} and {{path|~/.config/rc/conf.d/}} can have user customized service scripts for User services and their respective configuration files. These scripts override official files at {{Path|/etc/user/}}, if their service names match.&lt;br /&gt;
&lt;br /&gt;
=== Configure environment variables ===&lt;br /&gt;
&lt;br /&gt;
==== For Wayland ====&lt;br /&gt;
{{Tip|User services like {{pkg|wlsunset}} depend on the {{ic|$WAYLAND_DISPLAY}} environment variable. Hence, it is [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17375#note_530383 recommended] to use &#039;&#039;&#039;gui&#039;&#039;&#039; runlevel for such services. Even though [[PipeWire]] can run at &#039;&#039;&#039;default&#039;&#039;&#039; runlevel, ensure that all your User services can run at the chosen runlevel.}} &lt;br /&gt;
* Allow propagation of the {{ic|$WAYLAND_DISPLAY}} and associated environment variables by adding the following lines to file {{path|~/.config/rc/rc.conf}} as follows:{{Cat|~/.config/rc/rc.conf|&amp;lt;nowiki&amp;gt;rc_env_allow=&amp;quot;WAYLAND_DISPLAY&amp;quot;&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
* Create a custom &#039;&#039;&#039;gui&#039;&#039;&#039; user runlevel:{{Cmd|$ mkdir -p ~/.config/rc/runlevels/gui}}&lt;br /&gt;
* To start &#039;&#039;&#039;gui&#039;&#039;&#039; user runlevel, add the line {{ic|openrc -U gui}} to the startup file of your compositor. For eg, for [[Sway]] add:{{Cat|~/.config/sway/config|...&lt;br /&gt;
exec openrc -U gui}}&lt;br /&gt;
&lt;br /&gt;
==== For Xorg ====&lt;br /&gt;
&lt;br /&gt;
If [[Elogind]] is not used, ensure that [[Wayland#Creating_and_exporting_XDG_RUNTIME_DIR_manually|XDG_RUNTIME_DIR]] is set manually in {{path|~/.xinitrc}}. For eg, for [[dwm]] add:{{Cat|~/.xinitrc|&amp;lt;nowiki&amp;gt;...&lt;br /&gt;
if [ -z &amp;quot;$XDG_RUNTIME_DIR&amp;quot; ]; then&lt;br /&gt;
	XDG_RUNTIME_DIR=&amp;quot;/tmp/$(id -u)-runtime-dir&amp;quot;&lt;br /&gt;
	mkdir -pm 0700 &amp;quot;$XDG_RUNTIME_DIR&amp;quot;&lt;br /&gt;
	export XDG_RUNTIME_DIR&lt;br /&gt;
fi&lt;br /&gt;
openrc -U default&lt;br /&gt;
exec dwm&amp;lt;/nowiki&amp;gt;}} &lt;br /&gt;
&lt;br /&gt;
{{Note|For both the above cases, logout and login for the OpenRC user services to be started, before proceeding further.}}&lt;br /&gt;
&lt;br /&gt;
=== User service management ===&lt;br /&gt;
&lt;br /&gt;
Issue the command {{ic|$ rc-status -Ur}} to view and verify the current user runlevel as &#039;&#039;&#039;gui&#039;&#039;&#039; and &#039;&#039;&#039;default&#039;&#039;&#039; for Wayland and Xorg, respectively, before proceeding. &lt;br /&gt;
&lt;br /&gt;
To start {{ic|ServiceName}} user service, issue the command:{{Cmd|$ rc-service -U {{ic|ServiceName}} start}}&lt;br /&gt;
Verify that the above OpenRC user service is started before proceeding further: {{Cmd|$ rc-status -U}} &lt;br /&gt;
To enable {{ic|ServiceName}} user service, issue the command: {{Cmd|$ rc-update -U add ServiceName}}&lt;br /&gt;
&lt;br /&gt;
{{Tip|Once a user service is configured, to prevent duplicate instance, remove them from {{Path|/etc/xdg/autostart}} folder or from the startup/config file.}}&lt;br /&gt;
&lt;br /&gt;
=== PAM support ===&lt;br /&gt;
&lt;br /&gt;
The default installation of OpenRC user services in Alpine Linux is without PAM support.&lt;br /&gt;
&lt;br /&gt;
In scenarios where services should not be allowed to [https://wiki.gentoo.org/wiki/OpenRC#lingering linger] on logout, PAM support for OpenRC user services can be enabled by installing the {{pkg|openrc-user-pam}} package.{{Cmd|# apk add {{pkg|openrc-user-pam}}}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
Whenever a openRC service fails to run, troubleshoot by enabling a debugging option, and then run the command. &lt;br /&gt;
&lt;br /&gt;
For example, if running the command {{ic|rc-service greetd start}} causes the [[Greetd|greetd]] service to immediately crash, then alter the command to enable debug and to view its output:{{Cmd|# rc-service -d greetd restart}}&lt;br /&gt;
&lt;br /&gt;
=== XDG_RUNTIME_DIR unset ===&lt;br /&gt;
&lt;br /&gt;
While configuring [[#User services|user services]], running the command {{ic|$ doas rc-update add -U pipewire gui}} will generate the above error {{ic|XDG_RUNTIME_DIR unset}}.  Always issue the command as normal user {{ic|$ rc-update add -U pipewire gui}} and do NOT use {{ic|doas}}. &lt;br /&gt;
&lt;br /&gt;
=== ERROR: user.greetd failed to start ===&lt;br /&gt;
&lt;br /&gt;
While using [[#User services|user services]] with [[greetd]], the above error message will appear. This failed error message for {{ic|user.greetd}} service is harmless as per {{MR|81612#note_492385}}.&lt;br /&gt;
&lt;br /&gt;
=== failed to create display ===&lt;br /&gt;
&lt;br /&gt;
When using openRC user services for {{ic|wlsunset}}, the following  error message may appear:{{Cmd|daemon.err wlsunset: failed to create display}}You will need the GUI runlevel for services that depend on {{ic|$WAYLAND_DISPLAY}}. Refer [[#For Wayland| Configure environment variables For Wayland]] section.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Writing Init Scripts]]&lt;br /&gt;
* [[Multiple Instances of Services]]&lt;br /&gt;
* [https://github.com/OpenRC/openrc/blob/master/user-guide.md OpenRC user Guide]&lt;br /&gt;
* [https://github.com/OpenRC/openrc/blob/master/service-script-guide.md OpenRC Service Script Writing Guide]&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/OpenRC Gentoo Wiki]&lt;br /&gt;
* [https://wiki.archlinux.org/title/OpenRC ArchWiki]&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/OpenRC PostmarketOS Wiki]&lt;br /&gt;
* [https://ptrcnull.me/posts/openrc-async-services.html Start services after login prompt]&lt;br /&gt;
&lt;br /&gt;
[[Category:Booting]] &lt;br /&gt;
[[Category:System Administration]]&lt;br /&gt;
[[Category:Services]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=OpenRC&amp;diff=30863</id>
		<title>OpenRC</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=OpenRC&amp;diff=30863"/>
		<updated>2025-09-05T12:42:47Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: /* Config files for user services */ describe runlevels&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Alpine Linux uses [https://github.com/OpenRC/ OpenRC] for its [https://en.wikipedia.org/wiki/Init init] system. The init system manages the services, including the boot and shutdown of your system. OpenRC also supports managing [[#User services|services for users]]. &lt;br /&gt;
&lt;br /&gt;
To learn the basics of OpenRC quickly, refer to the [https://docs.alpinelinux.org/user-handbook/0.1a/Working/openrc.html working with OpenRC] guide from the Alpine Linux documentation project. &lt;br /&gt;
&lt;br /&gt;
== Quickstart  ==&lt;br /&gt;
&lt;br /&gt;
{|align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| width=&amp;quot;50%&amp;quot; |Action&lt;br /&gt;
|             |Command&lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039;Managing a service - start,stop and restart&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Start {{ic|ServiceName}} now || {{ic|# rc-service {{ic|ServiceName}} start}}&lt;br /&gt;
|-&lt;br /&gt;
| Stop {{ic|ServiceName}} now || {{ic|# rc-service {{ic|ServiceName}} stop}} &lt;br /&gt;
|-&lt;br /&gt;
| Restart {{ic|ServiceName}} now || {{ic|# rc-service {{ic|ServiceName}} restart}} &lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039;Adding and removing service from runlevels&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Add {{ic|ServiceName}} to {{ic|runlevel}} || {{ic|# rc-update add {{ic|ServiceName}} {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
| Remove {{ic|ServiceName}} from {{ic|runlevel}} || {{ic|# rc-update del {{ic|ServiceName}} {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039; Check services in a runlevel and their status&#039;&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| To check status of {{ic|ServiceName}} || {{ic|$ rc-service {{ic|ServiceName}} status}} &lt;br /&gt;
|-&lt;br /&gt;
| To view services configured at {{ic|runlevel}}  || {{ic|$ rc-update show {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
| To view currently active runlevels and state of services  || {{ic|$ rc-status}} &lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039; Check and manage runlevels&#039;&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| To view available runlevels || {{ic|$ rc-status -l}} &lt;br /&gt;
|-&lt;br /&gt;
| To change to a different {{ic|runlevel}} || {{ic|# openrc {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039; Stacked runlevels&#039;&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| To add {{ic|s-runlevel}} as a stacked {{ic|runlevel}} || {{ic|# rc-update add -s {{ic|s-runlevel}} {{ic|runlevel}}}} &lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |&#039;&#039;&#039;User Services&#039;&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| To view currently active User runlevels and state of User services || {{ic|$ rc-status -U}} &lt;br /&gt;
|-&lt;br /&gt;
| To change to a different user {{ic|runlevel}} || {{ic|$ openrc -U {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
| Add User {{ic|ServiceName}} to user {{ic|runlevel}} || {{ic|$ rc-update -U add {{ic|ServiceName}} {{ic|runlevel}}}} &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Runlevels ==&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;runlevel&#039;&#039; is basically a collection of services that needs to be started when certain conditions are met. Instead of using runlevel numbers, such as is used traditionally with &#039;&#039;SysV&#039;&#039; init, these are named, and users can create their own, if needed. The default startup uses the &#039;&#039;&#039;sysinit&#039;&#039;&#039;, &#039;&#039;&#039;boot&#039;&#039;&#039;, and &#039;&#039;&#039;default&#039;&#039;&#039; runlevels, in that order. Shutdown uses the &#039;&#039;&#039;shutdown&#039;&#039;&#039; runlevel.&lt;br /&gt;
&lt;br /&gt;
The available runlevels are:&lt;br /&gt;
* &#039;&#039;&#039;default&#039;&#039;&#039; - Used if no runlevel is specified. (This is generally the runlevel you want to add services to.)&lt;br /&gt;
* &#039;&#039;&#039;hotplugged&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;manual&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The special runlevels are:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;sysinit&#039;&#039;&#039; - Brings up system specific stuff such as &amp;lt;code&amp;gt;/dev&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/proc&amp;lt;/code&amp;gt; and optionally &amp;lt;code&amp;gt;/sys&amp;lt;/code&amp;gt; for Linux based systems. It also mounts &amp;lt;code&amp;gt;/lib/rc/init.d&amp;lt;/code&amp;gt; as a ramdisk using tmpfs where available unless &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; is mounted rw at boot. &amp;lt;code&amp;gt;&#039;&#039;&#039;rc&#039;&#039;&#039;&amp;lt;/code&amp;gt; uses &amp;lt;code&amp;gt;/lib/rc/init.d&amp;lt;/code&amp;gt; to hold state information about the services it runs. &#039;&#039;&#039;sysinit&#039;&#039;&#039; always runs when the host first starts and should not be run again.&lt;br /&gt;
* &#039;&#039;&#039;boot&#039;&#039;&#039; - Generally, the only services that one should add to the &#039;&#039;&#039;boot&#039;&#039;&#039; runlevel are those which deal with the mounting of filesystems, setting the initial state of attached peripherals, and logging. Hotplugged services are added to the &#039;&#039;&#039;boot&#039;&#039;&#039; runlevel by the system. All services in the &#039;&#039;&#039;boot&#039;&#039;&#039; and &#039;&#039;&#039;sysinit&#039;&#039;&#039; runlevels are automatically included in all other runlevels except for those listed here.&lt;br /&gt;
* &#039;&#039;&#039;single&#039;&#039;&#039; - Stops all services except for those in the &#039;&#039;&#039;sysinit&#039;&#039;&#039; runlevel.&lt;br /&gt;
* &#039;&#039;&#039;reboot&#039;&#039;&#039; - Changes to the &#039;&#039;&#039;shutdown&#039;&#039;&#039; runlevel, and then reboots the host.&lt;br /&gt;
* &#039;&#039;&#039;shutdown&#039;&#039;&#039; - Changes to the shutdown &#039;&#039;&#039;runlevel&#039;&#039;&#039;, and then halts the host.&lt;br /&gt;
&lt;br /&gt;
=== Stacked runlevels ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Stacked&#039;&#039; runlevels allows for the &amp;quot;inheritance&amp;quot; of services. A few use cases are given below:-&lt;br /&gt;
* [https://docs.alpinelinux.org/user-handbook/0.1a/Working/openrc.html#_runlevel_stacking Running an office runlevel with VPN service]&lt;br /&gt;
* [[#Preventing slow services from delaying system startup|Preventing slow services from delaying system startup]]&lt;br /&gt;
For more detailed information, refer [https://wiki.gentoo.org/wiki/OpenRC/Stacked%20runlevel Gentoo wiki].&lt;br /&gt;
&lt;br /&gt;
== Config files == &lt;br /&gt;
&lt;br /&gt;
The main configuration file for OpenRC is {{Path|/etc/rc.conf}}. The OpenRC service scripts for each service can be found at {{Path|/etc/init.d/}} and their respective service configuration files at {{Path|/etc/conf.d/}}.&lt;br /&gt;
&lt;br /&gt;
== Command usage ==&lt;br /&gt;
&lt;br /&gt;
OpenRC provides the following commands:&lt;br /&gt;
* {{ic|rc-update}} &lt;br /&gt;
* {{ic|rc-service}}&lt;br /&gt;
* {{ic|rc-status}}&lt;br /&gt;
* {{ic|openrc}}&lt;br /&gt;
&lt;br /&gt;
To view the command usage for all OpenRC commands, use the &#039;&#039;&#039;--help&#039;&#039;&#039; or &#039;&#039;&#039;-h&#039;&#039;&#039; flag.  For eg:{{ic|$ rc-update &#039;&#039;&#039;--help&#039;&#039;&#039;}} or {{ic|$ rc-update &#039;&#039;&#039;-h&#039;&#039;&#039;}} will show usage information for {{ic|rc-update}}.&lt;br /&gt;
&lt;br /&gt;
To {{ic|start}}, {{ic|stop}} or {{ic|restart}} a service {{ic|ServiceName}} immediately at the current runlevel:&lt;br /&gt;
{{cmd|$ doas rc-service {{ic|ServiceName}} start}}&lt;br /&gt;
{{cmd|$ doas rc-service {{ic|ServiceName}} stop}}&lt;br /&gt;
&lt;br /&gt;
To {{ic|add}} or {{ic|delete}} a service to/from the sequence of services that need to start automatically in future sessions at the {{ic|boot}} runlevel: &lt;br /&gt;
{{cmd|$ doas rc-update add {{ic|ServiceName}} boot}}&lt;br /&gt;
Note that the {{ic|&#039;&#039;&#039;default&#039;&#039;&#039;}} runlevel is assumed, so it does not need to be stated explicitly:&lt;br /&gt;
{{cmd|$ doas rc-update add {{ic|ServiceName}}}}&lt;br /&gt;
{{cmd|$ doas rc-update del {{ic|ServiceName}}}}&lt;br /&gt;
&lt;br /&gt;
List the current status of all services; to display the status of all &#039;&#039;user services&#039;&#039; add &#039;&#039;&#039;-U&#039;&#039;&#039; :&lt;br /&gt;
{{cmd|$ rc-status}}&lt;br /&gt;
List the assigned runlevels of all services; to display the runlevels of &#039;&#039;user services&#039;&#039; add &#039;&#039;&#039;-U&#039;&#039;&#039; :&lt;br /&gt;
{{cmd|$ rc-update}}&lt;br /&gt;
&lt;br /&gt;
Refer to the [https://github.com/OpenRC/openrc/blob/master/user-guide.md OpenRC user guide] for more detailed information.&lt;br /&gt;
&lt;br /&gt;
== Cgroups ==&lt;br /&gt;
&lt;br /&gt;
OpenRC supports [https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html cgroups v2] in the default configuration. To enable hybrid cgroups, edit the file {{Path|/etc/rc.conf}} and change the setting for {{ic|rc_cgroup_mode}} as follows:{{Cat|/etc/rc.conf|rc_cgroup_mode{{=}}&amp;quot;hybrid&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
Then, one should run {{Cmd|# rc-service cgroups start}}&lt;br /&gt;
to take effect and {{Cmd|# rc-update add cgroups}}&lt;br /&gt;
to auto mount the cgroup filesystem on boot.&lt;br /&gt;
&lt;br /&gt;
== Local service ==&lt;br /&gt;
&lt;br /&gt;
Use the {{Path|/etc/local.d/}} directory to place programs or scripts which are to be run when the {{ic|local}} service is started or stopped.&lt;br /&gt;
&lt;br /&gt;
If a file in this directory is executable and it has a .start extension, it will be run when the local service is started. If a file is executable and it has a .stop extension, it will be run when the local service is stopped. For more info refer [https://github.com/OpenRC/openrc/blob/master/local.d/README README]&lt;br /&gt;
&lt;br /&gt;
To enable the {{ic|local}} service, issue the command:{{Cmd|# rc-update add local}}&lt;br /&gt;
&lt;br /&gt;
== Preventing slow services from delaying system startup ==&lt;br /&gt;
&lt;br /&gt;
Services that take a while to start will block the boot process until they complete. E.g.: {{ic|iwd}},{{ic|networking}},{{ic|chrony}} etc... might delay startup of an interactive system rather than start in the background. &lt;br /&gt;
&lt;br /&gt;
=== Parallel services === &lt;br /&gt;
&lt;br /&gt;
If the setting {{Codeline|rc_parallel{{=}}&amp;quot;YES&amp;quot;}} is configured, the OpenRC system tries to start services in parallel for a slight speed improvement. &lt;br /&gt;
This setting however comes with a message from openRC developers:{{Warning|whilst we have improved parallel, it can still potentially lock the boot process. Don&#039;t file bugs about this.}} &lt;br /&gt;
&lt;br /&gt;
=== Stacked runlevel method === &lt;br /&gt;
&lt;br /&gt;
Slow services can also be [https://ptrcnull.me/posts/openrc-async-services.html started after login prompt] using [[#Stacked runlevels|stacked runlevels]]. &lt;br /&gt;
{{Warning|Editing the file {{Path|&#039;&#039;&#039;/etc/inittab&#039;&#039;&#039;}} wrongly will render the system unusable. Take backup and learn to restore it using rescue disk before proceeding.}}&lt;br /&gt;
&lt;br /&gt;
# Create a custom runlevel &#039;&#039;&#039;async&#039;&#039;&#039;:  {{Cmd|# mkdir /etc/runlevels/async}}&lt;br /&gt;
# Add &#039;&#039;&#039;default&#039;&#039;&#039; as a stacked runlevel {{Cmd|# rc-update add -s default async}}&lt;br /&gt;
# Remove slow service from &#039;&#039;&#039;default&#039;&#039;&#039; runlevel and add them to the &#039;&#039;&#039;async&#039;&#039;&#039; runlevel:{{Cmd|&amp;lt;nowiki&amp;gt;# rc-update del &amp;lt;servicename&amp;gt; default&lt;br /&gt;
# rc-update add &amp;lt;servicename&amp;gt; async &amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
# Enable the &#039;&#039;&#039;async&#039;&#039;&#039; runlevel by adding the line &#039;&#039;&#039;::once:/sbin/openrc async&#039;&#039;&#039; to {{Path|/etc/inittab}} file as follows: {{Cat|/etc/inittab|&amp;lt;nowiki&amp;gt;...&lt;br /&gt;
::wait:/sbin/openrc default&lt;br /&gt;
::once:/sbin/openrc async -q&lt;br /&gt;
&lt;br /&gt;
# Set up a couple of getty&#039;s&lt;br /&gt;
tty1::respawn:/sbin/getty 38400 tty1&lt;br /&gt;
...&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
After rebooting, services from &#039;&#039;&#039;async&#039;&#039;&#039; will start separately. Other services started in &#039;&#039;&#039;default&#039;&#039;&#039; runlevel may still block [[TTY_Autologin|agetty]] from running, due to the {{ic|wait}} label.&lt;br /&gt;
&lt;br /&gt;
== User services ==&lt;br /&gt;
&lt;br /&gt;
OpenRC supports managing services for users. User services are currently experimental and available from [[Release_Notes_for_Alpine_3.22.0#OpenRC_User_services|v3.22]]. Here is the [https://pkgs.alpinelinux.org/contents?file=*&amp;amp;path=%2Fetc%2Fuser%2Finit.d&amp;amp;name=&amp;amp;branch=edge&amp;amp;repo=&amp;amp;arch=x86_64 list of OpenRC User services] available currently.&lt;br /&gt;
&lt;br /&gt;
Such services are said to be running in &#039;&#039;user mode&#039;&#039; and are managed with usual OpenRC commands using the  &#039;&#039;&#039;-U&#039;&#039;&#039; option (as distinct from the &#039;&#039;-u&#039;&#039; option), and without &#039;&#039;&#039;doas&#039;&#039;&#039; (nor as root).  &lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
&lt;br /&gt;
* [[XDG_RUNTIME_DIR]] variable must be set &lt;br /&gt;
&lt;br /&gt;
=== Config files for user services ===&lt;br /&gt;
&lt;br /&gt;
OpenRC uses {{path|$XDG_CONFIG_HOME/rc}} for its user service configuration. &amp;lt;code&amp;gt;$XDG_CONFIG_HOME&amp;lt;code&amp;gt;, the fallback {{path|~/.config}} is used. is unset.&lt;br /&gt;
&lt;br /&gt;
The main configuration file for OpenRC User services is {{path|~/.config/rc/rc.conf}}.&lt;br /&gt;
&lt;br /&gt;
==== Runlevels ====&lt;br /&gt;
&lt;br /&gt;
Runlevels are represented by directories in {{path|$XDG_CONFIG_HOME/rc/runlevels}}. The default runlevel is &amp;lt;code&amp;gt;sysinit&amp;lt;/code&amp;gt; and needs to be created explicitly in order to be enabled:&lt;br /&gt;
&lt;br /&gt;
 mkdir -p ${XDG_CONFIG_HOME:-~/.config}/rc/runlevels/sysinit&lt;br /&gt;
&lt;br /&gt;
To start the default runlevel (&amp;lt;code&amp;gt;sysinit&amp;lt;/code&amp;gt;), use:&lt;br /&gt;
&lt;br /&gt;
 openrc -U&lt;br /&gt;
&lt;br /&gt;
To start another runlevel, use:&lt;br /&gt;
&lt;br /&gt;
 openrc -U $RUNLEVEL&lt;br /&gt;
&lt;br /&gt;
==== Services ====&lt;br /&gt;
&lt;br /&gt;
The service scripts for each OpenRC user service provided as part of official packages can be found at {{Path|/etc/user/init.d/}} and their respective service configuration files at {{Path|/etc/user/conf.d/}}. &lt;br /&gt;
&lt;br /&gt;
The folders {{path|~/.config/rc/init.d/}} and {{path|~/.config/rc/conf.d/}} can have user customized service scripts for User services and their respective configuration files. These scripts override official files at {{Path|/etc/user/}}, if their service names match.&lt;br /&gt;
&lt;br /&gt;
=== Configure environment variables ===&lt;br /&gt;
&lt;br /&gt;
==== For Wayland ====&lt;br /&gt;
{{Tip|User services like {{pkg|wlsunset}} depend on the {{ic|$WAYLAND_DISPLAY}} environment variable. Hence, it is [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17375#note_530383 recommended] to use &#039;&#039;&#039;gui&#039;&#039;&#039; runlevel for such services. Even though [[PipeWire]] can run at &#039;&#039;&#039;default&#039;&#039;&#039; runlevel, ensure that all your User services can run at the chosen runlevel.}} &lt;br /&gt;
* Allow propagation of the {{ic|$WAYLAND_DISPLAY}} and associated environment variables by adding the following lines to file {{path|~/.config/rc/rc.conf}} as follows:{{Cat|~/.config/rc/rc.conf|&amp;lt;nowiki&amp;gt;rc_env_allow=&amp;quot;WAYLAND_DISPLAY&amp;quot;&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
* Create a custom &#039;&#039;&#039;gui&#039;&#039;&#039; user runlevel:{{Cmd|$ mkdir -p ~/.config/rc/runlevels/gui}}&lt;br /&gt;
* To start &#039;&#039;&#039;gui&#039;&#039;&#039; user runlevel, add the line {{ic|openrc -U gui}} to the startup file of your compositor. For eg, for [[Sway]] add:{{Cat|~/.config/sway/config|...&lt;br /&gt;
exec openrc -U gui}}&lt;br /&gt;
&lt;br /&gt;
==== For Xorg ====&lt;br /&gt;
&lt;br /&gt;
If [[Elogind]] is not used, ensure that [[Wayland#Creating_and_exporting_XDG_RUNTIME_DIR_manually|XDG_RUNTIME_DIR]] is set manually in {{path|~/.xinitrc}}. For eg, for [[dwm]] add:{{Cat|~/.xinitrc|&amp;lt;nowiki&amp;gt;...&lt;br /&gt;
if [ -z &amp;quot;$XDG_RUNTIME_DIR&amp;quot; ]; then&lt;br /&gt;
	XDG_RUNTIME_DIR=&amp;quot;/tmp/$(id -u)-runtime-dir&amp;quot;&lt;br /&gt;
	mkdir -pm 0700 &amp;quot;$XDG_RUNTIME_DIR&amp;quot;&lt;br /&gt;
	export XDG_RUNTIME_DIR&lt;br /&gt;
fi&lt;br /&gt;
openrc -U default&lt;br /&gt;
exec dwm&amp;lt;/nowiki&amp;gt;}} &lt;br /&gt;
&lt;br /&gt;
{{Note|For both the above cases, logout and login for the OpenRC user services to be started, before proceeding further.}}&lt;br /&gt;
&lt;br /&gt;
=== User service management ===&lt;br /&gt;
&lt;br /&gt;
Issue the command {{ic|$ rc-status -Ur}} to view and verify the current user runlevel as &#039;&#039;&#039;gui&#039;&#039;&#039; and &#039;&#039;&#039;default&#039;&#039;&#039; for Wayland and Xorg, respectively, before proceeding. &lt;br /&gt;
&lt;br /&gt;
To start {{ic|ServiceName}} user service, issue the command:{{Cmd|$ rc-service -U {{ic|ServiceName}} start}}&lt;br /&gt;
Verify that the above OpenRC user service is started before proceeding further: {{Cmd|$ rc-status -U}} &lt;br /&gt;
To enable {{ic|ServiceName}} user service, issue the command: {{Cmd|$ rc-update -U add ServiceName}}&lt;br /&gt;
&lt;br /&gt;
{{Tip|Once a user service is configured, to prevent duplicate instance, remove them from {{Path|/etc/xdg/autostart}} folder or from the startup/config file.}}&lt;br /&gt;
&lt;br /&gt;
=== PAM support ===&lt;br /&gt;
&lt;br /&gt;
The default installation of OpenRC user services in Alpine Linux is without PAM support.&lt;br /&gt;
&lt;br /&gt;
In scenarios where services should not be allowed to [https://wiki.gentoo.org/wiki/OpenRC#lingering linger] on logout, PAM support for OpenRC user services can be enabled by installing the {{pkg|openrc-user-pam}} package.{{Cmd|# apk add {{pkg|openrc-user-pam}}}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
Whenever a openRC service fails to run, troubleshoot by enabling a debugging option, and then run the command. &lt;br /&gt;
&lt;br /&gt;
For example, if running the command {{ic|rc-service greetd start}} causes the [[Greetd|greetd]] service to immediately crash, then alter the command to enable debug and to view its output:{{Cmd|# rc-service -d greetd restart}}&lt;br /&gt;
&lt;br /&gt;
=== XDG_RUNTIME_DIR unset ===&lt;br /&gt;
&lt;br /&gt;
While configuring [[#User services|user services]], running the command {{ic|$ doas rc-update add -U pipewire gui}} will generate the above error {{ic|XDG_RUNTIME_DIR unset}}.  Always issue the command as normal user {{ic|$ rc-update add -U pipewire gui}} and do NOT use {{ic|doas}}. &lt;br /&gt;
&lt;br /&gt;
=== ERROR: user.greetd failed to start ===&lt;br /&gt;
&lt;br /&gt;
While using [[#User services|user services]] with [[greetd]], the above error message will appear. This failed error message for {{ic|user.greetd}} service is harmless as per {{MR|81612#note_492385}}.&lt;br /&gt;
&lt;br /&gt;
=== failed to create display ===&lt;br /&gt;
&lt;br /&gt;
When using openRC user services for {{ic|wlsunset}}, the following  error message may appear:{{Cmd|daemon.err wlsunset: failed to create display}}You will need the GUI runlevel for services that depend on {{ic|$WAYLAND_DISPLAY}}. Refer [[#For Wayland| Configure environment variables For Wayland]] section.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Writing Init Scripts]]&lt;br /&gt;
* [[Multiple Instances of Services]]&lt;br /&gt;
* [https://github.com/OpenRC/openrc/blob/master/user-guide.md OpenRC user Guide]&lt;br /&gt;
* [https://github.com/OpenRC/openrc/blob/master/service-script-guide.md OpenRC Service Script Writing Guide]&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/OpenRC Gentoo Wiki]&lt;br /&gt;
* [https://wiki.archlinux.org/title/OpenRC ArchWiki]&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/OpenRC PostmarketOS Wiki]&lt;br /&gt;
* [https://ptrcnull.me/posts/openrc-async-services.html Start services after login prompt]&lt;br /&gt;
&lt;br /&gt;
[[Category:Booting]] &lt;br /&gt;
[[Category:System Administration]]&lt;br /&gt;
[[Category:Services]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=OpenRC&amp;diff=30862</id>
		<title>OpenRC</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=OpenRC&amp;diff=30862"/>
		<updated>2025-09-05T12:34:55Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: /* Configure environment variables */ Typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Alpine Linux uses [https://github.com/OpenRC/ OpenRC] for its [https://en.wikipedia.org/wiki/Init init] system. The init system manages the services, including the boot and shutdown of your system. OpenRC also supports managing [[#User services|services for users]]. &lt;br /&gt;
&lt;br /&gt;
To learn the basics of OpenRC quickly, refer to the [https://docs.alpinelinux.org/user-handbook/0.1a/Working/openrc.html working with OpenRC] guide from the Alpine Linux documentation project. &lt;br /&gt;
&lt;br /&gt;
== Quickstart  ==&lt;br /&gt;
&lt;br /&gt;
{|align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| width=&amp;quot;50%&amp;quot; |Action&lt;br /&gt;
|             |Command&lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039;Managing a service - start,stop and restart&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Start {{ic|ServiceName}} now || {{ic|# rc-service {{ic|ServiceName}} start}}&lt;br /&gt;
|-&lt;br /&gt;
| Stop {{ic|ServiceName}} now || {{ic|# rc-service {{ic|ServiceName}} stop}} &lt;br /&gt;
|-&lt;br /&gt;
| Restart {{ic|ServiceName}} now || {{ic|# rc-service {{ic|ServiceName}} restart}} &lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039;Adding and removing service from runlevels&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Add {{ic|ServiceName}} to {{ic|runlevel}} || {{ic|# rc-update add {{ic|ServiceName}} {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
| Remove {{ic|ServiceName}} from {{ic|runlevel}} || {{ic|# rc-update del {{ic|ServiceName}} {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039; Check services in a runlevel and their status&#039;&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| To check status of {{ic|ServiceName}} || {{ic|$ rc-service {{ic|ServiceName}} status}} &lt;br /&gt;
|-&lt;br /&gt;
| To view services configured at {{ic|runlevel}}  || {{ic|$ rc-update show {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
| To view currently active runlevels and state of services  || {{ic|$ rc-status}} &lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039; Check and manage runlevels&#039;&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| To view available runlevels || {{ic|$ rc-status -l}} &lt;br /&gt;
|-&lt;br /&gt;
| To change to a different {{ic|runlevel}} || {{ic|# openrc {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039; Stacked runlevels&#039;&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| To add {{ic|s-runlevel}} as a stacked {{ic|runlevel}} || {{ic|# rc-update add -s {{ic|s-runlevel}} {{ic|runlevel}}}} &lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |&#039;&#039;&#039;User Services&#039;&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| To view currently active User runlevels and state of User services || {{ic|$ rc-status -U}} &lt;br /&gt;
|-&lt;br /&gt;
| To change to a different user {{ic|runlevel}} || {{ic|$ openrc -U {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
| Add User {{ic|ServiceName}} to user {{ic|runlevel}} || {{ic|$ rc-update -U add {{ic|ServiceName}} {{ic|runlevel}}}} &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Runlevels ==&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;runlevel&#039;&#039; is basically a collection of services that needs to be started when certain conditions are met. Instead of using runlevel numbers, such as is used traditionally with &#039;&#039;SysV&#039;&#039; init, these are named, and users can create their own, if needed. The default startup uses the &#039;&#039;&#039;sysinit&#039;&#039;&#039;, &#039;&#039;&#039;boot&#039;&#039;&#039;, and &#039;&#039;&#039;default&#039;&#039;&#039; runlevels, in that order. Shutdown uses the &#039;&#039;&#039;shutdown&#039;&#039;&#039; runlevel.&lt;br /&gt;
&lt;br /&gt;
The available runlevels are:&lt;br /&gt;
* &#039;&#039;&#039;default&#039;&#039;&#039; - Used if no runlevel is specified. (This is generally the runlevel you want to add services to.)&lt;br /&gt;
* &#039;&#039;&#039;hotplugged&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;manual&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The special runlevels are:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;sysinit&#039;&#039;&#039; - Brings up system specific stuff such as &amp;lt;code&amp;gt;/dev&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/proc&amp;lt;/code&amp;gt; and optionally &amp;lt;code&amp;gt;/sys&amp;lt;/code&amp;gt; for Linux based systems. It also mounts &amp;lt;code&amp;gt;/lib/rc/init.d&amp;lt;/code&amp;gt; as a ramdisk using tmpfs where available unless &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; is mounted rw at boot. &amp;lt;code&amp;gt;&#039;&#039;&#039;rc&#039;&#039;&#039;&amp;lt;/code&amp;gt; uses &amp;lt;code&amp;gt;/lib/rc/init.d&amp;lt;/code&amp;gt; to hold state information about the services it runs. &#039;&#039;&#039;sysinit&#039;&#039;&#039; always runs when the host first starts and should not be run again.&lt;br /&gt;
* &#039;&#039;&#039;boot&#039;&#039;&#039; - Generally, the only services that one should add to the &#039;&#039;&#039;boot&#039;&#039;&#039; runlevel are those which deal with the mounting of filesystems, setting the initial state of attached peripherals, and logging. Hotplugged services are added to the &#039;&#039;&#039;boot&#039;&#039;&#039; runlevel by the system. All services in the &#039;&#039;&#039;boot&#039;&#039;&#039; and &#039;&#039;&#039;sysinit&#039;&#039;&#039; runlevels are automatically included in all other runlevels except for those listed here.&lt;br /&gt;
* &#039;&#039;&#039;single&#039;&#039;&#039; - Stops all services except for those in the &#039;&#039;&#039;sysinit&#039;&#039;&#039; runlevel.&lt;br /&gt;
* &#039;&#039;&#039;reboot&#039;&#039;&#039; - Changes to the &#039;&#039;&#039;shutdown&#039;&#039;&#039; runlevel, and then reboots the host.&lt;br /&gt;
* &#039;&#039;&#039;shutdown&#039;&#039;&#039; - Changes to the shutdown &#039;&#039;&#039;runlevel&#039;&#039;&#039;, and then halts the host.&lt;br /&gt;
&lt;br /&gt;
=== Stacked runlevels ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Stacked&#039;&#039; runlevels allows for the &amp;quot;inheritance&amp;quot; of services. A few use cases are given below:-&lt;br /&gt;
* [https://docs.alpinelinux.org/user-handbook/0.1a/Working/openrc.html#_runlevel_stacking Running an office runlevel with VPN service]&lt;br /&gt;
* [[#Preventing slow services from delaying system startup|Preventing slow services from delaying system startup]]&lt;br /&gt;
For more detailed information, refer [https://wiki.gentoo.org/wiki/OpenRC/Stacked%20runlevel Gentoo wiki].&lt;br /&gt;
&lt;br /&gt;
== Config files == &lt;br /&gt;
&lt;br /&gt;
The main configuration file for OpenRC is {{Path|/etc/rc.conf}}. The OpenRC service scripts for each service can be found at {{Path|/etc/init.d/}} and their respective service configuration files at {{Path|/etc/conf.d/}}.&lt;br /&gt;
&lt;br /&gt;
== Command usage ==&lt;br /&gt;
&lt;br /&gt;
OpenRC provides the following commands:&lt;br /&gt;
* {{ic|rc-update}} &lt;br /&gt;
* {{ic|rc-service}}&lt;br /&gt;
* {{ic|rc-status}}&lt;br /&gt;
* {{ic|openrc}}&lt;br /&gt;
&lt;br /&gt;
To view the command usage for all OpenRC commands, use the &#039;&#039;&#039;--help&#039;&#039;&#039; or &#039;&#039;&#039;-h&#039;&#039;&#039; flag.  For eg:{{ic|$ rc-update &#039;&#039;&#039;--help&#039;&#039;&#039;}} or {{ic|$ rc-update &#039;&#039;&#039;-h&#039;&#039;&#039;}} will show usage information for {{ic|rc-update}}.&lt;br /&gt;
&lt;br /&gt;
To {{ic|start}}, {{ic|stop}} or {{ic|restart}} a service {{ic|ServiceName}} immediately at the current runlevel:&lt;br /&gt;
{{cmd|$ doas rc-service {{ic|ServiceName}} start}}&lt;br /&gt;
{{cmd|$ doas rc-service {{ic|ServiceName}} stop}}&lt;br /&gt;
&lt;br /&gt;
To {{ic|add}} or {{ic|delete}} a service to/from the sequence of services that need to start automatically in future sessions at the {{ic|boot}} runlevel: &lt;br /&gt;
{{cmd|$ doas rc-update add {{ic|ServiceName}} boot}}&lt;br /&gt;
Note that the {{ic|&#039;&#039;&#039;default&#039;&#039;&#039;}} runlevel is assumed, so it does not need to be stated explicitly:&lt;br /&gt;
{{cmd|$ doas rc-update add {{ic|ServiceName}}}}&lt;br /&gt;
{{cmd|$ doas rc-update del {{ic|ServiceName}}}}&lt;br /&gt;
&lt;br /&gt;
List the current status of all services; to display the status of all &#039;&#039;user services&#039;&#039; add &#039;&#039;&#039;-U&#039;&#039;&#039; :&lt;br /&gt;
{{cmd|$ rc-status}}&lt;br /&gt;
List the assigned runlevels of all services; to display the runlevels of &#039;&#039;user services&#039;&#039; add &#039;&#039;&#039;-U&#039;&#039;&#039; :&lt;br /&gt;
{{cmd|$ rc-update}}&lt;br /&gt;
&lt;br /&gt;
Refer to the [https://github.com/OpenRC/openrc/blob/master/user-guide.md OpenRC user guide] for more detailed information.&lt;br /&gt;
&lt;br /&gt;
== Cgroups ==&lt;br /&gt;
&lt;br /&gt;
OpenRC supports [https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html cgroups v2] in the default configuration. To enable hybrid cgroups, edit the file {{Path|/etc/rc.conf}} and change the setting for {{ic|rc_cgroup_mode}} as follows:{{Cat|/etc/rc.conf|rc_cgroup_mode{{=}}&amp;quot;hybrid&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
Then, one should run {{Cmd|# rc-service cgroups start}}&lt;br /&gt;
to take effect and {{Cmd|# rc-update add cgroups}}&lt;br /&gt;
to auto mount the cgroup filesystem on boot.&lt;br /&gt;
&lt;br /&gt;
== Local service ==&lt;br /&gt;
&lt;br /&gt;
Use the {{Path|/etc/local.d/}} directory to place programs or scripts which are to be run when the {{ic|local}} service is started or stopped.&lt;br /&gt;
&lt;br /&gt;
If a file in this directory is executable and it has a .start extension, it will be run when the local service is started. If a file is executable and it has a .stop extension, it will be run when the local service is stopped. For more info refer [https://github.com/OpenRC/openrc/blob/master/local.d/README README]&lt;br /&gt;
&lt;br /&gt;
To enable the {{ic|local}} service, issue the command:{{Cmd|# rc-update add local}}&lt;br /&gt;
&lt;br /&gt;
== Preventing slow services from delaying system startup ==&lt;br /&gt;
&lt;br /&gt;
Services that take a while to start will block the boot process until they complete. E.g.: {{ic|iwd}},{{ic|networking}},{{ic|chrony}} etc... might delay startup of an interactive system rather than start in the background. &lt;br /&gt;
&lt;br /&gt;
=== Parallel services === &lt;br /&gt;
&lt;br /&gt;
If the setting {{Codeline|rc_parallel{{=}}&amp;quot;YES&amp;quot;}} is configured, the OpenRC system tries to start services in parallel for a slight speed improvement. &lt;br /&gt;
This setting however comes with a message from openRC developers:{{Warning|whilst we have improved parallel, it can still potentially lock the boot process. Don&#039;t file bugs about this.}} &lt;br /&gt;
&lt;br /&gt;
=== Stacked runlevel method === &lt;br /&gt;
&lt;br /&gt;
Slow services can also be [https://ptrcnull.me/posts/openrc-async-services.html started after login prompt] using [[#Stacked runlevels|stacked runlevels]]. &lt;br /&gt;
{{Warning|Editing the file {{Path|&#039;&#039;&#039;/etc/inittab&#039;&#039;&#039;}} wrongly will render the system unusable. Take backup and learn to restore it using rescue disk before proceeding.}}&lt;br /&gt;
&lt;br /&gt;
# Create a custom runlevel &#039;&#039;&#039;async&#039;&#039;&#039;:  {{Cmd|# mkdir /etc/runlevels/async}}&lt;br /&gt;
# Add &#039;&#039;&#039;default&#039;&#039;&#039; as a stacked runlevel {{Cmd|# rc-update add -s default async}}&lt;br /&gt;
# Remove slow service from &#039;&#039;&#039;default&#039;&#039;&#039; runlevel and add them to the &#039;&#039;&#039;async&#039;&#039;&#039; runlevel:{{Cmd|&amp;lt;nowiki&amp;gt;# rc-update del &amp;lt;servicename&amp;gt; default&lt;br /&gt;
# rc-update add &amp;lt;servicename&amp;gt; async &amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
# Enable the &#039;&#039;&#039;async&#039;&#039;&#039; runlevel by adding the line &#039;&#039;&#039;::once:/sbin/openrc async&#039;&#039;&#039; to {{Path|/etc/inittab}} file as follows: {{Cat|/etc/inittab|&amp;lt;nowiki&amp;gt;...&lt;br /&gt;
::wait:/sbin/openrc default&lt;br /&gt;
::once:/sbin/openrc async -q&lt;br /&gt;
&lt;br /&gt;
# Set up a couple of getty&#039;s&lt;br /&gt;
tty1::respawn:/sbin/getty 38400 tty1&lt;br /&gt;
...&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
After rebooting, services from &#039;&#039;&#039;async&#039;&#039;&#039; will start separately. Other services started in &#039;&#039;&#039;default&#039;&#039;&#039; runlevel may still block [[TTY_Autologin|agetty]] from running, due to the {{ic|wait}} label.&lt;br /&gt;
&lt;br /&gt;
== User services ==&lt;br /&gt;
&lt;br /&gt;
OpenRC supports managing services for users. User services are currently experimental and available from [[Release_Notes_for_Alpine_3.22.0#OpenRC_User_services|v3.22]]. Here is the [https://pkgs.alpinelinux.org/contents?file=*&amp;amp;path=%2Fetc%2Fuser%2Finit.d&amp;amp;name=&amp;amp;branch=edge&amp;amp;repo=&amp;amp;arch=x86_64 list of OpenRC User services] available currently.&lt;br /&gt;
&lt;br /&gt;
Such services are said to be running in &#039;&#039;user mode&#039;&#039; and are managed with usual OpenRC commands using the  &#039;&#039;&#039;-U&#039;&#039;&#039; option (as distinct from the &#039;&#039;-u&#039;&#039; option), and without &#039;&#039;&#039;doas&#039;&#039;&#039; (nor as root).  &lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
&lt;br /&gt;
* [[XDG_RUNTIME_DIR]] variable must be set &lt;br /&gt;
&lt;br /&gt;
=== Config files for user services ===&lt;br /&gt;
&lt;br /&gt;
OpenRC uses {{path|~/.config}}, if $XDG_CONFIG_HOME is unset. Adjust below instructions, if $XDG_CONFIG_HOME differs. The main configuration file for OpenRC User services is {{path|~/.config/rc/rc.conf}} and {{Path|~/.config/rc/runlevels/}} contains the User runlevels.&lt;br /&gt;
&lt;br /&gt;
The service scripts for each OpenRC user service provided as part of official packages can be found at {{Path|/etc/user/init.d/}} and their respective service configuration files at {{Path|/etc/user/conf.d/}}. &lt;br /&gt;
&lt;br /&gt;
The folders {{path|~/.config/rc/init.d/}} and {{path|~/.config/rc/conf.d/}} can have user customized service scripts for User services and their respective configuration files. These scripts override official files at {{Path|/etc/user/}}, if their service names match.&lt;br /&gt;
&lt;br /&gt;
=== Configure environment variables ===&lt;br /&gt;
&lt;br /&gt;
==== For Wayland ====&lt;br /&gt;
{{Tip|User services like {{pkg|wlsunset}} depend on the {{ic|$WAYLAND_DISPLAY}} environment variable. Hence, it is [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17375#note_530383 recommended] to use &#039;&#039;&#039;gui&#039;&#039;&#039; runlevel for such services. Even though [[PipeWire]] can run at &#039;&#039;&#039;default&#039;&#039;&#039; runlevel, ensure that all your User services can run at the chosen runlevel.}} &lt;br /&gt;
* Allow propagation of the {{ic|$WAYLAND_DISPLAY}} and associated environment variables by adding the following lines to file {{path|~/.config/rc/rc.conf}} as follows:{{Cat|~/.config/rc/rc.conf|&amp;lt;nowiki&amp;gt;rc_env_allow=&amp;quot;WAYLAND_DISPLAY&amp;quot;&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
* Create a custom &#039;&#039;&#039;gui&#039;&#039;&#039; user runlevel:{{Cmd|$ mkdir -p ~/.config/rc/runlevels/gui}}&lt;br /&gt;
* To start &#039;&#039;&#039;gui&#039;&#039;&#039; user runlevel, add the line {{ic|openrc -U gui}} to the startup file of your compositor. For eg, for [[Sway]] add:{{Cat|~/.config/sway/config|...&lt;br /&gt;
exec openrc -U gui}}&lt;br /&gt;
&lt;br /&gt;
==== For Xorg ====&lt;br /&gt;
&lt;br /&gt;
If [[Elogind]] is not used, ensure that [[Wayland#Creating_and_exporting_XDG_RUNTIME_DIR_manually|XDG_RUNTIME_DIR]] is set manually in {{path|~/.xinitrc}}. For eg, for [[dwm]] add:{{Cat|~/.xinitrc|&amp;lt;nowiki&amp;gt;...&lt;br /&gt;
if [ -z &amp;quot;$XDG_RUNTIME_DIR&amp;quot; ]; then&lt;br /&gt;
	XDG_RUNTIME_DIR=&amp;quot;/tmp/$(id -u)-runtime-dir&amp;quot;&lt;br /&gt;
	mkdir -pm 0700 &amp;quot;$XDG_RUNTIME_DIR&amp;quot;&lt;br /&gt;
	export XDG_RUNTIME_DIR&lt;br /&gt;
fi&lt;br /&gt;
openrc -U default&lt;br /&gt;
exec dwm&amp;lt;/nowiki&amp;gt;}} &lt;br /&gt;
&lt;br /&gt;
{{Note|For both the above cases, logout and login for the OpenRC user services to be started, before proceeding further.}}&lt;br /&gt;
&lt;br /&gt;
=== User service management ===&lt;br /&gt;
&lt;br /&gt;
Issue the command {{ic|$ rc-status -Ur}} to view and verify the current user runlevel as &#039;&#039;&#039;gui&#039;&#039;&#039; and &#039;&#039;&#039;default&#039;&#039;&#039; for Wayland and Xorg, respectively, before proceeding. &lt;br /&gt;
&lt;br /&gt;
To start {{ic|ServiceName}} user service, issue the command:{{Cmd|$ rc-service -U {{ic|ServiceName}} start}}&lt;br /&gt;
Verify that the above OpenRC user service is started before proceeding further: {{Cmd|$ rc-status -U}} &lt;br /&gt;
To enable {{ic|ServiceName}} user service, issue the command: {{Cmd|$ rc-update -U add ServiceName}}&lt;br /&gt;
&lt;br /&gt;
{{Tip|Once a user service is configured, to prevent duplicate instance, remove them from {{Path|/etc/xdg/autostart}} folder or from the startup/config file.}}&lt;br /&gt;
&lt;br /&gt;
=== PAM support ===&lt;br /&gt;
&lt;br /&gt;
The default installation of OpenRC user services in Alpine Linux is without PAM support.&lt;br /&gt;
&lt;br /&gt;
In scenarios where services should not be allowed to [https://wiki.gentoo.org/wiki/OpenRC#lingering linger] on logout, PAM support for OpenRC user services can be enabled by installing the {{pkg|openrc-user-pam}} package.{{Cmd|# apk add {{pkg|openrc-user-pam}}}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
Whenever a openRC service fails to run, troubleshoot by enabling a debugging option, and then run the command. &lt;br /&gt;
&lt;br /&gt;
For example, if running the command {{ic|rc-service greetd start}} causes the [[Greetd|greetd]] service to immediately crash, then alter the command to enable debug and to view its output:{{Cmd|# rc-service -d greetd restart}}&lt;br /&gt;
&lt;br /&gt;
=== XDG_RUNTIME_DIR unset ===&lt;br /&gt;
&lt;br /&gt;
While configuring [[#User services|user services]], running the command {{ic|$ doas rc-update add -U pipewire gui}} will generate the above error {{ic|XDG_RUNTIME_DIR unset}}.  Always issue the command as normal user {{ic|$ rc-update add -U pipewire gui}} and do NOT use {{ic|doas}}. &lt;br /&gt;
&lt;br /&gt;
=== ERROR: user.greetd failed to start ===&lt;br /&gt;
&lt;br /&gt;
While using [[#User services|user services]] with [[greetd]], the above error message will appear. This failed error message for {{ic|user.greetd}} service is harmless as per {{MR|81612#note_492385}}.&lt;br /&gt;
&lt;br /&gt;
=== failed to create display ===&lt;br /&gt;
&lt;br /&gt;
When using openRC user services for {{ic|wlsunset}}, the following  error message may appear:{{Cmd|daemon.err wlsunset: failed to create display}}You will need the GUI runlevel for services that depend on {{ic|$WAYLAND_DISPLAY}}. Refer [[#For Wayland| Configure environment variables For Wayland]] section.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Writing Init Scripts]]&lt;br /&gt;
* [[Multiple Instances of Services]]&lt;br /&gt;
* [https://github.com/OpenRC/openrc/blob/master/user-guide.md OpenRC user Guide]&lt;br /&gt;
* [https://github.com/OpenRC/openrc/blob/master/service-script-guide.md OpenRC Service Script Writing Guide]&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/OpenRC Gentoo Wiki]&lt;br /&gt;
* [https://wiki.archlinux.org/title/OpenRC ArchWiki]&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/OpenRC PostmarketOS Wiki]&lt;br /&gt;
* [https://ptrcnull.me/posts/openrc-async-services.html Start services after login prompt]&lt;br /&gt;
&lt;br /&gt;
[[Category:Booting]] &lt;br /&gt;
[[Category:System Administration]]&lt;br /&gt;
[[Category:Services]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=OpenRC&amp;diff=30861</id>
		<title>OpenRC</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=OpenRC&amp;diff=30861"/>
		<updated>2025-09-05T12:34:00Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: /* PAM support */ clarify that this is not mandatory&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Alpine Linux uses [https://github.com/OpenRC/ OpenRC] for its [https://en.wikipedia.org/wiki/Init init] system. The init system manages the services, including the boot and shutdown of your system. OpenRC also supports managing [[#User services|services for users]]. &lt;br /&gt;
&lt;br /&gt;
To learn the basics of OpenRC quickly, refer to the [https://docs.alpinelinux.org/user-handbook/0.1a/Working/openrc.html working with OpenRC] guide from the Alpine Linux documentation project. &lt;br /&gt;
&lt;br /&gt;
== Quickstart  ==&lt;br /&gt;
&lt;br /&gt;
{|align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| width=&amp;quot;50%&amp;quot; |Action&lt;br /&gt;
|             |Command&lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039;Managing a service - start,stop and restart&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Start {{ic|ServiceName}} now || {{ic|# rc-service {{ic|ServiceName}} start}}&lt;br /&gt;
|-&lt;br /&gt;
| Stop {{ic|ServiceName}} now || {{ic|# rc-service {{ic|ServiceName}} stop}} &lt;br /&gt;
|-&lt;br /&gt;
| Restart {{ic|ServiceName}} now || {{ic|# rc-service {{ic|ServiceName}} restart}} &lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039;Adding and removing service from runlevels&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Add {{ic|ServiceName}} to {{ic|runlevel}} || {{ic|# rc-update add {{ic|ServiceName}} {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
| Remove {{ic|ServiceName}} from {{ic|runlevel}} || {{ic|# rc-update del {{ic|ServiceName}} {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039; Check services in a runlevel and their status&#039;&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| To check status of {{ic|ServiceName}} || {{ic|$ rc-service {{ic|ServiceName}} status}} &lt;br /&gt;
|-&lt;br /&gt;
| To view services configured at {{ic|runlevel}}  || {{ic|$ rc-update show {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
| To view currently active runlevels and state of services  || {{ic|$ rc-status}} &lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039; Check and manage runlevels&#039;&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| To view available runlevels || {{ic|$ rc-status -l}} &lt;br /&gt;
|-&lt;br /&gt;
| To change to a different {{ic|runlevel}} || {{ic|# openrc {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &#039;&#039;&#039; Stacked runlevels&#039;&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| To add {{ic|s-runlevel}} as a stacked {{ic|runlevel}} || {{ic|# rc-update add -s {{ic|s-runlevel}} {{ic|runlevel}}}} &lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |&#039;&#039;&#039;User Services&#039;&#039;&#039;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 0.9em; text-align:center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| To view currently active User runlevels and state of User services || {{ic|$ rc-status -U}} &lt;br /&gt;
|-&lt;br /&gt;
| To change to a different user {{ic|runlevel}} || {{ic|$ openrc -U {{ic|runlevel}}}} &lt;br /&gt;
|-&lt;br /&gt;
| Add User {{ic|ServiceName}} to user {{ic|runlevel}} || {{ic|$ rc-update -U add {{ic|ServiceName}} {{ic|runlevel}}}} &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Runlevels ==&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;runlevel&#039;&#039; is basically a collection of services that needs to be started when certain conditions are met. Instead of using runlevel numbers, such as is used traditionally with &#039;&#039;SysV&#039;&#039; init, these are named, and users can create their own, if needed. The default startup uses the &#039;&#039;&#039;sysinit&#039;&#039;&#039;, &#039;&#039;&#039;boot&#039;&#039;&#039;, and &#039;&#039;&#039;default&#039;&#039;&#039; runlevels, in that order. Shutdown uses the &#039;&#039;&#039;shutdown&#039;&#039;&#039; runlevel.&lt;br /&gt;
&lt;br /&gt;
The available runlevels are:&lt;br /&gt;
* &#039;&#039;&#039;default&#039;&#039;&#039; - Used if no runlevel is specified. (This is generally the runlevel you want to add services to.)&lt;br /&gt;
* &#039;&#039;&#039;hotplugged&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;manual&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The special runlevels are:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;sysinit&#039;&#039;&#039; - Brings up system specific stuff such as &amp;lt;code&amp;gt;/dev&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/proc&amp;lt;/code&amp;gt; and optionally &amp;lt;code&amp;gt;/sys&amp;lt;/code&amp;gt; for Linux based systems. It also mounts &amp;lt;code&amp;gt;/lib/rc/init.d&amp;lt;/code&amp;gt; as a ramdisk using tmpfs where available unless &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; is mounted rw at boot. &amp;lt;code&amp;gt;&#039;&#039;&#039;rc&#039;&#039;&#039;&amp;lt;/code&amp;gt; uses &amp;lt;code&amp;gt;/lib/rc/init.d&amp;lt;/code&amp;gt; to hold state information about the services it runs. &#039;&#039;&#039;sysinit&#039;&#039;&#039; always runs when the host first starts and should not be run again.&lt;br /&gt;
* &#039;&#039;&#039;boot&#039;&#039;&#039; - Generally, the only services that one should add to the &#039;&#039;&#039;boot&#039;&#039;&#039; runlevel are those which deal with the mounting of filesystems, setting the initial state of attached peripherals, and logging. Hotplugged services are added to the &#039;&#039;&#039;boot&#039;&#039;&#039; runlevel by the system. All services in the &#039;&#039;&#039;boot&#039;&#039;&#039; and &#039;&#039;&#039;sysinit&#039;&#039;&#039; runlevels are automatically included in all other runlevels except for those listed here.&lt;br /&gt;
* &#039;&#039;&#039;single&#039;&#039;&#039; - Stops all services except for those in the &#039;&#039;&#039;sysinit&#039;&#039;&#039; runlevel.&lt;br /&gt;
* &#039;&#039;&#039;reboot&#039;&#039;&#039; - Changes to the &#039;&#039;&#039;shutdown&#039;&#039;&#039; runlevel, and then reboots the host.&lt;br /&gt;
* &#039;&#039;&#039;shutdown&#039;&#039;&#039; - Changes to the shutdown &#039;&#039;&#039;runlevel&#039;&#039;&#039;, and then halts the host.&lt;br /&gt;
&lt;br /&gt;
=== Stacked runlevels ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Stacked&#039;&#039; runlevels allows for the &amp;quot;inheritance&amp;quot; of services. A few use cases are given below:-&lt;br /&gt;
* [https://docs.alpinelinux.org/user-handbook/0.1a/Working/openrc.html#_runlevel_stacking Running an office runlevel with VPN service]&lt;br /&gt;
* [[#Preventing slow services from delaying system startup|Preventing slow services from delaying system startup]]&lt;br /&gt;
For more detailed information, refer [https://wiki.gentoo.org/wiki/OpenRC/Stacked%20runlevel Gentoo wiki].&lt;br /&gt;
&lt;br /&gt;
== Config files == &lt;br /&gt;
&lt;br /&gt;
The main configuration file for OpenRC is {{Path|/etc/rc.conf}}. The OpenRC service scripts for each service can be found at {{Path|/etc/init.d/}} and their respective service configuration files at {{Path|/etc/conf.d/}}.&lt;br /&gt;
&lt;br /&gt;
== Command usage ==&lt;br /&gt;
&lt;br /&gt;
OpenRC provides the following commands:&lt;br /&gt;
* {{ic|rc-update}} &lt;br /&gt;
* {{ic|rc-service}}&lt;br /&gt;
* {{ic|rc-status}}&lt;br /&gt;
* {{ic|openrc}}&lt;br /&gt;
&lt;br /&gt;
To view the command usage for all OpenRC commands, use the &#039;&#039;&#039;--help&#039;&#039;&#039; or &#039;&#039;&#039;-h&#039;&#039;&#039; flag.  For eg:{{ic|$ rc-update &#039;&#039;&#039;--help&#039;&#039;&#039;}} or {{ic|$ rc-update &#039;&#039;&#039;-h&#039;&#039;&#039;}} will show usage information for {{ic|rc-update}}.&lt;br /&gt;
&lt;br /&gt;
To {{ic|start}}, {{ic|stop}} or {{ic|restart}} a service {{ic|ServiceName}} immediately at the current runlevel:&lt;br /&gt;
{{cmd|$ doas rc-service {{ic|ServiceName}} start}}&lt;br /&gt;
{{cmd|$ doas rc-service {{ic|ServiceName}} stop}}&lt;br /&gt;
&lt;br /&gt;
To {{ic|add}} or {{ic|delete}} a service to/from the sequence of services that need to start automatically in future sessions at the {{ic|boot}} runlevel: &lt;br /&gt;
{{cmd|$ doas rc-update add {{ic|ServiceName}} boot}}&lt;br /&gt;
Note that the {{ic|&#039;&#039;&#039;default&#039;&#039;&#039;}} runlevel is assumed, so it does not need to be stated explicitly:&lt;br /&gt;
{{cmd|$ doas rc-update add {{ic|ServiceName}}}}&lt;br /&gt;
{{cmd|$ doas rc-update del {{ic|ServiceName}}}}&lt;br /&gt;
&lt;br /&gt;
List the current status of all services; to display the status of all &#039;&#039;user services&#039;&#039; add &#039;&#039;&#039;-U&#039;&#039;&#039; :&lt;br /&gt;
{{cmd|$ rc-status}}&lt;br /&gt;
List the assigned runlevels of all services; to display the runlevels of &#039;&#039;user services&#039;&#039; add &#039;&#039;&#039;-U&#039;&#039;&#039; :&lt;br /&gt;
{{cmd|$ rc-update}}&lt;br /&gt;
&lt;br /&gt;
Refer to the [https://github.com/OpenRC/openrc/blob/master/user-guide.md OpenRC user guide] for more detailed information.&lt;br /&gt;
&lt;br /&gt;
== Cgroups ==&lt;br /&gt;
&lt;br /&gt;
OpenRC supports [https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html cgroups v2] in the default configuration. To enable hybrid cgroups, edit the file {{Path|/etc/rc.conf}} and change the setting for {{ic|rc_cgroup_mode}} as follows:{{Cat|/etc/rc.conf|rc_cgroup_mode{{=}}&amp;quot;hybrid&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
Then, one should run {{Cmd|# rc-service cgroups start}}&lt;br /&gt;
to take effect and {{Cmd|# rc-update add cgroups}}&lt;br /&gt;
to auto mount the cgroup filesystem on boot.&lt;br /&gt;
&lt;br /&gt;
== Local service ==&lt;br /&gt;
&lt;br /&gt;
Use the {{Path|/etc/local.d/}} directory to place programs or scripts which are to be run when the {{ic|local}} service is started or stopped.&lt;br /&gt;
&lt;br /&gt;
If a file in this directory is executable and it has a .start extension, it will be run when the local service is started. If a file is executable and it has a .stop extension, it will be run when the local service is stopped. For more info refer [https://github.com/OpenRC/openrc/blob/master/local.d/README README]&lt;br /&gt;
&lt;br /&gt;
To enable the {{ic|local}} service, issue the command:{{Cmd|# rc-update add local}}&lt;br /&gt;
&lt;br /&gt;
== Preventing slow services from delaying system startup ==&lt;br /&gt;
&lt;br /&gt;
Services that take a while to start will block the boot process until they complete. E.g.: {{ic|iwd}},{{ic|networking}},{{ic|chrony}} etc... might delay startup of an interactive system rather than start in the background. &lt;br /&gt;
&lt;br /&gt;
=== Parallel services === &lt;br /&gt;
&lt;br /&gt;
If the setting {{Codeline|rc_parallel{{=}}&amp;quot;YES&amp;quot;}} is configured, the OpenRC system tries to start services in parallel for a slight speed improvement. &lt;br /&gt;
This setting however comes with a message from openRC developers:{{Warning|whilst we have improved parallel, it can still potentially lock the boot process. Don&#039;t file bugs about this.}} &lt;br /&gt;
&lt;br /&gt;
=== Stacked runlevel method === &lt;br /&gt;
&lt;br /&gt;
Slow services can also be [https://ptrcnull.me/posts/openrc-async-services.html started after login prompt] using [[#Stacked runlevels|stacked runlevels]]. &lt;br /&gt;
{{Warning|Editing the file {{Path|&#039;&#039;&#039;/etc/inittab&#039;&#039;&#039;}} wrongly will render the system unusable. Take backup and learn to restore it using rescue disk before proceeding.}}&lt;br /&gt;
&lt;br /&gt;
# Create a custom runlevel &#039;&#039;&#039;async&#039;&#039;&#039;:  {{Cmd|# mkdir /etc/runlevels/async}}&lt;br /&gt;
# Add &#039;&#039;&#039;default&#039;&#039;&#039; as a stacked runlevel {{Cmd|# rc-update add -s default async}}&lt;br /&gt;
# Remove slow service from &#039;&#039;&#039;default&#039;&#039;&#039; runlevel and add them to the &#039;&#039;&#039;async&#039;&#039;&#039; runlevel:{{Cmd|&amp;lt;nowiki&amp;gt;# rc-update del &amp;lt;servicename&amp;gt; default&lt;br /&gt;
# rc-update add &amp;lt;servicename&amp;gt; async &amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
# Enable the &#039;&#039;&#039;async&#039;&#039;&#039; runlevel by adding the line &#039;&#039;&#039;::once:/sbin/openrc async&#039;&#039;&#039; to {{Path|/etc/inittab}} file as follows: {{Cat|/etc/inittab|&amp;lt;nowiki&amp;gt;...&lt;br /&gt;
::wait:/sbin/openrc default&lt;br /&gt;
::once:/sbin/openrc async -q&lt;br /&gt;
&lt;br /&gt;
# Set up a couple of getty&#039;s&lt;br /&gt;
tty1::respawn:/sbin/getty 38400 tty1&lt;br /&gt;
...&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
After rebooting, services from &#039;&#039;&#039;async&#039;&#039;&#039; will start separately. Other services started in &#039;&#039;&#039;default&#039;&#039;&#039; runlevel may still block [[TTY_Autologin|agetty]] from running, due to the {{ic|wait}} label.&lt;br /&gt;
&lt;br /&gt;
== User services ==&lt;br /&gt;
&lt;br /&gt;
OpenRC supports managing services for users. User services are currently experimental and available from [[Release_Notes_for_Alpine_3.22.0#OpenRC_User_services|v3.22]]. Here is the [https://pkgs.alpinelinux.org/contents?file=*&amp;amp;path=%2Fetc%2Fuser%2Finit.d&amp;amp;name=&amp;amp;branch=edge&amp;amp;repo=&amp;amp;arch=x86_64 list of OpenRC User services] available currently.&lt;br /&gt;
&lt;br /&gt;
Such services are said to be running in &#039;&#039;user mode&#039;&#039; and are managed with usual OpenRC commands using the  &#039;&#039;&#039;-U&#039;&#039;&#039; option (as distinct from the &#039;&#039;-u&#039;&#039; option), and without &#039;&#039;&#039;doas&#039;&#039;&#039; (nor as root).  &lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
&lt;br /&gt;
* [[XDG_RUNTIME_DIR]] variable must be set &lt;br /&gt;
&lt;br /&gt;
=== Config files for user services ===&lt;br /&gt;
&lt;br /&gt;
OpenRC uses {{path|~/.config}}, if $XDG_CONFIG_HOME is unset. Adjust below instructions, if $XDG_CONFIG_HOME differs. The main configuration file for OpenRC User services is {{path|~/.config/rc/rc.conf}} and {{Path|~/.config/rc/runlevels/}} contains the User runlevels.&lt;br /&gt;
&lt;br /&gt;
The service scripts for each OpenRC user service provided as part of official packages can be found at {{Path|/etc/user/init.d/}} and their respective service configuration files at {{Path|/etc/user/conf.d/}}. &lt;br /&gt;
&lt;br /&gt;
The folders {{path|~/.config/rc/init.d/}} and {{path|~/.config/rc/conf.d/}} can have user customized service scripts for User services and their respective configuration files. These scripts override official files at {{Path|/etc/user/}}, if their service names match.&lt;br /&gt;
&lt;br /&gt;
=== Configure environment variables ===&lt;br /&gt;
&lt;br /&gt;
==== For Wayland ====&lt;br /&gt;
{{Tip|User services like {{pkg|wlsunset}} depend on the {{ic|$WAYLAND_DISPLAY}} environment variable. Hence, it is [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17375#note_530383 recommended] to use &#039;&#039;&#039;gui&#039;&#039;&#039; runlevel for such services. Eventhough [[PipeWire]] can run at &#039;&#039;&#039;default&#039;&#039;&#039; runlevel, ensure that all your User services can run at the chosen runlevel.}} &lt;br /&gt;
* Allow propagation of the {{ic|$WAYLAND_DISPLAY}} and associated environment variables by adding the following lines to file {{path|~/.config/rc/rc.conf}} as follows:{{Cat|~/.config/rc/rc.conf|&amp;lt;nowiki&amp;gt;rc_env_allow=&amp;quot;WAYLAND_DISPLAY&amp;quot;&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
* Create a custom &#039;&#039;&#039;gui&#039;&#039;&#039; user runlevel:{{Cmd|$ mkdir -p ~/.config/rc/runlevels/gui}}&lt;br /&gt;
* To start &#039;&#039;&#039;gui&#039;&#039;&#039; user runlevel, add the line {{ic|openrc -U gui}} to the startup file of your compositor. For eg, for [[Sway]] add:{{Cat|~/.config/sway/config|...&lt;br /&gt;
exec openrc -U gui}}&lt;br /&gt;
&lt;br /&gt;
==== For Xorg ====&lt;br /&gt;
&lt;br /&gt;
If [[Elogind]] is not used, ensure that [[Wayland#Creating_and_exporting_XDG_RUNTIME_DIR_manually|XDG_RUNTIME_DIR]] is set manually in {{path|~/.xinitrc}}. For eg, for [[dwm]] add:{{Cat|~/.xinitrc|&amp;lt;nowiki&amp;gt;...&lt;br /&gt;
if [ -z &amp;quot;$XDG_RUNTIME_DIR&amp;quot; ]; then&lt;br /&gt;
	XDG_RUNTIME_DIR=&amp;quot;/tmp/$(id -u)-runtime-dir&amp;quot;&lt;br /&gt;
	mkdir -pm 0700 &amp;quot;$XDG_RUNTIME_DIR&amp;quot;&lt;br /&gt;
	export XDG_RUNTIME_DIR&lt;br /&gt;
fi&lt;br /&gt;
openrc -U default&lt;br /&gt;
exec dwm&amp;lt;/nowiki&amp;gt;}} &lt;br /&gt;
&lt;br /&gt;
{{Note|For both the above cases, logout and login for the OpenRC user services to be started, before proceeding further.}} &lt;br /&gt;
&lt;br /&gt;
=== User service management ===&lt;br /&gt;
&lt;br /&gt;
Issue the command {{ic|$ rc-status -Ur}} to view and verify the current user runlevel as &#039;&#039;&#039;gui&#039;&#039;&#039; and &#039;&#039;&#039;default&#039;&#039;&#039; for Wayland and Xorg, respectively, before proceeding. &lt;br /&gt;
&lt;br /&gt;
To start {{ic|ServiceName}} user service, issue the command:{{Cmd|$ rc-service -U {{ic|ServiceName}} start}}&lt;br /&gt;
Verify that the above OpenRC user service is started before proceeding further: {{Cmd|$ rc-status -U}} &lt;br /&gt;
To enable {{ic|ServiceName}} user service, issue the command: {{Cmd|$ rc-update -U add ServiceName}}&lt;br /&gt;
&lt;br /&gt;
{{Tip|Once a user service is configured, to prevent duplicate instance, remove them from {{Path|/etc/xdg/autostart}} folder or from the startup/config file.}}&lt;br /&gt;
&lt;br /&gt;
=== PAM support ===&lt;br /&gt;
&lt;br /&gt;
The default installation of OpenRC user services in Alpine Linux is without PAM support.&lt;br /&gt;
&lt;br /&gt;
In scenarios where services should not be allowed to [https://wiki.gentoo.org/wiki/OpenRC#lingering linger] on logout, PAM support for OpenRC user services can be enabled by installing the {{pkg|openrc-user-pam}} package.{{Cmd|# apk add {{pkg|openrc-user-pam}}}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
Whenever a openRC service fails to run, troubleshoot by enabling a debugging option, and then run the command. &lt;br /&gt;
&lt;br /&gt;
For example, if running the command {{ic|rc-service greetd start}} causes the [[Greetd|greetd]] service to immediately crash, then alter the command to enable debug and to view its output:{{Cmd|# rc-service -d greetd restart}}&lt;br /&gt;
&lt;br /&gt;
=== XDG_RUNTIME_DIR unset ===&lt;br /&gt;
&lt;br /&gt;
While configuring [[#User services|user services]], running the command {{ic|$ doas rc-update add -U pipewire gui}} will generate the above error {{ic|XDG_RUNTIME_DIR unset}}.  Always issue the command as normal user {{ic|$ rc-update add -U pipewire gui}} and do NOT use {{ic|doas}}. &lt;br /&gt;
&lt;br /&gt;
=== ERROR: user.greetd failed to start ===&lt;br /&gt;
&lt;br /&gt;
While using [[#User services|user services]] with [[greetd]], the above error message will appear. This failed error message for {{ic|user.greetd}} service is harmless as per {{MR|81612#note_492385}}.&lt;br /&gt;
&lt;br /&gt;
=== failed to create display ===&lt;br /&gt;
&lt;br /&gt;
When using openRC user services for {{ic|wlsunset}}, the following  error message may appear:{{Cmd|daemon.err wlsunset: failed to create display}}You will need the GUI runlevel for services that depend on {{ic|$WAYLAND_DISPLAY}}. Refer [[#For Wayland| Configure environment variables For Wayland]] section.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Writing Init Scripts]]&lt;br /&gt;
* [[Multiple Instances of Services]]&lt;br /&gt;
* [https://github.com/OpenRC/openrc/blob/master/user-guide.md OpenRC user Guide]&lt;br /&gt;
* [https://github.com/OpenRC/openrc/blob/master/service-script-guide.md OpenRC Service Script Writing Guide]&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/OpenRC Gentoo Wiki]&lt;br /&gt;
* [https://wiki.archlinux.org/title/OpenRC ArchWiki]&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/OpenRC PostmarketOS Wiki]&lt;br /&gt;
* [https://ptrcnull.me/posts/openrc-async-services.html Start services after login prompt]&lt;br /&gt;
&lt;br /&gt;
[[Category:Booting]] &lt;br /&gt;
[[Category:System Administration]]&lt;br /&gt;
[[Category:Services]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Logbookd&amp;diff=30857</id>
		<title>Logbookd</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Logbookd&amp;diff=30857"/>
		<updated>2025-09-03T12:56:09Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: /* See also */ Link to Syslog&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://sr.ht/~martijnbraam/logbookd/ logbookd] is a syslogd implementation that uses an sqlite database as a backend.&lt;br /&gt;
&lt;br /&gt;
The default mode of operation uses a reduced write mode, where lots are written to memory and only flushed to disk when the service is interrupted or receives SIGUSR1.&lt;br /&gt;
&lt;br /&gt;
== Setup ==&lt;br /&gt;
&lt;br /&gt;
Logbook is provided via the {{pkg|logbookd}} package.&lt;br /&gt;
&lt;br /&gt;
Setting it up is quite straightforward:&lt;br /&gt;
&lt;br /&gt;
 apk add logbookd&lt;br /&gt;
 &lt;br /&gt;
 # Disable and stop the default syslog.&lt;br /&gt;
 rc-update del syslog boot&lt;br /&gt;
 service syslog stop&lt;br /&gt;
 &lt;br /&gt;
 # Enable and start logbookd&lt;br /&gt;
 rc-update add logbookd boot&lt;br /&gt;
 service logbookd start&lt;br /&gt;
&lt;br /&gt;
After the next reboot, you may want to review previous log files in &amp;lt;code&amp;gt;/var/log&amp;lt;/code&amp;gt;, which will remain unused and stale. Only the sqlite database should remain relevant.&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
&lt;br /&gt;
* [https://blog.brixit.nl/looking-closer-at-the-syslog/ Looking closer at the syslog]: an introductory article to syslog and logbookd.&lt;br /&gt;
* [[Syslog]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Services]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Syslog&amp;diff=30856</id>
		<title>Syslog</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Syslog&amp;diff=30856"/>
		<updated>2025-09-03T12:55:36Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: Mention s6-socklog&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Syslog collects log data from multiple programs either to RAM or to a file, and handles log rotation (similar to &amp;lt;code&amp;gt;journald&amp;lt;/code&amp;gt; on systemd-based systems). Alpine installs &amp;lt;code&amp;gt;syslog&amp;lt;/code&amp;gt; as provided by {{pkg|busybox}} per default, but it also packages [https://pkgs.alpinelinux.org/packages?name=*syslog* other implementations], such as {{pkg|rsyslog}}, {{pkg|syslog-ng}}, [https://skarnet.org/software/s6/s6-socklog.html s6-socklog] (from {{pkg|s6}}) and [[logbookd]].&lt;br /&gt;
&lt;br /&gt;
== busybox syslog ==&lt;br /&gt;
=== Running syslogd ===&lt;br /&gt;
Depending on how you have installed Alpine, it is already running (check with &amp;lt;code&amp;gt;ps a | grep syslogd&amp;lt;/code&amp;gt;). Otherwise enable it at boot and start it with the following commands:&lt;br /&gt;
&lt;br /&gt;
{{cmd|&amp;lt;nowiki&amp;gt;# rc-update add syslog boot&lt;br /&gt;
# rc-service syslog start&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
Edit {{path|/etc/conf.d/syslog}} to change the options used when running &amp;lt;code&amp;gt;syslogd&amp;lt;/code&amp;gt;. All available options can be looked up with &amp;lt;code&amp;gt;syslogd --help&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Reading logs ===&lt;br /&gt;
{{cmd|&amp;lt;nowiki&amp;gt;# tail -f /var/log/messages&lt;br /&gt;
Shows all messages and follows the log&lt;br /&gt;
# tail -f /var/log/messages | grep ssh&lt;br /&gt;
Only shows SSH related messages, also follows the log&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;code&amp;gt;-C&amp;lt;/code&amp;gt; is enabled in the configuration:&lt;br /&gt;
{{cmd|&amp;lt;nowiki&amp;gt;# logread -f&lt;br /&gt;
# logread -f | grep ssh&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
== Writing logs ==&lt;br /&gt;
Many applications are able to write to the syslog by default (e.g. &amp;lt;code&amp;gt;sshd&amp;lt;/code&amp;gt;). If you wish to write manually to it, use the &amp;lt;code&amp;gt;logger&amp;lt;/code&amp;gt; program.&lt;br /&gt;
&lt;br /&gt;
{{cmd|$ logger &amp;quot;hello world&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/Logging Gentoo Wiki - Logging]&lt;br /&gt;
&lt;br /&gt;
[[category:System Administration]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Steam&amp;diff=30855</id>
		<title>Steam</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Steam&amp;diff=30855"/>
		<updated>2025-09-02T22:05:05Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: /* Installation */ -&amp;gt; Installation via Flatpak&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page explains how to run [https://store.steampowered.com/about/ Steam], a popular game distribution platform by Valve on Alpine Linux. Steam requires glibc to run, and thus won&#039;t run natively on Alpine Linux. The simplest approach is to run it as [[Flatpak]]. Other workarounds involve using a virtual machine, a chroot or a container. It is theoretically possible to run the windows version of Steam using {{Pkg|wine}}.&lt;br /&gt;
&lt;br /&gt;
== Installation via Flatpak ==&lt;br /&gt;
&lt;br /&gt;
# Follow the [[Flatpak#Installing_Flatpak|Flatpak]] wiki page and ensure that [[Flatpak#Installing_Flatpak|Flathub repository]] is enabled. &lt;br /&gt;
# Install the Steam flatpak package from Flathub.{{Cmd|$ flatpak --user install com.valvesoftware.Steam}}&lt;br /&gt;
# After installation Steam can be started either using it&#039;s .desktop file or from the command line: {{Cmd|$ flatpak run com.valvesoftware.Steam}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== My controllers aren&#039;t detected ===&lt;br /&gt;
&lt;br /&gt;
By default Steam doesn&#039;t have permission to read your controllers.&lt;br /&gt;
This can be fixed by installing an [[udev]] rule from the official Steam package, but the udev rules are also available as an Alpine package.&lt;br /&gt;
&lt;br /&gt;
  # apk add {{pkg|steam-devices|arch=x86_64}}&lt;br /&gt;
&lt;br /&gt;
These udev rules rely on the &amp;lt;code&amp;gt;TAG+=&amp;quot;uaccess&amp;quot;&amp;lt;/code&amp;gt;, and are therefore only expected to work reliably when using [[Elogind]].&lt;br /&gt;
&lt;br /&gt;
=== SteamVR won&#039;t launch ===&lt;br /&gt;
&lt;br /&gt;
Out of the box SteamVR might not be able to launch and give you various errors. Steam tries to fix this itself by setting the right capabilities on the SteamVR binary, but this doesn&#039;t work in the Flatpak. Instead we&#039;ll have do it manually.&lt;br /&gt;
&lt;br /&gt;
  # setcap CAP_SYS_NICE+ep ~/.var/app/com.valvesoftware.Steam/data/Steam/steamapps/common/SteamVR/bin/linux64/vrcompositor-launcher&lt;br /&gt;
&lt;br /&gt;
Then restart Steam.&lt;br /&gt;
&lt;br /&gt;
There is an issue for this [https://github.com/flathub/com.valvesoftware.Steam/issues/636#issuecomment-779763326 on the Flathub repository].&lt;br /&gt;
&lt;br /&gt;
=== Steam - Error: OpenGL GLX extension not supported by display ===&lt;br /&gt;
&lt;br /&gt;
Add the Mesa gallium driver and reboot your system.&lt;br /&gt;
&lt;br /&gt;
 # apk add {{pkg|mesa-dri-gallium|arch=x86_64}}&lt;br /&gt;
&lt;br /&gt;
=== eventfd: Too many open files ===&lt;br /&gt;
&lt;br /&gt;
Due to a low amount of allowed open file descriptors, Proton games may crash shortly after launching. This can be worked around by disabling esync but many games will perform measurably worse without it. Instead, user limits should be increased. In order to do this, you will need [[PAM]] and a PAM enabled login.&lt;br /&gt;
&lt;br /&gt;
Add the following to &amp;lt;code&amp;gt;/etc/security/limits.conf&amp;lt;/code&amp;gt;:&lt;br /&gt;
 @users hard nofile 524288&lt;br /&gt;
&lt;br /&gt;
{{Note|Although you should already belong to the users group, you can run &amp;lt;code&amp;gt;groups&amp;lt;/code&amp;gt; to check.}}&lt;br /&gt;
&lt;br /&gt;
Reboot and run &amp;lt;code&amp;gt;ulimit -Hn&amp;lt;/code&amp;gt; to verify the new limits are applied.&lt;br /&gt;
&lt;br /&gt;
=== dbus-launch: no such file or directory ===&lt;br /&gt;
&lt;br /&gt;
Set up [[D-Bus|dbus]] for your session.&lt;br /&gt;
&lt;br /&gt;
=== Steam games launched via Proton crash before creating a window ===&lt;br /&gt;
&lt;br /&gt;
Instead of just using the in-Steam menu to install and select a Proton version, try installing the flatpak community build for Proton onto your system. There are several versions, depending on your desired stability, and the experimental version available in Flathub is called &amp;quot;com.valvesoftware.Steam.CompatibilityTool.Proton-Exp&amp;quot;. After you install your chosen version, go into Steam to specify compatibility tool for a game as usual. The installed community build will now be an option. Select that and try launching the game again.&lt;br /&gt;
&lt;br /&gt;
As your last resort, you can try installing [https://github.com/GloriousEggroll/proton-ge-custom proton-ge-custom], but please note that in order for this to be even detected by Steam, you will need to install Steam via Nix due to high level of isolation that Flatpaks utilize. This can however come at the expense of your [https://tosdr.org/en/service/180 privacy].&lt;br /&gt;
&lt;br /&gt;
=== Steam spams dmesg with x86/split lock detection entries ===&lt;br /&gt;
&lt;br /&gt;
Add the below line to {{path|/etc/sysctl.conf}}:&lt;br /&gt;
  kernel.split_lock_mitigate = 0&lt;br /&gt;
&lt;br /&gt;
=== Steam hangs on start with a steamwebhelper popup ===&lt;br /&gt;
&lt;br /&gt;
If this happens and {{path|~/.var/app/com.valvesoftware.Steam/.local/share/Steam/logs/steamwebhelper.log}} says that you are missing X server or &amp;lt;var&amp;gt;DISPLAY&amp;lt;/var&amp;gt;, it means your &amp;lt;var&amp;gt;DISPLAY&amp;lt;/var&amp;gt; is not present in the activation environment. For more information please see https://github.com/ValveSoftware/steam-for-linux/issues/10554 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;[[Sway]]&#039;&#039;&#039;: go into your sway config file and add &amp;lt;var&amp;gt;DISPLAY&amp;lt;/var&amp;gt; to the following line, then restart:&lt;br /&gt;
&amp;lt;pre&amp;gt;exec dbus-activation-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway&amp;lt;/pre&amp;gt;&lt;br /&gt;
For more information about this line, please see the Alpine Wiki&#039;s entry on Sway&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hyprland&#039;&#039;&#039;: add an exec-once to the configuration file at {{path|~/.config/hypr/hyprland}} to set &amp;lt;var&amp;gt;DISPLAY&amp;lt;/var&amp;gt;. Similarly to Sway you may already have a line that sets other variables. If so, add &amp;lt;var&amp;gt;DISPLAY&amp;lt;/var&amp;gt; to the line. The line should look similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;exec-once = dbus-update-activation-environment DISPLAY&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[Gaming on Alpine|Gaming on Alpine Linux]]&lt;br /&gt;
* [[Flatpak]]&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/Steam Steam on postmarketOS]&lt;br /&gt;
&lt;br /&gt;
[[category:Gaming]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Steam&amp;diff=30854</id>
		<title>Steam</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Steam&amp;diff=30854"/>
		<updated>2025-09-02T22:04:46Z</updated>

		<summary type="html">&lt;p&gt;WhyNotHugo: Mention other alternatives to flatpak&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page explains how to run [https://store.steampowered.com/about/ Steam], a popular game distribution platform by Valve on Alpine Linux. Steam requires glibc to run, and thus won&#039;t run natively on Alpine Linux. The simplest approach is to run it as [[Flatpak]]. Other workarounds involve using a virtual machine, a chroot or a container. It is theoretically possible to run the windows version of Steam using {{Pkg|wine}}.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
# Follow the [[Flatpak#Installing_Flatpak|Flatpak]] wiki page and ensure that [[Flatpak#Installing_Flatpak|Flathub repository]] is enabled. &lt;br /&gt;
# Install the Steam flatpak package from Flathub.{{Cmd|$ flatpak --user install com.valvesoftware.Steam}}&lt;br /&gt;
# After installation Steam can be started either using it&#039;s .desktop file or from the command line: {{Cmd|$ flatpak run com.valvesoftware.Steam}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== My controllers aren&#039;t detected ===&lt;br /&gt;
&lt;br /&gt;
By default Steam doesn&#039;t have permission to read your controllers.&lt;br /&gt;
This can be fixed by installing an [[udev]] rule from the official Steam package, but the udev rules are also available as an Alpine package.&lt;br /&gt;
&lt;br /&gt;
  # apk add {{pkg|steam-devices|arch=x86_64}}&lt;br /&gt;
&lt;br /&gt;
These udev rules rely on the &amp;lt;code&amp;gt;TAG+=&amp;quot;uaccess&amp;quot;&amp;lt;/code&amp;gt;, and are therefore only expected to work reliably when using [[Elogind]].&lt;br /&gt;
&lt;br /&gt;
=== SteamVR won&#039;t launch ===&lt;br /&gt;
&lt;br /&gt;
Out of the box SteamVR might not be able to launch and give you various errors. Steam tries to fix this itself by setting the right capabilities on the SteamVR binary, but this doesn&#039;t work in the Flatpak. Instead we&#039;ll have do it manually.&lt;br /&gt;
&lt;br /&gt;
  # setcap CAP_SYS_NICE+ep ~/.var/app/com.valvesoftware.Steam/data/Steam/steamapps/common/SteamVR/bin/linux64/vrcompositor-launcher&lt;br /&gt;
&lt;br /&gt;
Then restart Steam.&lt;br /&gt;
&lt;br /&gt;
There is an issue for this [https://github.com/flathub/com.valvesoftware.Steam/issues/636#issuecomment-779763326 on the Flathub repository].&lt;br /&gt;
&lt;br /&gt;
=== Steam - Error: OpenGL GLX extension not supported by display ===&lt;br /&gt;
&lt;br /&gt;
Add the Mesa gallium driver and reboot your system.&lt;br /&gt;
&lt;br /&gt;
 # apk add {{pkg|mesa-dri-gallium|arch=x86_64}}&lt;br /&gt;
&lt;br /&gt;
=== eventfd: Too many open files ===&lt;br /&gt;
&lt;br /&gt;
Due to a low amount of allowed open file descriptors, Proton games may crash shortly after launching. This can be worked around by disabling esync but many games will perform measurably worse without it. Instead, user limits should be increased. In order to do this, you will need [[PAM]] and a PAM enabled login.&lt;br /&gt;
&lt;br /&gt;
Add the following to &amp;lt;code&amp;gt;/etc/security/limits.conf&amp;lt;/code&amp;gt;:&lt;br /&gt;
 @users hard nofile 524288&lt;br /&gt;
&lt;br /&gt;
{{Note|Although you should already belong to the users group, you can run &amp;lt;code&amp;gt;groups&amp;lt;/code&amp;gt; to check.}}&lt;br /&gt;
&lt;br /&gt;
Reboot and run &amp;lt;code&amp;gt;ulimit -Hn&amp;lt;/code&amp;gt; to verify the new limits are applied.&lt;br /&gt;
&lt;br /&gt;
=== dbus-launch: no such file or directory ===&lt;br /&gt;
&lt;br /&gt;
Set up [[D-Bus|dbus]] for your session.&lt;br /&gt;
&lt;br /&gt;
=== Steam games launched via Proton crash before creating a window ===&lt;br /&gt;
&lt;br /&gt;
Instead of just using the in-Steam menu to install and select a Proton version, try installing the flatpak community build for Proton onto your system. There are several versions, depending on your desired stability, and the experimental version available in Flathub is called &amp;quot;com.valvesoftware.Steam.CompatibilityTool.Proton-Exp&amp;quot;. After you install your chosen version, go into Steam to specify compatibility tool for a game as usual. The installed community build will now be an option. Select that and try launching the game again.&lt;br /&gt;
&lt;br /&gt;
As your last resort, you can try installing [https://github.com/GloriousEggroll/proton-ge-custom proton-ge-custom], but please note that in order for this to be even detected by Steam, you will need to install Steam via Nix due to high level of isolation that Flatpaks utilize. This can however come at the expense of your [https://tosdr.org/en/service/180 privacy].&lt;br /&gt;
&lt;br /&gt;
=== Steam spams dmesg with x86/split lock detection entries ===&lt;br /&gt;
&lt;br /&gt;
Add the below line to {{path|/etc/sysctl.conf}}:&lt;br /&gt;
  kernel.split_lock_mitigate = 0&lt;br /&gt;
&lt;br /&gt;
=== Steam hangs on start with a steamwebhelper popup ===&lt;br /&gt;
&lt;br /&gt;
If this happens and {{path|~/.var/app/com.valvesoftware.Steam/.local/share/Steam/logs/steamwebhelper.log}} says that you are missing X server or &amp;lt;var&amp;gt;DISPLAY&amp;lt;/var&amp;gt;, it means your &amp;lt;var&amp;gt;DISPLAY&amp;lt;/var&amp;gt; is not present in the activation environment. For more information please see https://github.com/ValveSoftware/steam-for-linux/issues/10554 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;[[Sway]]&#039;&#039;&#039;: go into your sway config file and add &amp;lt;var&amp;gt;DISPLAY&amp;lt;/var&amp;gt; to the following line, then restart:&lt;br /&gt;
&amp;lt;pre&amp;gt;exec dbus-activation-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway&amp;lt;/pre&amp;gt;&lt;br /&gt;
For more information about this line, please see the Alpine Wiki&#039;s entry on Sway&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hyprland&#039;&#039;&#039;: add an exec-once to the configuration file at {{path|~/.config/hypr/hyprland}} to set &amp;lt;var&amp;gt;DISPLAY&amp;lt;/var&amp;gt;. Similarly to Sway you may already have a line that sets other variables. If so, add &amp;lt;var&amp;gt;DISPLAY&amp;lt;/var&amp;gt; to the line. The line should look similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;exec-once = dbus-update-activation-environment DISPLAY&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[Gaming on Alpine|Gaming on Alpine Linux]]&lt;br /&gt;
* [[Flatpak]]&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/Steam Steam on postmarketOS]&lt;br /&gt;
&lt;br /&gt;
[[category:Gaming]]&lt;/div&gt;</summary>
		<author><name>WhyNotHugo</name></author>
	</entry>
</feed>