<?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=Encode</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=Encode"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Encode"/>
	<updated>2026-04-28T02:38:53Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=KDE&amp;diff=31519</id>
		<title>KDE</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=KDE&amp;diff=31519"/>
		<updated>2025-11-21T05:28:35Z</updated>

		<summary type="html">&lt;p&gt;Encode: /* Prerequisites */ Change wording&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:KDEScreenshot.png|thumb|KDE Plasma screenshot.]]&lt;br /&gt;
&lt;br /&gt;
[https://kde.org/plasma-desktop/ Plasma] is the desktop environment from [https://kde.org/ KDE], a software project comprising of a collection of libraries known as [https://develop.kde.org/products/frameworks/ KDE Frameworks], and several applications known as [https://apps.kde.org/ KDE Applications]. Their [https://userbase.kde.org/Welcome_to_KDE_UserBase UserBase wiki] has detailed information about most KDE Applications.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|Everything but the first two and last two, are automatically handled if Plasma desktop is installed using [[#setup-desktop|setup-desktop]].}}&lt;br /&gt;
&lt;br /&gt;
{{:Include:Desktop prerequisites}}&lt;br /&gt;
* Enable [[Elogind]] service&lt;br /&gt;
* If you need Xwayland and [[Xorg]], run [[Alpine_setup_scripts#setup-xorg-base|setup-xorg-base]].&lt;br /&gt;
* Wayland users: Install package {{pkg|xf86-input-libinput|arch=}}&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Note|The {{Pkg|plasma-desktop-meta|arch=}} package, which is used by {{Ic|setup-desktop}}, isn&#039;t available for the {{Ic|armhf}} or {{Ic|s390x}} [[Alpine_Linux:Overview#Architectures|architectures]]. However, the rest of Plasma may be installed separately to potentially get a functional desktop.}}&lt;br /&gt;
&lt;br /&gt;
=== setup-desktop ===&lt;br /&gt;
&lt;br /&gt;
{{:Include:Setup-desktop}}&lt;br /&gt;
When Plasma is chosen, the above script additionally installs [[PipeWire]] for audio and [[SDDM]] as display manager.&lt;br /&gt;
&lt;br /&gt;
=== Manual ===&lt;br /&gt;
&lt;br /&gt;
The following command will install the Plasma desktop as specified by the plasma metapackage, including the {{Pkg|sddm|arch=}} display manager and other assorted niceties. {{Cmd|# apk add {{pkg|plasma-desktop-meta|arch=}}}}&lt;br /&gt;
{{Note|&#039;&#039;&#039;polkit&#039;&#039;&#039; and &#039;&#039;&#039;udev&#039;&#039;&#039; are optional services for authentication and device management respectively. While KDE will function without these services enabled, some functionality may be missing or incomplete.}}&lt;br /&gt;
&lt;br /&gt;
== KDE Applications ==&lt;br /&gt;
&lt;br /&gt;
To install the full set of KDE Applications, install {{Pkg|kde-applications}}. You can also choose to install a smaller set of applications by installing any of the subpackages:&lt;br /&gt;
&lt;br /&gt;
{{Note|{{Pkg|kde-applications-edu|arch=}}, {{Pkg|kde-applications-network|arch=}} and {{Pkg|kde-applications-pim|arch=}} are not available on the {{Ic|ppc64le}} or {{Ic|s390x}} [[Alpine_Linux:Overview#Architectures|architectures]].}}&lt;br /&gt;
&lt;br /&gt;
* {{Pkg|kde-applications-accessibility|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-admin|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-base|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-edu|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-games|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-graphics|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-multimedia|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-network|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-pim|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-sdk|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-utils|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-webdev|arch=}}&lt;br /&gt;
&lt;br /&gt;
== Starting Plasma ==&lt;br /&gt;
&lt;br /&gt;
Plasma can be started using a display manager or from the console.&lt;br /&gt;
&lt;br /&gt;
=== Using a display manager ===&lt;br /&gt;
&lt;br /&gt;
When Plasma is installed via the plasma meta-package, the display manager is set up using sddm.&lt;br /&gt;
&lt;br /&gt;
Make sure you enable and start the SDDM service.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;# rc-update add sddm&lt;br /&gt;
# rc-service sddm start &amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
* Select &#039;&#039;Plasma&#039;&#039; to launch a new session in Wayland&lt;br /&gt;
* Select &#039;&#039;Plasma (X11)&#039;&#039; to launch a new session in Xorg&lt;br /&gt;
&lt;br /&gt;
=== From the console ===&lt;br /&gt;
&lt;br /&gt;
For the Wayland session run:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ XDG_SESSION_TYPE{{=}}wayland dbus-run-session startplasma-wayland}}&lt;br /&gt;
&lt;br /&gt;
The Xorg session can be launched by installing {{Pkg|xinit|arch=}} and appending {{Ic|exec startplasma-x11}} to your {{Path|.xinitrc}} file. To start X:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ xinit}}&lt;br /&gt;
&lt;br /&gt;
== Discover ==&lt;br /&gt;
&lt;br /&gt;
[https://userbase.kde.org/Discover Discover] is the application installer from KDE. The alpine linux package {{pkg|discover}} is automatically installed if {{pkg|plasma-desktop-meta|arch=}} package is installed or if [[#setup-desktop|setup-desktop]] is used to install Plasma.&lt;br /&gt;
&lt;br /&gt;
Install the packages {{pkg|discover-backend-apk}} and {{pkg|discover-backend-flatpak}} to use Discover as a graphical interface to [[Alpine Package Keeper]] and [[Flatpak]] respectively.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== HiDPI Scaling ===&lt;br /&gt;
&lt;br /&gt;
When using high resolution screens, e.g. 4K, you might need to apply scaling so the fonts and windows are not too small.&lt;br /&gt;
&lt;br /&gt;
In order to achieve this you can open {{Ic|Settings -&amp;gt; Display and Monitor}} and change the slider under &#039;&#039;Global Scale&#039;&#039; to an appropriate value.&lt;br /&gt;
&lt;br /&gt;
You can also change the mouse cursor and icon size under {{Ic|Settings -&amp;gt; Appearance}}.&lt;br /&gt;
&lt;br /&gt;
If your taskbar and window decorations are still too small, you might want to create the file {{path|~/.xprofile}} to define the &#039;&#039;PLASMA_USE_QT_SCALING&#039;&#039; environment variable:{{Cmd|export PLASMA_USE_QT_SCALING{{=}}1}}&lt;br /&gt;
&lt;br /&gt;
After creating this file, you may need to restart your session to apply this modification.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Installation#Post-Installation|Post installation]]&lt;br /&gt;
* [[Flatpak]]&lt;br /&gt;
* [https://wiki.archlinux.org/title/KDE KDE - Archwiki]&lt;br /&gt;
&lt;br /&gt;
[[Category:Desktop Environments]]&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=KDE&amp;diff=31518</id>
		<title>KDE</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=KDE&amp;diff=31518"/>
		<updated>2025-11-21T03:42:26Z</updated>

		<summary type="html">&lt;p&gt;Encode: General wiki style&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:KDEScreenshot.png|thumb|KDE Plasma screenshot.]]&lt;br /&gt;
&lt;br /&gt;
[https://kde.org/plasma-desktop/ Plasma] is the desktop environment from [https://kde.org/ KDE], a software project comprising of a collection of libraries known as [https://develop.kde.org/products/frameworks/ KDE Frameworks], and several applications known as [https://apps.kde.org/ KDE Applications]. Their [https://userbase.kde.org/Welcome_to_KDE_UserBase UserBase wiki] has detailed information about most KDE Applications.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|Except for the first two &#039;&#039;Prerequisites&#039;&#039;, all the others are automatically handled if Plasma desktop is installed using [[#setup-desktop|setup-desktop]] script.}}&lt;br /&gt;
&lt;br /&gt;
{{:Include:Desktop prerequisites}}&lt;br /&gt;
* Enable [[Elogind]] service&lt;br /&gt;
* For users interested in Xorg as opposed to Wayland, install the [[Alpine_setup_scripts#setup-xorg-base|Xorg base packages]]&lt;br /&gt;
* Wayland users: Install package {{pkg|xf86-input-libinput|arch=}}&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Note|The {{Pkg|plasma-desktop-meta|arch=}} package, which is used by {{Ic|setup-desktop}}, isn&#039;t available for the {{Ic|armhf}} or {{Ic|s390x}} [[Alpine_Linux:Overview#Architectures|architectures]]. However, the rest of Plasma may be installed separately to potentially get a functional desktop.}}&lt;br /&gt;
&lt;br /&gt;
=== setup-desktop ===&lt;br /&gt;
&lt;br /&gt;
{{:Include:Setup-desktop}}&lt;br /&gt;
When Plasma is chosen, the above script additionally installs [[PipeWire]] for audio and [[SDDM]] as display manager.&lt;br /&gt;
&lt;br /&gt;
=== Manual ===&lt;br /&gt;
&lt;br /&gt;
The following command will install the Plasma desktop as specified by the plasma metapackage, including the {{Pkg|sddm|arch=}} display manager and other assorted niceties. {{Cmd|# apk add {{pkg|plasma-desktop-meta|arch=}}}}&lt;br /&gt;
{{Note|&#039;&#039;&#039;polkit&#039;&#039;&#039; and &#039;&#039;&#039;udev&#039;&#039;&#039; are optional services for authentication and device management respectively. While KDE will function without these services enabled, some functionality may be missing or incomplete.}}&lt;br /&gt;
&lt;br /&gt;
== KDE Applications ==&lt;br /&gt;
&lt;br /&gt;
To install the full set of KDE Applications, install {{Pkg|kde-applications}}. You can also choose to install a smaller set of applications by installing any of the subpackages:&lt;br /&gt;
&lt;br /&gt;
{{Note|{{Pkg|kde-applications-edu|arch=}}, {{Pkg|kde-applications-network|arch=}} and {{Pkg|kde-applications-pim|arch=}} are not available on the {{Ic|ppc64le}} or {{Ic|s390x}} [[Alpine_Linux:Overview#Architectures|architectures]].}}&lt;br /&gt;
&lt;br /&gt;
* {{Pkg|kde-applications-accessibility|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-admin|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-base|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-edu|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-games|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-graphics|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-multimedia|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-network|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-pim|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-sdk|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-utils|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-webdev|arch=}}&lt;br /&gt;
&lt;br /&gt;
== Starting Plasma ==&lt;br /&gt;
&lt;br /&gt;
Plasma can be started using a display manager or from the console.&lt;br /&gt;
&lt;br /&gt;
=== Using a display manager ===&lt;br /&gt;
&lt;br /&gt;
When Plasma is installed via the plasma meta-package, the display manager is set up using sddm.&lt;br /&gt;
&lt;br /&gt;
Make sure you enable and start the SDDM service.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;# rc-update add sddm&lt;br /&gt;
# rc-service sddm start &amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
* Select &#039;&#039;Plasma&#039;&#039; to launch a new session in Wayland&lt;br /&gt;
* Select &#039;&#039;Plasma (X11)&#039;&#039; to launch a new session in Xorg&lt;br /&gt;
&lt;br /&gt;
=== From the console ===&lt;br /&gt;
&lt;br /&gt;
For the Wayland session run:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ XDG_SESSION_TYPE{{=}}wayland dbus-run-session startplasma-wayland}}&lt;br /&gt;
&lt;br /&gt;
The Xorg session can be launched by installing {{Pkg|xinit|arch=}} and appending {{Ic|exec startplasma-x11}} to your {{Path|.xinitrc}} file. To start X:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ xinit}}&lt;br /&gt;
&lt;br /&gt;
== Discover ==&lt;br /&gt;
&lt;br /&gt;
[https://userbase.kde.org/Discover Discover] is the application installer from KDE. The alpine linux package {{pkg|discover}} is automatically installed if {{pkg|plasma-desktop-meta|arch=}} package is installed or if [[#setup-desktop|setup-desktop]] is used to install Plasma.&lt;br /&gt;
&lt;br /&gt;
Install the packages {{pkg|discover-backend-apk}} and {{pkg|discover-backend-flatpak}} to use Discover as a graphical interface to [[Alpine Package Keeper]] and [[Flatpak]] respectively.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== HiDPI Scaling ===&lt;br /&gt;
&lt;br /&gt;
When using high resolution screens, e.g. 4K, you might need to apply scaling so the fonts and windows are not too small.&lt;br /&gt;
&lt;br /&gt;
In order to achieve this you can open {{Ic|Settings -&amp;gt; Display and Monitor}} and change the slider under &#039;&#039;Global Scale&#039;&#039; to an appropriate value.&lt;br /&gt;
&lt;br /&gt;
You can also change the mouse cursor and icon size under {{Ic|Settings -&amp;gt; Appearance}}.&lt;br /&gt;
&lt;br /&gt;
If your taskbar and window decorations are still too small, you might want to create the file {{path|~/.xprofile}} to define the &#039;&#039;PLASMA_USE_QT_SCALING&#039;&#039; environment variable:{{Cmd|export PLASMA_USE_QT_SCALING{{=}}1}}&lt;br /&gt;
&lt;br /&gt;
After creating this file, you may need to restart your session to apply this modification.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Installation#Post-Installation|Post installation]]&lt;br /&gt;
* [[Flatpak]]&lt;br /&gt;
* [https://wiki.archlinux.org/title/KDE KDE - Archwiki]&lt;br /&gt;
&lt;br /&gt;
[[Category:Desktop Environments]]&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Talk:KDE&amp;diff=31517</id>
		<title>Talk:KDE</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Talk:KDE&amp;diff=31517"/>
		<updated>2025-11-20T21:05:12Z</updated>

		<summary type="html">&lt;p&gt;Encode: /* When is {{Ic|xf86-input-libinput}} needed? */ new section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Note on reversion of edit id 26401==&lt;br /&gt;
Romw314, I reverted your edit because apk template does not allow a display string different from the package being linked to, the apk command as written int the article {{ic|# apk add plasma}} is correct; the actual package name though is {{pkg|plasma-desktop-meta|arch=}}. It might be possible to change the command to the latter in order to have the display string and the package name match though... Will look into it shortly.&lt;br /&gt;
&amp;amp;ndash;[[User:zcrayfish|zcrayfish]] &amp;lt;small&amp;gt;([[User talk:zcrayfish|talk]]•[[Special:Contributions/zcrayfish|contribs]]•[[Special:EmailUser/zcrayfish|send email]])&amp;lt;/small&amp;gt; 04:29, 17 February 2024 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Should this page be renamed to Plasma ==&lt;br /&gt;
&lt;br /&gt;
Since KDE has adopted Plasma as the name of the Desktop, should we change the page name from KDE to Plasma. I don&#039;t see this wiki page has any relevance to KDE project and instead it&#039;s all about Plasma Desktop and KDE Addons and KDE Applications.&lt;br /&gt;
[[User:Prabuanand|Prabuanand]] ([[User talk:Prabuanand|talk]]) 09:10, 11 August 2024 (UTC)&lt;br /&gt;
&lt;br /&gt;
== When is {{Ic|xf86-input-libinput}} needed? ==&lt;br /&gt;
&lt;br /&gt;
What situation is this needed for?  It was added in [https://wiki.alpinelinux.org/w/index.php?title=KDE&amp;amp;diff=prev&amp;amp;oldid=26364 26364] because of {{Issue|15006#note_317477}}, updated in [https://wiki.alpinelinux.org/w/index.php?title=KDE&amp;amp;diff=prev&amp;amp;oldid=26391 26391] and changed to say it&#039;s only for Wayland users because {{Ic|setup-xorg-base}} would already install this.  I have KDE installed and inputs work without this.  --[[User:Encode|Encode]] ([[User talk:Encode|talk]]) 21:05, 20 November 2025 (UTC)&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=KDE&amp;diff=31516</id>
		<title>KDE</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=KDE&amp;diff=31516"/>
		<updated>2025-11-20T20:43:30Z</updated>

		<summary type="html">&lt;p&gt;Encode: Update supported architectures&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:KDEScreenshot.png |thumb |KDE Plasma screenshot.]]&lt;br /&gt;
&lt;br /&gt;
[https://kde.org/plasma-desktop/ Plasma] is the desktop environment from [https://kde.org/ KDE], a software project comprising of a collection of libraries known as [https://develop.kde.org/products/frameworks/ KDE Frameworks], and several applications known as [https://apps.kde.org/ KDE Applications]. Their [https://userbase.kde.org/Welcome_to_KDE_UserBase UserBase wiki] has detailed information about most KDE Applications.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
{{:Include:Desktop prerequisites}}&lt;br /&gt;
* For users interested in Xorg as opposed to Wayland, install the [[Alpine_setup_scripts#setup-xorg-base|Xorg base packages]]&lt;br /&gt;
* Enable [[Elogind]] service&lt;br /&gt;
* Wayland users: Install package {{pkg|xf86-input-libinput|arch=}}&lt;br /&gt;
{{Tip|Except for the first two [[#Prerequisites|Prerequisites]], all the others are automatically handled if Plasma desktop is [[#Installation using setup-desktop|installed using setup-desktop]] script.}}&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Note|The {{Pkg|plasma-desktop-meta|arch=}} package, which is used by {{Ic|setup-desktop}}, isn&#039;t available for the {{Ic|armhf}} or {{Ic|s390x}} architectures. However, the rest of Plasma may be installed separately to potentially get a functional desktop.}}&lt;br /&gt;
&lt;br /&gt;
=== setup-desktop ===&lt;br /&gt;
&lt;br /&gt;
{{:Include:Setup-desktop}}&lt;br /&gt;
When Plasma is chosen, the above script additionally installs [[PipeWire]] for audio and [[SDDM]] as display manager.&lt;br /&gt;
&lt;br /&gt;
=== Manual ===&lt;br /&gt;
&lt;br /&gt;
The following command will install the Plasma desktop as specified by the plasma metapackage, including the {{Pkg|sddm|arch=}} display manager and other assorted niceties. {{Cmd|# apk add {{pkg|plasma-desktop-meta|arch=}}}}&lt;br /&gt;
{{Note|&#039;&#039;&#039;polkit&#039;&#039;&#039; and &#039;&#039;&#039;udev&#039;&#039;&#039; are optional services for authentication and device management respectively. While KDE will function without these services enabled, some functionality may be missing or incomplete.}}&lt;br /&gt;
&lt;br /&gt;
== KDE Applications ==&lt;br /&gt;
&lt;br /&gt;
To install the full set of KDE Applications, install {{Pkg|kde-applications}}. You can also choose to install a smaller set of applications by installing any of the subpackages:&lt;br /&gt;
&lt;br /&gt;
{{Note|{{Pkg|kde-applications-edu|arch=}}, {{Pkg|kde-applications-network|arch=}} and {{Pkg|kde-applications-pim|arch=}} are not available on {{Ic|ppc64le}} or {{Ic|s390x}}.}}&lt;br /&gt;
&lt;br /&gt;
* {{Pkg|kde-applications-accessibility|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-admin|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-base|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-edu|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-games|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-graphics|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-multimedia|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-network|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-pim|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-sdk|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-utils|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-webdev|arch=}}&lt;br /&gt;
&lt;br /&gt;
== Starting Plasma ==&lt;br /&gt;
&lt;br /&gt;
Plasma can be started using a display manager or from the console.&lt;br /&gt;
&lt;br /&gt;
=== Using a display manager ===&lt;br /&gt;
&lt;br /&gt;
When Plasma is installed via the plasma meta-package, the display manager is set up using sddm.&lt;br /&gt;
&lt;br /&gt;
Make sure you enable and start the SDDM service.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|rc-update add sddm&lt;br /&gt;
rc-service sddm start&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
* Select &#039;&#039;Plasma&#039;&#039; to launch a new session in Wayland&lt;br /&gt;
* Select &#039;&#039;Plasma (X11)&#039;&#039; to launch a new session in Xorg&lt;br /&gt;
&lt;br /&gt;
=== From the console ===&lt;br /&gt;
&lt;br /&gt;
The Xorg session can be launched by installing {{Pkg|xinit|arch=}} and appending &amp;lt;code&amp;gt;exec startplasma-x11&amp;lt;/code&amp;gt; to your &amp;lt;code&amp;gt;.xinitrc&amp;lt;/code&amp;gt; file. To start X:&lt;br /&gt;
{{Cmd|xinit}}&lt;br /&gt;
&lt;br /&gt;
For the Wayland session run&lt;br /&gt;
{{Cmd|XDG_SESSION_TYPE{{=}}wayland dbus-run-session startplasma-wayland}}&lt;br /&gt;
&lt;br /&gt;
== Discover ==&lt;br /&gt;
&lt;br /&gt;
[https://userbase.kde.org/Discover Discover] is the application installer from KDE. The alpine linux package {{pkg|discover}} is automatically installed if {{pkg|plasma-desktop-meta|arch=}} package is installed or if [[#setup-desktop|setup-desktop]] is used to install Plasma.&lt;br /&gt;
&lt;br /&gt;
Install the packages {{pkg|discover-backend-apk}} and {{pkg|discover-backend-flatpak}} to use Discover as a graphical interface to [[Alpine Package Keeper]] and [[Flatpak]] respectively.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== HiDPI Scaling ===&lt;br /&gt;
&lt;br /&gt;
When using high resolution screens, e.g. 4K, you might need to apply scaling so the fonts and windows are not too small.&lt;br /&gt;
&lt;br /&gt;
In order to achieve this you can open &amp;lt;code&amp;gt;Settings -&amp;gt; Display and Monitor&amp;lt;/code&amp;gt; and change the slider under &#039;&#039;Global Scale&#039;&#039; to an appropriate value.&lt;br /&gt;
&lt;br /&gt;
You can also change the mouse cursor and icon size under &amp;lt;code&amp;gt;Settings -&amp;gt; Appearance&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If your taskbar and window decorations are still too small, you might want to create the file {{path|~/.xprofile}} to define the &#039;&#039;PLASMA_USE_QT_SCALING&#039;&#039; environment variable:{{Cmd|export PLASMA_USE_QT_SCALING{{=}}1}}&lt;br /&gt;
&lt;br /&gt;
After creating this file, you may need to restart your session to apply this modification.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Installation#Post-Installation|Post installation]]&lt;br /&gt;
* [[Flatpak]]&lt;br /&gt;
* [https://wiki.archlinux.org/title/KDE KDE - Archwiki]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Desktop Environments]]&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=KDE&amp;diff=31515</id>
		<title>KDE</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=KDE&amp;diff=31515"/>
		<updated>2025-11-20T20:07:44Z</updated>

		<summary type="html">&lt;p&gt;Encode: Put ‘setup-desktop’ and ‘Manual’ under ‘Installation’&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:KDEScreenshot.png |thumb |KDE Plasma screenshot.]]&lt;br /&gt;
&lt;br /&gt;
[https://kde.org/plasma-desktop/ Plasma] is the desktop environment from [https://kde.org/ KDE], a software project comprising of a collection of libraries known as [https://develop.kde.org/products/frameworks/ KDE Frameworks], and several applications known as [https://apps.kde.org/ KDE Applications]. Their [https://userbase.kde.org/Welcome_to_KDE_UserBase UserBase wiki] has detailed information about most KDE Applications.&lt;br /&gt;
&lt;br /&gt;
{{Note|the {{Pkg|plasma-desktop-meta|arch=}} package isn&#039;t available for the &amp;lt;code&amp;gt;ppc64le&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;s390x&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;armhf&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;riscv64&amp;lt;/code&amp;gt; architectures due to the {{Pkg|kdeplasma-addons|arch=}} dependency not being available there. However, the rest of Plasma may be installed separately to potentially get a functional desktop.}}&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
{{:Include:Desktop prerequisites}}&lt;br /&gt;
* For users interested in Xorg as opposed to Wayland, install the [[Alpine_setup_scripts#setup-xorg-base|Xorg base packages]]&lt;br /&gt;
* Enable [[Elogind]] service&lt;br /&gt;
* Wayland users: Install package {{pkg|xf86-input-libinput|arch=}}&lt;br /&gt;
{{Tip|Except for the first two [[#Prerequisites|Prerequisites]], all the others are automatically handled if Plasma desktop is [[#Installation using setup-desktop|installed using setup-desktop]] script.}}&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
=== setup-desktop ===&lt;br /&gt;
&lt;br /&gt;
{{:Include:Setup-desktop}}&lt;br /&gt;
When Plasma is chosen, the above script additionally installs [[PipeWire]] for audio and [[SDDM]] as display manager.&lt;br /&gt;
&lt;br /&gt;
=== Manual ===&lt;br /&gt;
&lt;br /&gt;
The following command will install the Plasma desktop as specified by the plasma metapackage, including the {{Pkg|sddm|arch=}} display manager and other assorted niceties. {{Cmd|# apk add {{pkg|plasma-desktop-meta|arch=}}}}&lt;br /&gt;
{{Note|&#039;&#039;&#039;polkit&#039;&#039;&#039; and &#039;&#039;&#039;udev&#039;&#039;&#039; are optional services for authentication and device management respectively. While KDE will function without these services enabled, some functionality may be missing or incomplete.}}&lt;br /&gt;
&lt;br /&gt;
== KDE Applications ==&lt;br /&gt;
&lt;br /&gt;
To install the full set of KDE Applications, install {{Pkg|kde-applications}}. You can also choose to install a smaller set of applications by installing any of the subpackages:&lt;br /&gt;
&lt;br /&gt;
{{Note|Most of these are not available on &amp;lt;code&amp;gt;ppc64le&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;s390x&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
* {{Pkg|kde-applications-accessibility|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-admin|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-base|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-edu|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-games|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-graphics|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-multimedia|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-network|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-pim|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-sdk|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-utils|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-webdev|arch=}}&lt;br /&gt;
&lt;br /&gt;
== Starting Plasma ==&lt;br /&gt;
&lt;br /&gt;
Plasma can be started using a display manager or from the console.&lt;br /&gt;
&lt;br /&gt;
=== Using a display manager ===&lt;br /&gt;
&lt;br /&gt;
When Plasma is installed via the plasma meta-package, the display manager is set up using sddm.&lt;br /&gt;
&lt;br /&gt;
Make sure you enable and start the SDDM service.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|rc-update add sddm&lt;br /&gt;
rc-service sddm start&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
* Select &#039;&#039;Plasma&#039;&#039; to launch a new session in Wayland&lt;br /&gt;
* Select &#039;&#039;Plasma (X11)&#039;&#039; to launch a new session in Xorg&lt;br /&gt;
&lt;br /&gt;
=== From the console ===&lt;br /&gt;
&lt;br /&gt;
The Xorg session can be launched by installing {{Pkg|xinit|arch=}} and appending &amp;lt;code&amp;gt;exec startplasma-x11&amp;lt;/code&amp;gt; to your &amp;lt;code&amp;gt;.xinitrc&amp;lt;/code&amp;gt; file. To start X:&lt;br /&gt;
{{Cmd|xinit}}&lt;br /&gt;
&lt;br /&gt;
For the Wayland session run&lt;br /&gt;
{{Cmd|XDG_SESSION_TYPE{{=}}wayland dbus-run-session startplasma-wayland}}&lt;br /&gt;
&lt;br /&gt;
== Discover ==&lt;br /&gt;
&lt;br /&gt;
[https://userbase.kde.org/Discover Discover] is the application installer from KDE. The alpine linux package {{pkg|discover}} is automatically installed if {{pkg|plasma-desktop-meta|arch=}} package is installed or if [[#setup-desktop|setup-desktop]] is used to install Plasma.&lt;br /&gt;
&lt;br /&gt;
Install the packages {{pkg|discover-backend-apk}} and {{pkg|discover-backend-flatpak}} to use Discover as a graphical interface to [[Alpine Package Keeper]] and [[Flatpak]] respectively.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== HiDPI Scaling ===&lt;br /&gt;
&lt;br /&gt;
When using high resolution screens, e.g. 4K, you might need to apply scaling so the fonts and windows are not too small.&lt;br /&gt;
&lt;br /&gt;
In order to achieve this you can open &amp;lt;code&amp;gt;Settings -&amp;gt; Display and Monitor&amp;lt;/code&amp;gt; and change the slider under &#039;&#039;Global Scale&#039;&#039; to an appropriate value.&lt;br /&gt;
&lt;br /&gt;
You can also change the mouse cursor and icon size under &amp;lt;code&amp;gt;Settings -&amp;gt; Appearance&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If your taskbar and window decorations are still too small, you might want to create the file {{path|~/.xprofile}} to define the &#039;&#039;PLASMA_USE_QT_SCALING&#039;&#039; environment variable:{{Cmd|export PLASMA_USE_QT_SCALING{{=}}1}}&lt;br /&gt;
&lt;br /&gt;
After creating this file, you may need to restart your session to apply this modification.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Installation#Post-Installation|Post installation]]&lt;br /&gt;
* [[Flatpak]]&lt;br /&gt;
* [https://wiki.archlinux.org/title/KDE KDE - Archwiki]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Desktop Environments]]&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Template_talk:Issue&amp;diff=31514</id>
		<title>Template talk:Issue</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Template_talk:Issue&amp;diff=31514"/>
		<updated>2025-11-20T09:36:19Z</updated>

		<summary type="html">&lt;p&gt;Encode: /* {{Ic|Issue}} should work for other projects under the Alpine umbrella */ Possible fix&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Update URL to {{Ic|gitlab.alpinelinux.org}} ==&lt;br /&gt;
&lt;br /&gt;
{{Done}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;s&amp;gt;Please update the URL used in the template to https://gitlab.alpinelinux.org/alpine/aports/-/issues/&amp;lt;/s&amp;gt;&lt;br /&gt;
[[User:Zcrayfish|zcrayfish]] ([[User talk:Zcrayfish|talk]]) 04:02, 31 July 2023 (UTC)&lt;br /&gt;
&lt;br /&gt;
== {{Ic|Issue}} should work for other projects under the Alpine umbrella ==&lt;br /&gt;
&lt;br /&gt;
This template refers only to aports. If the issue was filed against other subprojects like, alpine-conf, there is no way to use this template. Please fix this.&lt;br /&gt;
The below issue number cannot be referred in the current template. Please use aports as default argument, but allow users to choose other components like alpine-conf to refer bug reports.&lt;br /&gt;
https://gitlab.alpinelinux.org/alpine/alpine-conf/-/issues/10473&lt;br /&gt;
[[User:Prabuanand|Prabuanand]] ([[User talk:Prabuanand|talk]]) 08:55, 29 October 2024 (UTC)&lt;br /&gt;
: I don&#039;t know MediaWiki but I played around on [[Template:Sandbox]] and [https://wiki.alpinelinux.org/w/index.php?title=Template:Sandbox&amp;amp;oldid=31513 this] seems to work --[[User:Encode|Encode]] ([[User talk:Encode|talk]]) 09:36, 20 November 2025 (UTC)&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Template:Sandbox&amp;diff=31513</id>
		<title>Template:Sandbox</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Template:Sandbox&amp;diff=31513"/>
		<updated>2025-11-20T09:33:15Z</updated>

		<summary type="html">&lt;p&gt;Encode: Testing ‘Issue’ template&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Template}}&lt;br /&gt;
&lt;br /&gt;
Link to issues under the [https://gitlab.alpinelinux.org/alpine/ Alpine gitlab umbrella].&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{Issue|number|project=|description=}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Define|number|Issue number.&lt;br /&gt;
:This argument is &#039;&#039;&#039;required&#039;&#039;&#039;.}}&lt;br /&gt;
{{Define|project{{=}}|Project under {{Ic|https://gitlab.alpinelinux.org/alpine/}} to which the issue belongs.&lt;br /&gt;
:This argument is &#039;&#039;&#039;optional&#039;&#039;&#039;, defaults to {{Ic|aports}}.}}&lt;br /&gt;
{{Define|description{{=}}|Description for the issue, for example, what the issue title is.&lt;br /&gt;
:This argument is &#039;&#039;&#039;optional&#039;&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{Issue|10516}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Produces: {{Issue|10516}}&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{Issue|5|project=docs/user-handbook}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Produces: {{Issue|5|project=docs/user-handbook}}&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;{{Issue|10516|description=libreoffice is built without Wayland support}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Produces: {{Issue|10516|description=libreoffice is built without Wayland support}}&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;{{Issue|10516|project=alpine-conf|description=Boot partition only has enough space for one kernel}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Produces: {{Issue|10516|project=alpine-conf|description=Boot partition only has enough space for one kernel}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
&amp;lt;includeonly&amp;gt;&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;&lt;br /&gt;
[https://gitlab.alpinelinux.org/alpine/{{#if: {{{project|}}} | {{{project}}} | aports}}/-/issues/{{{1}}} {{{project|}}} #{{{1}}}{{#if: {{{description|}}} |&amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; {{{description}}}}}]&lt;br /&gt;
&amp;lt;/span&amp;gt;&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Template_talk:Issue&amp;diff=31512</id>
		<title>Template talk:Issue</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Template_talk:Issue&amp;diff=31512"/>
		<updated>2025-11-20T09:28:37Z</updated>

		<summary type="html">&lt;p&gt;Encode: Put headings and mark that one is done&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Update URL to {{Ic|gitlab.alpinelinux.org}} ==&lt;br /&gt;
&lt;br /&gt;
{{Done}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;s&amp;gt;Please update the URL used in the template to https://gitlab.alpinelinux.org/alpine/aports/-/issues/&amp;lt;/s&amp;gt;&lt;br /&gt;
[[User:Zcrayfish|zcrayfish]] ([[User talk:Zcrayfish|talk]]) 04:02, 31 July 2023 (UTC)&lt;br /&gt;
&lt;br /&gt;
== {{Ic|Issue}} should work for other projects under the Alpine umbrella ==&lt;br /&gt;
&lt;br /&gt;
This template refers only to aports. If the issue was filed against other subprojects like, alpine-conf, there is no way to use this template. Please fix this.&lt;br /&gt;
The below issue number cannot be referred in the current template. Please use aports as default argument, but allow users to choose other components like alpine-conf to refer bug reports.&lt;br /&gt;
https://gitlab.alpinelinux.org/alpine/alpine-conf/-/issues/10473&lt;br /&gt;
[[User:Prabuanand|Prabuanand]] ([[User talk:Prabuanand|talk]]) 08:55, 29 October 2024 (UTC)&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Talk:PipeWire&amp;diff=31511</id>
		<title>Talk:PipeWire</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Talk:PipeWire&amp;diff=31511"/>
		<updated>2025-11-18T20:35:59Z</updated>

		<summary type="html">&lt;p&gt;Encode: /* Is {{Ic|rtkit}} still recommended for Realtime scheduling? */ Add the ‘Done’ template&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Revert edit about considering two options to launch PipeWire ==&lt;br /&gt;
&lt;br /&gt;
Dear [[User:John3-16|John3-16]], This [https://wiki.alpinelinux.org/w/index.php?title=PipeWire&amp;amp;oldid=30543 edit] is being reverted because Pipewire user service is the recommended method going forward and the pipewire-launcher will be removed at some point. When a recommended method is available, listing them on par with bespoke methods will confuse new users. We can always list such methods under a heading like &#039;&#039;Custom configuration&#039;&#039;. Our [https://wiki.alpinelinux.org/w/index.php?title=Installation&amp;amp;oldid=26677 installation page] was a perfect example for listing a lot of options, but frustrating for new users. Thanks for you contributions to Wiki and it is highly appreciated and i hope you understand and agree with the reasoning for this revert. -[[User:Prabuanand|Prabuanand]] ([[User talk:Prabuanand|talk]]) 03:49, 22 July 2025 (UTC)&lt;br /&gt;
&lt;br /&gt;
:  Agreed that Pipewire user service is the recommended method; and that the pipewire-launcher method is expected to be sunsetted;  this was respected in my edit.  The Note was preserved which stated that the second option would be deprecated.  My impression is that enough readers may not stop and realize that these are mutually exclusive methods, if they implement the passages in this guide one after another in a rush.  &lt;br /&gt;
:  I concur with you too that other, bespoke methods would be superfluous on the wiki;  their existence was only being acknowledged in the edit&#039;s Summary.   Thank you for your extensive wiki help also;  please continue!&lt;br /&gt;
:[[User:John3-16|John3-16]] ([[User talk:John3-16|talk]]) 04:26, 22 July 2025 (UTC)&lt;br /&gt;
:: Thanks for you reply. Understood the reasoning and added the suggested changes. - [[User:Prabuanand|Prabuanand]] ([[User talk:Prabuanand|talk]]) 05:22, 22 July 2025 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Is {{Ic|rtkit}} still recommended for [[PipeWire#Realtime_scheduling|Realtime scheduling]]? ==&lt;br /&gt;
&lt;br /&gt;
{{Done}}&lt;br /&gt;
&lt;br /&gt;
[https://github.com/heftig/rtkit rtkit&#039;s] repository hasn&#039;t been updated since 2020-04-05 and the open [https://github.com/heftig/rtkit/issues issues] seem to list some problems.  [https://wiki.gentoo.org/wiki/PipeWire#Audio_Groups Gentoo PipeWire#Audio Groups] implies rtkit is the fallback and {{Ic|pipewire}} group is the recommeneded path.  {{Path|/etc/security/limits.d/25-pw-rlimits.conf}} (which is shipped from [https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/master/src/modules/module-rt/25-pw-rlimits.conf.in upstream]) also seems to imply that the {{Ic|pipewire}} group is preferred.  --[[User:Encode|Encode]] ([[User talk:Encode|talk]]) 07:48, 17 November 2025 (UTC)&lt;br /&gt;
: Made changes to wiki section. Please feel to make necessary changes to fix any remaining inaccuracies, and to remove the Accuracy template. Thanks. -[[User:Prabuanand|Prabuanand]] ([[User talk:Prabuanand|talk]]) 10:54, 17 November 2025 (UTC)&lt;br /&gt;
:: I changed the wording slightly and removed ‘glitch-free’ because I feel that is too strong.  Everything looks good.  --[[User:Encode|Encode]] ([[User talk:Encode|talk]]) 20:13, 18 November 2025 (UTC)&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Template_talk:Accuracy&amp;diff=31510</id>
		<title>Template talk:Accuracy</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Template_talk:Accuracy&amp;diff=31510"/>
		<updated>2025-11-18T20:34:56Z</updated>

		<summary type="html">&lt;p&gt;Encode: /* A space should be added after {{Ic|Reason:}} */ Add the ‘Done’ template&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== A space should be added after {{Ic|Reason:}} ==&lt;br /&gt;
&lt;br /&gt;
{{Done}}&lt;br /&gt;
&lt;br /&gt;
Between {{Ic|Reason:}} and the reason you put, a space should be added.  --[[User:Encode|Encode]] ([[User talk:Encode|talk]]) 07:58, 17 November 2025 (UTC)&lt;br /&gt;
: Hi [[User:Encode|Encode]], Thanks for the feedback and my sincere appreciation for all your past contributiions to improve Alpine Wiki. I copied many content from your user pages and used them in various pages of Alpine wiki. I tried making the change, but doesn&#039;t seem to make any difference. Please go ahead and make the necessary change. I copied this template from Archwiki and made minor changes to follow Alpine wiki template conventions. - [[User:Prabuanand|Prabuanand]] ([[User talk:Prabuanand|talk]]) 10:23, 17 November 2025 (UTC)&lt;br /&gt;
:: Just doing my part to improve the wiki.  I went ahead and added the space. --[[User:Encode|Encode]] ([[User talk:Encode|talk]]) 09:26, 18 November 2025 (UTC)&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Polkit&amp;diff=31509</id>
		<title>Polkit</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Polkit&amp;diff=31509"/>
		<updated>2025-11-18T20:23:40Z</updated>

		<summary type="html">&lt;p&gt;Encode: /* Authentication agents */ Correct KDE agent package name&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://polkit.pages.freedesktop.org/polkit/polkit.8.html Polkit] is an authorization manager which is used for allowing unprivileged processes to speak to privileged processes through some form of inter-process communication mechanism like [[D-Bus]]. &lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* Install and configure [[D-Bus#Installation|D-Bus]].&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
For graphical applications, polkit relies on [[Elogind|elogind]] or [[Seatd]] to determine the identity of the user making a request. To use the full features of polkit, [[#Using polkit with elogind|using polkit with elogind]] is recommended.&lt;br /&gt;
&lt;br /&gt;
=== Using polkit with elogind ===&lt;br /&gt;
&lt;br /&gt;
For a feature-rich [[Desktop environments and Window managers|desktop]] experience, use polkit with [[Elogind|elogind]]. Features like [[#Authentication agents|authentication agents]] can be used only with elogind. Install the {{Pkg|polkit-elogind}} package and enable the {{ic|polkit}} service using [[OpenRC]].&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;# apk add polkit-elogind&lt;br /&gt;
# rc-update add polkit&lt;br /&gt;
# rc-service polkit start &amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Proceed to configure [[Elogind|elogind]], if not done already.&lt;br /&gt;
&lt;br /&gt;
=== Using polkit with seatd ===&lt;br /&gt;
&lt;br /&gt;
For a minimal desktop like [[Sway]], polkit can be used with [[Seatd#Polkit|seatd with certain limitations]]. With Seatd, polkit rules can only evaluate group membership, resulting in a &#039;yes&#039; or &#039;no&#039; decision. Graphical, session aware [[#Authentication agents|authentication agents]] are not supported.  &lt;br /&gt;
&lt;br /&gt;
To proceed to use polkit with seatd, install the {{Pkg|polkit}} package and enable the {{ic|polkit}} service using [[OpenRC]]: {{Cmd|&amp;lt;nowiki&amp;gt;# apk add polkit&lt;br /&gt;
# rc-update add polkit&lt;br /&gt;
# rc-service polkit start &amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
== Authentication agents ==&lt;br /&gt;
&lt;br /&gt;
Polkit authentication agent integration helps coordinate the display of a password prompt to the active and local users. &lt;br /&gt;
When an unprivileged user attempts to access a privileged location (such as by typing admin:// in the address bar of a [[File_management#File_managers|File Manager]]), when the appropriate polkit policy requires administrative authentication, a password dialogue will typically appear. &lt;br /&gt;
&lt;br /&gt;
{{Warning|Authentication agents will work only when [[PAM]] is properly set up and [[#Using polkit with elogind|polkit is used with elogind]].}}&lt;br /&gt;
&lt;br /&gt;
Some of the authentication agents available in Alpine linux is listed below:&lt;br /&gt;
&lt;br /&gt;
* {{Pkg|xfce-polkit}}&lt;br /&gt;
* {{Pkg|mate-polkit}}&lt;br /&gt;
* {{Pkg|polkit-gnome}}&lt;br /&gt;
* {{Pkg|polkit-kde-agent-1}}&lt;br /&gt;
&lt;br /&gt;
For [[Xfce]], install {{Pkg|xfce-polkit}} as follows:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add xfce-polkit}}&lt;br /&gt;
&lt;br /&gt;
== Polkit rule files ==&lt;br /&gt;
&lt;br /&gt;
The following example rule files have been provided to show the limitations of [[#Using polkit with seatd|seatd]].&lt;br /&gt;
&lt;br /&gt;
Ensure that correct permissions are set for the rule files. For example, for the rule file {{Path|/etc/polkit-1/rules.d/50-udisks.rules}}:{{Cmd|&amp;lt;nowiki&amp;gt;# chown root:root /etc/polkit-1/rules.d/50-udisks.rules&lt;br /&gt;
# chmod 644 /etc/polkit-1/rules.d/50-udisks.rules&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
=== Example1 ===&lt;br /&gt;
&lt;br /&gt;
A sample polkit rule file {{Path|/etc/polkit-1/rules.d/50-udisks.rules}} which allow [[File_management#Automounting_removable_storage|automatic mounting of removable storage]] based on being a member of &#039;&#039;&#039;disk&#039;&#039;&#039; or &#039;&#039;&#039;storage&#039;&#039;&#039; group. This rule depends only on group membership which works with seatd: {{cat|/etc/polkit-1/rules.d/50-udisks.rules|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
polkit.addRule(function(action, subject) {&lt;br /&gt;
    if (subject.isInGroup(&amp;quot;disk&amp;quot;) || subject.isInGroup(&amp;quot;storage&amp;quot;)) &amp;amp;&amp;amp;&lt;br /&gt;
        (action.id == &amp;quot;org.freedesktop.udisks2.filesystem-mount&amp;quot; ||&lt;br /&gt;
         action.id == &amp;quot;org.freedesktop.udisks2.filesystem-mount-system&amp;quot; ||&lt;br /&gt;
	action.id == &amp;quot;org.freedesktop.udisks2.filesystem-unmount-others&amp;quot; ||  &lt;br /&gt;
         action.id == &amp;quot;org.freedesktop.udisks2.drive-eject&amp;quot; ||&lt;br /&gt;
         action.id == &amp;quot;org.freedesktop.udisks2.encrypted-unlock&amp;quot; ||&lt;br /&gt;
         action.id == &amp;quot;org.freedesktop.udisks2.power-off-drive&amp;quot;)) {&lt;br /&gt;
        return polkit.Result.YES; // &lt;br /&gt;
    }&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}} &lt;br /&gt;
&lt;br /&gt;
The above polkit rule file is fully supported when used with both [[#Using polkit with seatd|seatd]] and [[#Using polkit with elogind|Elogind]].&lt;br /&gt;
&lt;br /&gt;
=== Example2 ===&lt;br /&gt;
&lt;br /&gt;
[[elogind|Elogind]] is required for &amp;quot;subject.active&amp;quot; rules and no AUTH_ADMIN, since polkit agents need POLKIT_IS_SUBJECT. Given below is a sample polkit rule file {{Path|/etc/polkit-1/rules.d/51-require-active-session.rules}} which allow only active local sessions to suspend:{{Cat|/etc/polkit-1/rules.d/51-require-active-session.rules|&amp;lt;nowiki&amp;gt; &lt;br /&gt;
    polkit.addRule(function(action, subject) {&lt;br /&gt;
        if (action.id == &amp;quot;org.freedesktop.login1.suspend&amp;quot; &amp;amp;&amp;amp;&lt;br /&gt;
            subject.active) {&lt;br /&gt;
            return polkit.Result.YES;&lt;br /&gt;
        } else if (action.id == &amp;quot;org.freedesktop.login1.suspend&amp;quot;) {&lt;br /&gt;
            return polkit.Result.NO; // Or polkit.Result.AUTH_ADMIN to prompt for password&lt;br /&gt;
        }&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}     &lt;br /&gt;
&lt;br /&gt;
The above rule file depends on &#039;&#039;subject.active&#039;&#039; which is supported only when [[#Using polkit with elogind|polkit is used with Elogind]].&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [https://polkit.pages.freedesktop.org/polkit/polkit.8.html polkit Architecture]&lt;br /&gt;
* [https://github.com/polkit-org/polkit polkit github page]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Polkit  Arch wiki Polkit page]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Running_GUI_applications_as_root Arch wiki Running GUI applications as root]&lt;br /&gt;
&lt;br /&gt;
[[Category:Authentication]]&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Talk:PipeWire&amp;diff=31508</id>
		<title>Talk:PipeWire</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Talk:PipeWire&amp;diff=31508"/>
		<updated>2025-11-18T20:13:08Z</updated>

		<summary type="html">&lt;p&gt;Encode: /* Is {{Ic|rtkit}} still recommended for Realtime scheduling? */ Everything looks good&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Revert edit about considering two options to launch PipeWire ==&lt;br /&gt;
&lt;br /&gt;
Dear [[User:John3-16|John3-16]], This [https://wiki.alpinelinux.org/w/index.php?title=PipeWire&amp;amp;oldid=30543 edit] is being reverted because Pipewire user service is the recommended method going forward and the pipewire-launcher will be removed at some point. When a recommended method is available, listing them on par with bespoke methods will confuse new users. We can always list such methods under a heading like &#039;&#039;Custom configuration&#039;&#039;. Our [https://wiki.alpinelinux.org/w/index.php?title=Installation&amp;amp;oldid=26677 installation page] was a perfect example for listing a lot of options, but frustrating for new users. Thanks for you contributions to Wiki and it is highly appreciated and i hope you understand and agree with the reasoning for this revert. -[[User:Prabuanand|Prabuanand]] ([[User talk:Prabuanand|talk]]) 03:49, 22 July 2025 (UTC)&lt;br /&gt;
&lt;br /&gt;
:  Agreed that Pipewire user service is the recommended method; and that the pipewire-launcher method is expected to be sunsetted;  this was respected in my edit.  The Note was preserved which stated that the second option would be deprecated.  My impression is that enough readers may not stop and realize that these are mutually exclusive methods, if they implement the passages in this guide one after another in a rush.  &lt;br /&gt;
:  I concur with you too that other, bespoke methods would be superfluous on the wiki;  their existence was only being acknowledged in the edit&#039;s Summary.   Thank you for your extensive wiki help also;  please continue!&lt;br /&gt;
:[[User:John3-16|John3-16]] ([[User talk:John3-16|talk]]) 04:26, 22 July 2025 (UTC)&lt;br /&gt;
:: Thanks for you reply. Understood the reasoning and added the suggested changes. - [[User:Prabuanand|Prabuanand]] ([[User talk:Prabuanand|talk]]) 05:22, 22 July 2025 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Is {{Ic|rtkit}} still recommended for [[PipeWire#Realtime_scheduling|Realtime scheduling]]? ==&lt;br /&gt;
&lt;br /&gt;
[https://github.com/heftig/rtkit rtkit&#039;s] repository hasn&#039;t been updated since 2020-04-05 and the open [https://github.com/heftig/rtkit/issues issues] seem to list some problems.  [https://wiki.gentoo.org/wiki/PipeWire#Audio_Groups Gentoo PipeWire#Audio Groups] implies rtkit is the fallback and {{Ic|pipewire}} group is the recommeneded path.  {{Path|/etc/security/limits.d/25-pw-rlimits.conf}} (which is shipped from [https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/master/src/modules/module-rt/25-pw-rlimits.conf.in upstream]) also seems to imply that the {{Ic|pipewire}} group is preferred.  --[[User:Encode|Encode]] ([[User talk:Encode|talk]]) 07:48, 17 November 2025 (UTC)&lt;br /&gt;
: Made changes to wiki section. Please feel to make necessary changes to fix any remaining inaccuracies, and to remove the Accuracy template. Thanks. -[[User:Prabuanand|Prabuanand]] ([[User talk:Prabuanand|talk]]) 10:54, 17 November 2025 (UTC)&lt;br /&gt;
:: I changed the wording slightly and removed ‘glitch-free’ because I feel that is too strong.  Everything looks good.  --[[User:Encode|Encode]] ([[User talk:Encode|talk]]) 20:13, 18 November 2025 (UTC)&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=PipeWire&amp;diff=31507</id>
		<title>PipeWire</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=PipeWire&amp;diff=31507"/>
		<updated>2025-11-18T20:06:46Z</updated>

		<summary type="html">&lt;p&gt;Encode: /* Realtime scheduling */ Rewording&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;
* PipeWire requires [[D-Bus#D-Bus_session_bus|D-Bus session bus]] for most of its functionality.&lt;br /&gt;
* Ensure that your [[Setting_up_a_new_user#Creating_a_new_user|non-root user account]] has 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;
* 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;
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;
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;
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;
== 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>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Template_talk:Accuracy&amp;diff=31502</id>
		<title>Template talk:Accuracy</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Template_talk:Accuracy&amp;diff=31502"/>
		<updated>2025-11-18T09:26:44Z</updated>

		<summary type="html">&lt;p&gt;Encode: /* A space should be added after {{Ic|Reason:}} */ Respond that it is done&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== A space should be added after {{Ic|Reason:}} ==&lt;br /&gt;
&lt;br /&gt;
Between {{Ic|Reason:}} and the reason you put, a space should be added.  --[[User:Encode|Encode]] ([[User talk:Encode|talk]]) 07:58, 17 November 2025 (UTC)&lt;br /&gt;
: Hi [[User:Encode|Encode]], Thanks for the feedback and my sincere appreciation for all your past contributiions to improve Alpine Wiki. I copied many content from your user pages and used them in various pages of Alpine wiki. I tried making the change, but doesn&#039;t seem to make any difference. Please go ahead and make the necessary change. I copied this template from Archwiki and made minor changes to follow Alpine wiki template conventions. - [[User:Prabuanand|Prabuanand]] ([[User talk:Prabuanand|talk]]) 10:23, 17 November 2025 (UTC)&lt;br /&gt;
:: Just doing my part to improve the wiki.  I went ahead and added the space. --[[User:Encode|Encode]] ([[User talk:Encode|talk]]) 09:26, 18 November 2025 (UTC)&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Template:Accuracy&amp;diff=31501</id>
		<title>Template:Accuracy</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Template:Accuracy&amp;diff=31501"/>
		<updated>2025-11-18T09:21:16Z</updated>

		<summary type="html">&lt;p&gt;Encode: Add a space after ‘Reason:’&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;{{Template}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;This &amp;quot;accuracy dispute&amp;quot; flag template must be used to indicate inaccurate content.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Usage ===&lt;br /&gt;
&lt;br /&gt;
This template should be added at the beginning of articles or sections suspected of incorrect, misleading, or confusing content. Ensure to cite specific concerns with the first argument and possibly also on the flagged article&#039;s discussion page. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{Accuracy|reason}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can override the default discussion page with a second optional argument:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{Accuracy|reason|Talk:Alternative Page}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively you can point to a specific section in the default talk page with the named {{ic|section}} parameter:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{Accuracy|reason|section=Section name}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Flagged pages can be found in [[Special:WhatLinksHere/Template:Accuracy]] or in [[:Category:Pages or sections flagged with Template:Accuracy]]. If knowledgeable in a subject, users are encouraged to participate to resolve the issue. The {{Ic|&amp;lt;nowiki&amp;gt;{{Accuracy}}&amp;lt;/nowiki&amp;gt;}} flag should be removed after verification/correction/removal of disputed facts.&lt;br /&gt;
&lt;br /&gt;
{{Note|The talk page is linked through an external link: this is to avoid polluting [[Special:WantedPages]] when the talk page does not exist.}}&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;{{Accuracy|Briefly provide a note on what is not correct. Feel free to help us make an up-to-date version.}}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will produce:&lt;br /&gt;
{|style=&amp;quot;width: 60vw; padding:2px; margin:0; margin-bottom:10px; background-color:#f1f1de; border:1px solid #cc9; -moz-border-radius-bottomright: 0.5em; -moz-border-radius-bottomleft: 1em; border-radius-bottomright: 0.5em; border-radius-bottomleft: 1em; -webkit-border-bottom-right-radius: 0.5em; -webkit-border-bottom-left-radius: 1em;&amp;quot;&lt;br /&gt;
|&amp;lt;div style=&amp;quot;font-size: 1.0em; font-weight:bold; text-align:center;&amp;quot;&amp;gt; [[Image:Inaccurate.svg|54px|left|link=]] The factual accuracy of this article or section is disputed. &amp;lt;/div&amp;gt;&amp;lt;p style=&amp;quot;text-align: left; font-size: 87%;&amp;quot;&amp;gt;&#039;&#039;&#039;Reason:&#039;&#039;&#039; Briefly provide a note on what is not correct. Feel free to help us make an up-to-date version.&lt;br /&gt;
([[{{TALKPAGENAME}}|Discuss]])&amp;lt;/p&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&amp;lt;includeonly&amp;gt;&amp;lt;center&amp;gt;&lt;br /&gt;
{|style=&amp;quot;width: 60vw; padding:2px; margin:0; margin-bottom:10px; background-color:#f1f1de; border:1px solid #cc9; -moz-border-radius-bottomright: 0.5em; -moz-border-radius-bottomleft: 1em; border-radius-bottomright: 0.5em; border-radius-bottomleft: 1em; -webkit-border-bottom-right-radius: 0.5em; -webkit-border-bottom-left-radius: 1em;&amp;quot;&lt;br /&gt;
|&amp;lt;div style=&amp;quot;font-size: 1.0em; font-weight:bold; text-align:center;&amp;quot;&amp;gt; [[Image:Inaccurate.svg|54px|left|link=]] The factual accuracy of this article or section is disputed. &amp;lt;/div&amp;gt;&amp;lt;p style=&amp;quot;text-align: left; font-size: 87%;&amp;quot;&amp;gt;&#039;&#039;&#039;Reason:&#039;&#039;&#039; {{{reason|{{{1|}}}}}}&lt;br /&gt;
(Discuss in {{#if:{{{talk|{{{2|}}}}}}{{{section|}}}|[[{{{talk|{{{2|{{TALKPAGENAME}}#{{{section|}}}}}}}}}]]|[{{fullurl:{{TALKPAGENAME}}}} {{TALKPAGENAME}}]}})&amp;lt;/p&amp;gt;&lt;br /&gt;
|}&amp;lt;/center&amp;gt;[[Category:Pages or sections flagged with Template:Accuracy]]&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Template_talk:Accuracy&amp;diff=31489</id>
		<title>Template talk:Accuracy</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Template_talk:Accuracy&amp;diff=31489"/>
		<updated>2025-11-17T07:58:04Z</updated>

		<summary type="html">&lt;p&gt;Encode: A space should be added after {{Ic|Reason:}}&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== A space should be added after {{Ic|Reason:}} ==&lt;br /&gt;
&lt;br /&gt;
Between {{Ic|Reason:}} and the reason you put, a space should be added.  --[[User:Encode|Encode]] ([[User talk:Encode|talk]]) 07:58, 17 November 2025 (UTC)&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=PipeWire&amp;diff=31488</id>
		<title>PipeWire</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=PipeWire&amp;diff=31488"/>
		<updated>2025-11-17T07:52:02Z</updated>

		<summary type="html">&lt;p&gt;Encode: Question accuracy of ‘Realtime scheduling’ section.&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;
* PipeWire requires [[D-Bus#D-Bus_session_bus|D-Bus session bus]] for most of its functionality.&lt;br /&gt;
* Ensure that your [[Setting_up_a_new_user#Creating_a_new_user|non-root user account]] has 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;
* 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;
{{Accuracy|Is rtkit still recommended?|section=Is rtkit still recommended for Realtime scheduling?}}&lt;br /&gt;
&lt;br /&gt;
For realtime scheduling, it is recommended to use {{Pkg|rtkit}} package. Add your user to the &amp;lt;code&amp;gt;rtkit&amp;lt;/code&amp;gt; group.&lt;br /&gt;
&lt;br /&gt;
Alternatively, ensure your user has the right ulimit permissions. Since PipeWire 0.3.66, you can add yourself to the &amp;lt;code&amp;gt;pipewire&amp;lt;/code&amp;gt; group. You generally need (e.g. in {{Path|/etc/security/limits.conf}}):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@pipewire - memlock 4194304&lt;br /&gt;
@pipewire - nice -19&lt;br /&gt;
@pipewire - rtprio 95&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This allows a member of the pipewire group to have the right permissions for PipeWire to use realtime scheduling without rtkit. This same snippet comes with PipeWire since 0.3.66, so if you have a [[PAM]] login session and add yourself to the pipewire group, you don&#039;t have to do anything else. Note that the above {{Path|/etc/security/limits.conf}} will only work if your session is using [[PAM]].&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;
Installing the {{pkg|rtkit}} package as mentioned in [[#Realtime scheduling|Realtime scheduling]] section resolves the above error message.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Bluetooth]]&lt;br /&gt;
* [https://gitlab.freedesktop.org/pipewire/pipewire PipeWire source repository]&lt;br /&gt;
* [https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/home PipeWire Wiki]&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>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Talk:PipeWire&amp;diff=31487</id>
		<title>Talk:PipeWire</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Talk:PipeWire&amp;diff=31487"/>
		<updated>2025-11-17T07:48:42Z</updated>

		<summary type="html">&lt;p&gt;Encode: Is rtkit still recommended for Realtime scheduling?&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Revert edit about considering two options to launch PipeWire ==&lt;br /&gt;
&lt;br /&gt;
Dear [[User:John3-16|John3-16]], This [https://wiki.alpinelinux.org/w/index.php?title=PipeWire&amp;amp;oldid=30543 edit] is being reverted because Pipewire user service is the recommended method going forward and the pipewire-launcher will be removed at some point. When a recommended method is available, listing them on par with bespoke methods will confuse new users. We can always list such methods under a heading like &#039;&#039;Custom configuration&#039;&#039;. Our [https://wiki.alpinelinux.org/w/index.php?title=Installation&amp;amp;oldid=26677 installation page] was a perfect example for listing a lot of options, but frustrating for new users. Thanks for you contributions to Wiki and it is highly appreciated and i hope you understand and agree with the reasoning for this revert. -[[User:Prabuanand|Prabuanand]] ([[User talk:Prabuanand|talk]]) 03:49, 22 July 2025 (UTC)&lt;br /&gt;
&lt;br /&gt;
:  Agreed that Pipewire user service is the recommended method; and that the pipewire-launcher method is expected to be sunsetted;  this was respected in my edit.  The Note was preserved which stated that the second option would be deprecated.  My impression is that enough readers may not stop and realize that these are mutually exclusive methods, if they implement the passages in this guide one after another in a rush.  &lt;br /&gt;
:  I concur with you too that other, bespoke methods would be superfluous on the wiki;  their existence was only being acknowledged in the edit&#039;s Summary.   Thank you for your extensive wiki help also;  please continue!&lt;br /&gt;
:[[User:John3-16|John3-16]] ([[User talk:John3-16|talk]]) 04:26, 22 July 2025 (UTC)&lt;br /&gt;
:: Thanks for you reply. Understood the reasoning and added the suggested changes. - [[User:Prabuanand|Prabuanand]] ([[User talk:Prabuanand|talk]]) 05:22, 22 July 2025 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Is {{Ic|rtkit}} still recommended for [[PipeWire#Realtime_scheduling|Realtime scheduling]]? ==&lt;br /&gt;
&lt;br /&gt;
[https://github.com/heftig/rtkit rtkit&#039;s] repository hasn&#039;t been updated since 2020-04-05 and the open [https://github.com/heftig/rtkit/issues issues] seem to list some problems.  [https://wiki.gentoo.org/wiki/PipeWire#Audio_Groups Gentoo PipeWire#Audio Groups] implies rtkit is the fallback and {{Ic|pipewire}} group is the recommeneded path.  {{Path|/etc/security/limits.d/25-pw-rlimits.conf}} (which is shipped from [https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/master/src/modules/module-rt/25-pw-rlimits.conf.in upstream]) also seems to imply that the {{Ic|pipewire}} group is preferred.  --[[User:Encode|Encode]] ([[User talk:Encode|talk]]) 07:48, 17 November 2025 (UTC)&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=PipeWire&amp;diff=31485</id>
		<title>PipeWire</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=PipeWire&amp;diff=31485"/>
		<updated>2025-11-17T00:05:02Z</updated>

		<summary type="html">&lt;p&gt;Encode: Misc styling&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;
* PipeWire requires [[D-Bus#D-Bus_session_bus|D-Bus session bus]] for most of its functionality.&lt;br /&gt;
* Ensure that your [[Setting_up_a_new_user#Creating_a_new_user|non-root user account]] has 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;
* 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;
For realtime scheduling, it is recommended to use {{Pkg|rtkit}} package. Add your user to the &amp;lt;code&amp;gt;rtkit&amp;lt;/code&amp;gt; group.&lt;br /&gt;
&lt;br /&gt;
Alternatively, ensure your user has the right ulimit permissions. Since PipeWire 0.3.66, you can add yourself to the &amp;lt;code&amp;gt;pipewire&amp;lt;/code&amp;gt; group. You generally need (e.g. in {{Path|/etc/security/limits.conf}}):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@pipewire - memlock 4194304&lt;br /&gt;
@pipewire - nice -19&lt;br /&gt;
@pipewire - rtprio 95&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This allows a member of the pipewire group to have the right permissions for PipeWire to use realtime scheduling without rtkit. This same snippet comes with PipeWire since 0.3.66, so if you have a [[PAM]] login session and add yourself to the pipewire group, you don&#039;t have to do anything else. Note that the above {{Path|/etc/security/limits.conf}} will only work if your session is using [[PAM]].&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;
Installing the {{pkg|rtkit}} package as mentioned in [[#Realtime scheduling|Realtime scheduling]] section resolves the above error message.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Bluetooth]]&lt;br /&gt;
* [https://gitlab.freedesktop.org/pipewire/pipewire PipeWire source repository]&lt;br /&gt;
* [https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/home PipeWire Wiki]&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>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=PipeWire&amp;diff=31484</id>
		<title>PipeWire</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=PipeWire&amp;diff=31484"/>
		<updated>2025-11-16T21:28:41Z</updated>

		<summary type="html">&lt;p&gt;Encode: Use ‘_’ (low lines) when linking, have ‘{{Cmd|...}}’ on its own line, misc styling&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;
* PipeWire requires [[D-Bus#D-Bus_session_bus|D-Bus session bus]] for most of its functionality.&lt;br /&gt;
* Ensure that your [[Setting_up_a_new_user#Creating_a_new_user|non-root user account]] has 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;
* 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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ rc-service -U pipewire start&lt;br /&gt;
$ rc-service -U wireplumber start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To enable the {{Ic|pipewire}} and {{Ic|wireplumber}} user services in [[Wayland]], issue the following commands; omit the term {{ic|gui}}/swap it for {{ic|default}} for [[Xorg]] sessions:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ rc-update -U add pipewire gui&lt;br /&gt;
$ rc-update -U add wireplumber gui&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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 that 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;
For realtime scheduling, it is recommended to use {{Pkg|rtkit}} package. Add your user to the &amp;lt;code&amp;gt;rtkit&amp;lt;/code&amp;gt; group.&lt;br /&gt;
&lt;br /&gt;
Alternatively, ensure your user has the right ulimit permissions. Since PipeWire 0.3.66, you can add yourself to the &amp;lt;code&amp;gt;pipewire&amp;lt;/code&amp;gt; group. You generally need (e.g. in {{Path|/etc/security/limits.conf}}):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@pipewire - memlock 4194304&lt;br /&gt;
@pipewire - nice -19&lt;br /&gt;
@pipewire - rtprio 95&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This allows a member of the pipewire group to have the right permissions for PipeWire to use realtime scheduling without rtkit. This same snippet comes with PipeWire since 0.3.66, so if you have a [[PAM]] login session and add yourself to the pipewire group, you don&#039;t have to do anything else. Note that the above {{Path|/etc/security/limits.conf}} will only work if your session is using [[PAM]].&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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ pactl list&lt;br /&gt;
Connection failure: Connection refused&lt;br /&gt;
pa_context_connect() failed: Connection refused&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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}}. If you see something like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
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;
&amp;lt;/pre&amp;gt;&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;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Installing the {{pkg|rtkit}} package as mentioned in [[#Realtime scheduling|Realtime scheduling]] section resolves the above error message.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Bluetooth]]&lt;br /&gt;
* [https://gitlab.freedesktop.org/pipewire/pipewire PipeWire source repository]&lt;br /&gt;
* [https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/home PipeWire Wiki]&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>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Bluetooth&amp;diff=31483</id>
		<title>Bluetooth</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Bluetooth&amp;diff=31483"/>
		<updated>2025-11-16T20:04:01Z</updated>

		<summary type="html">&lt;p&gt;Encode: ‘pipewire’ → ‘PipeWire’, to match upstream&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://en.wikipedia.org/wiki/Bluetooth Bluetooth] is a standard for the short-range wireless interconnection of cellular phones, computers, and other electronic devices. [https://www.bluez.org/ BlueZ] is an implementation of the Bluetooth protocol stack for Linux, and it is provided by the {{Pkg|bluez}} package.&lt;br /&gt;
&lt;br /&gt;
This article describes the basic installation of Bluetooth controllers and devices.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* Set up [[Include:Setup Device Manager|eudev]]&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
Basic installation requires the Installation of {{Pkg|bluez}} package as follows:{{Cmd|# apk add {{Pkg|bluez}}}}&lt;br /&gt;
&lt;br /&gt;
Optionally install {{Pkg|bluez-deprecated}} if you need deprecated tools like &amp;lt;code&amp;gt;hcitool&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== File transfer ===&lt;br /&gt;
&lt;br /&gt;
To enable bluetooth file transfer, [[Install]] the {{Pkg|openobex}} package.&lt;br /&gt;
&lt;br /&gt;
=== Front-ends ===&lt;br /&gt;
&lt;br /&gt;
There are several front-ends available:&lt;br /&gt;
&lt;br /&gt;
* The {{Pkg|bluez}} comes with the &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; front-end&lt;br /&gt;
* {{Pkg|blueman}}: a full-featured Bluetooth manager&lt;br /&gt;
* {{Pkg|bluedevil}}: the [[KDE]] Bluetooth manager&lt;br /&gt;
* {{Pkg|bluetuith}}: simple text-based bluetooth management user interface&lt;br /&gt;
* {{Pkg|gnome-bluetooth}}: the [[GNOME]] Bluetooth manager&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
Set up the bluetooth hardware first before connecting it to other devices. The steps involved are as follows:&lt;br /&gt;
&lt;br /&gt;
Load the &amp;lt;code&amp;gt;btusb&amp;lt;/code&amp;gt; kernel module: {{Cmd|# modprobe btusb}}&lt;br /&gt;
Add user &amp;lt;username&amp;gt; to the &amp;lt;code&amp;gt;lp&amp;lt;/code&amp;gt; group: {{Cmd|# adduser &amp;lt;username&amp;gt; lp}}&lt;br /&gt;
&lt;br /&gt;
=== Service configuration ===&lt;br /&gt;
&lt;br /&gt;
It is necessary to set up the {{ic|bluetooth}} service before proceeding further.&lt;br /&gt;
&lt;br /&gt;
Use standard &#039;&#039;&#039;start|stop|restart&#039;&#039;&#039; [[OpenRC]] command to start the {{ic|bluetooth}} service immediately: {{Cmd|# rc-service bluetooth start}}&lt;br /&gt;
Add the {{ic|bluetooth}} service to start during every boot: {{Cmd|# rc-update add bluetooth default}}&lt;br /&gt;
&lt;br /&gt;
=== Verify the hardware ===&lt;br /&gt;
&lt;br /&gt;
Now, check the state of the Bluetooth radio transmitter using &amp;lt;code&amp;gt;rfkill&amp;lt;/code&amp;gt;: {{Cmd|$ rfkill list bluetooth}}&lt;br /&gt;
&lt;br /&gt;
It should return something similar to:&lt;br /&gt;
&lt;br /&gt;
 0: hci0: Bluetooth&lt;br /&gt;
         Soft blocked: no&lt;br /&gt;
         Hard blocked: no&lt;br /&gt;
&lt;br /&gt;
If the device is listed as blocked, it can be unblocked using the same tool: {{Cmd|# rfkill unblock bluetooth}}&lt;br /&gt;
&lt;br /&gt;
{{Note|It may be necessary to [[OpenRC|restart]] the Bluetooth service before continuing.}}&lt;br /&gt;
&lt;br /&gt;
=== Pairing with &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; tool can be run both in interactive and non-interactive mode. The non-interactive commands can be issued from the shell by suffixing &amp;lt;Code&amp;gt;bluetoothctl&amp;lt;/Code&amp;gt; like {{ic|$ bluetoothctl list}} or {{ic|$ bluetoothctl power on}}. &lt;br /&gt;
&lt;br /&gt;
The example below shows step-by-step procedure to configure a bluetooth adapter in interactive mode. Begin by starting &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; and follow these basic steps:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ bluetoothctl}}&lt;br /&gt;
&lt;br /&gt;
The prompt should display:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;#&lt;br /&gt;
&lt;br /&gt;
List the available controllers:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# list&lt;br /&gt;
&lt;br /&gt;
Display information about a controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# show &#039;&#039;controller_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Set the default controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# select &#039;&#039;controller_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Power on the controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# power on&lt;br /&gt;
&lt;br /&gt;
Enable the agent and set it as default:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# agent on&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# default-agent&lt;br /&gt;
&lt;br /&gt;
Set the controller as discoverable (temporarily for 3 minutes) and pairable:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# discoverable on&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# pairable on&lt;br /&gt;
&lt;br /&gt;
Scan for devices:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# scan on&lt;br /&gt;
&lt;br /&gt;
Put the device into pairing mode. This generally involves pressing a button or a combinations of buttons, usually for several seconds.&lt;br /&gt;
&lt;br /&gt;
Discover the device MAC address:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# devices&lt;br /&gt;
&lt;br /&gt;
Pair with the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# pair &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Enter the PIN if prompted:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red;&amp;quot;&amp;gt;[agent]&amp;lt;/span&amp;gt; PIN code: ####&lt;br /&gt;
&lt;br /&gt;
Trust the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# trust &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Connect to the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# connect &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Display information about the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# info &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The device is now paired:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# quit&lt;br /&gt;
&lt;br /&gt;
=== Set adapter power state ===&lt;br /&gt;
&lt;br /&gt;
If you would like the adapter to not be automatically enabled (e.g. on a portable device where you wish to save battery), set &amp;lt;code&amp;gt;AutoEnable=false&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;/etc/bluetooth/main.conf&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;[Policy]&amp;lt;/code&amp;gt; section: {{Cat|/etc/bluetooth/main.conf|[Policy]&lt;br /&gt;
...&lt;br /&gt;
AutoEnable&amp;amp;#61;false&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
=== Battery Reporting ===&lt;br /&gt;
&lt;br /&gt;
An experimental feature can be enabled in order to report device battery level: {{Cat|/etc/bluetooth/main.conf|[General]&lt;br /&gt;
...&lt;br /&gt;
Experimental&amp;amp;#61;true&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
Due to the variety of available Bluetooth hardware it is possible that you receive errors while attempting to install, activate, or find your Bluetooth device.&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;No default controller available&amp;quot; error ===&lt;br /&gt;
&lt;br /&gt;
After having followed these instructions, or others, you run &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; and encounter the following scenario:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# list&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# show&lt;br /&gt;
 No default controller available&lt;br /&gt;
&lt;br /&gt;
One possible solution is that you are missing firmware drivers.&lt;br /&gt;
&lt;br /&gt;
Try running the following command to discover the source of the issue: {{Cmd|# dmesg &amp;amp;#124; grep -i bluetooth &amp;amp;#124; grep -i firmware}}&lt;br /&gt;
&lt;br /&gt;
There are many firmware packages available that could likely solve the this problem (see {{Pkg|linux-firmware-*}}).&lt;br /&gt;
&lt;br /&gt;
Another possible solution is to install {{Pkg|hidapi}} and add load the module: {{Cmd|# apk add hidapi&lt;br /&gt;
&amp;amp;#35; modprobe uhid}}&lt;br /&gt;
&lt;br /&gt;
It may also be necessary to create configuration to load the uhid and btusb kernel modules on boot: {{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/uhid.conf&lt;br /&gt;
&amp;amp;#35;Load uhid kernel module:&lt;br /&gt;
uhid&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/btusb.conf&lt;br /&gt;
&amp;amp;#35;Load btusb kernel module:&lt;br /&gt;
btusb&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;org.bluez.Error.NotAvailable br-connection-profile-unavailable&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
The error &amp;lt;code&amp;gt;br-connection-profile-unavailable&amp;lt;/code&amp;gt; is sometimes produced when trying to connect a Bluetooth HID device but the &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; kernel module is not loaded. HID devices include keyboards and the volume buttons on headphones (which are sometimes presented to the OS as a keyboard), mice, game controllers, alphanumeric displays, etc.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; kernel module is required for USB HID devices with drivers that are implemented in userspace, when userspace HID support is enabled.&lt;br /&gt;
&lt;br /&gt;
Loading &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;modprobe&amp;lt;/code&amp;gt; after encountering this error does not always fix the problem.&lt;br /&gt;
&lt;br /&gt;
Try setting up &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; to load at boot, and then rebooting: {{Cmd|# cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/uhid.conf&lt;br /&gt;
&amp;amp;#35;Load uhid kernel module:&lt;br /&gt;
uhid&lt;br /&gt;
EOF&lt;br /&gt;
&amp;amp;#35; reboot}}&lt;br /&gt;
&lt;br /&gt;
Alternatively, the userspace HID feature can be disabled entirely in favour of kernel HIDP drivers in &amp;lt;code&amp;gt;/etc/bluetooth/input.conf&amp;lt;/code&amp;gt;: {{Cmd|1=UserspaceHID=false}}&lt;br /&gt;
&lt;br /&gt;
If running [[PipeWire]], you may also try installing {{Pkg|pipewire-spa-bluez}} to see if that solves the issue.&lt;br /&gt;
&lt;br /&gt;
=== Unable to control Bluetooth speaker volume / Bluetooth output is muted (Pulseaudio) ===&lt;br /&gt;
&lt;br /&gt;
It is possible to automatically switch audio output and volume control to last connected device.&lt;br /&gt;
&lt;br /&gt;
This can solve the problem of controlling the speaker volume when switching between Bluetooth devices.&lt;br /&gt;
&lt;br /&gt;
Append the following lines at the end of the {{Path|/etc/pulse/default.pa}}: {{Cat|/etc/pulse/default.pa|...&lt;br /&gt;
&amp;amp;#35;##Automatically switch audio to the most recently connected device (Bluetooth, HDMI, USB)&lt;br /&gt;
load-module module-switch-on-connect}}&lt;br /&gt;
&lt;br /&gt;
=== Failed to connect: org.bluez.Error.NotReady br-connection-adapter-not-powered ===&lt;br /&gt;
&lt;br /&gt;
The error code &amp;lt;code&amp;gt;Failed to connect: org.bluez.Error.NotReady br-connection-adapter-not-powered&amp;lt;/code&amp;gt; may appear after resuming from suspend. This error can be resolved by issuing the command:{{Cmd|$ bluetoothctl power on}}&lt;br /&gt;
&lt;br /&gt;
=== Failed to connect: org.bluez.Error.Failed br-connection-unknown ===&lt;br /&gt;
&lt;br /&gt;
When trying to connect to a bluetooth speaker, If you receive the following error message {{Cmd|$ bluetoothctl connect 88:C6:26:0A:7D:F1&lt;br /&gt;
Attempting to connect to 88:C6:26:0A:7D:F1&lt;br /&gt;
Failed to connect: org.bluez.Error.Failed br-connection-unknown}}  &lt;br /&gt;
Check the following {{Cmd|&amp;lt;nowiki&amp;gt;$ bluetoothctl info&lt;br /&gt;
Missing device address argument&lt;br /&gt;
DeviceSet (null) not available&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
The above errors may appear after resuming from suspend. In such cases, resolve it by restarting {{ic|bluetooth}} service: {{Cmd|$ doas service bluetooth restart}}&lt;br /&gt;
&lt;br /&gt;
=== dbus-daemon[2431]: [system] Rejected send message error name=&amp;quot;org.bluez.Profile1.Error.NotImplemented&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
 Jul 19 20:54:59 homepc2 auth.notice dbus-daemon[2431]: [system] Rejected send message, 0 matched rules; type=&amp;quot;error&amp;quot;, sender=&amp;quot;:1.119&amp;quot; (uid=1000 pid=10213 comm=&amp;quot;/usr/bin/wireplumber&amp;quot;) interface=&amp;quot;(unset)&amp;quot; member=&amp;quot;(unset)&amp;quot; error name=&amp;quot;org.bluez.Profile1.Error.NotImplemented&amp;quot; requested_reply=&amp;quot;0&amp;quot; destination=&amp;quot;:1.661&amp;quot; (uid=0 pid=11828 comm=&amp;quot;/usr/lib/bluetooth/bluetoothd&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
To make the above error message in {{path|/var/log/message}} to disappear, enable the following {{Cat|/etc/bluethooth/main.conf|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
[General]&lt;br /&gt;
...&lt;br /&gt;
# Enables D-Bus experimental interfaces&lt;br /&gt;
# Possible values: true or false&lt;br /&gt;
Experimental = true&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[PulseAudio#Bluetooth|PulseAudio with Bluetooth]]&lt;br /&gt;
* [[PipeWire#Bluetooth_audio|PipeWire with Bluetooth]]&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/Bluetooth Bluetooth entry on PostmarketOS Wiki]&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/Bluetooth Bluetooth entry on Gentoo Wiki]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Bluetooth Bluetooth entry on ArchWiki]&lt;br /&gt;
&lt;br /&gt;
[[Category:Multimedia]]&lt;br /&gt;
[[Category:Hardware]]&lt;br /&gt;
[[Category:Sound]]&lt;br /&gt;
[[Category:Drivers]]&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=KDE&amp;diff=31482</id>
		<title>KDE</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=KDE&amp;diff=31482"/>
		<updated>2025-11-16T20:01:11Z</updated>

		<summary type="html">&lt;p&gt;Encode: ‘Pipewire’ → ‘PipeWire’, to match upstream&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:KDEScreenshot.png |thumb |KDE Plasma screenshot.]]&lt;br /&gt;
&lt;br /&gt;
[https://kde.org/plasma-desktop/ Plasma] is the desktop environment from [https://kde.org/ KDE], a software project comprising of a collection of libraries known as [https://develop.kde.org/products/frameworks/ KDE Frameworks], and several applications known as [https://apps.kde.org/ KDE Applications]. Their [https://userbase.kde.org/Welcome_to_KDE_UserBase UserBase wiki] has detailed information about most KDE Applications.&lt;br /&gt;
&lt;br /&gt;
{{Note|the {{Pkg|plasma-desktop-meta|arch=}} package isn&#039;t available for the &amp;lt;code&amp;gt;ppc64le&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;s390x&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;armhf&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;riscv64&amp;lt;/code&amp;gt; architectures due to the {{Pkg|kdeplasma-addons|arch=}} dependency not being available there. However, the rest of Plasma may be installed separately to potentially get a functional desktop.}}&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
{{:Include:Desktop prerequisites}}&lt;br /&gt;
* For users interested in Xorg as opposed to Wayland, install the [[Alpine_setup_scripts#setup-xorg-base|Xorg base packages]]&lt;br /&gt;
* Enable [[Elogind]] service&lt;br /&gt;
* Wayland users: Install package {{pkg|xf86-input-libinput|arch=}}&lt;br /&gt;
{{Tip|Except for the first two [[#Prerequisites|Prerequisites]], all the others are automatically handled if Plasma desktop is [[#Installation using setup-desktop|installed using setup-desktop]] script.}}&lt;br /&gt;
== Installation using setup-desktop ==&lt;br /&gt;
{{:Include:Setup-desktop}}&lt;br /&gt;
When Plasma is chosen, the above script additionally installs [[PipeWire]] for audio and [[SDDM]] as display manager.&lt;br /&gt;
&lt;br /&gt;
== Manual Installation ==&lt;br /&gt;
&lt;br /&gt;
The following command will install the Plasma desktop as specified by the plasma metapackage, including the {{Pkg|sddm|arch=}} display manager and other assorted niceties. {{Cmd|# apk add {{pkg|plasma-desktop-meta|arch=}}}}&lt;br /&gt;
{{Note|&#039;&#039;&#039;polkit&#039;&#039;&#039; and &#039;&#039;&#039;udev&#039;&#039;&#039; are optional services for authentication and device management respectively. While KDE will function without these services enabled, some functionality may be missing or incomplete.}}&lt;br /&gt;
&lt;br /&gt;
== KDE Applications ==&lt;br /&gt;
&lt;br /&gt;
To install the full set of KDE Applications, install {{Pkg|kde-applications}}. You can also choose to install a smaller set of applications by installing any of the subpackages:&lt;br /&gt;
&lt;br /&gt;
{{Note|Most of these are not available on &amp;lt;code&amp;gt;ppc64le&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;s390x&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
* {{Pkg|kde-applications-accessibility|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-admin|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-base|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-edu|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-games|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-graphics|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-multimedia|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-network|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-pim|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-sdk|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-utils|arch=}}&lt;br /&gt;
* {{Pkg|kde-applications-webdev|arch=}}&lt;br /&gt;
&lt;br /&gt;
== Starting Plasma ==&lt;br /&gt;
&lt;br /&gt;
Plasma can be started using a display manager or from the console.&lt;br /&gt;
&lt;br /&gt;
=== Using a display manager ===&lt;br /&gt;
&lt;br /&gt;
When Plasma is installed via the plasma meta-package, the display manager is set up using sddm.&lt;br /&gt;
&lt;br /&gt;
Make sure you enable and start the SDDM service.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|rc-update add sddm&lt;br /&gt;
rc-service sddm start&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
* Select &#039;&#039;Plasma&#039;&#039; to launch a new session in Wayland&lt;br /&gt;
* Select &#039;&#039;Plasma (X11)&#039;&#039; to launch a new session in Xorg&lt;br /&gt;
&lt;br /&gt;
=== From the console ===&lt;br /&gt;
&lt;br /&gt;
The Xorg session can be launched by installing {{Pkg|xinit|arch=}} and appending &amp;lt;code&amp;gt;exec startplasma-x11&amp;lt;/code&amp;gt; to your &amp;lt;code&amp;gt;.xinitrc&amp;lt;/code&amp;gt; file. To start X:&lt;br /&gt;
{{Cmd|xinit}}&lt;br /&gt;
&lt;br /&gt;
For the Wayland session run&lt;br /&gt;
{{Cmd|XDG_SESSION_TYPE{{=}}wayland dbus-run-session startplasma-wayland}}&lt;br /&gt;
&lt;br /&gt;
== Discover ==&lt;br /&gt;
&lt;br /&gt;
[https://userbase.kde.org/Discover Discover] is the application installer from KDE. The alpine linux package {{pkg|discover}} is automatically installed if {{pkg|plasma-desktop-meta|arch=}} package is installed or if [[#Installation using setup-desktop|setup-desktop]] is used to install Plasma.&lt;br /&gt;
&lt;br /&gt;
Install the packages {{pkg|discover-backend-apk}} and {{pkg|discover-backend-flatpak}} to use Discover as a graphical interface to [[Alpine Package Keeper]] and [[Flatpak]] respectively.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== HiDPI Scaling ===&lt;br /&gt;
&lt;br /&gt;
When using high resolution screens, e.g. 4K, you might need to apply scaling so the fonts and windows are not too small.&lt;br /&gt;
&lt;br /&gt;
In order to achieve this you can open &amp;lt;code&amp;gt;Settings -&amp;gt; Display and Monitor&amp;lt;/code&amp;gt; and change the slider under &#039;&#039;Global Scale&#039;&#039; to an appropriate value.&lt;br /&gt;
&lt;br /&gt;
You can also change the mouse cursor and icon size under &amp;lt;code&amp;gt;Settings -&amp;gt; Appearance&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If your taskbar and window decorations are still too small, you might want to create the file {{path|~/.xprofile}} to define the &#039;&#039;PLASMA_USE_QT_SCALING&#039;&#039; environment variable:{{Cmd|export PLASMA_USE_QT_SCALING{{=}}1}}&lt;br /&gt;
&lt;br /&gt;
After creating this file, you may need to restart your session to apply this modification.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Installation#Post-Installation|Post installation]]&lt;br /&gt;
* [[Flatpak]]&lt;br /&gt;
* [https://wiki.archlinux.org/title/KDE KDE - Archwiki]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Desktop Environments]]&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=GNOME&amp;diff=31481</id>
		<title>GNOME</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=GNOME&amp;diff=31481"/>
		<updated>2025-11-16T19:43:42Z</updated>

		<summary type="html">&lt;p&gt;Encode: ‘Pipewire’ → ‘PipeWire’, to match upstream&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://www.gnome.org/ Gnome Desktop] aims to get things done with ease, comfort, and control.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
{{:Include:Desktop prerequisites}}&lt;br /&gt;
{{Tip|Except for the first two [[#Prerequisites|Prerequisites]], all the others are automatically handled by [[#Installation|setup-desktop]] script.}}&lt;br /&gt;
== Installation == &lt;br /&gt;
{{:Include:Setup-desktop}}&lt;br /&gt;
&lt;br /&gt;
When gnome is chosen, the above script enables community repository and additionally installs [[D-Bus]], [[eudev]], [[PipeWire]] and {{Pkg|gdm}} as [[Display manager|display manager]] .&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
To manage network through GUI, configure [[NetworkManager]]. You may need to [[Install]] necessary subpackages like {{Pkg|networkmanager-wifi}}. &lt;br /&gt;
&lt;br /&gt;
=== Software ===&lt;br /&gt;
&lt;br /&gt;
GNOME [https://apps.gnome.org/Software/ Software] can be used as GUI front end for [[Alpine Package Keeper]] and [[Flatpak|Flatpak]].&lt;br /&gt;
* [[Install]] the packages {{pkg|gnome-software-plugin-apk}} and {{pkg|gnome-software-plugin-flatpak}}, if not already installed. &lt;br /&gt;
* Ensure that {{ic|apk-polkit-server}} service from {{pkg|apk-polkit-rs}} package is running:{{cmd|# rc-update add apk-polkit-server default &amp;amp;&amp;amp; rc-service apk-polkit-server start}}&lt;br /&gt;
&lt;br /&gt;
== Updating GNOME packages ==&lt;br /&gt;
&lt;br /&gt;
Most GNOME apps and core systems follow a common versioning pattern, and have a similar release cadence. In order to reduce the workload on maintainers, the [https://gitlab.alpinelinux.org/pabloyoyoista/gnome-aports-utils gnome-aports-utils] project exists. It contains a series of scripts that can be used to detect changes on GNOME-related projects, and commit them. When doing major GNOME updates, and doing minor updates on many projects, these scripts can help warranty that no project is forgotten, and reduce the time needed to build and test the upgrades. &lt;br /&gt;
&lt;br /&gt;
We recommend everybody to &#039;&#039;&#039;use and contribute&#039;&#039;&#039; to that repository instead of pushing updates for every GNOME component individually.&lt;br /&gt;
&lt;br /&gt;
=== Major GNOME upgrade ===&lt;br /&gt;
&lt;br /&gt;
About every half year, GNOME publishes a new major release. These are announced at: https://release.gnome.org/calendar/ (note the dates are the tarball-due-dates and not the actual release drop).&lt;br /&gt;
&lt;br /&gt;
With this release the whole GNOME stack gets upgraded, this includes G-related libraries, the GNOME shell with mutter, [https://apps.gnome.org/ GNOME core apps] and other packages following the same schedule. The [https://matrix.to/#/%23release-team:gnome.org GNOME release engineering team] publishes dates for alpha, beta, release candidates and stable versions for every major version, most GNOME core packages follow their schedules, but not all of them. Announcements of the releng team are posted on the GNOME forum (https://discourse.gnome.org/tag/release-team) and Release Notes for each phase (with it&#039;s upgraded packages) are at: https://download.gnome.org/core/&lt;br /&gt;
&lt;br /&gt;
Therefore we should also upgrade along the dependency tree (glib -&amp;gt; gtk4 -&amp;gt; mutter -&amp;gt; gnome-shell -&amp;gt; other apps). Most important libraries are glib, gtk4, libadwaita. These are mostly already released in the alpha-phase and don&#039;t contain many breaking changed. To upgrade other GNOME core package to the latest version in a major version, you can use [https://gitlab.alpinelinux.org/pabloyoyoista/gnome-aports-utils gnome-aports-utils] or also check [https://download.gnome.org/sources/?C=M&amp;amp;O=D https://download.gnome.org/sources (sorted by date)] (thats where all GNOME core maintainers upload their tarballs).&lt;br /&gt;
&lt;br /&gt;
Also take a look at Gentoo&#039;s upgrading guide: https://wiki.gentoo.org/wiki/Project:GNOME/GNOME_Bumping_Guide&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
If you are unable to log in, check {{Path|/var/log/gdm/greeter.log}}, there may be info there from X that indicates failed modules, etc.&lt;br /&gt;
&lt;br /&gt;
If GNOME Terminal doesn&#039;t start, add the following to /etc/profile.d/locale.sh: &amp;lt;code&amp;gt;LANG=en_US.UTF-8&amp;lt;/code&amp;gt; and reboot.&lt;br /&gt;
&lt;br /&gt;
If the on-screen keyboard shows up in GDM after installing other UIs such as Phosh, you need to disable it by opening the Accessibility menu (top right) when you are in the GDM login screen. You can disable the on-screen keyboard there. Or set &amp;lt;code&amp;gt;org.gnome.desktop.a11y.applications screen-keyboard-enabled&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; for the &amp;lt;code&amp;gt;gdm&amp;lt;/code&amp;gt; user with &amp;lt;code&amp;gt;dconf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Slow applications or rendering issues ===&lt;br /&gt;
&lt;br /&gt;
Please note that some applications, i.e. Gnome Web (Epiphany), may require the installation of libraries related to hardware acceleration to work correctly. &lt;br /&gt;
&lt;br /&gt;
In quite some cases, this can be solved by installing &amp;lt;code&amp;gt;mesa-gles&amp;lt;/code&amp;gt; (OpenGL ES). Check if you you have issues loading the shared library &amp;lt;code&amp;gt;libGLESv2.so.2&amp;lt;/code&amp;gt;. If so, you can install it with:{{Cmd|# apk add mesa-gles}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [https://wiki.archlinux.org/title/GNOME GNOME - Archwiki]&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/GNOME GNOME - Gentoo Wiki]&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/GNOME GNOME - PostmarketOS Wiki]&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/GNOME_apps Alpine linux packages available for Gnome]&lt;br /&gt;
&lt;br /&gt;
[[Category:Desktop Environments]]&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=PipeWire&amp;diff=31476</id>
		<title>PipeWire</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=PipeWire&amp;diff=31476"/>
		<updated>2025-11-16T09:29:02Z</updated>

		<summary type="html">&lt;p&gt;Encode: Reword ‘GUI tools’&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;
* PipeWire requires [[D-Bus#D-Bus session bus|D-Bus session bus]] for most of its functionality.&lt;br /&gt;
* Ensure that your [[Setting_up_a_new_user#Creating_a_new_user|non-root user account]] has 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.{{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.{{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.{{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 section below only if PipeWire is [[#Testing|not launched]] after a relogin/reboot.&lt;br /&gt;
&lt;br /&gt;
[[#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|V3.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;
* 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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ rc-service -U pipewire start&lt;br /&gt;
$ rc-service -U wireplumber start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To enable the {{Ic|pipewire}} and {{Ic|wireplumber}} user services in [[Wayland]], issue the following commands;  omit the term {{ic|gui}}/swap it for {{ic|default}} for [[Xorg]] sessions:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ rc-update -U add pipewire gui&lt;br /&gt;
$ rc-update -U add wireplumber gui&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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 that 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 pipewire-launcher script will be removed in the future to be replaced with [[#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. {{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:{{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;
For realtime scheduling, it is recommended to use {{Pkg|rtkit}} package. Add your user to the &amp;lt;code&amp;gt;rtkit&amp;lt;/code&amp;gt; group.&lt;br /&gt;
&lt;br /&gt;
Alternatively, ensure your user has the right ulimit permissions. Since PipeWire 0.3.66, you can add yourself to the &amp;lt;code&amp;gt;pipewire&amp;lt;/code&amp;gt; group. You generally need (e.g. in {{Path|/etc/security/limits.conf}}):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@pipewire - memlock 4194304&lt;br /&gt;
@pipewire - nice -19&lt;br /&gt;
@pipewire - rtprio 95&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This allows a member of the pipewire group to have the right permissions for PipeWire to use realtime scheduling without rtkit. This same snippet comes with PipeWire since 0.3.66, so if you have a [[PAM]] login session and add yourself to the pipewire group, you don&#039;t have to do anything else. Note that the above {{Path|/etc/security/limits.conf}} will only work if your session is using [[PAM]].&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: {{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: {{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 Pavucontrol or pactl, you will get the following error:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ pactl list&lt;br /&gt;
Connection failure: Connection refused&lt;br /&gt;
pa_context_connect() failed: Connection refused&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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}}. If you see something like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then 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;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Installing the {{pkg|rtkit}} package as mentioned in [[#Realtime scheduling|Realtime scheduling]] section resolves the above error message.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Bluetooth]]&lt;br /&gt;
* [https://gitlab.freedesktop.org/pipewire/pipewire PipeWire source repository]&lt;br /&gt;
* [https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/home PipeWire Wiki]&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>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=PipeWire&amp;diff=31475</id>
		<title>PipeWire</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=PipeWire&amp;diff=31475"/>
		<updated>2025-11-16T08:43:56Z</updated>

		<summary type="html">&lt;p&gt;Encode: Fix links&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;
* PipeWire requires [[D-Bus#D-Bus session bus|D-Bus session bus]] for most of its functionality.&lt;br /&gt;
* Ensure that your [[Setting_up_a_new_user#Creating_a_new_user|non-root user account]] has 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.{{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.{{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.{{Cmd|# apk add pipewire-alsa}}&lt;br /&gt;
&lt;br /&gt;
=== GUI tools ===&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;
&amp;lt;code&amp;gt;pavucontrol&amp;lt;/code&amp;gt; tool from {{Pkg|pavucontrol}} provide a simple GUI app for controlling sound, outputs, etc. Consider using {{Pkg|pavucontrol-qt}} for [[KDE|Plasma]], if not installed already. &lt;br /&gt;
&lt;br /&gt;
The XFCE Audio mixer can also be used to help control volume by installing the package {{pkg|xfce4-mixer}} which is currently in available in [[Repositories#Testing|testing]] repository.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;{{Pkg|qpwgraph}}&#039;&#039;&#039; is a 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 section below only if PipeWire is [[#Testing|not launched]] after a relogin/reboot.&lt;br /&gt;
&lt;br /&gt;
[[#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|V3.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;
* 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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ rc-service -U pipewire start&lt;br /&gt;
$ rc-service -U wireplumber start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To enable the {{Ic|pipewire}} and {{Ic|wireplumber}} user services in [[Wayland]], issue the following commands;  omit the term {{ic|gui}}/swap it for {{ic|default}} for [[Xorg]] sessions:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ rc-update -U add pipewire gui&lt;br /&gt;
$ rc-update -U add wireplumber gui&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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 that 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 pipewire-launcher script will be removed in the future to be replaced with [[#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. {{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:{{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;
For realtime scheduling, it is recommended to use {{Pkg|rtkit}} package. Add your user to the &amp;lt;code&amp;gt;rtkit&amp;lt;/code&amp;gt; group.&lt;br /&gt;
&lt;br /&gt;
Alternatively, ensure your user has the right ulimit permissions. Since PipeWire 0.3.66, you can add yourself to the &amp;lt;code&amp;gt;pipewire&amp;lt;/code&amp;gt; group. You generally need (e.g. in {{Path|/etc/security/limits.conf}}):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@pipewire - memlock 4194304&lt;br /&gt;
@pipewire - nice -19&lt;br /&gt;
@pipewire - rtprio 95&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This allows a member of the pipewire group to have the right permissions for PipeWire to use realtime scheduling without rtkit. This same snippet comes with PipeWire since 0.3.66, so if you have a [[PAM]] login session and add yourself to the pipewire group, you don&#039;t have to do anything else. Note that the above {{Path|/etc/security/limits.conf}} will only work if your session is using [[PAM]].&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: {{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: {{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 Pavucontrol or pactl, you will get the following error:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ pactl list&lt;br /&gt;
Connection failure: Connection refused&lt;br /&gt;
pa_context_connect() failed: Connection refused&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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}}. If you see something like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then 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;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Installing the {{pkg|rtkit}} package as mentioned in [[#Realtime scheduling|Realtime scheduling]] section resolves the above error message.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Bluetooth]]&lt;br /&gt;
* [https://gitlab.freedesktop.org/pipewire/pipewire PipeWire source repository]&lt;br /&gt;
* [https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/home PipeWire Wiki]&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>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=PipeWire&amp;diff=31473</id>
		<title>PipeWire</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=PipeWire&amp;diff=31473"/>
		<updated>2025-11-16T05:07:46Z</updated>

		<summary type="html">&lt;p&gt;Encode: Simplify wording&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;
* PipeWire requires [[D-Bus#D-Bus session bus|D-Bus session bus]] for most of its functionality.&lt;br /&gt;
* Ensure that your [[Setting_up_a_new_user#Creating_a_new_user|non-root user account]] has appropriate [[Setting_up_a_new_user#Groups for desktop usage|groups for desktop usage]].&lt;br /&gt;
* WirePlumber requires [[udev]] 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.{{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.{{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.{{Cmd|# apk add pipewire-alsa}}&lt;br /&gt;
&lt;br /&gt;
=== GUI tools ===&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;
&amp;lt;code&amp;gt;pavucontrol&amp;lt;/code&amp;gt; tool from {{Pkg|pavucontrol}} provide a simple GUI app for controlling sound, outputs, etc. Consider using {{Pkg|pavucontrol-qt}} for [[KDE|Plasma]], if not installed already. &lt;br /&gt;
&lt;br /&gt;
The XFCE Audio mixer can also be used to help control volume by installing the package {{pkg|xfce4-mixer}} which is currently in available in [[Repositories#Testing|testing]] repository.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;{{Pkg|qpwgraph}}&#039;&#039;&#039; is a 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 section below only if PipeWire is [[#Testing|not launched]] after a relogin/reboot.&lt;br /&gt;
&lt;br /&gt;
[[#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|V3.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;
* 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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ rc-service -U pipewire start&lt;br /&gt;
$ rc-service -U wireplumber start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To enable the {{Ic|pipewire}} and {{Ic|wireplumber}} user services in [[Wayland]], issue the following commands;  omit the term {{ic|gui}}/swap it for {{ic|default}} for [[Xorg]] sessions:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ rc-update -U add pipewire gui&lt;br /&gt;
$ rc-update -U add wireplumber gui&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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 that 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 pipewire-launcher script will be removed in the future to be replaced with [[#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. {{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:{{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;
For realtime scheduling, it is recommended to use {{Pkg|rtkit}} package. Add your user to the &amp;lt;code&amp;gt;rtkit&amp;lt;/code&amp;gt; group.&lt;br /&gt;
&lt;br /&gt;
Alternatively, ensure your user has the right ulimit permissions. Since PipeWire 0.3.66, you can add yourself to the &amp;lt;code&amp;gt;pipewire&amp;lt;/code&amp;gt; group. You generally need (e.g. in {{Path|/etc/security/limits.conf}}):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@pipewire - memlock 4194304&lt;br /&gt;
@pipewire - nice -19&lt;br /&gt;
@pipewire - rtprio 95&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This allows a member of the pipewire group to have the right permissions for PipeWire to use realtime scheduling without rtkit. This same snippet comes with PipeWire since 0.3.66, so if you have a [[PAM]] login session and add yourself to the pipewire group, you don&#039;t have to do anything else. Note that the above {{Path|/etc/security/limits.conf}} will only work if your session is using [[PAM]].&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: {{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: {{Cmd|aplay -l}}&lt;br /&gt;
&lt;br /&gt;
If sound devices are found, the issue is likely with your PipeWire configuration.  Ensure that [[udev]] 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 [[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 Pavucontrol or pactl, you will get the following error:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ pactl list&lt;br /&gt;
Connection failure: Connection refused&lt;br /&gt;
pa_context_connect() failed: Connection refused&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are running Alpine 3.22+ and continue to experience this error after verifying that [[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}}. If you see something like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then 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#Module_Loading]] 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;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Installing the {{pkg|rtkit}} package as mentioned in [[#Realtime scheduling|Realtime scheduling]] section resolves the above error message.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Bluetooth]]&lt;br /&gt;
* [https://gitlab.freedesktop.org/pipewire/pipewire PipeWire source repository]&lt;br /&gt;
* [https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/home PipeWire Wiki]&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>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=PipeWire&amp;diff=31471</id>
		<title>PipeWire</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=PipeWire&amp;diff=31471"/>
		<updated>2025-11-16T04:36:35Z</updated>

		<summary type="html">&lt;p&gt;Encode: Use ‘PipeWire’ and ‘WirePlumber’ throughout, matching upstream&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;
* PipeWire requires [[D-Bus#D-Bus session bus|D-Bus session bus]] for most of its functionality.&lt;br /&gt;
* Ensure that your [[Setting_up_a_new_user#Creating_a_new_user|non-root user account]] has appropriate [[Setting_up_a_new_user#Groups for desktop usage|groups for desktop usage]].&lt;br /&gt;
* WirePlumber requires [[udev]] for ALSA device discovery.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
The following packages i.e {{Pkg|pipewire}} and {{Pkg|wireplumber}} a session manager are the minimum required packages for getting PipeWire to work.{{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.{{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.{{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.{{Cmd|# apk add pipewire-alsa}}&lt;br /&gt;
&lt;br /&gt;
=== GUI tools ===&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;
&amp;lt;code&amp;gt;pavucontrol&amp;lt;/code&amp;gt; tool from {{Pkg|pavucontrol}} provide a simple GUI app for controlling sound, outputs, etc. Consider using {{Pkg|pavucontrol-qt}} for [[KDE|Plasma]], if not installed already. &lt;br /&gt;
&lt;br /&gt;
The XFCE Audio mixer can also be used to help control volume by installing the package {{pkg|xfce4-mixer}} which is currently in available in [[Repositories#Testing|testing]] repository.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;{{Pkg|qpwgraph}}&#039;&#039;&#039; is a 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 section below only if PipeWire is [[#Testing|not launched]] after a relogin/reboot.&lt;br /&gt;
&lt;br /&gt;
[[#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|V3.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;
* 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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ rc-service -U pipewire start&lt;br /&gt;
$ rc-service -U wireplumber start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To enable the {{Ic|pipewire}} and {{Ic|wireplumber}} user services in [[Wayland]], issue the following commands;  omit the term {{ic|gui}}/swap it for {{ic|default}} for [[Xorg]] sessions:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ rc-update -U add pipewire gui&lt;br /&gt;
$ rc-update -U add wireplumber gui&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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 that 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 pipewire-launcher script will be removed in the future to be replaced with [[#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. {{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:{{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;
For realtime scheduling, it is recommended to use {{Pkg|rtkit}} package. Add your user to the &amp;lt;code&amp;gt;rtkit&amp;lt;/code&amp;gt; group.&lt;br /&gt;
&lt;br /&gt;
Alternatively, ensure your user has the right ulimit permissions. Since PipeWire 0.3.66, you can add yourself to the &amp;lt;code&amp;gt;pipewire&amp;lt;/code&amp;gt; group. You generally need (e.g. in {{Path|/etc/security/limits.conf}}):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@pipewire - memlock 4194304&lt;br /&gt;
@pipewire - nice -19&lt;br /&gt;
@pipewire - rtprio 95&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This allows a member of the pipewire group to have the right permissions for PipeWire to use realtime scheduling without rtkit. This same snippet comes with PipeWire since 0.3.66, so if you have a [[PAM]] login session and add yourself to the pipewire group, you don&#039;t have to do anything else. Note that the above {{Path|/etc/security/limits.conf}} will only work if your session is using [[PAM]].&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: {{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: {{Cmd|aplay -l}}&lt;br /&gt;
&lt;br /&gt;
If sound devices are found, the issue is likely with your PipeWire configuration.  Ensure that [[udev]] 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 [[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 Pavucontrol or pactl, you will get the following error:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ pactl list&lt;br /&gt;
Connection failure: Connection refused&lt;br /&gt;
pa_context_connect() failed: Connection refused&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are running Alpine 3.22+ and continue to experience this error after verifying that [[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 that [[#WirePlumber|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}}. If you see something like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then 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#Module_Loading]] 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;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Installing the {{pkg|rtkit}} package as mentioned in [[#Realtime scheduling|Realtime scheduling]] section resolves the above error message.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Bluetooth]]&lt;br /&gt;
* [https://gitlab.freedesktop.org/pipewire/pipewire PipeWire source repository]&lt;br /&gt;
* [https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/home PipeWire Wiki]&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>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Shell_management&amp;diff=31470</id>
		<title>Shell management</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Shell_management&amp;diff=31470"/>
		<updated>2025-11-15T23:56:58Z</updated>

		<summary type="html">&lt;p&gt;Encode: Make the warning more prominent&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The default shell used by Alpine Linux is the [[BusyBox]] variant of the [[BusyBox#Ash_shell|ash]] shell. This page explains how to use the default shell and various ways to change the default shell in Alpine Linux. &lt;br /&gt;
&lt;br /&gt;
== Ash shell == &lt;br /&gt;
&lt;br /&gt;
Alpine Linux uses [[Busybox]] Ash shell for its default shell. It is a standard POSIX shell derived from Debian Ash variant. &lt;br /&gt;
&lt;br /&gt;
One&#039;s ~/.bashrc file (or, alternatively, a different shell alias file) could be considered as a basis, say, for an {{Path|~/.ashrc}} file, reviewing it carefully for syntax/cli variants against that of Ash shell. For non-login, interactive shells refer to [[#Setting alias|Setting alias]] section.&lt;br /&gt;
&lt;br /&gt;
{{Tip|Use {{pkg|checkbashisms}} script to perform basic checks for the presence of bashisms in scripts and help remove them.}}&lt;br /&gt;
&lt;br /&gt;
=== Setting alias ===&lt;br /&gt;
&lt;br /&gt;
For non-login shells, Busybox Ash and other POSIX shells do NOT automatically read a startup file like {{Path|~/.ashrc}}. To ensure that both login and non-login shells work consistently, use &#039;&#039;&#039;ENV&#039;&#039;&#039; environment variable in {{Path|~/.profile}} to refer {{Path|~/.ashrc}} file. &lt;br /&gt;
&lt;br /&gt;
# Edit the {{Path|~/.profile}} as follows: {{Cat|~/.profile|&amp;lt;nowiki&amp;gt;...&lt;br /&gt;
export ENV=&amp;quot;$HOME/.ashrc&amp;quot; &amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
# Now aliases can be added in the startup file {{Path|~/.ashrc}} as follows: {{Cat|~/.ashrc|&amp;lt;nowiki&amp;gt;# ~/.ashrc: interactive shell configuration for BusyBox Ash&lt;br /&gt;
&lt;br /&gt;
# Custom Aliases&lt;br /&gt;
alias ls=&#039;ls --color=auto&#039;&lt;br /&gt;
alias grep=&#039;grep --color=auto&#039;&lt;br /&gt;
&lt;br /&gt;
# You may want to put all your additions into a separate file like&lt;br /&gt;
# ~/.ash_aliases, instead of adding them here directly.&lt;br /&gt;
&lt;br /&gt;
if [ -f ~/.ash_aliases ]; then&lt;br /&gt;
    . ~/.ash_aliases&lt;br /&gt;
fi&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
== Available shells ==&lt;br /&gt;
&lt;br /&gt;
Most of the popular shells are available in Alpine Linux repositories as can be seen from the below list. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; 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: 1.2em; text-align:center;&amp;quot;&lt;br /&gt;
|width=&amp;quot;10%&amp;quot; | Name &lt;br /&gt;
|width=&amp;quot;36%&amp;quot; | URL &lt;br /&gt;
|Remarks&lt;br /&gt;
|-&lt;br /&gt;
|{{Pkg|bash}}|| https://www.gnu.org/software/bash/bash.html||The GNU Bourne Again shell&lt;br /&gt;
|-&lt;br /&gt;
|{{pkg|dash}} ||http://gondor.apana.org.au/~herbert/dash/||Small and fast POSIX-compliant shell&lt;br /&gt;
|-&lt;br /&gt;
|{{pkg|elvish}} ||https://elv.sh||Friendly and expressive Unix shell&lt;br /&gt;
|-&lt;br /&gt;
|{{Pkg|fish}} ||https://fishshell.com/||Modern interactive commandline shell&lt;br /&gt;
|-&lt;br /&gt;
|{{pkg|loksh}} ||https://github.com/dimkr/loksh||A Linux port of OpenBSD&#039;s ksh&lt;br /&gt;
|-&lt;br /&gt;
|{{pkg|murex}} ||https://murex.rocks/||Intuitive, typed and content aware shell&lt;br /&gt;
|-&lt;br /&gt;
|{{pkg|nsh}} ||https://github.com/nuta/nsh||A command-line shell like fish, but POSIX compatible&lt;br /&gt;
|-&lt;br /&gt;
|{{pkg|nushell}} ||https://www.nushell.sh||A new type of shell&lt;br /&gt;
|-&lt;br /&gt;
|{{pkg|oksh}} ||https://github.com/ibara/oksh||Portable OpenBSD ksh, based on pdksh&lt;br /&gt;
|-&lt;br /&gt;
|{{pkg|tcsh}} ||https://github.com/tcsh-org/tcsh||extended C-shell&lt;br /&gt;
|-&lt;br /&gt;
|{{pkg|yash}} ||https://magicant.github.io/yash||Yet another shell&lt;br /&gt;
|-&lt;br /&gt;
|{{Pkg|zsh}} || https://www.zsh.org/||Very advanced and programmable command interpreter&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To install any of the above shells, say for eg: {{pkg|bash}} shell: {{Cmd|# apk add {{pkg|bash}} {{pkg|bash-completion}}}}&lt;br /&gt;
&lt;br /&gt;
== Change default shell == &lt;br /&gt;
&lt;br /&gt;
There are various ways to change the default user shell in Alpine Linux. You can revert back to [[#ash|ash]] shell at anytime with the same steps. &lt;br /&gt;
&lt;br /&gt;
{{Note|After performing the below step, you need to log out and login again for these changes to take effect.}}&lt;br /&gt;
&lt;br /&gt;
=== By hand ===&lt;br /&gt;
&lt;br /&gt;
{{Warning|Take care not to delete/mangle the line, as it would make you unable to log in again.}}&lt;br /&gt;
&lt;br /&gt;
Edit {{Path|/etc/passwd}} manually using an editor of your choice. An example line for a user named &amp;lt;code&amp;gt;user&amp;lt;/code&amp;gt; is: {{Cat|/etc/passwd|...&lt;br /&gt;
user:x:1000:1000:user:/home/user:/bin/ash&lt;br /&gt;
...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Change {{Path|/bin/ash}} to point to the path of a shell from {{Path|/etc/shells}}. The &amp;lt;code&amp;gt;user&amp;lt;/code&amp;gt; should be the user you are changing the default login shell for.&lt;br /&gt;
&lt;br /&gt;
=== Using chsh command ===&lt;br /&gt;
&lt;br /&gt;
To use {{ic|chsh}} command, install the {{pkg|shadow}} package: {{Cmd|# apk add shadow}}&lt;br /&gt;
And use chsh: {{Cmd|# chsh username}}&lt;br /&gt;
Now enter the path for the shell you want to use (e.g {{Path|/bin/zsh}})&lt;br /&gt;
and press {{Key|Enter}} to confirm this change. The shell should exist in {{Path|/etc/shells}}.&lt;br /&gt;
&lt;br /&gt;
== /bin/sh ==&lt;br /&gt;
&lt;br /&gt;
Most applications expect a POSIX-compliant shell to be present in a standard location, {{Path|/bin/sh}}. In Alpine Linux, {{Path|/bin/sh}} is linked to [[#Ash shell|Busybox ash]] by default, but you can change this by installing an alternate {{pkg|*-binsh}} package. Changing {{Path|/bin/sh}} may lead to a difference in script execution speed.&lt;br /&gt;
&lt;br /&gt;
To use {{pkg|dash}} shell as {{Path|/bin/sh}}:{{Cmd|# apk add {{pkg|dash-binsh}}}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [https://linux.die.net/man/1/dash dash Manual]&lt;br /&gt;
* [https://git.busybox.net/busybox/tree/shell/README Ash README]&lt;br /&gt;
* [https://git.busybox.net/busybox/tree/shell Ash source code]&lt;br /&gt;
* [https://pubs.opengroup.org/onlinepubs/9799919799/ POSIX standard]&lt;br /&gt;
* [https://stackoverflow.com/questions/38024160/how-to-get-etc-profile-to-run-automatically-in-alpine-docker/38025686#38025686 stackoverflow on ash shell]&lt;br /&gt;
&lt;br /&gt;
[[Category:Shell]]&lt;br /&gt;
[[Category:System Administration]]&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Shell_management&amp;diff=31469</id>
		<title>Shell management</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Shell_management&amp;diff=31469"/>
		<updated>2025-11-15T23:53:18Z</updated>

		<summary type="html">&lt;p&gt;Encode: Alphabetize ‘Available shells’ list&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The default shell used by Alpine Linux is the [[BusyBox]] variant of the [[BusyBox#Ash_shell|ash]] shell. This page explains how to use the default shell and various ways to change the default shell in Alpine Linux. &lt;br /&gt;
&lt;br /&gt;
== Ash shell == &lt;br /&gt;
&lt;br /&gt;
Alpine Linux uses [[Busybox]] Ash shell for its default shell. It is a standard POSIX shell derived from Debian Ash variant. &lt;br /&gt;
&lt;br /&gt;
One&#039;s ~/.bashrc file (or, alternatively, a different shell alias file) could be considered as a basis, say, for an {{Path|~/.ashrc}} file, reviewing it carefully for syntax/cli variants against that of Ash shell. For non-login, interactive shells refer to [[#Setting alias|Setting alias]] section.&lt;br /&gt;
&lt;br /&gt;
{{Tip|Use {{pkg|checkbashisms}} script to perform basic checks for the presence of bashisms in scripts and help remove them.}}&lt;br /&gt;
&lt;br /&gt;
=== Setting alias ===&lt;br /&gt;
&lt;br /&gt;
For non-login shells, Busybox Ash and other POSIX shells do NOT automatically read a startup file like {{Path|~/.ashrc}}. To ensure that both login and non-login shells work consistently, use &#039;&#039;&#039;ENV&#039;&#039;&#039; environment variable in {{Path|~/.profile}} to refer {{Path|~/.ashrc}} file. &lt;br /&gt;
&lt;br /&gt;
# Edit the {{Path|~/.profile}} as follows: {{Cat|~/.profile|&amp;lt;nowiki&amp;gt;...&lt;br /&gt;
export ENV=&amp;quot;$HOME/.ashrc&amp;quot; &amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
# Now aliases can be added in the startup file {{Path|~/.ashrc}} as follows: {{Cat|~/.ashrc|&amp;lt;nowiki&amp;gt;# ~/.ashrc: interactive shell configuration for BusyBox Ash&lt;br /&gt;
&lt;br /&gt;
# Custom Aliases&lt;br /&gt;
alias ls=&#039;ls --color=auto&#039;&lt;br /&gt;
alias grep=&#039;grep --color=auto&#039;&lt;br /&gt;
&lt;br /&gt;
# You may want to put all your additions into a separate file like&lt;br /&gt;
# ~/.ash_aliases, instead of adding them here directly.&lt;br /&gt;
&lt;br /&gt;
if [ -f ~/.ash_aliases ]; then&lt;br /&gt;
    . ~/.ash_aliases&lt;br /&gt;
fi&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
== Available shells ==&lt;br /&gt;
&lt;br /&gt;
Most of the popular shells are available in Alpine Linux repositories as can be seen from the below list. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; 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: 1.2em; text-align:center;&amp;quot;&lt;br /&gt;
|width=&amp;quot;10%&amp;quot; | Name &lt;br /&gt;
|width=&amp;quot;36%&amp;quot; | URL &lt;br /&gt;
|Remarks&lt;br /&gt;
|-&lt;br /&gt;
|{{Pkg|bash}}|| https://www.gnu.org/software/bash/bash.html||The GNU Bourne Again shell&lt;br /&gt;
|-&lt;br /&gt;
|{{pkg|dash}} ||http://gondor.apana.org.au/~herbert/dash/||Small and fast POSIX-compliant shell&lt;br /&gt;
|-&lt;br /&gt;
|{{pkg|elvish}} ||https://elv.sh||Friendly and expressive Unix shell&lt;br /&gt;
|-&lt;br /&gt;
|{{Pkg|fish}} ||https://fishshell.com/||Modern interactive commandline shell&lt;br /&gt;
|-&lt;br /&gt;
|{{pkg|loksh}} ||https://github.com/dimkr/loksh||A Linux port of OpenBSD&#039;s ksh&lt;br /&gt;
|-&lt;br /&gt;
|{{pkg|murex}} ||https://murex.rocks/||Intuitive, typed and content aware shell&lt;br /&gt;
|-&lt;br /&gt;
|{{pkg|nsh}} ||https://github.com/nuta/nsh||A command-line shell like fish, but POSIX compatible&lt;br /&gt;
|-&lt;br /&gt;
|{{pkg|nushell}} ||https://www.nushell.sh||A new type of shell&lt;br /&gt;
|-&lt;br /&gt;
|{{pkg|oksh}} ||https://github.com/ibara/oksh||Portable OpenBSD ksh, based on pdksh&lt;br /&gt;
|-&lt;br /&gt;
|{{pkg|tcsh}} ||https://github.com/tcsh-org/tcsh||extended C-shell&lt;br /&gt;
|-&lt;br /&gt;
|{{pkg|yash}} ||https://magicant.github.io/yash||Yet another shell&lt;br /&gt;
|-&lt;br /&gt;
|{{Pkg|zsh}} || https://www.zsh.org/||Very advanced and programmable command interpreter&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To install any of the above shells, say for eg: {{pkg|bash}} shell: {{Cmd|# apk add {{pkg|bash}} {{pkg|bash-completion}}}}&lt;br /&gt;
&lt;br /&gt;
== Change default shell == &lt;br /&gt;
&lt;br /&gt;
There are various ways to change the default user shell in Alpine Linux. You can revert back to [[#ash|ash]] shell at anytime with the same steps. &lt;br /&gt;
&lt;br /&gt;
{{Note|After performing the below step, you need to log out and login again for these changes to take effect.}}&lt;br /&gt;
&lt;br /&gt;
=== By hand ===&lt;br /&gt;
&lt;br /&gt;
Edit {{Path|/etc/passwd}} manually using an editor of your choice. An example line for a user named &amp;lt;code&amp;gt;user&amp;lt;/code&amp;gt; is: {{Cat|/etc/passwd|...&lt;br /&gt;
user:x:1000:1000:user:/home/user:/bin/ash&lt;br /&gt;
...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Change {{Path|/bin/ash}} to point to the path of a shell from {{Path|/etc/shells}}. Take care to not delete/mangle the line, as it would make you unable to log in again. The &amp;lt;code&amp;gt;user&amp;lt;/code&amp;gt; should be the user you are changing the default login shell for.&lt;br /&gt;
&lt;br /&gt;
=== Using chsh command ===&lt;br /&gt;
&lt;br /&gt;
To use {{ic|chsh}} command, install the {{pkg|shadow}} package: {{Cmd|# apk add shadow}}&lt;br /&gt;
And use chsh: {{Cmd|# chsh username}}&lt;br /&gt;
Now enter the path for the shell you want to use (e.g {{Path|/bin/zsh}})&lt;br /&gt;
and press {{Key|Enter}} to confirm this change. The shell should exist in {{Path|/etc/shells}}.&lt;br /&gt;
&lt;br /&gt;
== /bin/sh ==&lt;br /&gt;
&lt;br /&gt;
Most applications expect a POSIX-compliant shell to be present in a standard location, {{Path|/bin/sh}}. In Alpine Linux, {{Path|/bin/sh}} is linked to [[#Ash shell|Busybox ash]] by default, but you can change this by installing an alternate {{pkg|*-binsh}} package. Changing {{Path|/bin/sh}} may lead to a difference in script execution speed.&lt;br /&gt;
&lt;br /&gt;
To use {{pkg|dash}} shell as {{Path|/bin/sh}}:{{Cmd|# apk add {{pkg|dash-binsh}}}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [https://linux.die.net/man/1/dash dash Manual]&lt;br /&gt;
* [https://git.busybox.net/busybox/tree/shell/README Ash README]&lt;br /&gt;
* [https://git.busybox.net/busybox/tree/shell Ash source code]&lt;br /&gt;
* [https://pubs.opengroup.org/onlinepubs/9799919799/ POSIX standard]&lt;br /&gt;
* [https://stackoverflow.com/questions/38024160/how-to-get-etc-profile-to-run-automatically-in-alpine-docker/38025686#38025686 stackoverflow on ash shell]&lt;br /&gt;
&lt;br /&gt;
[[Category:Shell]]&lt;br /&gt;
[[Category:System Administration]]&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Alpine_Package_Keeper&amp;diff=31468</id>
		<title>Alpine Package Keeper</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Alpine_Package_Keeper&amp;diff=31468"/>
		<updated>2025-11-15T23:43:08Z</updated>

		<summary type="html">&lt;p&gt;Encode: Spelling&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!--For searching: apk, APK--&amp;gt;&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
This page documents the Alpine Package Keeper(APK), the package manager in Alpine Linux. Refer to the excellent guide [https://docs.alpinelinux.org/user-handbook/0.1a/Working/apk.html Working with APK] from Alpine Linux documentation project to learn the basics quickly. &lt;br /&gt;
&lt;br /&gt;
[[Software management#Graphical software manager|Graphical software managers]] can be used for certain basic package management tasks like adding/removing and upgrading packages.&lt;br /&gt;
&lt;br /&gt;
Package management in [[Installation#Diskless_Mode|Diskless]] mode  and [[Data Disk Mode|Data disk]] mode requires additional step i.e running:{{ic|&#039;&#039;&#039;# [[Alpine_local_backup#Committing changes|lbu commit]]&#039;&#039;&#039;}} for the changes to take effect on next reboot.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
The {{pkg|apk-tools}} provides &#039;&#039;&#039;apk&#039;&#039;&#039; and it supports the following operations:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| [[#Add a Package|add]] &lt;br /&gt;
| Add new packages or upgrade packages to the running system&lt;br /&gt;
|-&lt;br /&gt;
| [[#Remove a Package|del]]&lt;br /&gt;
| Delete packages from the running system&lt;br /&gt;
|-&lt;br /&gt;
| [[#apk fix|fix ]]&lt;br /&gt;
| Repair packages or system&lt;br /&gt;
|-&lt;br /&gt;
| [[#Update Package list|update]] &lt;br /&gt;
| Update the index of available packages&lt;br /&gt;
|-&lt;br /&gt;
| [[#Information on Packages|info]]&lt;br /&gt;
| Prints information about installed or available packages&lt;br /&gt;
|-&lt;br /&gt;
| [[#Search for Packages|search]] &lt;br /&gt;
| Search for packages or descriptions with wildcard patterns&lt;br /&gt;
|-&lt;br /&gt;
| [[#Upgrade a Running System|upgrade]]&lt;br /&gt;
| Upgrade the currently installed packages&lt;br /&gt;
|-&lt;br /&gt;
| [[#Local Cache|cache]]&lt;br /&gt;
| Maintenance operations for locally cached package repository&lt;br /&gt;
|-&lt;br /&gt;
| version &lt;br /&gt;
| Compare version differences between installed and available packages&lt;br /&gt;
|-&lt;br /&gt;
| index &lt;br /&gt;
| create a repository index from a list of packages&lt;br /&gt;
|-&lt;br /&gt;
| fetch &lt;br /&gt;
| download (but not install) packages&lt;br /&gt;
|-&lt;br /&gt;
| audit &lt;br /&gt;
| List changes to the file system from pristine package install state&lt;br /&gt;
|-&lt;br /&gt;
| verify &lt;br /&gt;
| Verify a package signature&lt;br /&gt;
|- &lt;br /&gt;
| [[#apk dot|dot]]&lt;br /&gt;
| Create a [https://graphviz.org/ graphviz] graph description for a given package&lt;br /&gt;
|- &lt;br /&gt;
| [[#apk_policy|policy]]&lt;br /&gt;
| Display the repository that updates a given package, plus repositories that also offer the package&lt;br /&gt;
|- &lt;br /&gt;
| stats &lt;br /&gt;
| Display statistics, including number of packages installed and available, number of directories and files, etc.&lt;br /&gt;
|- &lt;br /&gt;
| manifest&lt;br /&gt;
| Display checksums for files contained in a given package&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Packages and Repositories  ==&lt;br /&gt;
{{Main|Repositories}}&lt;br /&gt;
Software packages for Alpine Linux are digitally signed tar.gz archives containing programs, configuration files, and dependency metadata. They have the extension &amp;lt;code&amp;gt;.apk&amp;lt;/code&amp;gt;, and are often called &amp;quot;a-packs&amp;quot;. Packages in Alpine Linux are organized into [[Repositories|&#039;&#039;&#039;repositories&#039;&#039;&#039;]] and are defined in the {{Path|/etc/apk/repositories}} file.&lt;br /&gt;
&lt;br /&gt;
=== Subpackages ===&lt;br /&gt;
&lt;br /&gt;
In Alpine Linux, software packages are thinned out and split into subpackages to give more control over what features are installed and keeps the installation as small and efficient as possible.&lt;br /&gt;
&lt;br /&gt;
== World ==&lt;br /&gt;
&lt;br /&gt;
At {{Path|/etc/apk/world}}, apk maintains the world, that is, a list of constraints the package selection needs to fulfill. World describes the desired system state. The commands {{ic|apk add foo}} and {{ic|apk del bar}} manipulate the desired state by adding or removing packages &amp;lt;code&amp;gt;foo&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;bar&amp;lt;/code&amp;gt; respectively as a dependency constraint in {{Path|/etc/apk/world}}. &lt;br /&gt;
&lt;br /&gt;
{{Path|/etc/apk/world}} is a plaintext file with one constraint using dependency notation per line. Each line has the format:&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;code&amp;gt;name{@tag}{[&amp;lt;&amp;gt;~=]version}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
apk will by default only use the untagged repositories, but adding a package with a @tag will make apk use the [[Repositories#Tagged_repository|tagged repository]] for the named package. It also allows pulling in dependencies for the tagged package from the tagged repository, though it prefers to use untagged repositories to satisfy dependencies if possible. &lt;br /&gt;
&lt;br /&gt;
Every constraint listed in {{Path|/etc/apk/world}} must be solvable in order for the system to be considered correct, and no transaction may be committed that is incorrect. If apk cannot verify the correctness of the requested change, it will back out adding the constraint before attempting to change what packages are actually installed on the system. Thus apk will never [[#ERROR:_unsatisfiable_constraints|commit]] a change to the system that leaves it unbootable. &lt;br /&gt;
&lt;br /&gt;
== apk fix ==&lt;br /&gt;
&lt;br /&gt;
If a package is specified, the &#039;&#039;&#039;fix&#039;&#039;&#039; subcommand applies repair strategies to correct errors in the installation of the specified packages. If no packages are specified, this command synchronizes all the installed packages with the desired system state.  &lt;br /&gt;
&lt;br /&gt;
{{Tip|If {{Path|/etc/apk/world}} is edited manually, run the command {{ic|&#039;&#039;&#039;# apk fix&#039;&#039;&#039;}} to apply the changes.}}&lt;br /&gt;
&lt;br /&gt;
== Update Package list ==&lt;br /&gt;
&lt;br /&gt;
Alpine Linux [[Repositories|&#039;&#039;&#039;repositories&#039;&#039;&#039;]] change as packages are added and upgraded. To get the latest list of available packages, use the &#039;&#039;update&#039;&#039; command.  This command downloads the {{Path|APKINDEX.tar.gz}} from each repository and stores it in the local cache, typically {{Path|/var/cache/apk/}}, {{Path|/var/lib/apk/}} or {{Path|/etc/apk/cache/}}. {{Cmd|# apk update}}&lt;br /&gt;
&lt;br /&gt;
Adding the &amp;lt;code&amp;gt;--update-cache&amp;lt;/code&amp;gt;, or for short &amp;lt;code&amp;gt;-U&amp;lt;/code&amp;gt; switch to another apk command, as in &amp;lt;code&amp;gt;apk --update-cache upgrade&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;apk -U add ...&amp;lt;/code&amp;gt;, the command has the same effect as first running &amp;lt;code&amp;gt;apk update&amp;lt;/code&amp;gt; before the other apk command.&lt;br /&gt;
&lt;br /&gt;
It is a good idea to always do an &#039;&#039;&#039;update&#039;&#039;&#039; right &#039;&#039;&#039;before&#039;&#039;&#039; doing an &#039;&#039;&#039;upgrade or add&#039;&#039;&#039; command. That way the command will install the latest available packages from the repositories.&lt;br /&gt;
&lt;br /&gt;
== Add a Package ==&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;add&#039;&#039;&#039; to install packages from a [[Repositories|&#039;&#039;&#039;repository&#039;&#039;&#039;]]. Any necessary dependencies are also installed. If you have multiple repositories, the &#039;&#039;&#039;add&#039;&#039;&#039; command installs the newest package. {{Cmd|&amp;lt;nowiki&amp;gt;# apk add openssh&lt;br /&gt;
# apk add openssh openntp vim &amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Packages from a [[Repositories#Tagged repository|tagged repository]] can be installed by adding tags to them:{{cmd|# apk add wireguard-go@testing}}&lt;br /&gt;
&lt;br /&gt;
A specific package can also be [[#Package pinning|held back or pinned]] at a specific level or version. &lt;br /&gt;
&lt;br /&gt;
=== Add a local Package ===&lt;br /&gt;
&lt;br /&gt;
To install a locally available apk package, for example if this device has no internet access but you can upload apk packages directly to it, use the &#039;&#039;&#039;--allow-untrusted&#039;&#039;&#039; flag: {{cmd|# apk add --allow-untrusted /path/to/file.apk}}&lt;br /&gt;
&lt;br /&gt;
Note that multiple packages can be given.  When installing a local package, all dependencies should also be specified.  For example:&lt;br /&gt;
&lt;br /&gt;
{{cmd|# apk add --allow-untrusted /var/tig-2.2-r0.apk /var/git-2.11.1-20.apk}}&lt;br /&gt;
&lt;br /&gt;
== Remove a Package  ==&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;del&#039;&#039;&#039; to remove a package along with dependencies that are no longer needed.{{cmd|&amp;lt;nowiki&amp;gt;# apk del openssh&lt;br /&gt;
# apk del openssh openntp vim&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
== Upgrade a Running System ==&lt;br /&gt;
&lt;br /&gt;
To get the latest security upgrades and bugfixes available for the currently installed packages from the [[Repositories#Release_Branches|release branch]] of a running system, always [[#Update Package list| update the packages list]] before issuing the &#039;&#039;&#039;upgrade&#039;&#039;&#039; command as shown below:{{cmd|&amp;lt;nowiki&amp;gt;# apk update&lt;br /&gt;
# apk upgrade &amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Or, combining the same into one single command:{{cmd|# apk -U upgrade}}&lt;br /&gt;
&lt;br /&gt;
To upgrade only &#039;&#039;specific&#039;&#039; packages, use the &#039;&#039;&#039;upgrade&#039;&#039;&#039; command and specify them: {{cmd|&amp;lt;nowiki&amp;gt;# apk update&lt;br /&gt;
# apk upgrade busybox&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
{{Tip|Alpine Linux [https://github.com/jirutka/apk-autoupdate tool for automatic updates] is available as {{pkg|apk-autoupdate}} package. It can be used to enable unattended, automatic upgrades of packages.}} &lt;br /&gt;
&lt;br /&gt;
Here is an example, showing the procedure on a system that has [[Repositories#Using testing repository|testing repository tagged]]:&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
 # apk update&lt;br /&gt;
 fetch &amp;lt;nowiki&amp;gt;https://dl-3.alpinelinux.org/alpine/v3.6/main/x86_64/APKINDEX.tar.gz&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 fetch &amp;lt;nowiki&amp;gt;https://dl-3.alpinelinux.org/alpine/v3.6/community/x86_64/APKINDEX.tar.gz&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 fetch &amp;lt;nowiki&amp;gt;https://dl-3.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 v3.6.2-191-gf98d79930f &amp;lt;nowiki&amp;gt;[https://dl-3.alpinelinux.org/alpine/v3.6/main]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 v3.6.2-190-ga5d68c47df &amp;lt;nowiki&amp;gt;[https://dl-3.alpinelinux.org/alpine/v3.6/community]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 v3.6.0-4624-g11f1b9c8ab &amp;lt;nowiki&amp;gt;[https://dl-3.alpinelinux.org/alpine/edge/testing]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 OK: 20118 distinct packages available&lt;br /&gt;
 &lt;br /&gt;
 # apk upgrade&lt;br /&gt;
 (1/2) Upgrading extra-cmake-modules@testing (5.38.0-r0 -&amp;gt; 5.39.0-r0)&lt;br /&gt;
 (2/2) Upgrading extra-cmake-modules-doc@testing (5.38.0-r0 -&amp;gt; 5.39.0-r0)&lt;br /&gt;
 Executing mdocml-apropos-1.14.1-r0.trigger&lt;br /&gt;
 OK: 2635 MiB in 803 packages&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Tip|To upgrade Alpine Linux to a newer [[Repositories#Release_Branches|release branch]], refer [[Upgrading_Alpine|Upgrading Alpine]] page.}}&lt;br /&gt;
&lt;br /&gt;
=== Handling changes in configuration files ===&lt;br /&gt;
&lt;br /&gt;
apk avoids overwriting configuration files in the {{path|/etc}} directory. Whenever apk installs a file there, but realizes a potentially edited one is already present, it will write its file to that filename with {{path|.apk-new}} appended. You may handle these by hand, or use [[Alpine configuration management scripts#update-conf|update-conf]] utility. &lt;br /&gt;
&lt;br /&gt;
* To check for changes to configurations from the new packages: {{Cmd|# update-conf -a -l}}&lt;br /&gt;
* Simply invoking it will present you with the difference between the two files, and offer various choices for dealing with the conflicts.{{Cmd|# update-conf}}&lt;br /&gt;
&lt;br /&gt;
=== Upgrading &amp;quot;diskless&amp;quot; and &amp;quot;data&amp;quot; disk mode installs ===&lt;br /&gt;
&lt;br /&gt;
When upgrading packages followed by running {{ic|&#039;&#039;&#039;# [[Alpine_local_backup#Committing changes|lbu commit]]&#039;&#039;&#039;}} in [[Diskless Mode|diskless]] and [[Data Disk Mode|Data disk]] mode systems, the kernel and firmware packages are &#039;&#039;&#039;not&#039;&#039;&#039; upgraded. Upgrading them requires [[Diskless Mode#update-kernel script|&#039;&#039;&#039;update-kernel&#039;&#039;&#039;]] script.&lt;br /&gt;
&lt;br /&gt;
== Search for Packages ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|Alpine Linux provides a specialized [https://pkgs.alpinelinux.org web interface] dedicated to looking through various available packages.}}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;search&#039;&#039;&#039; command searches the repository Index files for installable packages. &lt;br /&gt;
&lt;br /&gt;
The return format is &#039;&#039;&#039;Package&#039;&#039;&#039;-&#039;&#039;&#039;Version&#039;&#039;&#039;. Omit &#039;&#039;&#039;Version&#039;&#039;&#039; for &#039;&#039;apk add &#039;&#039;&#039;Package&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
* To list all packages available, along with their descriptions: {{cmd|$ apk search -v}}&lt;br /&gt;
* To list all packages are part of the ACF system: {{cmd|$ apk search -v &#039;acf*&#039; }}&lt;br /&gt;
* To list all packages that list NTP as part of their description, use the &#039;&#039;-d&#039;&#039; or &#039;&#039;--description&#039;&#039; option: {{cmd|$ apk search -v --description &#039;NTP&#039; }}&lt;br /&gt;
* To list all packages that provide the &amp;lt;code&amp;gt;git&amp;lt;/code&amp;gt; command: {{cmd|$ apk search -v &#039;cmd:git&#039;}}&lt;br /&gt;
&lt;br /&gt;
== Information on Packages ==&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;info&#039;&#039;&#039; command provides information on the contents of packages, their dependencies, and which files belong to a package.&lt;br /&gt;
&lt;br /&gt;
For a given package, each element can be chosen (for example, &#039;&#039;-w&#039;&#039; to show just the webpage information), or all information displayed with the &#039;&#039;-a&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
Example: {{cmd|$ apk info -a zlib}}&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;zlib-1.2.5-r1 description:&#039;&#039;&#039;&lt;br /&gt;
 A compression/decompression Library&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;zlib-1.2.5-r1 webpage:&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;https://zlib.net&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;zlib-1.2.5-r1 installed size:&#039;&#039;&#039;&lt;br /&gt;
 94208&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;zlib-1.2.5-r1 depends on:&#039;&#039;&#039;&lt;br /&gt;
 libc0.9.32&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;zlib-1.2.5-r1 is required by:&#039;&#039;&#039;&lt;br /&gt;
 libcrypto1.0-1.0.0-r0&lt;br /&gt;
 apk-tools-2.0.2-r4&lt;br /&gt;
 openssh-client-5.4_p1-r2&lt;br /&gt;
 openssh-5.4_p1-r2&lt;br /&gt;
 libssl1.0-1.0.0-r0&lt;br /&gt;
 freeswitch-1.0.6-r6&lt;br /&gt;
 atop-1.25-r0 &lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;zlib-1.2.5-r1 contains:&#039;&#039;&#039;&lt;br /&gt;
 lib/libz.so.1.2.5&lt;br /&gt;
 lib/libz.so.1&lt;br /&gt;
 lib/libz.so &lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;zlib-1.2.5-r1 triggers:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As shown in the example you can determine&lt;br /&gt;
* The &#039;&#039;&#039;description&#039;&#039;&#039; of the package (&#039;&#039;-d&#039;&#039; or &#039;&#039;--description&#039;&#039;)&lt;br /&gt;
* The &#039;&#039;&#039;webpage&#039;&#039;&#039; where the application is hosted (&#039;&#039;-w&#039;&#039; or &#039;&#039;--webpage&#039;&#039;)&lt;br /&gt;
* The &#039;&#039;&#039;size&#039;&#039;&#039; the package will require once installed (in bytes) (&#039;&#039;-s&#039;&#039; or &#039;&#039;--size&#039;&#039;)&lt;br /&gt;
* What packages are required to use this one  (&#039;&#039;&#039;depends&#039;&#039;&#039;) (&#039;&#039;-R&#039;&#039; or &#039;&#039;--depends&#039;&#039;)&lt;br /&gt;
* What packages require this one to be installed (&#039;&#039;&#039;required by&#039;&#039;&#039;) (&#039;&#039;-r&#039;&#039; or &#039;&#039;--rdepends&#039;&#039;)&lt;br /&gt;
* The &#039;&#039;&#039;contents&#039;&#039;&#039; of the package, that is, which files it installs (&#039;&#039;-L&#039;&#039; or &#039;&#039;--contents&#039;&#039;)&lt;br /&gt;
* Any &#039;&#039;&#039;triggers&#039;&#039;&#039; this package sets. (&#039;&#039;-t&#039;&#039; or &#039;&#039;--triggers&#039;&#039;) Listed here are directories that are watched; if a change happens to the directory, then the trigger script is run at the end of the apk add/delete. For example, doing a depmod once after installing all packages that add kernel modules.&lt;br /&gt;
&lt;br /&gt;
===  Check file ownership ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;info&#039;&#039;&#039; command is also useful to determine which package a file belongs to.  For example: {{cmd|$ apk info --who-owns /sbin/lbu}} &lt;br /&gt;
will display&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/sbin/lbu is owned by alpine-conf-x.x-rx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===  Check Dependencies ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;info&#039;&#039;&#039; command specific to check package dependency and reverse dependency is explained below:&lt;br /&gt;
&lt;br /&gt;
The option &#039;&#039;&#039;-R&#039;&#039;&#039; or &#039;&#039;&#039;--depends&#039;&#039;&#039; lists the dependencies of the package: {{Cmd|$ apk info --depends pipewire}} &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pipewire-1.0.6-r1 depends on:&lt;br /&gt;
/bin/sh&lt;br /&gt;
so:libc.musl-x86_64.so.1&lt;br /&gt;
so:libpipewire-0.3.so.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The option &#039;&#039;&#039;-r&#039;&#039;&#039; or  &#039;&#039;&#039;--rdepends&#039;&#039;&#039; lists the  reverse dependencies of the package (all other packages which depend on the package). {{Cmd|$ apk info --rdepends pipewire}}  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pipewire-1.0.6-r1 is required by:&lt;br /&gt;
xdg-desktop-portal-wlr-0.7.1-r0&lt;br /&gt;
pipewire-pulse-1.0.6-r1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Listing installed packages ===&lt;br /&gt;
&lt;br /&gt;
To list all installed packages, use: {{Cmd|$ apk info}}&lt;br /&gt;
&lt;br /&gt;
To list all installed packages in alphabetical order, with a description of each, do:{{Cmd|$ apk -vv info|sort}}&lt;br /&gt;
&lt;br /&gt;
To list packages locally installed that are not longer available in repositories, use {{Cmd|$ apk list --orphaned}}&lt;br /&gt;
&lt;br /&gt;
To browse details of installed package in a &amp;quot;TUI&amp;quot; with:{{Cmd|&amp;lt;nowiki&amp;gt;$ apk list --installed -q | fzf --preview &#039;apk query {1}&#039;&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To list subpackages for a package, for e.g {{pkg|util-linux}}:{{Cmd|$ apk list --quiet --origin util-linux}}&lt;br /&gt;
&lt;br /&gt;
The apk tool does not have a subcommand to list manually-installed packages that do not have reverse dependencies. To get this information on a traditional system that is not using [[Alpine local backup|lbu]], try this script. Note that this approach will also list core packages like alpine-base that should not be removed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
apk info | grep -ve &#039;-doc$&#039; | sort | while read pkg&lt;br /&gt;
        do&lt;br /&gt;
                rdep=`apk info -qr &amp;quot;$pkg&amp;quot;`&lt;br /&gt;
                [ -z &amp;quot;$rdep&amp;quot; ] &amp;amp;&amp;amp; echo $pkg&lt;br /&gt;
        done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== apk dot ==&lt;br /&gt;
&lt;br /&gt;
The dot option renders package dependencies as {{pkg|graphviz}} graphs.[[File:Seatd dependencies.png|800px|center|alt=Seatd dependencies|Seatd dependencies]] Steps to use the dot option is documented below:&lt;br /&gt;
# Save the output of apk dot option to a dot file.{{Cmd|$ apk dot seatd &amp;gt; seatd_dependencies.dot}}&lt;br /&gt;
# Use &amp;lt;code&amp;gt;dot&amp;lt;/code&amp;gt; utility from {{pkg|graphviz}} package to convert the {{Path|seatd_dependencies.dot}} file into a graphical format such as PNG, PDF, or SVG. {{Cmd|$ dot -Tpng seatd_dependencies.dot -o seatd_dependencies.png}}&lt;br /&gt;
&lt;br /&gt;
== apk policy ==&lt;br /&gt;
&lt;br /&gt;
To display the repository a package was installed from and will be updated from, plus any [[#Repository_pinning|tagged]] or enabled repositories where it is also offered, if any, for this architecture - its &#039;&#039;&#039;policy&#039;&#039;&#039;: {{Cmd|$ apk policy &#039;&#039;package&#039;&#039;}}&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 $ apk policy vlc&lt;br /&gt;
 vlc policy:&lt;br /&gt;
  2.2.6-r1:&lt;br /&gt;
    lib/apk/db/installed&lt;br /&gt;
    https://dl-3.alpinelinux.org/alpine/v3.7/community&lt;br /&gt;
  3.0.0_rc2-r1:&lt;br /&gt;
    @edgecommunity https://dl-3.alpinelinux.org/alpine/edge/community&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Local Cache ==&lt;br /&gt;
{{Main|Local APK cache}}&lt;br /&gt;
APK can keep a cache of installed packages on a local disk. HDD or [[Installation#System_Disk_Mode|sys mode]] installs don&#039;t need an apk cache, it still allows to serve packages over the network, though, e.g. to get installed by other local machines.&lt;br /&gt;
&lt;br /&gt;
{{Note|For [[Diskless Mode|diskless]] installations, [[Local APK cache|local package cache]] is needed to automatically (re-)install packages when booting.}} &lt;br /&gt;
&lt;br /&gt;
When newer packages are added to the cache over time, the older versions of the packages default to remain in the cache directory.  The older versions of packages can be removed with the &#039;&#039;&#039;clean&#039;&#039;&#039; command.  {{cmd|# apk cache clean}} Or to see what is deleted include the verbose switch: {{cmd|# apk -v cache clean}}&lt;br /&gt;
&lt;br /&gt;
If packages got deleted accidentally from the cache directory, then use the &#039;&#039;&#039;download&#039;&#039;&#039; command, {{cmd|# apk cache download}}&lt;br /&gt;
&lt;br /&gt;
The above two steps can be combined  into one with the &#039;&#039;&#039;sync&#039;&#039;&#039; command - this cleans out old packages and downloads missing packages. {{cmd|# apk cache -v sync}}&lt;br /&gt;
&lt;br /&gt;
== Advanced APK Usage ==&lt;br /&gt;
&lt;br /&gt;
=== Commandline repository options ===&lt;br /&gt;
&lt;br /&gt;
By default, the &#039;&#039;&#039;apk&#039;&#039;&#039; utility will use the system repositories for all operations. This behavior can be overridden by the following options:&lt;br /&gt;
{|&lt;br /&gt;
| --repositories-file REPOFILE&lt;br /&gt;
| Override the system repositories by specifying a repositories file.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;-X|--repository REPO&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
| Specify a supplemental repository that will be used in addition to the system repositories. This option can be provided multiple times.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{cmd|# apk add cherokee --update-cache --repository https://dl-cdn.alpinelinux.org/alpine/edge/testing/ --allow-untrusted}}&lt;br /&gt;
&lt;br /&gt;
=== Package pinning ===&lt;br /&gt;
{{Seealso|Repositories#Tagged repository}}&lt;br /&gt;
&lt;br /&gt;
In certain cases, you may want to upgrade a system, but keep a specific package at a specific level or version by pinning a Package. It is possible to add &amp;quot;sticky&amp;quot; or versioned dependencies. &lt;br /&gt;
&lt;br /&gt;
{{Warning| If you desire deterministic, repeatable package installation (such as with containerized environments) via package pinning, it is important to understand your package repo&#039;s version retention rules. Always pin to a package version that is intended for your [[Repositories#Release_Branches|release branch]]. Pinning to a version on the [[Repositories#Edge|edge]] branch may stop working after the package version is revoked from the repo.}}&lt;br /&gt;
&lt;br /&gt;
For instance, to hold the &#039;&#039;asterisk&#039;&#039; package to the 1.6.2 level or lower:{{cmd|&amp;lt;nowiki&amp;gt;# apk add asterisk=1.6.0.21-r0&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
or {{cmd|# apk add &#039;asterisk&amp;lt;1.6.1&#039;}}&lt;br /&gt;
&lt;br /&gt;
To upgrade the entire system, keeping the asterisk package at the 1.6.0 or lower level:{{cmd|# apk upgrade}}&lt;br /&gt;
&lt;br /&gt;
To later upgrade to the current version, and ensure that 1.6.1 is the minimum version used. {{cmd|# apk add &#039;asterisk&amp;gt;1.6.1&#039;}}&lt;br /&gt;
&lt;br /&gt;
You can also use &amp;quot;fuzzy&amp;quot; version matching to pin the version to a major/minor release. To match any version of asterisk that starts with 1.6 (such as 1.6.0.21-r0 or 1.6.9.31-r9) use the command: {{cmd|&amp;lt;nowiki&amp;gt;# apk add &#039;asterisk=~1.6&#039;&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
==== Holding a specific package back ====&lt;br /&gt;
See [[#Package pinning|Package pinning]]&lt;br /&gt;
&lt;br /&gt;
=== Commit hooks ===&lt;br /&gt;
&lt;br /&gt;
If you&#039;d like to trigger an action or run a certain script on every commit made by apk, there&#039;s a built-in method for that. On every commit apk looks for executables located in the &amp;quot;/etc/apk/commit_hooks.d/&amp;quot; directory, and executes them both before and after the commit. To provide some way to selectively run hooks either before or after a change is commited by apk, the scripts are called with &amp;quot;pre-commit&amp;quot; or &amp;quot;post-commit&amp;quot; as argument 1.&lt;br /&gt;
This is an example of a hook to do different things before and after commit:&lt;br /&gt;
&lt;br /&gt;
{{cmd|1=#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$1&amp;quot; = &amp;quot;pre-commit&amp;quot; ]; then&lt;br /&gt;
    do_something&lt;br /&gt;
&lt;br /&gt;
elif [ &amp;quot;$1&amp;quot; = &amp;quot;post-commit&amp;quot; ]; then&lt;br /&gt;
    do_something_else&lt;br /&gt;
fi}}&lt;br /&gt;
&lt;br /&gt;
Commit hooks are $PATH-aware, so for the sake of security it&#039;s recommended to specify absolute paths to executables.&lt;br /&gt;
&lt;br /&gt;
==  Rosetta Stone ==&lt;br /&gt;
	&lt;br /&gt;
[[Comparison with other distros#Comparison chart/Rosetta Stone|Rosetta Stone]] or a Comparison chart shows how standard things related to package management are done in Alpine Linux compared to other popular distributions. &lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== ERROR: unable to select packages ===&lt;br /&gt;
&lt;br /&gt;
This error typically indicates that the package manager cannot find a suitable package to install. On issuing a command to add a package for eg: {{ic|# apk add labwc}}, you may receive below error message:&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
ERROR: unable to select packages:&lt;br /&gt;
 labwc (no such package):&lt;br /&gt;
 required by: world[labwc]&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above error indicates {{pkg|labwc}} does not exist in the [[Repositories|repositories]] currently configured in {{Path|/etc/apk/repositories}}. Ensure that &amp;lt;code&amp;gt;community&amp;lt;/code&amp;gt; repository is [[Repositories#Managing_repositories|enabled]], as by default only &amp;lt;code&amp;gt;main&amp;lt;/code&amp;gt; repository is enabled. You may also want to check [https://pkgs.alpinelinux.org/packages packages database] to identify the correct package name and the [[Repositories|repository]] in which the package is available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
ERROR: unable to select packages:&lt;br /&gt;
  so:libxml2.so.2 (no such package):&lt;br /&gt;
    required by: llvm19-libs-19.1.7-r1[so:libxml2.so.2]&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above error message may occur in [[Edge|Edge]] branch in certain other situations, even if all the necessary [[Repositories|repositories]] are enabled. Temporary non-availability of the packages from the repositories can occur, when software packages are [https://build.alpinelinux.org/ rebuilt]. You may want to wait for some time to try again.&lt;br /&gt;
&lt;br /&gt;
=== ERROR: unsatisfiable constraints === &lt;br /&gt;
&lt;br /&gt;
This error signifies a dependency conflict. It means that the package you&#039;re trying to install has dependencies that cannot be simultaneously satisfied within the current package repository. &lt;br /&gt;
&lt;br /&gt;
You may want to check [https://pkgs.alpinelinux.org/packages packages database] to identify the correct package name and version and the [[Repositories|repository]] in which the package is available. &lt;br /&gt;
&lt;br /&gt;
=== WARNING: This apk-tools is OLD! ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;apk update&#039;&#039;&#039;, &#039;&#039;&#039;apk upgrade&#039;&#039;&#039; or &#039;&#039;&#039;apk add&#039;&#039;&#039; may report the following: &lt;br /&gt;
 WARNING: This apk-tools is OLD! Some packages might not function properly&lt;br /&gt;
&lt;br /&gt;
This may happen if you are running Alpine Linux stable version with a [[Repositories#Edge|Edge]] package(s) also installed.  One resolution is to consider upgrading {{pkg|apk-tools}}. If edge/main is already [[Repositories#Tagged repository|tagged]] as &#039;&#039;@edgemain&#039;&#039; in your {{Path|/etc/apk/repositories}} file, then try: {{Cmd|# apk add --upgrade apk-tools@edgemain}}&lt;br /&gt;
&lt;br /&gt;
=== ERROR:  UNTRUSTED signature ===&lt;br /&gt;
&lt;br /&gt;
This happens when the release version changes. You need to update the local apk keys.&lt;br /&gt;
&lt;br /&gt;
If you have already updated your repositories, allow them to update without the trusted key:&lt;br /&gt;
{{Cmd|# apk update --allow-untrusted}}&lt;br /&gt;
&lt;br /&gt;
Then install the keys upgrade:&lt;br /&gt;
{{Cmd|# apk fix --upgrade --allow-untrusted alpine-keys}}&lt;br /&gt;
&lt;br /&gt;
Now updates and upgrades should proceed normally.&lt;br /&gt;
&lt;br /&gt;
Alternative, the updated alpine-keys package may be obtained, verified, installed directly, as covered earlier, prior to a repository update.&lt;br /&gt;
&lt;br /&gt;
=== World updated but the following packages are not removed === &lt;br /&gt;
&lt;br /&gt;
On issuing a command to remove a package for eg: {{ic|# apk del btrfs-progs}}, you may receive below error message:&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
World updated, but the following packages are not removed due to:&lt;br /&gt;
  btrfs-progs: btrbk&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here, the removal of package {{Pkg|btrfs-progs}} affects another package {{Pkg|btrbk}} in the constraints file [[#World|/etc/apk/world]]. So the package {{Pkg|btrfs-progs}} will be removed from the constraints file, but not removed from the system. The {{Pkg|btrfs-progs}} will remain in the system, until the constraint i.e {{Pkg|btrbk}} which depends on {{Pkg|btrfs-progs}} is removed. &lt;br /&gt;
&lt;br /&gt;
If {{ic|apk del btrbk}} is issued, the package {{Pkg|btrfs-progs}} will be automatically removed from system as the constraint {{Pkg|btrfs-progs}} does not exist in {{Path|/etc/apk/world}}.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [https://git.alpinelinux.org/apk-tools/tree/doc/apk.8.scd Manual for apk(8)]&lt;br /&gt;
* [https://git.alpinelinux.org/apk-tools/tree/doc/apk-world.5.scd Manual for apk-world(5)]&lt;br /&gt;
* [https://pkgs.alpinelinux.org Official web interface for packages] &lt;br /&gt;
* [[Software management]]&lt;br /&gt;
* [https://ariadne.space/2021/04/24/why-apktools-is-different-than.html  Why apk-tools is different than other package managers]&lt;br /&gt;
* [https://ariadne.space/2021/10/30/spelunking-through-the-apktools-dependency.html spelunking through the apk-tools dependency solver]&lt;br /&gt;
* [https://whynothugo.nl/journal/2023/02/18/in-praise-of-alpine-and-apk/ In praise of alpine and apk]&lt;br /&gt;
* [https://www.cyberciti.biz/faq/10-alpine-linux-apk-command-examples/ 10 Alpine Linux apk Command Examples]&lt;br /&gt;
[[Category:Package Manager]]&lt;br /&gt;
[[Category:System_Administration]]&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Pipewire&amp;diff=31467</id>
		<title>Pipewire</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Pipewire&amp;diff=31467"/>
		<updated>2025-11-15T23:37:46Z</updated>

		<summary type="html">&lt;p&gt;Encode: Redirect ‘pipewire’ → ‘PipeWire’&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[PipeWire]]&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Dbus&amp;diff=31466</id>
		<title>Dbus</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Dbus&amp;diff=31466"/>
		<updated>2025-11-15T23:34:56Z</updated>

		<summary type="html">&lt;p&gt;Encode: Redirect dbus &amp;gt; D-Bus&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[D-Bus]]&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=User:Encode&amp;diff=29368</id>
		<title>User:Encode</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=User:Encode&amp;diff=29368"/>
		<updated>2025-03-19T05:00:52Z</updated>

		<summary type="html">&lt;p&gt;Encode: I don&amp;#039;t think this is the right way to do things anymore&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[User:Encode/XDG_package_building]]&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=User:Encode/Workstation&amp;diff=29367</id>
		<title>User:Encode/Workstation</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=User:Encode/Workstation&amp;diff=29367"/>
		<updated>2025-03-19T05:00:05Z</updated>

		<summary type="html">&lt;p&gt;Encode: Request deletion, I don&amp;#039;t think this is the right way to do things anymore&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Delete|I don&#039;t think this is the right way to do things anymore.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Comment for Editors&lt;br /&gt;
&lt;br /&gt;
  * If it gets its own heading it should be in Abc order.&lt;br /&gt;
    The display components can break this rule since that is what most&lt;br /&gt;
    users will want in a workstation, so put it first.&lt;br /&gt;
  * Miscellaneous should come last and have things that don&#039;t need a&lt;br /&gt;
    dedicated section.&lt;br /&gt;
  * The Laptop section should come right above: Miscellaneous, since&lt;br /&gt;
    everything above that should be general and apply to both&lt;br /&gt;
    desktop/laptops.&lt;br /&gt;
&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Alpine Linux&#039;&#039;&#039; has no official desktop; older versions used [[Xfce]], but now, all GUI and graphical interfaces are optional.  This page is an attempt at being a &#039;&#039;jumping off page&#039;&#039; for everything you need to have a decent workstation.&lt;br /&gt;
&lt;br /&gt;
{{Tip|Combine a version control system (like [[:Category:Git|Git]]) and a configuration management/deployment system (like [[Ansible]]) to automate this.}}&lt;br /&gt;
&lt;br /&gt;
== [https://en.wikipedia.org/wiki/Graphical_user_interface Graphical user interfaces (GUI)] ==&lt;br /&gt;
&lt;br /&gt;
=== Display Server ===&lt;br /&gt;
&lt;br /&gt;
* [[Wayland]]&lt;br /&gt;
* [[X|X (also called: Xorg, X11)]]&lt;br /&gt;
&lt;br /&gt;
=== Desktop environments ===&lt;br /&gt;
&lt;br /&gt;
* [[GNOME]]&lt;br /&gt;
* [[KDE|KDE Plasma]]&lt;br /&gt;
* [[LXQt]]&lt;br /&gt;
* [[MATE]]&lt;br /&gt;
* [[Xfce]]&lt;br /&gt;
&lt;br /&gt;
=== Window managers ===&lt;br /&gt;
&lt;br /&gt;
==== [https://en.wikipedia.org/wiki/Stacking_window_manager Stacking (floating) window managers] ====&lt;br /&gt;
&lt;br /&gt;
* [[Wayland]]:&lt;br /&gt;
** [[LabWC]]&lt;br /&gt;
** [[Wayfire]]&lt;br /&gt;
** [[Weston]]&lt;br /&gt;
&lt;br /&gt;
* [[X]]:&lt;br /&gt;
** [[Fluxbox (spanish)]]&lt;br /&gt;
** [[Openbox]]&lt;br /&gt;
&lt;br /&gt;
==== [https://en.wikipedia.org/wiki/Tiling_window_manager Tiling (dynamic) window managers] ====&lt;br /&gt;
&lt;br /&gt;
* [[Wayland]]:&lt;br /&gt;
** [[River]]&lt;br /&gt;
** [[Sway]]&lt;br /&gt;
&lt;br /&gt;
* [[X]]:&lt;br /&gt;
** [[AwesomeWM]]&lt;br /&gt;
** [[Dwm]]&lt;br /&gt;
** [[I3wm]]&lt;br /&gt;
&lt;br /&gt;
== Fonts ==&lt;br /&gt;
&lt;br /&gt;
{{Note|Depending on the Desktop environment/window manager fonts may or may not be installed automatically.}}&lt;br /&gt;
&lt;br /&gt;
* [[Fonts]]&lt;br /&gt;
&lt;br /&gt;
== Networking ==&lt;br /&gt;
&lt;br /&gt;
* [[Tutorials_and_Howtos#Networking_2|Networking]]&lt;br /&gt;
&lt;br /&gt;
== Printer ==&lt;br /&gt;
&lt;br /&gt;
* [[Printer Setup]]&lt;br /&gt;
&lt;br /&gt;
== Sound ==&lt;br /&gt;
&lt;br /&gt;
{{Note|If you are unsure, [[PipeWire]] is recommended.}}&lt;br /&gt;
&lt;br /&gt;
* [[ALSA]]&lt;br /&gt;
* [[PipeWire]]&lt;br /&gt;
* [[PulseAudio]]&lt;br /&gt;
&lt;br /&gt;
== Laptop ==&lt;br /&gt;
&lt;br /&gt;
{{Expand|To be done.}}&lt;br /&gt;
&lt;br /&gt;
* [[Suspend on LID close]]&lt;br /&gt;
* Power management&lt;br /&gt;
** Suspend and hibernate&lt;br /&gt;
** [[CPU frequency scaling]]&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous ==&lt;br /&gt;
&lt;br /&gt;
* [[Alpine_Linux:FAQ#Why_don&#039;t_I_have_man_pages_or_where_is_the_&#039;man&#039;_command?|man command/man pages]]&lt;br /&gt;
* [[Default applications]] - Changing the default application associated with a filetype.&lt;br /&gt;
* [[Bubblewrap]] - Unprivileged sandboxing tool.&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[Installation#Post-Installation|Post Install]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Desktop]]&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Bubblewrap/Examples&amp;diff=29366</id>
		<title>Bubblewrap/Examples</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Bubblewrap/Examples&amp;diff=29366"/>
		<updated>2025-03-18T23:02:27Z</updated>

		<summary type="html">&lt;p&gt;Encode: *: Separate shell command short options that don&amp;#039;t take input from ones that do, I think it adds clarity&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|Someone more experienced needs to look over this.}}&lt;br /&gt;
&lt;br /&gt;
{{Todo|&lt;br /&gt;
* Since bubblewrap can make use of [https://en.wikipedia.org/wiki/Seccomp seccomp], restrictive versions should be added.&lt;br /&gt;
* {{Ic|imv}}, {{Ic|mpv}} and {{Ic|zathura}} currently only accept 1 mandatory (except {{Ic|imv}}) argument.  This should (hopefully) be temporary, until I figure out how to pass multiple arguments (without including everything else).}}&lt;br /&gt;
&lt;br /&gt;
{{Warning|These were found by going backward; start with a complicated program and as restricted as possible sandbox, allowing more till the program appears to work.  Because of this, complicated and sensitive programs (for example: {{Pkg|firefox|arch=}} and {{Pkg|keepassxc|arch=}}) may be missing some things they need, which might lead to &#039;&#039;&#039;LESS SECURITY&#039;&#039;&#039;, &#039;&#039;&#039;LESS PRIVACY&#039;&#039;&#039; and &#039;&#039;&#039;DATA LOSS&#039;&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
{{Note|&lt;br /&gt;
* This page assumes you have already read [[Bubblewrap]].&lt;br /&gt;
* To try and avoid duplicates everything will be explained for [[Firefox]] and only when it differs (non obviously) for everything else.&lt;br /&gt;
* Where applicable, this assumes: [[Wayland]] only + [[PipeWire]].&lt;br /&gt;
: If Wayland is needed, make sure you have dealt with [[Wayland#XDG_RUNTIME_DIR|XDG_RUNTIME_DIR]].}}&lt;br /&gt;
&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
== Firefox ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-firefox|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# Firefox wrapped in bwrap with network access.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CACHE_HOME{{=}}&amp;quot;${XDG_CACHE_HOME:-$HOME/.cache}&amp;quot;&lt;br /&gt;
XDG_DATA_HOME{{=}}&amp;quot;${XDG_DATA_HOME:-$HOME/.local/share}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CACHE_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mkdir -p -m 0700 &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --share-net \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CACHE_HOME &amp;quot;$NEW_XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --hostname localhost \&lt;br /&gt;
  --dev /dev/ \&lt;br /&gt;
  --ro-bind-try /etc/firefox/policies/policies.json /etc/firefox/policies/policies.json \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --ro-bind /etc/resolv.conf /etc/resolv.conf \&lt;br /&gt;
  --bind-try &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mozilla/&amp;quot; \&lt;br /&gt;
  --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
  --bind-try &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --proc /proc/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/glib-2.0/ /usr/share/glib-2.0/ \&lt;br /&gt;
  --ro-bind /usr/share/icons/ /usr/share/icons/ \&lt;br /&gt;
  --ro-bind /usr/share/icu/ /usr/share/icu/ \&lt;br /&gt;
  --ro-bind /usr/share/mime/ /usr/share/mime/ \&lt;br /&gt;
  /usr/lib/firefox/firefox}}&lt;br /&gt;
&lt;br /&gt;
 set -u&lt;br /&gt;
If the shell tries to expand an unset parameter, it will error (with a&lt;br /&gt;
few exceptions).&lt;br /&gt;
&lt;br /&gt;
 XDG_CACHE_HOME=&amp;quot;${XDG_CACHE_HOME:-$HOME/.cache}&amp;quot;&lt;br /&gt;
 XDG_DATA_HOME=&amp;quot;${XDG_DATA_HOME:-$HOME/.local/share}&amp;quot;&lt;br /&gt;
Take value if already set, else fallback to the [https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html XDG] default.&lt;br /&gt;
&lt;br /&gt;
 NEW_HOME=&#039;/home/user&#039;&lt;br /&gt;
User to appear as.&lt;br /&gt;
&lt;br /&gt;
 NEW_XDG_CACHE_HOME=&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
{{Path|&amp;quot;$XDG_CACHE_HOME&amp;quot;}} for the new user.&lt;br /&gt;
&lt;br /&gt;
 mkdir -p -m 0700 &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot;&lt;br /&gt;
Make sure the new (real) home for Firefox data exist.&lt;br /&gt;
&lt;br /&gt;
 --unshare-all \&lt;br /&gt;
Unshare all possible [https://en.wikipedia.org/wiki/Linux_namespaces namespaces].&lt;br /&gt;
&lt;br /&gt;
 --share-net \&lt;br /&gt;
Retain the network namespace.&lt;br /&gt;
&lt;br /&gt;
 --new-session \&lt;br /&gt;
New terminal session for the sandbox.&lt;br /&gt;
&lt;br /&gt;
 --die-with-parent \&lt;br /&gt;
Child process dies when {{Ic|bwrap}} parent dies.&lt;br /&gt;
&lt;br /&gt;
 --clearenv \&lt;br /&gt;
Unset all environment variables (except for {{Path|&amp;quot;$PWD&amp;quot;}}).&lt;br /&gt;
&lt;br /&gt;
 --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
Pass the path to {{Path|&amp;quot;$NEW_HOME&amp;quot;}} for {{Path|&amp;quot;$HOME&amp;quot;}}.&lt;br /&gt;
&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
Specify the Wayland display to run clients on.&lt;br /&gt;
&lt;br /&gt;
 --setenv XDG_CACHE_HOME &amp;quot;$NEW_XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
User-specific non-essential (cached) data.&lt;br /&gt;
&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
User-specific non-essential runtime files and other file objects.&lt;br /&gt;
&lt;br /&gt;
 --hostname localhost \&lt;br /&gt;
Use custom hostname in the sandbox.&lt;br /&gt;
&lt;br /&gt;
 --dev /dev/ \&lt;br /&gt;
New devtmpfs, access to special or device files.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind-try /etc/firefox/policies/policies.json /etc/firefox/policies/policies.json \&lt;br /&gt;
Set Firefox [https://mozilla.github.io/policy-templates/ policies], if found.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
System font configuration directory.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /etc/resolv.conf /etc/resolv.conf \&lt;br /&gt;
Needed for DNS resolution.&lt;br /&gt;
&lt;br /&gt;
 --bind-try &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mozilla/&amp;quot; \&lt;br /&gt;
Per-user Mozilla cache.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 XDG_CACHE_HOME=&amp;quot;${XDG_CACHE_HOME:-$HOME/.cache}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;XDG_CONFIG_HOME &amp;quot;${XDG_CONFIG_HOME:-$HOME/.config}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 XDG_DATA_HOME=&amp;quot;${XDG_DATA_HOME:-$HOME/.local/share}&amp;quot;&lt;br /&gt;
 ...&lt;br /&gt;
 NEW_XDG_CACHE_HOME=&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;NEW_XDG_CONFIG_HOME=&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --bind-try &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mozilla/&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/fontconfig/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) Per-user font configuration directory.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 XDG_CACHE_HOME=&amp;quot;${XDG_CACHE_HOME:-$HOME/.cache}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;XDG_CONFIG_HOME &amp;quot;${XDG_CONFIG_HOME:-$HOME/.config}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 XDG_DATA_HOME=&amp;quot;${XDG_DATA_HOME:-$HOME/.local/share}&amp;quot;&lt;br /&gt;
 ...&lt;br /&gt;
 NEW_XDG_CACHE_HOME=&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;NEW_XDG_CONFIG_HOME=&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --bind-try &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/user-dirs.dirs&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/user-dirs.dirs&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) If you modify &amp;quot;well known&amp;quot; user directories, like&lt;br /&gt;
{{Path|~/Downloads/}}, you need this to have Firefox pick it up.&lt;br /&gt;
&lt;br /&gt;
{{Note|If you use {{Path|&amp;quot;${XDG_CONFIG_HOME}/user-dirs.dirs&amp;quot;}} you should also add the corresponding path(s).&lt;br /&gt;
For example if you set {{Path|XDG_DOWNLOAD_DIR}} to&lt;br /&gt;
{{Path|&amp;quot;${HOME}/downloads/&amp;quot;}} you would also add:&lt;br /&gt;
  ...&lt;br /&gt;
  --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
  &#039;&#039;&#039;--bind-try &amp;quot;${HOME}/downloads/&amp;quot; &amp;quot;${NEW_HOME}/downloads/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
{{Path|&amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot;}} is the location of Firefox data.  Shown to Firefox as {{Path|&amp;quot;${NEW_HOME}/.mozilla/&amp;quot;}}.&lt;br /&gt;
&lt;br /&gt;
{{Note|This has the added benefit of getting {{Path|~/.mozilla/}} out of your {{Path|&amp;quot;$HOME&amp;quot;}}, and conforming more to XDG.  This may one day not be necessary: [https://bugzilla.mozilla.org/show_bug.cgi?id{{=}}259356 Support for the Freedesktop.org XDG Base Directory Specification (2004-09-14)].}}&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 NEW_XDG_CACHE_HOME=&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;NEW_XDG_DATA_HOME=&amp;quot;${NEW_HOME}${XDG_DATA_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--setenv XDG_DATA_HOME &amp;quot;$NEW_XDG_DATA_HOME&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind-try &amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot; &amp;quot;${NEW_XDG_DATA_HOME}/fonts/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --bind-try &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) Per-user directory scanned for font files.&lt;br /&gt;
&lt;br /&gt;
 --bind-try &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
Default {{Path|~/Downloads/}} directory.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
 --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
 --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
 --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
 --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
Shared libraries.&lt;br /&gt;
&lt;br /&gt;
 --proc /proc/ \&lt;br /&gt;
New procfs, provides information about running processes and the kernel.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
Bind the Wayland socket file.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
Object files and libraries.&lt;br /&gt;
&lt;br /&gt;
{{Note|It is not worth the time to limit this, the churn is too great.}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
XKB is a keyboard keymap support library.&lt;br /&gt;
&lt;br /&gt;
{{Note|Even tho the path has {{Path|*/X11/*}} Wayland uses it too.}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
Font presets.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
Global directory scanned for font files.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/glib-2.0/ /usr/share/glib-2.0/ \&lt;br /&gt;
Needed for &amp;quot;Save Page As…&amp;quot;, &amp;quot;Export|Import Bookmarks File&amp;quot;, among others.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/icons/ /usr/share/icons/ \&lt;br /&gt;
Global icons directory.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/icu/ /usr/share/icu/ \&lt;br /&gt;
International Components for Unicode (ICU) provides support for Unicode&lt;br /&gt;
and globalization.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 --ro-bind /usr/share/icu/ /usr/share/icu/ \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind /usr/share/libdrm/ /usr/share/libdrm/ \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind /usr/share/mime/ /usr/share/mime/ \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) Direct Rendering Manager (DRM), Linux kernel subsystem for&lt;br /&gt;
interfacing with GPUs of video cards.  Programs can use this to have the&lt;br /&gt;
GPU do hardware-accelerated 3D rendering and video decoding.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/mime/ /usr/share/mime/ \&lt;br /&gt;
Global XDG MIME directory.&lt;br /&gt;
&lt;br /&gt;
 /usr/lib/firefox/firefox&lt;br /&gt;
Call Firefox.&lt;br /&gt;
&lt;br /&gt;
{{Tip|If you use multiple profiles you can have:&lt;br /&gt;
 /usr/lib/firefox/firefox -P &amp;quot;$@&amp;quot;&lt;br /&gt;
this will allow you to pass a profile name and go into that specific one or not pass anything and get prompted for which to choose.}}&lt;br /&gt;
&lt;br /&gt;
=== PipeWire audio ===&lt;br /&gt;
&lt;br /&gt;
{{Todo|}}&lt;br /&gt;
&lt;br /&gt;
=== Pulse audio ===&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 --proc /proc/ \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind &amp;quot;${XDG_RUNTIME_DIR}/pulse/&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/pulse/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) Pulse audio.&lt;br /&gt;
&lt;br /&gt;
=== Optional(?) stuff ===&lt;br /&gt;
&lt;br /&gt;
{{Draft|Are these needed?}}&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 --proc /proc/ \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind /sys/bus/pci/ /sys/bus/pci/ \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
Information about PCI bus type.&lt;br /&gt;
&lt;br /&gt;
Without this you get&lt;br /&gt;
 Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: cannot access /sys/bus/pci (t=0.177033) [GFX1-]: glxtest: cannot access /sys/bus/pci&lt;br /&gt;
but it still seems to work.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 --proc /proc/ \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
Contains a filesystem representation of the kernel device tree.&lt;br /&gt;
&lt;br /&gt;
With {{Ic|--ro-bind /sys/bus/pci/ /sys/bus/pci/ \}} but without this you get:&lt;br /&gt;
 Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: ManageChildProcess failed&lt;br /&gt;
  (t=0.189558) [GFX1-]: glxtest: ManageChildProcess failed&lt;br /&gt;
&lt;br /&gt;
 Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: ManageChildProcess failed&lt;br /&gt;
  (t=0.189558) |[1][GFX1-]: No GPUs detected via PCI&lt;br /&gt;
  (t=0.18958) [GFX1-]: No GPUs detected via PCI&lt;br /&gt;
but it still seems to work.&lt;br /&gt;
&lt;br /&gt;
== imv ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-imv|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# imv wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:-$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --ro-bind /bin/sh /bin/sh \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
  --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/libexec/imv-wayland /usr/libexec/imv-wayland \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
  /usr/libexec/imv-wayland &amp;quot;${1:-./}&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /bin/sh /bin/sh \&lt;br /&gt;
Needed to use {{Path|config}} and have various information in the window&lt;br /&gt;
title.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;XDG_CACHE_HOME{{=}}&amp;quot;${XDG_CACHE_HOME:-$HOME/.cache}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:-$HOME/.config}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;XDG_DATA_HOME{{=}}&amp;quot;${XDG_DATA_HOME:-$HOME/.local/share}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--setenv XDG_CACHE_HOME &amp;quot;$XDG_CACHE_HOME&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --setenv XDG_CONFIG_HOME &amp;quot;$XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--setenv XDG_DATA_HOME &amp;quot;$XDG_DATA_HOME&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind /etc/fonts/ /etc/fonts/ \&#039;&#039;&#039;&lt;br /&gt;
 &#039;&#039;&#039;--bind-try &amp;quot;${XDG_CACHE_HOME}/fontconfig/&amp;quot; &amp;quot;${XDG_CACHE_HOME}/fontconfig/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind-try &amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot; &amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
 ...&lt;br /&gt;
 --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind /usr/share/fonts/ /usr/share/fonts/ \&#039;&#039;&#039;&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind /usr/share/icu/ /usr/share/icu/ \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) To use commands in {{Ic|imv}}.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
Access to character devices.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
Access to PCI resources.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
Get the absolute pathname using {{Ic|realpath}}, so you can pass a&lt;br /&gt;
relative argument and still bind the argument.  If you don&#039;t pass in&lt;br /&gt;
anything it will default to {{Path|./}}, the current directory.&lt;br /&gt;
&lt;br /&gt;
{{Warning|If you don&#039;t pass anything and it defaults to the current directory, it will have &#039;&#039;&#039;everything&#039;&#039;&#039; under that directory shown to {{Ic|imv}}, recursively.}}&lt;br /&gt;
&lt;br /&gt;
== KeePassXC ==&lt;br /&gt;
&lt;br /&gt;
{{Note|I only use the bare minimum functionality, so functionality you need is probably missing.  If you use functionality not here, your contribution will be most appreciated.  To kick things off: {{Ic|Unable to initialize libusb. USB devices may not be detected properly.}} can be silenced with {{Ic|--dev-bind /dev/bus/usb/ /dev/bus/usb/ \}}.}}&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-keepassxc|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# keepassxc wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:-$HOME/.config}&amp;quot;&lt;br /&gt;
PASSWORD_DATABASE{{=}}&amp;quot;${HOME}/password database&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CONFIG_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
NEW_PASSWORD_DATABASE{{=}}&amp;quot;${NEW_HOME}${PASSWORD_DATABASE#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mkdir -p -m 0700 &amp;quot;$PASSWORD_DATABASE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --setenv XDG_SESSION_TYPE &amp;quot;$XDG_SESSION_TYPE&amp;quot; \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --bind-try &amp;quot;${XDG_CONFIG_HOME}/keepassxc/&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/keepassxc/&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libssl.so.3 /lib/libssl.so.3 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind /usr/bin/keepassxc /usr/bin/keepassxc \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/ /usr/share/X11/ \&lt;br /&gt;
  --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/keepassxc/ /usr/share/keepassxc/ \&lt;br /&gt;
  --bind &amp;quot;$PASSWORD_DATABASE/&amp;quot; &amp;quot;$NEW_PASSWORD_DATABASE/&amp;quot; \&lt;br /&gt;
  /usr/bin/keepassxc &amp;quot;$@&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 PASSWORD_DATABASE=&amp;quot;${HOME}/password database&amp;quot;&lt;br /&gt;
Directory containing your {{Pkg|keepassxc|arch=}} password database.&lt;br /&gt;
&lt;br /&gt;
{{Tip|This is almost certainly not where &#039;&#039;&#039;your&#039;&#039;&#039; database is located.  You will need to change it to where you put your password database.}}&lt;br /&gt;
&lt;br /&gt;
 --setenv XDG_SESSION_TYPE &amp;quot;$XDG_SESSION_TYPE&amp;quot; \&lt;br /&gt;
Session type, since we are assuming Wayland only, this will be &amp;quot;wayland&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
Access to character devices.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
Access to PCI resources.&lt;br /&gt;
&lt;br /&gt;
 --bind &amp;quot;$PASSWORD_DATABASE/&amp;quot; &amp;quot;$NEW_PASSWORD_DATABASE/&amp;quot; \&lt;br /&gt;
Bind password database.&lt;br /&gt;
&lt;br /&gt;
== mpv ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-mpv|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# mpv wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; !{{=}} 1 ]&lt;br /&gt;
then&lt;br /&gt;
	printf &#039;Run mpv wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
  $ bwrap-mpv VIDEO\n&#039;&lt;br /&gt;
	exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
XDG_CACHE_HOME{{=}}&amp;quot;${XDG_CACHE_HOME:-$HOME/.cache}&amp;quot;&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:-$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CACHE_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
NEW_XDG_CONFIG_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CACHE_HOME &amp;quot;$NEW_XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --hostname localhost \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --ro-bind /etc/mpv/ /etc/mpv/ \&lt;br /&gt;
  --bind-try &amp;quot;${XDG_CACHE_HOME}/mesa_shader_cache/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mesa_shader_cache/&amp;quot; \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libacl.so.1 /lib/libacl.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libssl.so.3 /lib/libssl.so.3 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --proc /proc/ \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/pipewire-0&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/pipewire-0&amp;quot; \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/bin/mpv /usr/bin/mpv \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/pipewire/ /usr/share/pipewire/ \&lt;br /&gt;
  --ro-bind &amp;quot;$1&amp;quot; &amp;quot;$(realpath &amp;quot;$1&amp;quot;)&amp;quot; \&lt;br /&gt;
  /usr/bin/mpv \&lt;br /&gt;
    --player-operation-mode{{=}}pseudo-gui \&lt;br /&gt;
    --title{{=}}&#039;bwrap {{!}} ${media-title}&#039; \&lt;br /&gt;
    &amp;quot;$1&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
Access to character devices.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
Access to PCI resources.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;$1&amp;quot; &amp;quot;$(realpath &amp;quot;$1&amp;quot;)&amp;quot; \&lt;br /&gt;
Get the absolute pathname using {{Ic|realpath}}, so you can pass a&lt;br /&gt;
relative argument and still bind the argument.&lt;br /&gt;
&lt;br /&gt;
 --player-operation-mode=pseudo-gui \&lt;br /&gt;
Because {{Ic|--new-session}} is used, this is needed to have a way to&lt;br /&gt;
control {{Ic|mpv}} when it would otherwise not show a GUI.&lt;br /&gt;
&lt;br /&gt;
{{Tip|If you followed [[Bubblewrap#.desktop_integration]], you should remove it from {{Path|&amp;quot;${XDG_DATA_HOME}/applications/bwrap-mpv.desktop&amp;quot;}}.}}&lt;br /&gt;
&lt;br /&gt;
 --title=&#039;bwrap | ${media-title}&#039; \&lt;br /&gt;
Set the window title, showing at a glance that you are using {{Ic|bwrap}}.&lt;br /&gt;
&lt;br /&gt;
=== mpv-net ===&lt;br /&gt;
&lt;br /&gt;
If you want to use {{Ic|mpv}} to stream over the Internet, you will need&lt;br /&gt;
a few things more.&lt;br /&gt;
&lt;br /&gt;
{{Tip|You can use both {{Ic|bwrap-mpv}} and {{Ic|bwrap-mpv-net}}.  {{Ic|bwrap-mpv}} for local stuff and {{Ic|bwrap-mpv-net}} for watching over the Internet.}}&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-mpv-net|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# mpv wrapped in bwrap with network access.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CACHE_HOME{{=}}&amp;quot;${XDG_CACHE_HOME:-$HOME/.cache}&amp;quot;&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:-$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CACHE_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
NEW_XDG_CONFIG_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --share-net \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv PATH /usr/bin/ \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CACHE_HOME &amp;quot;$NEW_XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --hostname localhost \&lt;br /&gt;
  --dev /dev/ \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --ro-bind /etc/mpv/ /etc/mpv/ \&lt;br /&gt;
  --ro-bind /etc/resolv.conf /etc/resolv.conf \&lt;br /&gt;
  --ro-bind /etc/ssl/certs/ /etc/ssl/certs/ \&lt;br /&gt;
  --bind-try &amp;quot;${XDG_CACHE_HOME}/mesa_shader_cache/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mesa_shader_cache/&amp;quot; \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libacl.so.1 /lib/libacl.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libssl.so.3 /lib/libssl.so.3 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --proc /proc/ \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/pipewire-0&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/pipewire-0&amp;quot; \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/bin/mpv /usr/bin/mpv \&lt;br /&gt;
  --ro-bind /usr/bin/python3 /usr/bin/python3 \&lt;br /&gt;
  --ro-bind /usr/bin/yt-dlp /usr/bin/yt-dlp \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/pipewire/ /usr/share/pipewire/ \&lt;br /&gt;
  /usr/bin/mpv \&lt;br /&gt;
    --player-operation-mode{{=}}pseudo-gui \&lt;br /&gt;
    --title{{=}}&#039;bwrap {{!}} ${media-title}&#039; \&lt;br /&gt;
    &amp;quot;$@&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 --setenv PATH /usr/bin/ \&lt;br /&gt;
{{Todo|Document why this is needed.}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /etc/ssl/certs/ /etc/ssl/certs/ \&lt;br /&gt;
Certificate authorities that are &#039;&#039;trusted&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
Access to character devices.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
Access to PCI resources.&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;$@&amp;quot;&lt;br /&gt;
This is so you can pass more options to {{Ic|bwrap-mpv-net}}, for example:&lt;br /&gt;
 $ bwrap-mpv-net --video=no --sub=no &#039;URL1&#039; &#039;URL2&#039;&lt;br /&gt;
&lt;br /&gt;
=== Pulse audio ===&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/pulse&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/pulse&amp;quot; \&lt;br /&gt;
Pulse audio.&lt;br /&gt;
&lt;br /&gt;
=== Screenshots ===&lt;br /&gt;
&lt;br /&gt;
The default screenshots directory is {{Path|&amp;quot;$XDG_DESKTOP_DIR&amp;quot;}} (which is&lt;br /&gt;
{{Path|&amp;quot;${HOME}/Desktop/&amp;quot;}}, which will fallback to {{Path|&amp;quot;$HOME/&amp;quot;}} if&lt;br /&gt;
{{Path|&amp;quot;${HOME}/Desktop/&amp;quot;}} doesn&#039;t exist).  That means that by default&lt;br /&gt;
{{Ic|bwrap-mpv[-net]}} won&#039;t allow screenshots unless you change a few things.&lt;br /&gt;
Do the following to allow an XDG approved screenshots directory:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 XDG_CONFIG_HOME=&amp;quot;${XDG_CONFIG_HOME:-$HOME/.config}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;XDG_DATA_HOME=&amp;quot;${XDG_DATA_HOME:-$HOME/.local/share}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
 NEW_XDG_CONFIG_HOME=&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;NEW_XDG_DATA_HOME=&amp;quot;${NEW_HOME}${XDG_DATA_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;mkdir -p -m 0700 &amp;quot;${XDG_DATA_HOME}/mpv/&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
 --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--setenv XDG_DATA_HOME &amp;quot;$NEW_XDG_DATA_HOME&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--bind &amp;quot;${XDG_DATA_HOME}/mpv/&amp;quot; &amp;quot;${NEW_XDG_DATA_HOME}/mpv/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
 ...&lt;br /&gt;
Now make {{Ic|mpv}} use that directory:&lt;br /&gt;
&lt;br /&gt;
{{Cat|&amp;quot;${XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot;|&amp;lt;nowiki&amp;gt;...&lt;br /&gt;
# Something like this, change to match your &amp;quot;$XDG_DATA_HOME&amp;quot;&lt;br /&gt;
screenshot-template=&amp;quot;~/.local/share/mpv/screenshots/%F [%p] %02n&amp;quot;&lt;br /&gt;
...&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
== yt-dlp ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-yt-dlp|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# yt-dlp wrapped in bwrap with network access.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:-$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CONFIG_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mkdir -p -m 0700 &amp;quot;${HOME}/Downloads/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --share-net \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --hostname localhost \&lt;br /&gt;
  --ro-bind /etc/resolv.conf /etc/resolv.conf \&lt;br /&gt;
  --ro-bind /etc/ssl/certs/ /etc/ssl/certs/ \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/yt-dlp/config&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/yt-dlp/config&amp;quot; \&lt;br /&gt;
  --bind &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libssl.so.3 /lib/libssl.so.3 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind /usr/bin/ffmpeg /usr/bin/ffmpeg \&lt;br /&gt;
  --ro-bind /usr/bin/python3 /usr/bin/python3 \&lt;br /&gt;
  --ro-bind /usr/bin/yt-dlp /usr/bin/yt-dlp \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  /usr/bin/yt-dlp &amp;quot;$@&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 --bind &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
Directory for writing the files.  This should match {{Ic|--output}} that&lt;br /&gt;
is either in {{Path|&amp;quot;${XDG_CONFIG_HOME}/yt-dlp/config&amp;quot;}} or passed on&lt;br /&gt;
the command line.&lt;br /&gt;
&lt;br /&gt;
 /usr/bin/yt-dlp &amp;quot;$@&amp;quot;&lt;br /&gt;
This is so you can pass more options to {{Ic|bwrap-yt-dlp}}, for example:&lt;br /&gt;
 $ bwrap-yt-dlp --no-playlist &#039;URL1&#039; &#039;URL2&#039;&lt;br /&gt;
&lt;br /&gt;
== zathura ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-zathura|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# zathura wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; !{{=}} 1 ]&lt;br /&gt;
then&lt;br /&gt;
	printf &#039;Run zathura wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
  $ bwrap-zathura PDF\n&#039;&lt;br /&gt;
	exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:-$HOME/.config}&amp;quot;&lt;br /&gt;
XDG_DATA_HOME{{=}}&amp;quot;${XDG_DATA_HOME:-$HOME/.local/share}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mkdir -p -m 0700 &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$HOME&amp;quot; \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_DATA_HOME &amp;quot;$XDG_DATA_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/zathura/zathurarc&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/zathura/zathurarc&amp;quot; \&lt;br /&gt;
  --bind &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot; &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
  --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/bin/zathura /usr/bin/zathura \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/misc/magic.mgc /usr/share/misc/magic.mgc \&lt;br /&gt;
  --ro-bind &amp;quot;$1&amp;quot; &amp;quot;$(realpath &amp;quot;$1&amp;quot;)&amp;quot; \&lt;br /&gt;
  /usr/bin/zathura &amp;quot;$1&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 mkdir -p -m 0700 &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot;&lt;br /&gt;
Have to premake the directory for {{Ic|zathura}} data.&lt;br /&gt;
&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot; &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot; \&lt;br /&gt;
Allow writing of: bookmarks, history, input history.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/misc/magic.mgc /usr/share/misc/magic.mgc \&lt;br /&gt;
Used for identifying what type a file should be.  Read the&lt;br /&gt;
{{Ic|file(1)}} man page for more information.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;$1&amp;quot; &amp;quot;$(realpath &amp;quot;$1&amp;quot;)&amp;quot; \&lt;br /&gt;
Get the absolute pathname using {{Ic|realpath}}, so you can pass a&lt;br /&gt;
relative argument and still bind the argument.&lt;br /&gt;
&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Bubblewrap/Examples&amp;diff=29365</id>
		<title>Bubblewrap/Examples</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Bubblewrap/Examples&amp;diff=29365"/>
		<updated>2025-03-18T22:50:59Z</updated>

		<summary type="html">&lt;p&gt;Encode: Firefox: allow policies, if found&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|Someone more experienced needs to look over this.}}&lt;br /&gt;
&lt;br /&gt;
{{Todo|&lt;br /&gt;
* Since bubblewrap can make use of [https://en.wikipedia.org/wiki/Seccomp seccomp], restrictive versions should be added.&lt;br /&gt;
* {{Ic|imv}}, {{Ic|mpv}} and {{Ic|zathura}} currently only accept 1 mandatory (except {{Ic|imv}}) argument.  This should (hopefully) be temporary, until I figure out how to pass multiple arguments (without including everything else).}}&lt;br /&gt;
&lt;br /&gt;
{{Warning|These were found by going backward; start with a complicated program and as restricted as possible sandbox, allowing more till the program appears to work.  Because of this, complicated and sensitive programs (for example: {{Pkg|firefox|arch=}} and {{Pkg|keepassxc|arch=}}) may be missing some things they need, which might lead to &#039;&#039;&#039;LESS SECURITY&#039;&#039;&#039;, &#039;&#039;&#039;LESS PRIVACY&#039;&#039;&#039; and &#039;&#039;&#039;DATA LOSS&#039;&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
{{Note|&lt;br /&gt;
* This page assumes you have already read [[Bubblewrap]].&lt;br /&gt;
* To try and avoid duplicates everything will be explained for [[Firefox]] and only when it differs (non obviously) for everything else.&lt;br /&gt;
* Where applicable, this assumes: [[Wayland]] only + [[PipeWire]].&lt;br /&gt;
: If Wayland is needed, make sure you have dealt with [[Wayland#XDG_RUNTIME_DIR|XDG_RUNTIME_DIR]].}}&lt;br /&gt;
&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
== Firefox ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-firefox|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# Firefox wrapped in bwrap with network access.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CACHE_HOME{{=}}&amp;quot;${XDG_CACHE_HOME:-$HOME/.cache}&amp;quot;&lt;br /&gt;
XDG_DATA_HOME{{=}}&amp;quot;${XDG_DATA_HOME:-$HOME/.local/share}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CACHE_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --share-net \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CACHE_HOME &amp;quot;$NEW_XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --hostname localhost \&lt;br /&gt;
  --dev /dev/ \&lt;br /&gt;
  --ro-bind-try /etc/firefox/policies/policies.json /etc/firefox/policies/policies.json \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --ro-bind /etc/resolv.conf /etc/resolv.conf \&lt;br /&gt;
  --bind-try &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mozilla/&amp;quot; \&lt;br /&gt;
  --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
  --bind-try &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --proc /proc/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/glib-2.0/ /usr/share/glib-2.0/ \&lt;br /&gt;
  --ro-bind /usr/share/icons/ /usr/share/icons/ \&lt;br /&gt;
  --ro-bind /usr/share/icu/ /usr/share/icu/ \&lt;br /&gt;
  --ro-bind /usr/share/mime/ /usr/share/mime/ \&lt;br /&gt;
  /usr/lib/firefox/firefox}}&lt;br /&gt;
&lt;br /&gt;
 set -u&lt;br /&gt;
If the shell tries to expand an unset parameter, it will error (with a&lt;br /&gt;
few exceptions).&lt;br /&gt;
&lt;br /&gt;
 XDG_CACHE_HOME=&amp;quot;${XDG_CACHE_HOME:-$HOME/.cache}&amp;quot;&lt;br /&gt;
 XDG_DATA_HOME=&amp;quot;${XDG_DATA_HOME:-$HOME/.local/share}&amp;quot;&lt;br /&gt;
Take value if already set, else fallback to the [https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html XDG] default.&lt;br /&gt;
&lt;br /&gt;
 NEW_HOME=&#039;/home/user&#039;&lt;br /&gt;
User to appear as.&lt;br /&gt;
&lt;br /&gt;
 NEW_XDG_CACHE_HOME=&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
{{Path|&amp;quot;$XDG_CACHE_HOME&amp;quot;}} for the new user.&lt;br /&gt;
&lt;br /&gt;
 mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot;&lt;br /&gt;
Make sure the new (real) home for Firefox data exist.&lt;br /&gt;
&lt;br /&gt;
 --unshare-all \&lt;br /&gt;
Unshare all possible [https://en.wikipedia.org/wiki/Linux_namespaces namespaces].&lt;br /&gt;
&lt;br /&gt;
 --share-net \&lt;br /&gt;
Retain the network namespace.&lt;br /&gt;
&lt;br /&gt;
 --new-session \&lt;br /&gt;
New terminal session for the sandbox.&lt;br /&gt;
&lt;br /&gt;
 --die-with-parent \&lt;br /&gt;
Child process dies when {{Ic|bwrap}} parent dies.&lt;br /&gt;
&lt;br /&gt;
 --clearenv \&lt;br /&gt;
Unset all environment variables (except for {{Path|&amp;quot;$PWD&amp;quot;}}).&lt;br /&gt;
&lt;br /&gt;
 --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
Pass the path to {{Path|&amp;quot;$NEW_HOME&amp;quot;}} for {{Path|&amp;quot;$HOME&amp;quot;}}.&lt;br /&gt;
&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
Specify the Wayland display to run clients on.&lt;br /&gt;
&lt;br /&gt;
 --setenv XDG_CACHE_HOME &amp;quot;$NEW_XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
User-specific non-essential (cached) data.&lt;br /&gt;
&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
User-specific non-essential runtime files and other file objects.&lt;br /&gt;
&lt;br /&gt;
 --hostname localhost \&lt;br /&gt;
Use custom hostname in the sandbox.&lt;br /&gt;
&lt;br /&gt;
 --dev /dev/ \&lt;br /&gt;
New devtmpfs, access to special or device files.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind-try /etc/firefox/policies/policies.json /etc/firefox/policies/policies.json \&lt;br /&gt;
Set Firefox [https://mozilla.github.io/policy-templates/ policies], if found.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
System font configuration directory.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /etc/resolv.conf /etc/resolv.conf \&lt;br /&gt;
Needed for DNS resolution.&lt;br /&gt;
&lt;br /&gt;
 --bind-try &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mozilla/&amp;quot; \&lt;br /&gt;
Per-user Mozilla cache.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 XDG_CACHE_HOME=&amp;quot;${XDG_CACHE_HOME:-$HOME/.cache}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;XDG_CONFIG_HOME &amp;quot;${XDG_CONFIG_HOME:-$HOME/.config}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 XDG_DATA_HOME=&amp;quot;${XDG_DATA_HOME:-$HOME/.local/share}&amp;quot;&lt;br /&gt;
 ...&lt;br /&gt;
 NEW_XDG_CACHE_HOME=&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;NEW_XDG_CONFIG_HOME=&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --bind-try &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mozilla/&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/fontconfig/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) Per-user font configuration directory.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 XDG_CACHE_HOME=&amp;quot;${XDG_CACHE_HOME:-$HOME/.cache}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;XDG_CONFIG_HOME &amp;quot;${XDG_CONFIG_HOME:-$HOME/.config}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 XDG_DATA_HOME=&amp;quot;${XDG_DATA_HOME:-$HOME/.local/share}&amp;quot;&lt;br /&gt;
 ...&lt;br /&gt;
 NEW_XDG_CACHE_HOME=&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;NEW_XDG_CONFIG_HOME=&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --bind-try &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/user-dirs.dirs&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/user-dirs.dirs&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) If you modify &amp;quot;well known&amp;quot; user directories, like&lt;br /&gt;
{{Path|~/Downloads/}}, you need this to have Firefox pick it up.&lt;br /&gt;
&lt;br /&gt;
{{Note|If you use {{Path|&amp;quot;${XDG_CONFIG_HOME}/user-dirs.dirs&amp;quot;}} you should also add the corresponding path(s).&lt;br /&gt;
For example if you set {{Path|XDG_DOWNLOAD_DIR}} to&lt;br /&gt;
{{Path|&amp;quot;${HOME}/downloads/&amp;quot;}} you would also add:&lt;br /&gt;
  ...&lt;br /&gt;
  --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
  &#039;&#039;&#039;--bind-try &amp;quot;${HOME}/downloads/&amp;quot; &amp;quot;${NEW_HOME}/downloads/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
{{Path|&amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot;}} is the location of Firefox data.  Shown to Firefox as {{Path|&amp;quot;${NEW_HOME}/.mozilla/&amp;quot;}}.&lt;br /&gt;
&lt;br /&gt;
{{Note|This has the added benefit of getting {{Path|~/.mozilla/}} out of your {{Path|&amp;quot;$HOME&amp;quot;}}, and conforming more to XDG.  This may one day not be necessary: [https://bugzilla.mozilla.org/show_bug.cgi?id{{=}}259356 Support for the Freedesktop.org XDG Base Directory Specification (2004-09-14)].}}&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 NEW_XDG_CACHE_HOME=&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;NEW_XDG_DATA_HOME=&amp;quot;${NEW_HOME}${XDG_DATA_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--setenv XDG_DATA_HOME &amp;quot;$NEW_XDG_DATA_HOME&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind-try &amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot; &amp;quot;${NEW_XDG_DATA_HOME}/fonts/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --bind-try &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) Per-user directory scanned for font files.&lt;br /&gt;
&lt;br /&gt;
 --bind-try &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
Default {{Path|~/Downloads/}} directory.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
 --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
 --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
 --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
 --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
Shared libraries.&lt;br /&gt;
&lt;br /&gt;
 --proc /proc/ \&lt;br /&gt;
New procfs, provides information about running processes and the kernel.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
Bind the Wayland socket file.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
Object files and libraries.&lt;br /&gt;
&lt;br /&gt;
{{Note|It is not worth the time to limit this, the churn is too great.}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
XKB is a keyboard keymap support library.&lt;br /&gt;
&lt;br /&gt;
{{Note|Even tho the path has {{Path|*/X11/*}} Wayland uses it too.}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
Font presets.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
Global directory scanned for font files.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/glib-2.0/ /usr/share/glib-2.0/ \&lt;br /&gt;
Needed for &amp;quot;Save Page As…&amp;quot;, &amp;quot;Export|Import Bookmarks File&amp;quot;, among others.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/icons/ /usr/share/icons/ \&lt;br /&gt;
Global icons directory.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/icu/ /usr/share/icu/ \&lt;br /&gt;
International Components for Unicode (ICU) provides support for Unicode&lt;br /&gt;
and globalization.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 --ro-bind /usr/share/icu/ /usr/share/icu/ \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind /usr/share/libdrm/ /usr/share/libdrm/ \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind /usr/share/mime/ /usr/share/mime/ \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) Direct Rendering Manager (DRM), Linux kernel subsystem for&lt;br /&gt;
interfacing with GPUs of video cards.  Programs can use this to have the&lt;br /&gt;
GPU do hardware-accelerated 3D rendering and video decoding.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/mime/ /usr/share/mime/ \&lt;br /&gt;
Global XDG MIME directory.&lt;br /&gt;
&lt;br /&gt;
 /usr/lib/firefox/firefox&lt;br /&gt;
Call Firefox.&lt;br /&gt;
&lt;br /&gt;
{{Tip|If you use multiple profiles you can have:&lt;br /&gt;
 /usr/lib/firefox/firefox -P &amp;quot;$@&amp;quot;&lt;br /&gt;
this will allow you to pass a profile name and go into that specific one or not pass anything and get prompted for which to choose.}}&lt;br /&gt;
&lt;br /&gt;
=== PipeWire audio ===&lt;br /&gt;
&lt;br /&gt;
{{Todo|}}&lt;br /&gt;
&lt;br /&gt;
=== Pulse audio ===&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 --proc /proc/ \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind &amp;quot;${XDG_RUNTIME_DIR}/pulse/&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/pulse/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) Pulse audio.&lt;br /&gt;
&lt;br /&gt;
=== Optional(?) stuff ===&lt;br /&gt;
&lt;br /&gt;
{{Draft|Are these needed?}}&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 --proc /proc/ \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind /sys/bus/pci/ /sys/bus/pci/ \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
Information about PCI bus type.&lt;br /&gt;
&lt;br /&gt;
Without this you get&lt;br /&gt;
 Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: cannot access /sys/bus/pci (t=0.177033) [GFX1-]: glxtest: cannot access /sys/bus/pci&lt;br /&gt;
but it still seems to work.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 --proc /proc/ \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
Contains a filesystem representation of the kernel device tree.&lt;br /&gt;
&lt;br /&gt;
With {{Ic|--ro-bind /sys/bus/pci/ /sys/bus/pci/ \}} but without this you get:&lt;br /&gt;
 Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: ManageChildProcess failed&lt;br /&gt;
  (t=0.189558) [GFX1-]: glxtest: ManageChildProcess failed&lt;br /&gt;
&lt;br /&gt;
 Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: ManageChildProcess failed&lt;br /&gt;
  (t=0.189558) |[1][GFX1-]: No GPUs detected via PCI&lt;br /&gt;
  (t=0.18958) [GFX1-]: No GPUs detected via PCI&lt;br /&gt;
but it still seems to work.&lt;br /&gt;
&lt;br /&gt;
== imv ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-imv|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# imv wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:-$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --ro-bind /bin/sh /bin/sh \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
  --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/libexec/imv-wayland /usr/libexec/imv-wayland \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
  /usr/libexec/imv-wayland &amp;quot;${1:-./}&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /bin/sh /bin/sh \&lt;br /&gt;
Needed to use {{Path|config}} and have various information in the window&lt;br /&gt;
title.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;XDG_CACHE_HOME{{=}}&amp;quot;${XDG_CACHE_HOME:-$HOME/.cache}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:-$HOME/.config}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;XDG_DATA_HOME{{=}}&amp;quot;${XDG_DATA_HOME:-$HOME/.local/share}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--setenv XDG_CACHE_HOME &amp;quot;$XDG_CACHE_HOME&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --setenv XDG_CONFIG_HOME &amp;quot;$XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--setenv XDG_DATA_HOME &amp;quot;$XDG_DATA_HOME&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind /etc/fonts/ /etc/fonts/ \&#039;&#039;&#039;&lt;br /&gt;
 &#039;&#039;&#039;--bind-try &amp;quot;${XDG_CACHE_HOME}/fontconfig/&amp;quot; &amp;quot;${XDG_CACHE_HOME}/fontconfig/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind-try &amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot; &amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
 ...&lt;br /&gt;
 --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind /usr/share/fonts/ /usr/share/fonts/ \&#039;&#039;&#039;&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind /usr/share/icu/ /usr/share/icu/ \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) To use commands in {{Ic|imv}}.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
Access to character devices.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
Access to PCI resources.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
Get the absolute pathname using {{Ic|realpath}}, so you can pass a&lt;br /&gt;
relative argument and still bind the argument.  If you don&#039;t pass in&lt;br /&gt;
anything it will default to {{Path|./}}, the current directory.&lt;br /&gt;
&lt;br /&gt;
{{Warning|If you don&#039;t pass anything and it defaults to the current directory, it will have &#039;&#039;&#039;everything&#039;&#039;&#039; under that directory shown to {{Ic|imv}}, recursively.}}&lt;br /&gt;
&lt;br /&gt;
== KeePassXC ==&lt;br /&gt;
&lt;br /&gt;
{{Note|I only use the bare minimum functionality, so functionality you need is probably missing.  If you use functionality not here, your contribution will be most appreciated.  To kick things off: {{Ic|Unable to initialize libusb. USB devices may not be detected properly.}} can be silenced with {{Ic|--dev-bind /dev/bus/usb/ /dev/bus/usb/ \}}.}}&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-keepassxc|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# keepassxc wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:-$HOME/.config}&amp;quot;&lt;br /&gt;
PASSWORD_DATABASE{{=}}&amp;quot;${HOME}/password database&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CONFIG_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
NEW_PASSWORD_DATABASE{{=}}&amp;quot;${NEW_HOME}${PASSWORD_DATABASE#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mkdir -pm 0700 &amp;quot;$PASSWORD_DATABASE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --setenv XDG_SESSION_TYPE &amp;quot;$XDG_SESSION_TYPE&amp;quot; \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --bind-try &amp;quot;${XDG_CONFIG_HOME}/keepassxc/&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/keepassxc/&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libssl.so.3 /lib/libssl.so.3 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind /usr/bin/keepassxc /usr/bin/keepassxc \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/ /usr/share/X11/ \&lt;br /&gt;
  --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/keepassxc/ /usr/share/keepassxc/ \&lt;br /&gt;
  --bind &amp;quot;$PASSWORD_DATABASE/&amp;quot; &amp;quot;$NEW_PASSWORD_DATABASE/&amp;quot; \&lt;br /&gt;
  /usr/bin/keepassxc &amp;quot;$@&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 PASSWORD_DATABASE=&amp;quot;${HOME}/password database&amp;quot;&lt;br /&gt;
Directory containing your {{Pkg|keepassxc|arch=}} password database.&lt;br /&gt;
&lt;br /&gt;
{{Tip|This is almost certainly not where &#039;&#039;&#039;your&#039;&#039;&#039; database is located.  You will need to change it to where you put your password database.}}&lt;br /&gt;
&lt;br /&gt;
 --setenv XDG_SESSION_TYPE &amp;quot;$XDG_SESSION_TYPE&amp;quot; \&lt;br /&gt;
Session type, since we are assuming Wayland only, this will be &amp;quot;wayland&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
Access to character devices.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
Access to PCI resources.&lt;br /&gt;
&lt;br /&gt;
 --bind &amp;quot;$PASSWORD_DATABASE/&amp;quot; &amp;quot;$NEW_PASSWORD_DATABASE/&amp;quot; \&lt;br /&gt;
Bind password database.&lt;br /&gt;
&lt;br /&gt;
== mpv ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-mpv|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# mpv wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; !{{=}} 1 ]&lt;br /&gt;
then&lt;br /&gt;
	printf &#039;Run mpv wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
  $ bwrap-mpv VIDEO\n&#039;&lt;br /&gt;
	exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
XDG_CACHE_HOME{{=}}&amp;quot;${XDG_CACHE_HOME:-$HOME/.cache}&amp;quot;&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:-$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CACHE_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
NEW_XDG_CONFIG_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CACHE_HOME &amp;quot;$NEW_XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --hostname localhost \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --ro-bind /etc/mpv/ /etc/mpv/ \&lt;br /&gt;
  --bind-try &amp;quot;${XDG_CACHE_HOME}/mesa_shader_cache/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mesa_shader_cache/&amp;quot; \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libacl.so.1 /lib/libacl.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libssl.so.3 /lib/libssl.so.3 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --proc /proc/ \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/pipewire-0&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/pipewire-0&amp;quot; \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/bin/mpv /usr/bin/mpv \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/pipewire/ /usr/share/pipewire/ \&lt;br /&gt;
  --ro-bind &amp;quot;$1&amp;quot; &amp;quot;$(realpath &amp;quot;$1&amp;quot;)&amp;quot; \&lt;br /&gt;
  /usr/bin/mpv \&lt;br /&gt;
    --player-operation-mode{{=}}pseudo-gui \&lt;br /&gt;
    --title{{=}}&#039;bwrap {{!}} ${media-title}&#039; \&lt;br /&gt;
    &amp;quot;$1&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
Access to character devices.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
Access to PCI resources.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;$1&amp;quot; &amp;quot;$(realpath &amp;quot;$1&amp;quot;)&amp;quot; \&lt;br /&gt;
Get the absolute pathname using {{Ic|realpath}}, so you can pass a&lt;br /&gt;
relative argument and still bind the argument.&lt;br /&gt;
&lt;br /&gt;
 --player-operation-mode=pseudo-gui \&lt;br /&gt;
Because {{Ic|--new-session}} is used, this is needed to have a way to&lt;br /&gt;
control {{Ic|mpv}} when it would otherwise not show a GUI.&lt;br /&gt;
&lt;br /&gt;
{{Tip|If you followed [[Bubblewrap#.desktop_integration]], you should remove it from {{Path|&amp;quot;${XDG_DATA_HOME}/applications/bwrap-mpv.desktop&amp;quot;}}.}}&lt;br /&gt;
&lt;br /&gt;
 --title=&#039;bwrap | ${media-title}&#039; \&lt;br /&gt;
Set the window title, showing at a glance that you are using {{Ic|bwrap}}.&lt;br /&gt;
&lt;br /&gt;
=== mpv-net ===&lt;br /&gt;
&lt;br /&gt;
If you want to use {{Ic|mpv}} to stream over the Internet, you will need&lt;br /&gt;
a few things more.&lt;br /&gt;
&lt;br /&gt;
{{Tip|You can use both {{Ic|bwrap-mpv}} and {{Ic|bwrap-mpv-net}}.  {{Ic|bwrap-mpv}} for local stuff and {{Ic|bwrap-mpv-net}} for watching over the Internet.}}&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-mpv-net|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# mpv wrapped in bwrap with network access.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CACHE_HOME{{=}}&amp;quot;${XDG_CACHE_HOME:-$HOME/.cache}&amp;quot;&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:-$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CACHE_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
NEW_XDG_CONFIG_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --share-net \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv PATH /usr/bin/ \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CACHE_HOME &amp;quot;$NEW_XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --hostname localhost \&lt;br /&gt;
  --dev /dev/ \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --ro-bind /etc/mpv/ /etc/mpv/ \&lt;br /&gt;
  --ro-bind /etc/resolv.conf /etc/resolv.conf \&lt;br /&gt;
  --ro-bind /etc/ssl/certs/ /etc/ssl/certs/ \&lt;br /&gt;
  --bind-try &amp;quot;${XDG_CACHE_HOME}/mesa_shader_cache/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mesa_shader_cache/&amp;quot; \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libacl.so.1 /lib/libacl.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libssl.so.3 /lib/libssl.so.3 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --proc /proc/ \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/pipewire-0&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/pipewire-0&amp;quot; \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/bin/mpv /usr/bin/mpv \&lt;br /&gt;
  --ro-bind /usr/bin/python3 /usr/bin/python3 \&lt;br /&gt;
  --ro-bind /usr/bin/yt-dlp /usr/bin/yt-dlp \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/pipewire/ /usr/share/pipewire/ \&lt;br /&gt;
  /usr/bin/mpv \&lt;br /&gt;
    --player-operation-mode{{=}}pseudo-gui \&lt;br /&gt;
    --title{{=}}&#039;bwrap {{!}} ${media-title}&#039; \&lt;br /&gt;
    &amp;quot;$@&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 --setenv PATH /usr/bin/ \&lt;br /&gt;
{{Todo|Document why this is needed.}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /etc/ssl/certs/ /etc/ssl/certs/ \&lt;br /&gt;
Certificate authorities that are &#039;&#039;trusted&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
Access to character devices.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
Access to PCI resources.&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;$@&amp;quot;&lt;br /&gt;
This is so you can pass more options to {{Ic|bwrap-mpv-net}}, for example:&lt;br /&gt;
 $ bwrap-mpv-net --video=no --sub=no &#039;URL1&#039; &#039;URL2&#039;&lt;br /&gt;
&lt;br /&gt;
=== Pulse audio ===&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/pulse&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/pulse&amp;quot; \&lt;br /&gt;
Pulse audio.&lt;br /&gt;
&lt;br /&gt;
=== Screenshots ===&lt;br /&gt;
&lt;br /&gt;
The default screenshots directory is {{Path|&amp;quot;$XDG_DESKTOP_DIR&amp;quot;}} (which is&lt;br /&gt;
{{Path|&amp;quot;${HOME}/Desktop/&amp;quot;}}, which will fallback to {{Path|&amp;quot;$HOME/&amp;quot;}} if&lt;br /&gt;
{{Path|&amp;quot;${HOME}/Desktop/&amp;quot;}} doesn&#039;t exist).  That means that by default&lt;br /&gt;
{{Ic|bwrap-mpv[-net]}} won&#039;t allow screenshots unless you change a few things.&lt;br /&gt;
Do the following to allow an XDG approved screenshots directory:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 XDG_CONFIG_HOME=&amp;quot;${XDG_CONFIG_HOME:-$HOME/.config}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;XDG_DATA_HOME=&amp;quot;${XDG_DATA_HOME:-$HOME/.local/share}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
 NEW_XDG_CONFIG_HOME=&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;NEW_XDG_DATA_HOME=&amp;quot;${NEW_HOME}${XDG_DATA_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/mpv/&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
 --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--setenv XDG_DATA_HOME &amp;quot;$NEW_XDG_DATA_HOME&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--bind &amp;quot;${XDG_DATA_HOME}/mpv/&amp;quot; &amp;quot;${NEW_XDG_DATA_HOME}/mpv/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
 ...&lt;br /&gt;
Now make {{Ic|mpv}} use that directory:&lt;br /&gt;
&lt;br /&gt;
{{Cat|&amp;quot;${XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot;|&amp;lt;nowiki&amp;gt;...&lt;br /&gt;
# Something like this, change to match &amp;quot;$XDG_DATA_HOME&amp;quot;&lt;br /&gt;
screenshot-template=&amp;quot;~/.local/share/mpv/screenshots/%F [%p] %02n&amp;quot;&lt;br /&gt;
...&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
== yt-dlp ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-yt-dlp|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# yt-dlp wrapped in bwrap with network access.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:-$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CONFIG_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mkdir -pm 0700 &amp;quot;${HOME}/Downloads/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --share-net \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --hostname localhost \&lt;br /&gt;
  --ro-bind /etc/resolv.conf /etc/resolv.conf \&lt;br /&gt;
  --ro-bind /etc/ssl/certs/ /etc/ssl/certs/ \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/yt-dlp/config&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/yt-dlp/config&amp;quot; \&lt;br /&gt;
  --bind &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libssl.so.3 /lib/libssl.so.3 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind /usr/bin/ffmpeg /usr/bin/ffmpeg \&lt;br /&gt;
  --ro-bind /usr/bin/python3 /usr/bin/python3 \&lt;br /&gt;
  --ro-bind /usr/bin/yt-dlp /usr/bin/yt-dlp \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  /usr/bin/yt-dlp &amp;quot;$@&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 --bind &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
Directory for writing the files.  This should match {{Ic|--output}} that&lt;br /&gt;
is either in {{Path|&amp;quot;${XDG_CONFIG_HOME}/yt-dlp/config&amp;quot;}} or passed on&lt;br /&gt;
the command line.&lt;br /&gt;
&lt;br /&gt;
 /usr/bin/yt-dlp &amp;quot;$@&amp;quot;&lt;br /&gt;
This is so you can pass more options to {{Ic|bwrap-yt-dlp}}, for example:&lt;br /&gt;
 $ bwrap-yt-dlp --no-playlist &#039;URL1&#039; &#039;URL2&#039;&lt;br /&gt;
&lt;br /&gt;
== zathura ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-zathura|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# zathura wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; !{{=}} 1 ]&lt;br /&gt;
then&lt;br /&gt;
	printf &#039;Run zathura wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
  $ bwrap-zathura PDF\n&#039;&lt;br /&gt;
	exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:-$HOME/.config}&amp;quot;&lt;br /&gt;
XDG_DATA_HOME{{=}}&amp;quot;${XDG_DATA_HOME:-$HOME/.local/share}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$HOME&amp;quot; \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_DATA_HOME &amp;quot;$XDG_DATA_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/zathura/zathurarc&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/zathura/zathurarc&amp;quot; \&lt;br /&gt;
  --bind &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot; &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
  --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/bin/zathura /usr/bin/zathura \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/misc/magic.mgc /usr/share/misc/magic.mgc \&lt;br /&gt;
  --ro-bind &amp;quot;$1&amp;quot; &amp;quot;$(realpath &amp;quot;$1&amp;quot;)&amp;quot; \&lt;br /&gt;
  /usr/bin/zathura &amp;quot;$1&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot;&lt;br /&gt;
Have to premake the directory for {{Ic|zathura}} data.&lt;br /&gt;
&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot; &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot; \&lt;br /&gt;
Allow writing of: bookmarks, history, input history.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/misc/magic.mgc /usr/share/misc/magic.mgc \&lt;br /&gt;
Used for identifying what type a file should be.  Read the&lt;br /&gt;
{{Ic|file(1)}} man page for more information.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;$1&amp;quot; &amp;quot;$(realpath &amp;quot;$1&amp;quot;)&amp;quot; \&lt;br /&gt;
Get the absolute pathname using {{Ic|realpath}}, so you can pass a&lt;br /&gt;
relative argument and still bind the argument.&lt;br /&gt;
&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Gaming_on_Alpine&amp;diff=29363</id>
		<title>Gaming on Alpine</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Gaming_on_Alpine&amp;diff=29363"/>
		<updated>2025-03-18T07:02:27Z</updated>

		<summary type="html">&lt;p&gt;Encode: Xonotic: Mention clients and server&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page documents the various game related packages available in Alpine Linux and lists alternate ways to game. If you are interested in developing games on Alpine Linux visit [[Game development on Alpine Linux]].&lt;br /&gt;
&lt;br /&gt;
== Installing Games ==&lt;br /&gt;
&lt;br /&gt;
Like with installing any other package, run the following:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add [game]}}&lt;br /&gt;
&lt;br /&gt;
Where &amp;lt;code&amp;gt;[game]&amp;lt;/code&amp;gt; is the name of the package containing the game, like &amp;lt;code&amp;gt;micro-tetris&amp;lt;/code&amp;gt; from among the [[#List of games|available games]].&lt;br /&gt;
&lt;br /&gt;
== Steam ==&lt;br /&gt;
{{Main|Steam}}&lt;br /&gt;
Steam, a popular game distribution platform by Valve can be run on Alpine Linux through [[Flatpak]].&lt;br /&gt;
 &lt;br /&gt;
== Wine ==&lt;br /&gt;
&lt;br /&gt;
{{Pkg|wine}} allows you to run some Windows software, including games, under Linux. A 32-bit Alpine chroot/multiboot might be required to use 32 bit Windows games under Wine.  If you use x86_64, 32-bit applications will run in Wine&#039;s experimental WoW64 mode, which may not be compatible with all software.&lt;br /&gt;
&lt;br /&gt;
To run windows app/games inside a [https://www.reddit.com/r/linux4noobs/comments/1fegh0i/winealpine/ docker container] with alpine Linux, {{pkg|libcap}} is required to fix issues related to [https://gitlab.winehq.org/wine/wine/-/wikis/FAQ#failed-to-use-icmp-network-ping-this-requires-special-permissions raw sockets]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
RUN apk add --no-cache libcap&lt;br /&gt;
RUN setcap cap_net_raw+epi /usr/bin/wine-preloader&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Permissions ==&lt;br /&gt;
&lt;br /&gt;
To make sure your account is in the &amp;quot;games&amp;quot; group, run the following:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# adduser youruser games}}&lt;br /&gt;
&lt;br /&gt;
Log-off and then log back on in order for the changes to take effect. Most games don&#039;t require this in order to work.&lt;br /&gt;
&lt;br /&gt;
== List of games ==&lt;br /&gt;
&lt;br /&gt;
Below is the list of games packages available in Alpine Linux:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; 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;20%&amp;quot; |Game &lt;br /&gt;
|width=&amp;quot;20%&amp;quot; | Package name &lt;br /&gt;
|| Description&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.advancemame.it/ AdvanceMAME] || {{Pkg|advancemame}} || Arcade simulator.&lt;br /&gt;
|-&lt;br /&gt;
| [https://gitlab.gnome.org/GNOME/aisleriot Aisleriot] || {{Pkg|aisleriot}} || Solitaire card games.&lt;br /&gt;
|-&lt;br /&gt;
|[https://www.chocolate-doom.org/wiki/index.php/Chocolate_Doom Chocolate Doom] || {{Pkg|chocolate-doom}} || Portable release of Doom, Heretic, Hexen, and Strife&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.dosbox-staging.org/ DOSBox Staging] || {{Pkg|dosbox-staging}} || DOS-emulator that uses SDL.&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.flightgear.org/ FlightGear]|| {{Pkg|flightgear}} || Flight simulator.&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.freeciv.org Freeciv]|| {{Pkg|freeciv}} || Free and Open Source empire-building strategy game.&lt;br /&gt;
|-&lt;br /&gt;
|[https://freedoom.github.io/ Freedoom]|| {{Pkg|freedoom}} || an entirely free software game running on a Doom engine.&lt;br /&gt;
|-&lt;br /&gt;
| [https://davidgriffith.gitlab.io/frotz/ Frotz] || {{Pkg|frotz}} || Z machine (Infocom interactive fiction) Interpreter.&lt;br /&gt;
|-&lt;br /&gt;
| [https://gcompris.net/index-en.html GCompris] || {{Pkg|gcompris-qt}} || Educational software suite comprising of numerous activities for children aged 2 to 10.&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.gnu.org/software/chess/ GNU Chess]|| {{Pkg|gnuchess}} || Play chess against the computer.&lt;br /&gt;
|-&lt;br /&gt;
|[https://zdoom.org/index GZDoom] || {{Pkg|gzdoom}} || Modern game engine resembling modern FPSes compatible with Doom WADs&lt;br /&gt;
|-&lt;br /&gt;
| [https://lgames.sourceforge.io/LBreakout2/ LBreakout2]|| {{Pkg|lbreakout2}} || Ball-and-paddle game.&lt;br /&gt;
|-&lt;br /&gt;
| [https://lgames.sourceforge.io/LBreakoutHD LBreakoutHD] || {{Pkg|lbreakouthd}} || {{Note|No level editor available.}}&lt;br /&gt;
The successor to LBreakout2. &lt;br /&gt;
{{Pkg|lbreakout2}} is needed for level creation.&lt;br /&gt;
|-&lt;br /&gt;
| [https://lgames.sourceforge.io/LPairs LPairs]|| {{Pkg|lpairs2}} || Classical memory game.&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.luanti.org/ Luanti] || {{Pkg|luanti}} || An open source voxel game engine.&lt;br /&gt;
|-&lt;br /&gt;
| [https://github.com/troglobit/tetris Micro Tetris] || {{Pkg|micro-tetris}} || A version of Tetris that uses ANSI escape sequences and can fit in embedded devices.&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.nethack.org NetHack] || {{Pkg|nethack}} || A single player Rogue-like dungeon crawler or dungeon exploration game&lt;br /&gt;
|-&lt;br /&gt;
| [https://openrct2.io/ OpenRCT2] || {{Pkg|openrct2}} || {{Note| Requires original files of “RollerCoaster Tycoon 2” to play.}}&lt;br /&gt;
A free and open-source reimplementation of “RollerCoaster Tycoon 2”.&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.openttd.org/ OpenTTD]|| {{Pkg|openttd}} || A business simulation game.&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.retroarch.com/ RetroArch] || {{Pkg|retroarch}} || Frontend for emulators, game engines, and media players using libretro.&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.scummvm.org/ ScummVM]|| {{Pkg|scummvm}} || Engine for several graphical adventure games.&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.supertux.org/ SuperTux] || {{Pkg|supertux}} || Classic 2D jump&#039;n&#039;run side-scroller game in a style similar to the original Super Mario games.&lt;br /&gt;
|-&lt;br /&gt;
|[https://supertuxkart.net/Main_Page SuperTuxKart] || {{pkg|supertuxkart}} || Kart racing game with OSS mascots.&lt;br /&gt;
|-&lt;br /&gt;
|[https://www.xonotic.org/ Xonotic] || {{Pkg|xonotic}} || The Free and Fast Arena Shooter.&lt;br /&gt;
Clients are: {{Pkg|xonotic-sdl}} or {{Pkg|xonotic-glx}}.  Install {{Pkg|xonotic-server}} to run a dedicated server.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Steam|Steam on Alpine Linux]]  &lt;br /&gt;
* [https://gitlab.winehq.org/wine/wine/-/wikis/FAQ  Wine FAQ]&lt;br /&gt;
* [https://obsproject.com/ OBS Studio] ({{Pkg|obs-studio}}) - Used by live streamers on streaming platforms such as YouTube and Twitch.&lt;br /&gt;
* [https://wine.htmlvalidator.com/install-wine-on-alpine-linux-3.html  How to Install Wine on Alpine Linux 3]&lt;br /&gt;
[[category:Gaming]]&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Gaming_on_Alpine&amp;diff=29362</id>
		<title>Gaming on Alpine</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Gaming_on_Alpine&amp;diff=29362"/>
		<updated>2025-03-18T06:50:09Z</updated>

		<summary type="html">&lt;p&gt;Encode: Update game website links&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page documents the various game related packages available in Alpine Linux and lists alternate ways to game. If you are interested in developing games on Alpine Linux visit [[Game development on Alpine Linux]].&lt;br /&gt;
&lt;br /&gt;
== Installing Games ==&lt;br /&gt;
&lt;br /&gt;
Like with installing any other package, run the following:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add [game]}}&lt;br /&gt;
&lt;br /&gt;
Where &amp;lt;code&amp;gt;[game]&amp;lt;/code&amp;gt; is the name of the package containing the game, like &amp;lt;code&amp;gt;micro-tetris&amp;lt;/code&amp;gt; from among the [[#List of games|available games]].&lt;br /&gt;
&lt;br /&gt;
== Steam ==&lt;br /&gt;
{{Main|Steam}}&lt;br /&gt;
Steam, a popular game distribution platform by Valve can be run on Alpine Linux through [[Flatpak]].&lt;br /&gt;
 &lt;br /&gt;
== Wine ==&lt;br /&gt;
&lt;br /&gt;
{{Pkg|wine}} allows you to run some Windows software, including games, under Linux. A 32-bit Alpine chroot/multiboot might be required to use 32 bit Windows games under Wine.  If you use x86_64, 32-bit applications will run in Wine&#039;s experimental WoW64 mode, which may not be compatible with all software.&lt;br /&gt;
&lt;br /&gt;
To run windows app/games inside a [https://www.reddit.com/r/linux4noobs/comments/1fegh0i/winealpine/ docker container] with alpine Linux, {{pkg|libcap}} is required to fix issues related to [https://gitlab.winehq.org/wine/wine/-/wikis/FAQ#failed-to-use-icmp-network-ping-this-requires-special-permissions raw sockets]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
RUN apk add --no-cache libcap&lt;br /&gt;
RUN setcap cap_net_raw+epi /usr/bin/wine-preloader&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Permissions ==&lt;br /&gt;
&lt;br /&gt;
To make sure your account is in the &amp;quot;games&amp;quot; group, run the following:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# adduser youruser games}}&lt;br /&gt;
&lt;br /&gt;
Log-off and then log back on in order for the changes to take effect. Most games don&#039;t require this in order to work.&lt;br /&gt;
&lt;br /&gt;
== List of games ==&lt;br /&gt;
&lt;br /&gt;
Below is the list of games packages available in Alpine Linux:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; 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;20%&amp;quot; |Game &lt;br /&gt;
|width=&amp;quot;20%&amp;quot; | Package name &lt;br /&gt;
|| Description&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.advancemame.it/ AdvanceMAME] || {{Pkg|advancemame}} || Arcade simulator.&lt;br /&gt;
|-&lt;br /&gt;
| [https://gitlab.gnome.org/GNOME/aisleriot Aisleriot] || {{Pkg|aisleriot}} || Solitaire card games.&lt;br /&gt;
|-&lt;br /&gt;
|[https://www.chocolate-doom.org/wiki/index.php/Chocolate_Doom Chocolate Doom] || {{Pkg|chocolate-doom}} || Portable release of Doom, Heretic, Hexen, and Strife&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.dosbox-staging.org/ DOSBox Staging] || {{Pkg|dosbox-staging}} || DOS-emulator that uses SDL.&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.flightgear.org/ FlightGear]|| {{Pkg|flightgear}} || Flight simulator.&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.freeciv.org Freeciv]|| {{Pkg|freeciv}} || Free and Open Source empire-building strategy game.&lt;br /&gt;
|-&lt;br /&gt;
|[https://freedoom.github.io/ Freedoom]|| {{Pkg|freedoom}} || an entirely free software game running on a Doom engine.&lt;br /&gt;
|-&lt;br /&gt;
| [https://davidgriffith.gitlab.io/frotz/ Frotz] || {{Pkg|frotz}} || Z machine (Infocom interactive fiction) Interpreter.&lt;br /&gt;
|-&lt;br /&gt;
| [https://gcompris.net/index-en.html GCompris] || {{Pkg|gcompris-qt}} || Educational software suite comprising of numerous activities for children aged 2 to 10.&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.gnu.org/software/chess/ GNU Chess]|| {{Pkg|gnuchess}} || Play chess against the computer.&lt;br /&gt;
|-&lt;br /&gt;
|[https://zdoom.org/index GZDoom] || {{Pkg|gzdoom}} || Modern game engine resembling modern FPSes compatible with Doom WADs&lt;br /&gt;
|-&lt;br /&gt;
| [https://lgames.sourceforge.io/LBreakout2/ LBreakout2]|| {{Pkg|lbreakout2}} || Ball-and-paddle game.&lt;br /&gt;
|-&lt;br /&gt;
| [https://lgames.sourceforge.io/LBreakoutHD LBreakoutHD] || {{Pkg|lbreakouthd}} || {{Note|No level editor available.}}&lt;br /&gt;
The successor to LBreakout2. &lt;br /&gt;
{{Pkg|lbreakout2}} is needed for level creation.&lt;br /&gt;
|-&lt;br /&gt;
| [https://lgames.sourceforge.io/LPairs LPairs]|| {{Pkg|lpairs2}} || Classical memory game.&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.luanti.org/ Luanti] || {{Pkg|luanti}} || An open source voxel game engine.&lt;br /&gt;
|-&lt;br /&gt;
| [https://github.com/troglobit/tetris Micro Tetris] || {{Pkg|micro-tetris}} || A version of Tetris that uses ANSI escape sequences and can fit in embedded devices.&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.nethack.org NetHack] || {{Pkg|nethack}} || A single player Rogue-like dungeon crawler or dungeon exploration game&lt;br /&gt;
|-&lt;br /&gt;
| [https://openrct2.io/ OpenRCT2] || {{Pkg|openrct2}} || {{Note| Requires original files of “RollerCoaster Tycoon 2” to play.}}&lt;br /&gt;
A free and open-source reimplementation of “RollerCoaster Tycoon 2”.&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.openttd.org/ OpenTTD]|| {{Pkg|openttd}} || A business simulation game.&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.retroarch.com/ RetroArch] || {{Pkg|retroarch}} || Frontend for emulators, game engines, and media players using libretro.&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.scummvm.org/ ScummVM]|| {{Pkg|scummvm}} || Engine for several graphical adventure games.&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.supertux.org/ SuperTux] || {{Pkg|supertux}} || Classic 2D jump&#039;n&#039;run side-scroller game in a style similar to the original Super Mario games.&lt;br /&gt;
|-&lt;br /&gt;
|[https://supertuxkart.net/Main_Page SuperTuxKart] || {{pkg|supertuxkart}} || Kart racing game with OSS mascots.&lt;br /&gt;
|-&lt;br /&gt;
|[https://www.xonotic.org/ Xonotic] || {{Pkg|xonotic}} || A free and open-source FPS.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Steam|Steam on Alpine Linux]]  &lt;br /&gt;
* [https://gitlab.winehq.org/wine/wine/-/wikis/FAQ  Wine FAQ]&lt;br /&gt;
* [https://obsproject.com/ OBS Studio] ({{Pkg|obs-studio}}) - Used by live streamers on streaming platforms such as YouTube and Twitch.&lt;br /&gt;
* [https://wine.htmlvalidator.com/install-wine-on-alpine-linux-3.html  How to Install Wine on Alpine Linux 3]&lt;br /&gt;
[[category:Gaming]]&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Gaming_on_Alpine&amp;diff=29361</id>
		<title>Gaming on Alpine</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Gaming_on_Alpine&amp;diff=29361"/>
		<updated>2025-03-18T06:37:39Z</updated>

		<summary type="html">&lt;p&gt;Encode: Alphabetize list&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page documents the various game related packages available in Alpine Linux and lists alternate ways to game. If you are interested in developing games on Alpine Linux visit [[Game development on Alpine Linux]].&lt;br /&gt;
&lt;br /&gt;
== Installing Games ==&lt;br /&gt;
&lt;br /&gt;
Like with installing any other package, run the following:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add [game]}}&lt;br /&gt;
&lt;br /&gt;
Where &amp;lt;code&amp;gt;[game]&amp;lt;/code&amp;gt; is the name of the package containing the game, like &amp;lt;code&amp;gt;micro-tetris&amp;lt;/code&amp;gt; from among the [[#List of games|available games]].&lt;br /&gt;
&lt;br /&gt;
== Steam ==&lt;br /&gt;
{{Main|Steam}}&lt;br /&gt;
Steam, a popular game distribution platform by Valve can be run on Alpine Linux through [[Flatpak]].&lt;br /&gt;
 &lt;br /&gt;
== Wine ==&lt;br /&gt;
&lt;br /&gt;
{{Pkg|wine}} allows you to run some Windows software, including games, under Linux. A 32-bit Alpine chroot/multiboot might be required to use 32 bit Windows games under Wine.  If you use x86_64, 32-bit applications will run in Wine&#039;s experimental WoW64 mode, which may not be compatible with all software.&lt;br /&gt;
&lt;br /&gt;
To run windows app/games inside a [https://www.reddit.com/r/linux4noobs/comments/1fegh0i/winealpine/ docker container] with alpine Linux, {{pkg|libcap}} is required to fix issues related to [https://gitlab.winehq.org/wine/wine/-/wikis/FAQ#failed-to-use-icmp-network-ping-this-requires-special-permissions raw sockets]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
RUN apk add --no-cache libcap&lt;br /&gt;
RUN setcap cap_net_raw+epi /usr/bin/wine-preloader&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Permissions ==&lt;br /&gt;
&lt;br /&gt;
To make sure your account is in the &amp;quot;games&amp;quot; group, run the following:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# adduser youruser games}}&lt;br /&gt;
&lt;br /&gt;
Log-off and then log back on in order for the changes to take effect. Most games don&#039;t require this in order to work.&lt;br /&gt;
&lt;br /&gt;
== List of games ==&lt;br /&gt;
&lt;br /&gt;
Below is the list of games packages available in Alpine Linux:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; 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;20%&amp;quot; |Game &lt;br /&gt;
|width=&amp;quot;20%&amp;quot; | Package name &lt;br /&gt;
|| Description&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.advancemame.it/ AdvanceMAME]|| {{Pkg|advancemame}} || Arcade simulator.&lt;br /&gt;
|-&lt;br /&gt;
| [https://wiki.gnome.org/Apps/Aisleriot Aisleriot]|| {{Pkg|aisleriot}} || Solitaire card games.&lt;br /&gt;
|-&lt;br /&gt;
|[https://www.chocolate-doom.org/ Chocolate Doom] || {{Pkg|chocolate-doom}}|| Portable release of Doom, Heretic, Hexen, and Strife&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.dosbox-staging.org/ DOSBox Staging] ||{{Pkg|dosbox-staging}} || DOS-emulator that uses SDL.&lt;br /&gt;
|-&lt;br /&gt;
| [https://home.flightgear.org FlightGear]|| {{Pkg|flightgear}} || Flight simulator.&lt;br /&gt;
|-&lt;br /&gt;
| [https://freeciv.fandom.com Freeciv]|| {{Pkg|freeciv}} || Free and Open Source empire-building strategy game.&lt;br /&gt;
|-&lt;br /&gt;
|[https://freedoom.github.io/ Freedoom]|| {{Pkg|freedoom}}|| an entirely free software game running on a Doom engine.&lt;br /&gt;
|-&lt;br /&gt;
| [https://frotz.sourceforge.net/ Frotz] || {{Pkg|frotz}} || Z machine (Infocom interactive fiction) Interpreter.&lt;br /&gt;
|-&lt;br /&gt;
| [https://gcompris.net GCompris] || {{Pkg|gcompris-qt}}|| Educational software suite comprising of numerous activities for children aged 2 to 10.&lt;br /&gt;
|-&lt;br /&gt;
| [https://en.wikipedia.org/wiki/GNU_Chess GNU Chess]|| {{Pkg|gnuchess}}|| Play chess against the computer.&lt;br /&gt;
|-&lt;br /&gt;
|[https://zdoom.org GZDoom] || {{Pkg|gzdoom}} || Modern game engine resembling modern FPSes compatible with Doom WADs&lt;br /&gt;
|-&lt;br /&gt;
| [https://lgames.sourceforge.io/LBreakout2 LBreakout2]|| {{Pkg|lbreakout2}}|| Ball-and-paddle game.&lt;br /&gt;
|-&lt;br /&gt;
| [https://lgames.sourceforge.io/LBreakoutHD LBreakoutHD] || {{Pkg|lbreakouthd}}|| The successor to LBreakout2. Note: no level editor available. &lt;br /&gt;
lbreakout2 is needed for level creation.&lt;br /&gt;
|-&lt;br /&gt;
| [https://lgames.sourceforge.io/LPairs LPairs]||{{Pkg|lpairs2}}|| Classical memory game.&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.luanti.org/ Luanti] || {{Pkg|luanti}} || An open source voxel game engine.&lt;br /&gt;
|-&lt;br /&gt;
| [https://github.com/troglobit/tetris Micro Tetris] ||{{Pkg|micro-tetris}}|| A version of Tetris that uses ANSI escape sequences and can fit in embedded devices.&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.nethack.org NetHack] ||{{Pkg|netHack}} || A single player Rogue-like dungeon crawler or dungeon exploration game&lt;br /&gt;
|-&lt;br /&gt;
| [https://openrct2.org/ OpenRCT2] || {{Pkg|openrct2 }}|| A free and open-source reimplementation of RollerCoaster Tycoon 2 but &#039;&#039;&#039;requires&#039;&#039;&#039; original RollerCoaster Tycoon 2 assets.&lt;br /&gt;
|-&lt;br /&gt;
| [https://en.wikipedia.org/wiki/OpenTTD OpenTTD]||{{Pkg|openttd}}|| A business simulation game.&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.retroarch.com RetroArch] ||{{Pkg|retroarch}}|| Frontend for emulators, game engines, and media players using libretro.&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.scummvm.org/ ScummVM]||{{Pkg|scummvm}}|| Engine for several graphical adventure games.&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.supertux.org/ SuperTux] ||{{Pkg|supertux}}|| Classic 2D jump&#039;n&#039;run side-scroller game in a style similar to the original Super Mario games.&lt;br /&gt;
|-&lt;br /&gt;
|[https://supertuxkart.net/Main_Page SuperTuxKart] || {{pkg|supertuxkart}}|| Kart racing game with OSS mascots.&lt;br /&gt;
|-&lt;br /&gt;
|[https://www.xonotic.org/ Xonotic] ||{{Pkg|xonotic}}|| A free and open-source FPS.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Steam|Steam on Alpine Linux]]  &lt;br /&gt;
* [https://gitlab.winehq.org/wine/wine/-/wikis/FAQ  Wine FAQ]&lt;br /&gt;
* [https://obsproject.com/ OBS Studio] ({{Pkg|obs-studio}}) - Used by live streamers on streaming platforms such as YouTube and Twitch.&lt;br /&gt;
* [https://wine.htmlvalidator.com/install-wine-on-alpine-linux-3.html  How to Install Wine on Alpine Linux 3]&lt;br /&gt;
[[category:Gaming]]&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Gaming_on_Alpine&amp;diff=29360</id>
		<title>Gaming on Alpine</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Gaming_on_Alpine&amp;diff=29360"/>
		<updated>2025-03-18T06:27:12Z</updated>

		<summary type="html">&lt;p&gt;Encode: Minetest → Luanti, https://blog.luanti.org/2024/10/13/Introducing-Our-New-Name/&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page documents the various game related packages available in Alpine Linux and lists alternate ways to game. If you are interested in developing games on Alpine Linux visit [[Game development on Alpine Linux]].&lt;br /&gt;
&lt;br /&gt;
== Installing Games ==&lt;br /&gt;
&lt;br /&gt;
Like with installing any other package, run the following:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add [game]}}&lt;br /&gt;
&lt;br /&gt;
Where &amp;lt;code&amp;gt;[game]&amp;lt;/code&amp;gt; is the name of the package containing the game, like &amp;lt;code&amp;gt;micro-tetris&amp;lt;/code&amp;gt; from among the [[#List of games|available games]].&lt;br /&gt;
&lt;br /&gt;
== Steam ==&lt;br /&gt;
{{Main|Steam}}&lt;br /&gt;
Steam, a popular game distribution platform by Valve can be run on Alpine Linux through [[Flatpak]].&lt;br /&gt;
 &lt;br /&gt;
== Wine ==&lt;br /&gt;
&lt;br /&gt;
{{Pkg|wine}} allows you to run some Windows software, including games, under Linux. A 32-bit Alpine chroot/multiboot might be required to use 32 bit Windows games under Wine.  If you use x86_64, 32-bit applications will run in Wine&#039;s experimental WoW64 mode, which may not be compatible with all software.&lt;br /&gt;
&lt;br /&gt;
To run windows app/games inside a [https://www.reddit.com/r/linux4noobs/comments/1fegh0i/winealpine/ docker container] with alpine Linux, {{pkg|libcap}} is required to fix issues related to [https://gitlab.winehq.org/wine/wine/-/wikis/FAQ#failed-to-use-icmp-network-ping-this-requires-special-permissions raw sockets]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
RUN apk add --no-cache libcap&lt;br /&gt;
RUN setcap cap_net_raw+epi /usr/bin/wine-preloader&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Permissions ==&lt;br /&gt;
&lt;br /&gt;
To make sure your account is in the &amp;quot;games&amp;quot; group, run the following:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# adduser youruser games}}&lt;br /&gt;
&lt;br /&gt;
Log-off and then log back on in order for the changes to take effect. Most games don&#039;t require this in order to work.&lt;br /&gt;
&lt;br /&gt;
== List of games ==&lt;br /&gt;
&lt;br /&gt;
Below is the list of games packages available in Alpine Linux:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; 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;20%&amp;quot; |Game &lt;br /&gt;
|width=&amp;quot;20%&amp;quot; | Package name &lt;br /&gt;
|| Description&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.advancemame.it/ AdvanceMAME]|| {{Pkg|advancemame}} || Arcade simulator.&lt;br /&gt;
|-&lt;br /&gt;
| [https://wiki.gnome.org/Apps/Aisleriot Aisleriot]|| {{Pkg|aisleriot}} || Solitaire card games.&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.dosbox-staging.org/ DOSBox Staging] ||{{Pkg|dosbox-staging}} || DOS-emulator that uses SDL.&lt;br /&gt;
|-&lt;br /&gt;
| [https://freeciv.fandom.com Freeciv]|| {{Pkg|freeciv}} || Free and Open Source empire-building strategy game.&lt;br /&gt;
|-&lt;br /&gt;
| [https://frotz.sourceforge.net/ Frotz] || {{Pkg|frotz}} || Z machine (Infocom interactive fiction) Interpreter.&lt;br /&gt;
|-&lt;br /&gt;
| [https://home.flightgear.org FlightGear]|| {{Pkg|flightgear}} || Flight simulator.&lt;br /&gt;
|-&lt;br /&gt;
|[https://freedoom.github.io/ Freedoom]|| {{Pkg|freedoom}}|| an entirely free software game running on a Doom engine.&lt;br /&gt;
|-&lt;br /&gt;
|[https://www.chocolate-doom.org/ Chocolate Doom] || {{Pkg|chocolate-doom}}|| Portable release of Doom, Heretic, Hexen, and Strife&lt;br /&gt;
|-&lt;br /&gt;
|[https://zdoom.org GZDoom] || {{Pkg|gzdoom}} || Modern game engine resembling modern FPSes compatible with Doom WADs&lt;br /&gt;
|-&lt;br /&gt;
| [https://gcompris.net GCompris] || {{Pkg|gcompris-qt}}|| Educational software suite comprising of numerous activities for children aged 2 to 10.&lt;br /&gt;
|-&lt;br /&gt;
| [https://en.wikipedia.org/wiki/GNU_Chess GNU Chess]|| {{Pkg|gnuchess}}|| Play chess against the computer.&lt;br /&gt;
|-&lt;br /&gt;
| [https://lgames.sourceforge.io/LBreakout2 LBreakout2]|| {{Pkg|lbreakout2}}|| Ball-and-paddle game.&lt;br /&gt;
|-&lt;br /&gt;
| [https://lgames.sourceforge.io/LBreakoutHD LBreakoutHD] || {{Pkg|lbreakouthd}}|| The successor to LBreakout2. Note: no level editor available. &lt;br /&gt;
lbreakout2 is needed for level creation.&lt;br /&gt;
|-&lt;br /&gt;
| [https://lgames.sourceforge.io/LPairs LPairs]||{{Pkg|lpairs2}}|| Classical memory game.&lt;br /&gt;
|-&lt;br /&gt;
| [https://github.com/troglobit/tetris Micro Tetris] ||{{Pkg|micro-tetris}}|| A version of Tetris that uses ANSI escape sequences and can fit in embedded devices.&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.luanti.org/ Luanti] ||{{Pkg|luanti}}|| An open source voxel game engine.&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.nethack.org NetHack] ||{{Pkg|netHack}} || A single player Rogue-like dungeon crawler or dungeon exploration game&lt;br /&gt;
|-&lt;br /&gt;
| [https://openrct2.org/ OpenRCT2] || {{Pkg|openrct2 }}|| A free and open-source reimplementation of RollerCoaster Tycoon 2 but &#039;&#039;&#039;requires&#039;&#039;&#039; original RollerCoaster Tycoon 2 assets.&lt;br /&gt;
|-&lt;br /&gt;
| [https://en.wikipedia.org/wiki/OpenTTD OpenTTD]||{{Pkg|openttd}}|| A business simulation game.&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.retroarch.com RetroArch] ||{{Pkg|retroarch}}|| Frontend for emulators, game engines, and media players using libretro.&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.scummvm.org/ ScummVM]||{{Pkg|scummvm}}|| Engine for several graphical adventure games.&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.supertux.org/ SuperTux] ||{{Pkg|supertux}}|| Classic 2D jump&#039;n&#039;run side-scroller game in a style similar to the original Super Mario games.&lt;br /&gt;
|-&lt;br /&gt;
|[https://supertuxkart.net/Main_Page SuperTuxKart] || {{pkg|supertuxkart}}|| Kart racing game with OSS mascots.&lt;br /&gt;
|-&lt;br /&gt;
|[https://www.xonotic.org/ Xonotic] ||{{Pkg|xonotic}}|| A free and open-source FPS.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Steam|Steam on Alpine Linux]]  &lt;br /&gt;
* [https://gitlab.winehq.org/wine/wine/-/wikis/FAQ  Wine FAQ]&lt;br /&gt;
* [https://obsproject.com/ OBS Studio] ({{Pkg|obs-studio}}) - Used by live streamers on streaming platforms such as YouTube and Twitch.&lt;br /&gt;
* [https://wine.htmlvalidator.com/install-wine-on-alpine-linux-3.html  How to Install Wine on Alpine Linux 3]&lt;br /&gt;
[[category:Gaming]]&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Bubblewrap/Examples&amp;diff=26828</id>
		<title>Bubblewrap/Examples</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Bubblewrap/Examples&amp;diff=26828"/>
		<updated>2024-06-05T03:06:03Z</updated>

		<summary type="html">&lt;p&gt;Encode: Use default values, instead of assign default values.  Doesn&amp;#039;t matter in this situation, but will lead to surprising results in most situations.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|Someone more experienced needs to look over this.}}&lt;br /&gt;
&lt;br /&gt;
{{Todo|&lt;br /&gt;
* Since bubblewrap can make use of [https://en.wikipedia.org/wiki/Seccomp seccomp], restrictive versions should be added.&lt;br /&gt;
* {{Ic|imv}}, {{Ic|mpv}} and {{Ic|zathura}} currently only accept 1 mandatory (except {{Ic|imv}}) argument.  This should (hopefully) be temporary, until I figure out how to pass multiple arguments (without including everything else).}}&lt;br /&gt;
&lt;br /&gt;
{{Warning|These were found by going backward; start with a complicated program and as restricted as possible sandbox, allowing more till the program appears to work.  Because of this, complicated and sensitive programs (for example: {{Pkg|firefox|arch=}} and {{Pkg|keepassxc|arch=}}) may be missing some things they need, which might lead to &#039;&#039;&#039;LESS SECURITY&#039;&#039;&#039;, &#039;&#039;&#039;LESS PRIVACY&#039;&#039;&#039; and &#039;&#039;&#039;DATA LOSS&#039;&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
{{Note|&lt;br /&gt;
* This page assumes you have already read [[Bubblewrap]].&lt;br /&gt;
* To try and avoid duplicates everything will be explained for [[Firefox]] and only when it differs (non obviously) for everything else.&lt;br /&gt;
* Where applicable, this assumes: [[Wayland]] only + [[PipeWire]].&lt;br /&gt;
: If Wayland is needed, make sure you have dealt with [[Wayland#XDG_RUNTIME_DIR|XDG_RUNTIME_DIR]].}}&lt;br /&gt;
&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
== Firefox ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-firefox|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# Firefox wrapped in bwrap with network access.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CACHE_HOME{{=}}&amp;quot;${XDG_CACHE_HOME:-$HOME/.cache}&amp;quot;&lt;br /&gt;
XDG_DATA_HOME{{=}}&amp;quot;${XDG_DATA_HOME:-$HOME/.local/share}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CACHE_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --share-net \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CACHE_HOME &amp;quot;$NEW_XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --hostname localhost \&lt;br /&gt;
  --dev /dev/ \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --ro-bind /etc/resolv.conf /etc/resolv.conf \&lt;br /&gt;
  --bind-try &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mozilla/&amp;quot; \&lt;br /&gt;
  --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
  --bind-try &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --proc /proc/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/glib-2.0/ /usr/share/glib-2.0/ \&lt;br /&gt;
  --ro-bind /usr/share/icons/ /usr/share/icons/ \&lt;br /&gt;
  --ro-bind /usr/share/icu/ /usr/share/icu/ \&lt;br /&gt;
  --ro-bind /usr/share/mime/ /usr/share/mime/ \&lt;br /&gt;
  /usr/lib/firefox/firefox}}&lt;br /&gt;
&lt;br /&gt;
 set -u&lt;br /&gt;
If the shell tries to expand an unset parameter, it will error (with a&lt;br /&gt;
few exceptions).&lt;br /&gt;
&lt;br /&gt;
 XDG_CACHE_HOME=&amp;quot;${XDG_CACHE_HOME:-$HOME/.cache}&amp;quot;&lt;br /&gt;
 XDG_DATA_HOME=&amp;quot;${XDG_DATA_HOME:-$HOME/.local/share}&amp;quot;&lt;br /&gt;
Take value if already set, else fallback to the [https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html XDG] default.&lt;br /&gt;
&lt;br /&gt;
 NEW_HOME=&#039;/home/user&#039;&lt;br /&gt;
User to appear as.&lt;br /&gt;
&lt;br /&gt;
 NEW_XDG_CACHE_HOME=&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
{{Path|&amp;quot;$XDG_CACHE_HOME&amp;quot;}} for the new user.&lt;br /&gt;
&lt;br /&gt;
 mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot;&lt;br /&gt;
Make sure the new (real) home for Firefox data exist.&lt;br /&gt;
&lt;br /&gt;
 --unshare-all \&lt;br /&gt;
Unshare all possible [https://en.wikipedia.org/wiki/Linux_namespaces namespaces].&lt;br /&gt;
&lt;br /&gt;
 --share-net \&lt;br /&gt;
Retain the network namespace.&lt;br /&gt;
&lt;br /&gt;
 --new-session \&lt;br /&gt;
New terminal session for the sandbox.&lt;br /&gt;
&lt;br /&gt;
 --die-with-parent \&lt;br /&gt;
Child process dies when {{Ic|bwrap}} parent dies.&lt;br /&gt;
&lt;br /&gt;
 --clearenv \&lt;br /&gt;
Unset all environment variables (except for {{Path|&amp;quot;$PWD&amp;quot;}}).&lt;br /&gt;
&lt;br /&gt;
 --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
Pass the path to {{Path|&amp;quot;$NEW_HOME&amp;quot;}} for {{Path|&amp;quot;$HOME&amp;quot;}}.&lt;br /&gt;
&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
Specify the Wayland display to run clients on.&lt;br /&gt;
&lt;br /&gt;
 --setenv XDG_CACHE_HOME &amp;quot;$NEW_XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
User-specific non-essential (cached) data.&lt;br /&gt;
&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
User-specific non-essential runtime files and other file objects.&lt;br /&gt;
&lt;br /&gt;
 --hostname localhost \&lt;br /&gt;
Use custom hostname in the sandbox.&lt;br /&gt;
&lt;br /&gt;
 --dev /dev/ \&lt;br /&gt;
New devtmpfs, access to special or device files.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
System font configuration directory.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /etc/resolv.conf /etc/resolv.conf \&lt;br /&gt;
Needed for DNS resolution.&lt;br /&gt;
&lt;br /&gt;
 --bind-try &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mozilla/&amp;quot; \&lt;br /&gt;
Per-user Mozilla cache.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 XDG_CACHE_HOME=&amp;quot;${XDG_CACHE_HOME:-$HOME/.cache}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;XDG_CONFIG_HOME &amp;quot;${XDG_CONFIG_HOME:-$HOME/.config}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 XDG_DATA_HOME=&amp;quot;${XDG_DATA_HOME:-$HOME/.local/share}&amp;quot;&lt;br /&gt;
 ...&lt;br /&gt;
 NEW_XDG_CACHE_HOME=&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;NEW_XDG_CONFIG_HOME=&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --bind-try &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mozilla/&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/fontconfig/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) Per-user font configuration directory.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 XDG_CACHE_HOME=&amp;quot;${XDG_CACHE_HOME:-$HOME/.cache}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;XDG_CONFIG_HOME &amp;quot;${XDG_CONFIG_HOME:-$HOME/.config}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 XDG_DATA_HOME=&amp;quot;${XDG_DATA_HOME:-$HOME/.local/share}&amp;quot;&lt;br /&gt;
 ...&lt;br /&gt;
 NEW_XDG_CACHE_HOME=&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;NEW_XDG_CONFIG_HOME=&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --bind-try &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/user-dirs.dirs&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/user-dirs.dirs&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) If you modify &amp;quot;well known&amp;quot; user directories, like&lt;br /&gt;
{{Path|~/Downloads/}}, you need this to have Firefox pick it up.&lt;br /&gt;
&lt;br /&gt;
{{Note|If you use {{Path|&amp;quot;${XDG_CONFIG_HOME}/user-dirs.dirs&amp;quot;}} you should also add the corresponding path(s).&lt;br /&gt;
For example if you set {{Path|XDG_DOWNLOAD_DIR}} to&lt;br /&gt;
{{Path|&amp;quot;${HOME}/downloads/&amp;quot;}} you would also add:&lt;br /&gt;
  ...&lt;br /&gt;
  --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
  &#039;&#039;&#039;--bind-try &amp;quot;${HOME}/downloads/&amp;quot; &amp;quot;${NEW_HOME}/downloads/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
{{Path|&amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot;}} is the location of Firefox data.  Shown to Firefox as {{Path|&amp;quot;${NEW_HOME}/.mozilla/&amp;quot;}}.&lt;br /&gt;
&lt;br /&gt;
{{Note|This has the added benefit of getting {{Path|~/.mozilla/}} out of your {{Path|&amp;quot;$HOME&amp;quot;}}, and conforming more to XDG.  This may one day not be necessary: [https://bugzilla.mozilla.org/show_bug.cgi?id{{=}}259356 Support for the Freedesktop.org XDG Base Directory Specification (2004-09-14)].}}&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 NEW_XDG_CACHE_HOME=&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;NEW_XDG_DATA_HOME=&amp;quot;${NEW_HOME}${XDG_DATA_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--setenv XDG_DATA_HOME &amp;quot;$NEW_XDG_DATA_HOME&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind-try &amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot; &amp;quot;${NEW_XDG_DATA_HOME}/fonts/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --bind-try &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) Per-user directory scanned for font files.&lt;br /&gt;
&lt;br /&gt;
 --bind-try &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
Default {{Path|~/Downloads/}} directory.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
 --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
 --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
 --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
 --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
Shared libraries.&lt;br /&gt;
&lt;br /&gt;
 --proc /proc/ \&lt;br /&gt;
New procfs, provides information about running processes and the kernel.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
Bind the Wayland socket file.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
Object files and libraries.&lt;br /&gt;
&lt;br /&gt;
{{Note|It is not worth the time to limit this, the churn is too great.}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
XKB is a keyboard keymap support library.&lt;br /&gt;
&lt;br /&gt;
{{Note|Even tho the path has {{Path|*/X11/*}} Wayland uses it too.}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
Font presets.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
Global directory scanned for font files.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/glib-2.0/ /usr/share/glib-2.0/ \&lt;br /&gt;
Needed for &amp;quot;Save Page As…&amp;quot;, &amp;quot;Export|Import Bookmarks File&amp;quot;, among others.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/icons/ /usr/share/icons/ \&lt;br /&gt;
Global icons directory.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/icu/ /usr/share/icu/ \&lt;br /&gt;
International Components for Unicode (ICU) provides support for Unicode&lt;br /&gt;
and globalization.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 --ro-bind /usr/share/icu/ /usr/share/icu/ \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind /usr/share/libdrm/ /usr/share/libdrm/ \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind /usr/share/mime/ /usr/share/mime/ \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) Direct Rendering Manager (DRM), Linux kernel subsystem for&lt;br /&gt;
interfacing with GPUs of video cards.  Programs can use this to have the&lt;br /&gt;
GPU do hardware-accelerated 3D rendering and video decoding.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/mime/ /usr/share/mime/ \&lt;br /&gt;
Global XDG MIME directory.&lt;br /&gt;
&lt;br /&gt;
 /usr/lib/firefox/firefox&lt;br /&gt;
Call Firefox.&lt;br /&gt;
&lt;br /&gt;
{{Tip|If you use multiple profiles you can have:&lt;br /&gt;
 /usr/lib/firefox/firefox -P &amp;quot;$@&amp;quot;&lt;br /&gt;
this will allow you to pass a profile name and go into that specific one or not pass anything and get prompted for which to choose.}}&lt;br /&gt;
&lt;br /&gt;
=== PipeWire audio ===&lt;br /&gt;
&lt;br /&gt;
{{Todo|}}&lt;br /&gt;
&lt;br /&gt;
=== Pulse audio ===&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 --proc /proc/ \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind &amp;quot;${XDG_RUNTIME_DIR}/pulse/&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/pulse/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) Pulse audio.&lt;br /&gt;
&lt;br /&gt;
=== Optional(?) stuff ===&lt;br /&gt;
&lt;br /&gt;
{{Draft|Are these needed?}}&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 --proc /proc/ \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind /sys/bus/pci/ /sys/bus/pci/ \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
Information about PCI bus type.&lt;br /&gt;
&lt;br /&gt;
Without this you get&lt;br /&gt;
 Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: cannot access /sys/bus/pci (t=0.177033) [GFX1-]: glxtest: cannot access /sys/bus/pci&lt;br /&gt;
but it still seems to work.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 --proc /proc/ \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
Contains a filesystem representation of the kernel device tree.&lt;br /&gt;
&lt;br /&gt;
With {{Ic|--ro-bind /sys/bus/pci/ /sys/bus/pci/ \}} but without this you get:&lt;br /&gt;
 Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: ManageChildProcess failed&lt;br /&gt;
  (t=0.189558) [GFX1-]: glxtest: ManageChildProcess failed&lt;br /&gt;
&lt;br /&gt;
 Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: ManageChildProcess failed&lt;br /&gt;
  (t=0.189558) |[1][GFX1-]: No GPUs detected via PCI&lt;br /&gt;
  (t=0.18958) [GFX1-]: No GPUs detected via PCI&lt;br /&gt;
but it still seems to work.&lt;br /&gt;
&lt;br /&gt;
== imv ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-imv|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# imv wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:-$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --ro-bind /bin/sh /bin/sh \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
  --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/libexec/imv-wayland /usr/libexec/imv-wayland \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
  /usr/libexec/imv-wayland &amp;quot;${1:-./}&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /bin/sh /bin/sh \&lt;br /&gt;
Needed to use {{Path|config}} and have various information in the window&lt;br /&gt;
title.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;XDG_CACHE_HOME{{=}}&amp;quot;${XDG_CACHE_HOME:-$HOME/.cache}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:-$HOME/.config}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;XDG_DATA_HOME{{=}}&amp;quot;${XDG_DATA_HOME:-$HOME/.local/share}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--setenv XDG_CACHE_HOME &amp;quot;$XDG_CACHE_HOME&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --setenv XDG_CONFIG_HOME &amp;quot;$XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--setenv XDG_DATA_HOME &amp;quot;$XDG_DATA_HOME&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind /etc/fonts/ /etc/fonts/ \&#039;&#039;&#039;&lt;br /&gt;
 &#039;&#039;&#039;--bind-try &amp;quot;${XDG_CACHE_HOME}/fontconfig/&amp;quot; &amp;quot;${XDG_CACHE_HOME}/fontconfig/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind-try &amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot; &amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
 ...&lt;br /&gt;
 --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind /usr/share/fonts/ /usr/share/fonts/ \&#039;&#039;&#039;&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind /usr/share/icu/ /usr/share/icu/ \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) To use commands in {{Ic|imv}}.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
Access to character devices.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
Access to PCI resources.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
Get the absolute pathname using {{Ic|realpath}}, so you can pass a&lt;br /&gt;
relative argument and still bind the argument.  If you don&#039;t pass in&lt;br /&gt;
anything it will default to {{Path|./}}, the current directory.&lt;br /&gt;
&lt;br /&gt;
{{Warning|If you don&#039;t pass anything and it defaults to the current directory, it will have &#039;&#039;&#039;everything&#039;&#039;&#039; under that directory shown to {{Ic|imv}}, recursively.}}&lt;br /&gt;
&lt;br /&gt;
== KeePassXC ==&lt;br /&gt;
&lt;br /&gt;
{{Note|I only use the bare minimum functionality, so functionality you need is probably missing.  If you use functionality not here, your contribution will be most appreciated.  To kick things off: {{Ic|Unable to initialize libusb. USB devices may not be detected properly.}} can be silenced with {{Ic|--dev-bind /dev/bus/usb/ /dev/bus/usb/ \}}.}}&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-keepassxc|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# keepassxc wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:-$HOME/.config}&amp;quot;&lt;br /&gt;
PASSWORD_DATABASE{{=}}&amp;quot;${HOME}/password database&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CONFIG_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
NEW_PASSWORD_DATABASE{{=}}&amp;quot;${NEW_HOME}${PASSWORD_DATABASE#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mkdir -pm 0700 &amp;quot;$PASSWORD_DATABASE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --setenv XDG_SESSION_TYPE &amp;quot;$XDG_SESSION_TYPE&amp;quot; \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --bind-try &amp;quot;${XDG_CONFIG_HOME}/keepassxc/&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/keepassxc/&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libssl.so.3 /lib/libssl.so.3 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind /usr/bin/keepassxc /usr/bin/keepassxc \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/ /usr/share/X11/ \&lt;br /&gt;
  --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/keepassxc/ /usr/share/keepassxc/ \&lt;br /&gt;
  --bind &amp;quot;$PASSWORD_DATABASE/&amp;quot; &amp;quot;$NEW_PASSWORD_DATABASE/&amp;quot; \&lt;br /&gt;
  /usr/bin/keepassxc &amp;quot;$@&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 PASSWORD_DATABASE=&amp;quot;${HOME}/password database&amp;quot;&lt;br /&gt;
Directory containing your {{Pkg|keepassxc|arch=}} password database.&lt;br /&gt;
&lt;br /&gt;
{{Tip|This is almost certainly not where &#039;&#039;&#039;your&#039;&#039;&#039; database is located.  You will need to change it to where you put your password database.}}&lt;br /&gt;
&lt;br /&gt;
 --setenv XDG_SESSION_TYPE &amp;quot;$XDG_SESSION_TYPE&amp;quot; \&lt;br /&gt;
Session type, since we are assuming Wayland only, this will be &amp;quot;wayland&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
Access to character devices.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
Access to PCI resources.&lt;br /&gt;
&lt;br /&gt;
 --bind &amp;quot;$PASSWORD_DATABASE/&amp;quot; &amp;quot;$NEW_PASSWORD_DATABASE/&amp;quot; \&lt;br /&gt;
Bind password database.&lt;br /&gt;
&lt;br /&gt;
== mpv ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-mpv|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# mpv wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; !{{=}} 1 ]&lt;br /&gt;
then&lt;br /&gt;
	printf &#039;Run mpv wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
  $ bwrap-mpv VIDEO\n&#039;&lt;br /&gt;
	exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
XDG_CACHE_HOME{{=}}&amp;quot;${XDG_CACHE_HOME:-$HOME/.cache}&amp;quot;&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:-$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CACHE_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
NEW_XDG_CONFIG_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CACHE_HOME &amp;quot;$NEW_XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --hostname localhost \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --ro-bind /etc/mpv/ /etc/mpv/ \&lt;br /&gt;
  --bind-try &amp;quot;${XDG_CACHE_HOME}/mesa_shader_cache/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mesa_shader_cache/&amp;quot; \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libacl.so.1 /lib/libacl.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libssl.so.3 /lib/libssl.so.3 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --proc /proc/ \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/pipewire-0&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/pipewire-0&amp;quot; \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/bin/mpv /usr/bin/mpv \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/pipewire/ /usr/share/pipewire/ \&lt;br /&gt;
  --ro-bind &amp;quot;$1&amp;quot; &amp;quot;$(realpath &amp;quot;$1&amp;quot;)&amp;quot; \&lt;br /&gt;
  /usr/bin/mpv \&lt;br /&gt;
    --player-operation-mode{{=}}pseudo-gui \&lt;br /&gt;
    --title{{=}}&#039;bwrap {{!}} ${media-title}&#039; \&lt;br /&gt;
    &amp;quot;$1&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
Access to character devices.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
Access to PCI resources.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;$1&amp;quot; &amp;quot;$(realpath &amp;quot;$1&amp;quot;)&amp;quot; \&lt;br /&gt;
Get the absolute pathname using {{Ic|realpath}}, so you can pass a&lt;br /&gt;
relative argument and still bind the argument.&lt;br /&gt;
&lt;br /&gt;
 --player-operation-mode=pseudo-gui \&lt;br /&gt;
Because {{Ic|--new-session}} is used, this is needed to have a way to&lt;br /&gt;
control {{Ic|mpv}} when it would otherwise not show a GUI.&lt;br /&gt;
&lt;br /&gt;
{{Tip|If you followed [[Bubblewrap#.desktop_integration]], you should remove it from {{Path|&amp;quot;${XDG_DATA_HOME}/applications/bwrap-mpv.desktop&amp;quot;}}.}}&lt;br /&gt;
&lt;br /&gt;
 --title=&#039;bwrap | ${media-title}&#039; \&lt;br /&gt;
Set the window title, showing at a glance that you are using {{Ic|bwrap}}.&lt;br /&gt;
&lt;br /&gt;
=== mpv-net ===&lt;br /&gt;
&lt;br /&gt;
If you want to use {{Ic|mpv}} to stream over the Internet, you will need&lt;br /&gt;
a few things more.&lt;br /&gt;
&lt;br /&gt;
{{Tip|You can use both {{Ic|bwrap-mpv}} and {{Ic|bwrap-mpv-net}}.  {{Ic|bwrap-mpv}} for local stuff and {{Ic|bwrap-mpv-net}} for watching over the Internet.}}&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-mpv-net|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# mpv wrapped in bwrap with network access.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CACHE_HOME{{=}}&amp;quot;${XDG_CACHE_HOME:-$HOME/.cache}&amp;quot;&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:-$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CACHE_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
NEW_XDG_CONFIG_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --share-net \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv PATH /usr/bin/ \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CACHE_HOME &amp;quot;$NEW_XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --hostname localhost \&lt;br /&gt;
  --dev /dev/ \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --ro-bind /etc/mpv/ /etc/mpv/ \&lt;br /&gt;
  --ro-bind /etc/resolv.conf /etc/resolv.conf \&lt;br /&gt;
  --ro-bind /etc/ssl/certs/ /etc/ssl/certs/ \&lt;br /&gt;
  --bind-try &amp;quot;${XDG_CACHE_HOME}/mesa_shader_cache/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mesa_shader_cache/&amp;quot; \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libacl.so.1 /lib/libacl.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libssl.so.3 /lib/libssl.so.3 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --proc /proc/ \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/pipewire-0&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/pipewire-0&amp;quot; \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/bin/mpv /usr/bin/mpv \&lt;br /&gt;
  --ro-bind /usr/bin/python3 /usr/bin/python3 \&lt;br /&gt;
  --ro-bind /usr/bin/yt-dlp /usr/bin/yt-dlp \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/pipewire/ /usr/share/pipewire/ \&lt;br /&gt;
  /usr/bin/mpv \&lt;br /&gt;
    --player-operation-mode{{=}}pseudo-gui \&lt;br /&gt;
    --title{{=}}&#039;bwrap {{!}} ${media-title}&#039; \&lt;br /&gt;
    &amp;quot;$@&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 --setenv PATH /usr/bin/ \&lt;br /&gt;
{{Todo|Document why this is needed.}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /etc/ssl/certs/ /etc/ssl/certs/ \&lt;br /&gt;
Certificate authorities that are &#039;&#039;trusted&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
Access to character devices.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
Access to PCI resources.&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;$@&amp;quot;&lt;br /&gt;
This is so you can pass more options to {{Ic|bwrap-mpv-net}}, for example:&lt;br /&gt;
 $ bwrap-mpv-net --video=no --sub=no &#039;URL1&#039; &#039;URL2&#039;&lt;br /&gt;
&lt;br /&gt;
=== Pulse audio ===&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/pulse&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/pulse&amp;quot; \&lt;br /&gt;
Pulse audio.&lt;br /&gt;
&lt;br /&gt;
=== Screenshots ===&lt;br /&gt;
&lt;br /&gt;
The default screenshots directory is {{Path|&amp;quot;$XDG_DESKTOP_DIR&amp;quot;}} (which is&lt;br /&gt;
{{Path|&amp;quot;${HOME}/Desktop/&amp;quot;}}, which will fallback to {{Path|&amp;quot;$HOME/&amp;quot;}} if&lt;br /&gt;
{{Path|&amp;quot;${HOME}/Desktop/&amp;quot;}} doesn&#039;t exist).  That means that by default&lt;br /&gt;
{{Ic|bwrap-mpv[-net]}} won&#039;t allow screenshots unless you change a few things.&lt;br /&gt;
Do the following to allow an XDG approved screenshots directory:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 XDG_CONFIG_HOME=&amp;quot;${XDG_CONFIG_HOME:-$HOME/.config}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;XDG_DATA_HOME=&amp;quot;${XDG_DATA_HOME:-$HOME/.local/share}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
 NEW_XDG_CONFIG_HOME=&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;NEW_XDG_DATA_HOME=&amp;quot;${NEW_HOME}${XDG_DATA_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/mpv/&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
 --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--setenv XDG_DATA_HOME &amp;quot;$NEW_XDG_DATA_HOME&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--bind &amp;quot;${XDG_DATA_HOME}/mpv/&amp;quot; &amp;quot;${NEW_XDG_DATA_HOME}/mpv/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
 ...&lt;br /&gt;
Now make {{Ic|mpv}} use that directory:&lt;br /&gt;
&lt;br /&gt;
{{Cat|&amp;quot;${XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot;|&amp;lt;nowiki&amp;gt;...&lt;br /&gt;
# Something like this, change to match &amp;quot;$XDG_DATA_HOME&amp;quot;&lt;br /&gt;
screenshot-template=&amp;quot;~/.local/share/mpv/screenshots/%F [%p] %02n&amp;quot;&lt;br /&gt;
...&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
== yt-dlp ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-yt-dlp|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# yt-dlp wrapped in bwrap with network access.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:-$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CONFIG_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mkdir -pm 0700 &amp;quot;${HOME}/Downloads/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --share-net \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --hostname localhost \&lt;br /&gt;
  --ro-bind /etc/resolv.conf /etc/resolv.conf \&lt;br /&gt;
  --ro-bind /etc/ssl/certs/ /etc/ssl/certs/ \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/yt-dlp/config&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/yt-dlp/config&amp;quot; \&lt;br /&gt;
  --bind &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libssl.so.3 /lib/libssl.so.3 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind /usr/bin/ffmpeg /usr/bin/ffmpeg \&lt;br /&gt;
  --ro-bind /usr/bin/python3 /usr/bin/python3 \&lt;br /&gt;
  --ro-bind /usr/bin/yt-dlp /usr/bin/yt-dlp \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  /usr/bin/yt-dlp &amp;quot;$@&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 --bind &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
Directory for writing the files.  This should match {{Ic|--output}} that&lt;br /&gt;
is either in {{Path|&amp;quot;${XDG_CONFIG_HOME}/yt-dlp/config&amp;quot;}} or passed on&lt;br /&gt;
the command line.&lt;br /&gt;
&lt;br /&gt;
 /usr/bin/yt-dlp &amp;quot;$@&amp;quot;&lt;br /&gt;
This is so you can pass more options to {{Ic|bwrap-yt-dlp}}, for example:&lt;br /&gt;
 $ bwrap-yt-dlp --no-playlist &#039;URL1&#039; &#039;URL2&#039;&lt;br /&gt;
&lt;br /&gt;
== zathura ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-zathura|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# zathura wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; !{{=}} 1 ]&lt;br /&gt;
then&lt;br /&gt;
	printf &#039;Run zathura wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
  $ bwrap-zathura PDF\n&#039;&lt;br /&gt;
	exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:-$HOME/.config}&amp;quot;&lt;br /&gt;
XDG_DATA_HOME{{=}}&amp;quot;${XDG_DATA_HOME:-$HOME/.local/share}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$HOME&amp;quot; \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_DATA_HOME &amp;quot;$XDG_DATA_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/zathura/zathurarc&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/zathura/zathurarc&amp;quot; \&lt;br /&gt;
  --bind &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot; &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
  --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/bin/zathura /usr/bin/zathura \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/misc/magic.mgc /usr/share/misc/magic.mgc \&lt;br /&gt;
  --ro-bind &amp;quot;$1&amp;quot; &amp;quot;$(realpath &amp;quot;$1&amp;quot;)&amp;quot; \&lt;br /&gt;
  /usr/bin/zathura &amp;quot;$1&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot;&lt;br /&gt;
Have to premake the directory for {{Ic|zathura}} data.&lt;br /&gt;
&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot; &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot; \&lt;br /&gt;
Allow writing of: bookmarks, history, input history.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/misc/magic.mgc /usr/share/misc/magic.mgc \&lt;br /&gt;
Used for identifying what type a file should be.  Read the&lt;br /&gt;
{{Ic|file(1)}} man page for more information.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;$1&amp;quot; &amp;quot;$(realpath &amp;quot;$1&amp;quot;)&amp;quot; \&lt;br /&gt;
Get the absolute pathname using {{Ic|realpath}}, so you can pass a&lt;br /&gt;
relative argument and still bind the argument.&lt;br /&gt;
&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Bubblewrap&amp;diff=26827</id>
		<title>Bubblewrap</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Bubblewrap&amp;diff=26827"/>
		<updated>2024-06-05T02:45:01Z</updated>

		<summary type="html">&lt;p&gt;Encode: Use default values, instead of assign default values.  Doesn&amp;#039;t matter in this situation, but will lead to surprising results in most situations.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|The reasoning is most likely wrong for why to do some stuff.  Someone more experienced needs to look it over.}}&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
[https://github.com/containers/bubblewrap Bubblewrap] is an&lt;br /&gt;
unprivileged sandboxing tool.  Kernel features it also has:&lt;br /&gt;
User/IPC/PID/Network/UTS/cgroup&lt;br /&gt;
[https://en.wikipedia.org/wiki/Linux_namespaces namespaces] and&lt;br /&gt;
[https://en.wikipedia.org/wiki/Seccomp Seccomp] filters.&lt;br /&gt;
&lt;br /&gt;
How bubblewrap works, as stated in the&lt;br /&gt;
[https://github.com/containers/bubblewrap/blob/main/README.md#usage README.md]:&lt;br /&gt;
:bubblewrap works by creating a new, completely empty, mount namespace where the root is on a tmpfs that is invisible from the host, and will be automatically cleaned up when the last process exits. You can then use commandline options to construct the root filesystem and process environment and command to run in the namespace.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
Install {{Pkg|bubblewrap|arch=}}:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add bubblewrap}}&lt;br /&gt;
&lt;br /&gt;
{{Note|The package is {{pkg|bubblewrap|arch=}} but the command to&lt;br /&gt;
manage it is {{Ic|bwrap}}.}}&lt;br /&gt;
&lt;br /&gt;
== How to workout what a program needs ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|Look at [[Bubblewrap/Examples]] to see various ways {{Ic|bwrap}} can be used.}}&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
&lt;br /&gt;
First make sure to have a user editable directory in {{Path|&amp;quot;$PATH&amp;quot;}}.&lt;br /&gt;
This page will use {{Path|&amp;quot;${HOME}/.local/bin/&amp;quot;}}, create it if it does&lt;br /&gt;
not exist:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ mkdir -p ~/.local/bin}}&lt;br /&gt;
&lt;br /&gt;
Add it to {{Path|~/.profile}}:&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.profile|...&amp;lt;nowiki&amp;gt;&lt;br /&gt;
PATH=&amp;quot;${PATH}&amp;quot;:&amp;quot;${HOME}/.local/bin&amp;quot;&lt;br /&gt;
export PATH&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;...}}&lt;br /&gt;
&lt;br /&gt;
Will need to relog for this to apply.&lt;br /&gt;
&lt;br /&gt;
=== Basic bwrap setup ===&lt;br /&gt;
&lt;br /&gt;
{{Note|With how we will be sandboxing everything that doesn&#039;t match our owner/group will show as {{Ic|nobody}}.}}&lt;br /&gt;
&lt;br /&gt;
Lets assume you want to sandbox {{Pkg|imv|arch=}} and are using [[Wayland]]&lt;br /&gt;
only.  Here is how you might go about that.&lt;br /&gt;
&lt;br /&gt;
Create {{Ic|bwrap-imv}} inside {{Path|&amp;quot;${HOME}/.local/bin/&amp;quot;}} and make it&lt;br /&gt;
executable:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ touch ~/.local/bin/bwrap-imv&lt;br /&gt;
$ chmod 0700 ~/.local/bin/bwrap-imv}}&lt;br /&gt;
&lt;br /&gt;
Use {{Ic|file}} to determine the file type of {{Path|/usr/bin/imv}}:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ file /usr/bin/imv&lt;br /&gt;
/usr/bin/imv: POSIX shell script, ASCII text executable}}&lt;br /&gt;
&lt;br /&gt;
Since it is just a shell script, we can use {{Ic|less}} to view it:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ less /usr/bin/imv}}&lt;br /&gt;
&lt;br /&gt;
{{Cat|/usr/bin/imv|#!/bin/sh&lt;br /&gt;
if [ -n &amp;quot;${WAYLAND_DISPLAY}&amp;quot; ]; then&lt;br /&gt;
  exec /usr/libexec/imv-wayland &amp;quot;$@&amp;quot;&lt;br /&gt;
else&lt;br /&gt;
  exec /usr/libexec/imv-x11 &amp;quot;$@&amp;quot;&lt;br /&gt;
fi}}&lt;br /&gt;
&lt;br /&gt;
Since we are assuming Wayland only we can just skip to&lt;br /&gt;
{{Path|/usr/libexec/imv-wayland}}.  Run {{Ic|file}} on it:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ file /usr/libexec/imv-wayland&lt;br /&gt;
/usr/libexec/imv-wayland: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-x86_64.so.1, stripped}}&lt;br /&gt;
&lt;br /&gt;
It is an&lt;br /&gt;
[https://en.wikipedia.org/wiki/Executable_and_Linkable_Format Executable and Linkable Format (ELF)]&lt;br /&gt;
file.  So we know we need the ELF interpreter&lt;br /&gt;
{{Path|/lib/ld-musl-x86_64.so.1}}.  We also know we need&lt;br /&gt;
{{Path|/usr/libexec/imv-wayland}}, since it has to know where the command&lt;br /&gt;
is located.&lt;br /&gt;
&lt;br /&gt;
As the argument to {{Ic|/usr/libexec/imv-wayland}}, put&lt;br /&gt;
{{Ic|&amp;quot;${1:-./}&amp;quot;}}, this will pass &#039;&#039;&#039;only&#039;&#039;&#039; the first argument and if&lt;br /&gt;
there is none, will default to {{Path|./}}, the current directory.  We&lt;br /&gt;
will also need {{Ic|--ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \}},&lt;br /&gt;
since we are not passing the whole filesystem.  This will get the&lt;br /&gt;
absolute pathname using {{Ic|realpath}}, so you can pass a relative&lt;br /&gt;
argument and still bind the argument:&lt;br /&gt;
 --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
 /usr/libexec/imv-wayland &amp;quot;${1:-./}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
{{Warning|If you don&#039;t pass anything and it defaults to the current directory, it will have &#039;&#039;&#039;everything&#039;&#039;&#039; under that directory shown to {{Ic|imv}}, recursively.}}&lt;br /&gt;
{{Todo|How can you pass 2+ arguments?}}&lt;br /&gt;
&lt;br /&gt;
Find necessary shared libraries, except ones loaded at runtime:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ ldd /usr/libexec/imv-wayland}}&lt;br /&gt;
&lt;br /&gt;
It outputs a lot of things but we only need a few; the directory path of&lt;br /&gt;
the majority {{Path|/usr/lib/*}} and the 4 paths that start with&lt;br /&gt;
{{Path|/lib/*}}.  Filter the output to see those clearer:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ ldd /usr/libexec/imv-wayland {{!}} grep &#039; /lib/&#039;}}&lt;br /&gt;
&lt;br /&gt;
In total:&lt;br /&gt;
 --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
 --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
 --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
 --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
 --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
&lt;br /&gt;
{{Note|It is not worth the time to limit {{Path|/usr/lib/*}}, the churn is too great.}}&lt;br /&gt;
&lt;br /&gt;
{{Warning|The {{Ic|ldd}} manpage talks about some security implications.  It may not apply since they seem to be talking about glibc and {{Pkg|musl-utils|arch=}} makes {{Path|/lib/ld-musl-x86_64.so.1}} ldd [https://git.alpinelinux.org/aports/tree/main/musl/APKBUILD#n105].  Is this something to worry about?}}&lt;br /&gt;
&lt;br /&gt;
Since this is a shell script, lets use a helpful command:&lt;br /&gt;
 set -u&lt;br /&gt;
if the shell tries to expand an unset parameter, it will error (with a&lt;br /&gt;
few exceptions).&lt;br /&gt;
&lt;br /&gt;
Since this is for a GUI [[Wayland]] program, so lets also add some prerequisites:&lt;br /&gt;
&lt;br /&gt;
{{Note|Make sure you have dealt with [[Wayland#XDG_RUNTIME_DIR|XDG_RUNTIME_DIR]].}}&lt;br /&gt;
&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
for determining the directory for the wayland socket;&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
for determining the socket;&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
mount readonly.&lt;br /&gt;
&lt;br /&gt;
Lets also add some nice to haves:&lt;br /&gt;
 --unshare-all \&lt;br /&gt;
will create a new user/ipc/pid/net/utc namespaces and try to create a&lt;br /&gt;
new cgroup namespace if possible;&lt;br /&gt;
 --new-session&lt;br /&gt;
will create a new terminal session for the sandbox, disconnecting from&lt;br /&gt;
the controlling terminal so for example it can&#039;t inject input into the&lt;br /&gt;
terminal;&lt;br /&gt;
  --die-with-parent&lt;br /&gt;
will ensure child process ({{Ic|imv-wayland}} in this case) dies when&lt;br /&gt;
{{Ic|bwrap}} parent dies.&lt;br /&gt;
&lt;br /&gt;
We might also have a {{Path|config}} file:&lt;br /&gt;
 --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; \&lt;br /&gt;
this will add your local config to {{Ic|imv}} if you have one and if not&lt;br /&gt;
will still continue.&lt;br /&gt;
&lt;br /&gt;
Pass {{Path|&amp;quot;$XDG_CONFIG_HOME&amp;quot;}} to sandbox:&lt;br /&gt;
 --setenv XDG_CONFIG_HOME &amp;quot;$XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
but this isn&#039;t always defined, so lets fallback to the&lt;br /&gt;
[https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html XDG Base Directory]&lt;br /&gt;
default:&lt;br /&gt;
 XDG_CONFIG_HOME=&amp;quot;${XDG_CONFIG_HOME:-$HOME/.config}&amp;quot;&lt;br /&gt;
this will use {{Path|&amp;quot;$XDG_CONFIG_HOME&amp;quot;}} if it&#039;s set, otherwise&lt;br /&gt;
fallback to the default of {{Path|&amp;quot;$HOME/.config&amp;quot;}}.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /bin/sh /bin/sh \&lt;br /&gt;
Needed to use {{Path|config}} and have various information in the window&lt;br /&gt;
title.&lt;br /&gt;
&lt;br /&gt;
{{Todo|This was found using: [[Bubblewrap#Can&#039;t_find_what_path_is_missing]], any better way?}}&lt;br /&gt;
&lt;br /&gt;
{{Path|~/.local/bin/bwrap-imv}} now looks like:&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-imv|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# imv wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:-$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --ro-bind /bin/sh /bin/sh \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
  --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/libexec/imv-wayland /usr/libexec/imv-wayland \&lt;br /&gt;
  --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
  /usr/libexec/imv-wayland &amp;quot;${1:-./}&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
Now lets run {{Ic|bwrap-imv}}, go into a directory with an image:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ bwrap-imv IMAGE&lt;br /&gt;
sh: eval: line 0: can&#039;t create /dev/null: nonexistent directory&lt;br /&gt;
...&lt;br /&gt;
sh: eval: line 0: can&#039;t create /dev/null: nonexistent directory&lt;br /&gt;
xkbcommon: ERROR: failed to add default include path /usr/share/X11/xkb&lt;br /&gt;
Assertion failed: keyboard-&amp;gt;context (../src/keyboard.c: imv_keyboard_create: 20)}}&lt;br /&gt;
&lt;br /&gt;
Add:&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
to {{Ic|bwrap-imv}}.  [https://en.wikipedia.org/wiki/X_keyboard_extension XKB]&lt;br /&gt;
is a keyboard keymap support library.&lt;br /&gt;
&lt;br /&gt;
After adding the above, run it again:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ bwrap-imv IMAGE&lt;br /&gt;
sh: eval: line 0: can&#039;t create /dev/null: nonexistent directory&lt;br /&gt;
...&lt;br /&gt;
sh: eval: line 0: can&#039;t create /dev/null: nonexistent directory&lt;br /&gt;
libEGL warning: wayland-egl: could not open /dev/dri/renderD128 (No such file or directory)}}&lt;br /&gt;
&lt;br /&gt;
Add:&lt;br /&gt;
 --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
and run again:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ bwrap-imv IMAGE&lt;br /&gt;
libEGL warning: wayland-egl: drmGetMagic failed}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
Access to character devices.&lt;br /&gt;
&lt;br /&gt;
{{Todo|This was found using: [[Bubblewrap#Can&#039;t_find_what_path_is_missing]], any better way?}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
Access to PCI resources.&lt;br /&gt;
&lt;br /&gt;
{{Todo|This was found using: [[Bubblewrap#Can&#039;t_find_what_path_is_missing]], any better way?}}&lt;br /&gt;
&lt;br /&gt;
 --clearenv \&lt;br /&gt;
Finally we can unset all environment variables, except for&lt;br /&gt;
{{Path|&amp;quot;$PWD&amp;quot;}} and any we set with {{Ic|--setenv}}.&lt;br /&gt;
&lt;br /&gt;
Now {{Ic|imv}} should show images and your {{Path|config}} file should&lt;br /&gt;
work (if you have one).  If you do not use commands, the finished&lt;br /&gt;
{{Path|~/.local/bin/bwrap-imv}} should look like:&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-imv|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# imv wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:-$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --ro-bind /bin/sh /bin/sh \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
  --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/libexec/imv-wayland /usr/libexec/imv-wayland \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
  /usr/libexec/imv-wayland &amp;quot;${1:-./}&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
If you do use commands however, you will notice it is only showing&lt;br /&gt;
[https://en.wikipedia.org/wiki/Substitute_character substitute characters].&lt;br /&gt;
&lt;br /&gt;
{{Tip|Commands in {{Ic|imv}} are entered by pressing {{Ic|:}}.}}&lt;br /&gt;
&lt;br /&gt;
If you try to use a command it will say:&lt;br /&gt;
&lt;br /&gt;
 Fontconfig error: Cannot load default config file: No such file: (null)&lt;br /&gt;
&lt;br /&gt;
Look at the {{Ic|fonts-conf}} manpage (which is from&lt;br /&gt;
{{Pkg|fontconfig-doc|arch=}}) we see that {{Path|/etc/fonts/}} is the system&lt;br /&gt;
font configuration directory and&lt;br /&gt;
{{Path|&amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot;}} is the per-user configuration&lt;br /&gt;
directory.  {{Path|&amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot;}} is added with&lt;br /&gt;
{{Ic|--ro-bind-try}} so it doesn&#039;t have to exist:&lt;br /&gt;
 --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
 --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot; \&lt;br /&gt;
&lt;br /&gt;
The default directories scanned for font files are&lt;br /&gt;
{{Path|/usr/share/fonts/}} and {{Path|&amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot;}}.&lt;br /&gt;
{{Path|&amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot;}} added with {{Ic|--ro-bind-try}}:&lt;br /&gt;
 --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
 --ro-bind-try &amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot; &amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot; \&lt;br /&gt;
&lt;br /&gt;
Pass {{Path|&amp;quot;$XDG_DATA_HOME&amp;quot;}} to sandbox:&lt;br /&gt;
 --setenv XDG_DATA_HOME &amp;quot;$XDG_DATA_HOME&amp;quot; \&lt;br /&gt;
just like for {{Path|&amp;quot;$XDG_CONFIG_HOME&amp;quot;}}, this isn&#039;t always defined, so&lt;br /&gt;
fallback to&lt;br /&gt;
[https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html XDG Base Directory]&lt;br /&gt;
default:&lt;br /&gt;
 XDG_DATA_HOME=&amp;quot;${XDG_DATA_HOME:-$HOME/.local/share}&amp;quot;&lt;br /&gt;
use {{Path|&amp;quot;$XDG_DATA_HOME&amp;quot;}} if set, else use {{Path|&amp;quot;$HOME/.local/share&amp;quot;}}.&lt;br /&gt;
&lt;br /&gt;
The user cache of font information is also needed, by default&lt;br /&gt;
{{Path|&amp;quot;${XDG_CACHE_HOME}/fontconfig/&amp;quot;}}:&lt;br /&gt;
 --bind-try &amp;quot;${XDG_CACHE_HOME}/fontconfig/&amp;quot; &amp;quot;${XDG_CACHE_HOME}/fontconfig/&amp;quot; \&lt;br /&gt;
&lt;br /&gt;
Pass {{Path|&amp;quot;$XDG_CACHE_HOME&amp;quot;}} to sandbox:&lt;br /&gt;
 --setenv XDG_CACHE_HOME &amp;quot;$XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
just like for {{Path|&amp;quot;$XDG_CONFIG_HOME&amp;quot;}}, this isn&#039;t always defined, so&lt;br /&gt;
fallback to&lt;br /&gt;
[https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html XDG Base Directory]&lt;br /&gt;
default:&lt;br /&gt;
 XDG_CACHE_HOME=&amp;quot;${XDG_CACHE_HOME:-$HOME/.cache}&amp;quot;&lt;br /&gt;
use {{Path|&amp;quot;$XDG_CACHE_HOME&amp;quot;}} if set, else use {{Path|&amp;quot;$HOME/.cache&amp;quot;}}.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/icu/ /usr/share/icu/ \&lt;br /&gt;
Is also needed or when you do {{Ic|:&amp;lt;backspace&amp;gt;}} it will terminate the&lt;br /&gt;
process.  ICU provides Unicode and Globalization support.&lt;br /&gt;
&lt;br /&gt;
{{Todo|This was found using: [[Bubblewrap#Can&#039;t_find_what_path_is_missing]], any better way?}}&lt;br /&gt;
&lt;br /&gt;
The updated {{Path|~/.local/bin/bwrap-imv}} should look like this:&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-imv|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# imv wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CACHE_HOME{{=}}&amp;quot;${XDG_CACHE_HOME:-$HOME/.cache}&amp;quot;&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:-$HOME/.config}&amp;quot;&lt;br /&gt;
XDG_DATA_HOME{{=}}&amp;quot;${XDG_DATA_HOME:-$HOME/.local/share}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CACHE_HOME &amp;quot;$XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_DATA_HOME &amp;quot;$XDG_DATA_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --ro-bind /bin/sh /bin/sh \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --bind-try &amp;quot;${XDG_CACHE_HOME}/fontconfig/&amp;quot; &amp;quot;${XDG_CACHE_HOME}/fontconfig/&amp;quot; \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot; \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot; &amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
  --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/libexec/imv-wayland /usr/libexec/imv-wayland \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/icu/ /usr/share/icu/ \&lt;br /&gt;
  --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
  /usr/libexec/imv-wayland &amp;quot;${1:-./}&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
==== See what exists in the sandbox ====&lt;br /&gt;
&lt;br /&gt;
Finally test what all is allowed by replacing&lt;br /&gt;
{{Ic|/usr/libexec/imv-wayland &amp;quot;${1:-./}&amp;quot;}} with {{Ic|/bin/sh}} and&lt;br /&gt;
adding {{Ic|--ro-bind /bin/ /bin/ \}}.  Check around and see what the&lt;br /&gt;
filesystem is like:&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-imv|  ...&lt;br /&gt;
  --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
  --ro-bind /bin/ /bin/ \&lt;br /&gt;
  /bin/sh}}&lt;br /&gt;
&lt;br /&gt;
Invoke {{Ic|bwrap-imv}}:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ bwrap-imv IMAGE}}&lt;br /&gt;
&lt;br /&gt;
Show what environment variables are active:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ printenv}}&lt;br /&gt;
&lt;br /&gt;
See what directories are at root:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ ls -la /&lt;br /&gt;
... bin&lt;br /&gt;
... dev&lt;br /&gt;
... etc&lt;br /&gt;
... home&lt;br /&gt;
... lib&lt;br /&gt;
... sys&lt;br /&gt;
... tmp&lt;br /&gt;
... usr}}&lt;br /&gt;
&lt;br /&gt;
{{Ic|exit}} when done:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ exit}}&lt;br /&gt;
&lt;br /&gt;
Do not forget to change it back:&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-imv|  ...&lt;br /&gt;
  --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
  /usr/libexec/imv-wayland &amp;quot;${1:-./}&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
All done with a basic {{Ic|bwrap}} wrapper.&lt;br /&gt;
&lt;br /&gt;
=== Seccomp ===&lt;br /&gt;
&lt;br /&gt;
{{Expand|}}&lt;br /&gt;
&lt;br /&gt;
== .desktop integration ==&lt;br /&gt;
&lt;br /&gt;
{{Obsolete|This should probably be documented in [[Default_applications]] and linked here.  Nothing is unique in using with {{Ic|bwrap}}.}}&lt;br /&gt;
&lt;br /&gt;
{{Note|This section is also using {{Pkg|imv|arch=}} as the example.}}&lt;br /&gt;
&lt;br /&gt;
[https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html XDG Desktop Entry Specification]&lt;br /&gt;
are a set of standards describing how a particular program is to be&lt;br /&gt;
launched, how it appears in menus, etc.&lt;br /&gt;
&lt;br /&gt;
The default &#039;&#039;.desktop&#039;&#039; file for {{Ic|imv}} is at&lt;br /&gt;
{{Path|/usr/share/applications/imv.desktop}}.  Move it to&lt;br /&gt;
{{Path|&amp;quot;${XDG_DATA_HOME}/applications/bwrap-imv.desktop&amp;quot;}}.&lt;br /&gt;
&lt;br /&gt;
Only 3 options will need to be changed: Name/Name[en_US], what shows up&lt;br /&gt;
in the application menu in a graphical file manager (if you have one&lt;br /&gt;
installed); Exec, program to execute:&lt;br /&gt;
&lt;br /&gt;
{{Cat|&amp;quot;${XDG_DATA_HOME}/applications/bwrap-imv.desktop&amp;quot;|...&amp;lt;nowiki&amp;gt;&lt;br /&gt;
Name=bwrap-imv&lt;br /&gt;
Name[en_US]=bwrap-imv&lt;br /&gt;
Exec=bwrap-imv %F&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;...}}&lt;br /&gt;
&lt;br /&gt;
The program {{Ic|xdg-open}} (from the {{Pkg|xdg-utils|arch=}} package) can be&lt;br /&gt;
used to open files based on the [https://en.wikipedia.org/wiki/MIME MIME]&lt;br /&gt;
type + corresponding entry in&lt;br /&gt;
{{Path|&amp;quot;${XDG_CONFIG_HOME}/mimeapps.list&amp;quot;}} and&lt;br /&gt;
{{Path|&amp;quot;${XDG_DATA_HOME}/applications/mimeinfo.cache&amp;quot;}}.&lt;br /&gt;
&lt;br /&gt;
Install {{Pkg|desktop-file-utils|arch=}} if it is not installed already, it&lt;br /&gt;
comes with two commands that are needed {{Ic|desktop-file-validate}} and&lt;br /&gt;
{{Ic|update-desktop-database}}:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add desktop-file-utils}}&lt;br /&gt;
&lt;br /&gt;
=== Validate ===&lt;br /&gt;
&lt;br /&gt;
It is a good idea to validate {{Ic|imv.desktop}} using&lt;br /&gt;
{{Ic|desktop-file-validate}}:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ desktop-file-validate &amp;quot;${XDG_DATA_HOME}/applications/bwrap-imv.desktop&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
=== Update database ===&lt;br /&gt;
&lt;br /&gt;
This will make entries in {{Path|&amp;quot;${XDG_DATA_HOME}/applications/&amp;quot;}} take&lt;br /&gt;
precedence over system-wide files ({{Path|/usr/share/applications/}}).&lt;br /&gt;
However {{Path|&amp;quot;${XDG_CONFIG_HOME}/mimeapps.list&amp;quot;}} has precedence over&lt;br /&gt;
both.&lt;br /&gt;
&lt;br /&gt;
Updating the database, will create&lt;br /&gt;
{{Path|&amp;quot;${XDG_DATA_HOME}/applications/mimeinfo.cache&amp;quot;}}:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ update-desktop-database &amp;quot;${XDG_DATA_HOME}/applications&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== Can&#039;t find what path is missing ===&lt;br /&gt;
&lt;br /&gt;
If all else fails start broad and work toward narrowing.  See if&lt;br /&gt;
{{Ic|bwrap}} works with the program at all:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ bwrap \&lt;br /&gt;
  --dev-bind / / PROGRAM}}&lt;br /&gt;
&lt;br /&gt;
If that works start to narrow:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ bwrap \&lt;br /&gt;
  --ro-bind /bin/ /bin/ \&lt;br /&gt;
  --dev-bind /dev/ /dev/ \&lt;br /&gt;
  --ro-bind /lib/ /lib/ \&lt;br /&gt;
  --ro-bind /sys/ /sys/ \&lt;br /&gt;
  --ro-bind /usr/ /usr/ \&lt;br /&gt;
  PROGRAM}}&lt;br /&gt;
&lt;br /&gt;
Keep going till you have narrowed as much as possible.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Bubblewrap/Examples]]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Bubblewrap ArchWiki: Bubblewrap]&lt;br /&gt;
** [https://wiki.archlinux.org/title/Bubblewrap/Examples ArchWiki: Bubblewrap/Examples]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Desktop_entries ArchWiki: Desktop entries (*.desktop files)]&lt;br /&gt;
&lt;br /&gt;
[[Category:Desktop]]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Template_talk:Pkg&amp;diff=26789</id>
		<title>Template talk:Pkg</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Template_talk:Pkg&amp;diff=26789"/>
		<updated>2024-05-27T00:54:42Z</updated>

		<summary type="html">&lt;p&gt;Encode: &amp;#039;arch=&amp;#039; default to all architectures&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This template should have options to specify the architecture and maybe also the repository. Currently packages which are not available in the x86_64 architecture (eg. `linux-asahi`) can&#039;t be linked with this template. [[User:Sertonix|Sertonix]] ([[User talk:Sertonix|talk]]) 22:52, 8 November 2023 (UTC)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;s&amp;gt;:Hey Sertonix, I&#039;ve been working on this lately, check out the potential new template @ [[Template:Sandbox]], and I&#039;d love for you to add some test cases to @ [[Sandbox]] too just in case I&#039;ve missed something! &lt;br /&gt;
:Thanks &amp;amp;ndash;[[User:zcrayfish|zcrayfish]] &amp;lt;small&amp;gt;([[User talk:zcrayfish|talk]]•[[Special:Contributions/zcrayfish|contribs]]•[[Special:EmailUser/zcrayfish|send email]])&amp;lt;/small&amp;gt; 20:32, 2 January 2024 (UTC)&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:{{done}}&lt;br /&gt;
:The pkg template has been updated!&lt;br /&gt;
:&amp;amp;ndash;[[User:zcrayfish|zcrayfish]] &amp;lt;small&amp;gt;([[User talk:zcrayfish|talk]]•[[Special:Contributions/zcrayfish|contribs]]•[[Special:EmailUser/zcrayfish|send email]])&amp;lt;/small&amp;gt; 21:40, 9 January 2024 (UTC)&lt;br /&gt;
&lt;br /&gt;
::Thanks! [[User:Sertonix|Sertonix]] ([[User talk:Sertonix|talk]]) 14:45, 10 January 2024 (UTC)&lt;br /&gt;
&lt;br /&gt;
= &#039;&#039;&#039;arch=&#039;&#039;&#039; default to all architectures =&lt;br /&gt;
&lt;br /&gt;
Most of the time what you say will apply regardless of the architecture,&lt;br /&gt;
so this will cut down on the amount of text you need for the common&lt;br /&gt;
case.&amp;lt;br&amp;gt;&lt;br /&gt;
(The same argument may apply for &#039;&#039;&#039;branch=&#039;&#039;&#039; too but I have no opinion.)&lt;br /&gt;
--[[User:Encode|Encode]] ([[User talk:Encode|talk]]) 00:54, 27 May 2024 (UTC)&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Bubblewrap&amp;diff=26777</id>
		<title>Bubblewrap</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Bubblewrap&amp;diff=26777"/>
		<updated>2024-05-24T07:28:32Z</updated>

		<summary type="html">&lt;p&gt;Encode: Pkg: Search every arch&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|The reasoning is most likely wrong for why to do some stuff.  Someone more experienced needs to look it over.}}&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
[https://github.com/containers/bubblewrap Bubblewrap] is an&lt;br /&gt;
unprivileged sandboxing tool.  Kernel features it also has:&lt;br /&gt;
User/IPC/PID/Network/UTS/cgroup&lt;br /&gt;
[https://en.wikipedia.org/wiki/Linux_namespaces namespaces] and&lt;br /&gt;
[https://en.wikipedia.org/wiki/Seccomp Seccomp] filters.&lt;br /&gt;
&lt;br /&gt;
How bubblewrap works, as stated in the&lt;br /&gt;
[https://github.com/containers/bubblewrap/blob/main/README.md#usage README.md]:&lt;br /&gt;
:bubblewrap works by creating a new, completely empty, mount namespace where the root is on a tmpfs that is invisible from the host, and will be automatically cleaned up when the last process exits. You can then use commandline options to construct the root filesystem and process environment and command to run in the namespace.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
Install {{Pkg|bubblewrap|arch=}}:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add bubblewrap}}&lt;br /&gt;
&lt;br /&gt;
{{Note|The package is {{pkg|bubblewrap|arch=}} but the command to&lt;br /&gt;
manage it is {{Ic|bwrap}}.}}&lt;br /&gt;
&lt;br /&gt;
== How to workout what a program needs ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|Look at [[Bubblewrap/Examples]] to see various ways {{Ic|bwrap}} can be used.}}&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
&lt;br /&gt;
First make sure to have a user editable directory in {{Path|&amp;quot;$PATH&amp;quot;}}.&lt;br /&gt;
This page will use {{Path|&amp;quot;${HOME}/.local/bin/&amp;quot;}}, create it if it does&lt;br /&gt;
not exist:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ mkdir -p ~/.local/bin}}&lt;br /&gt;
&lt;br /&gt;
Add it to {{Path|~/.profile}}:&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.profile|...&amp;lt;nowiki&amp;gt;&lt;br /&gt;
PATH=&amp;quot;${PATH}&amp;quot;:&amp;quot;${HOME}/.local/bin&amp;quot;&lt;br /&gt;
export PATH&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;...}}&lt;br /&gt;
&lt;br /&gt;
Will need to relog for this to apply.&lt;br /&gt;
&lt;br /&gt;
=== Basic bwrap setup ===&lt;br /&gt;
&lt;br /&gt;
{{Note|With how we will be sandboxing everything that doesn&#039;t match our owner/group will show as {{Ic|nobody}}.}}&lt;br /&gt;
&lt;br /&gt;
Lets assume you want to sandbox {{Pkg|imv|arch=}} and are using [[Wayland]]&lt;br /&gt;
only.  Here is how you might go about that.&lt;br /&gt;
&lt;br /&gt;
Create {{Ic|bwrap-imv}} inside {{Path|&amp;quot;${HOME}/.local/bin/&amp;quot;}} and make it&lt;br /&gt;
executable:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ touch ~/.local/bin/bwrap-imv&lt;br /&gt;
$ chmod 0700 ~/.local/bin/bwrap-imv}}&lt;br /&gt;
&lt;br /&gt;
Use {{Ic|file}} to determine the file type of {{Path|/usr/bin/imv}}:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ file /usr/bin/imv&lt;br /&gt;
/usr/bin/imv: POSIX shell script, ASCII text executable}}&lt;br /&gt;
&lt;br /&gt;
Since it is just a shell script, we can use {{Ic|less}} to view it:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ less /usr/bin/imv}}&lt;br /&gt;
&lt;br /&gt;
{{Cat|/usr/bin/imv|#!/bin/sh&lt;br /&gt;
if [ -n &amp;quot;${WAYLAND_DISPLAY}&amp;quot; ]; then&lt;br /&gt;
  exec /usr/libexec/imv-wayland &amp;quot;$@&amp;quot;&lt;br /&gt;
else&lt;br /&gt;
  exec /usr/libexec/imv-x11 &amp;quot;$@&amp;quot;&lt;br /&gt;
fi}}&lt;br /&gt;
&lt;br /&gt;
Since we are assuming Wayland only we can just skip to&lt;br /&gt;
{{Path|/usr/libexec/imv-wayland}}.  Run {{Ic|file}} on it:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ file /usr/libexec/imv-wayland&lt;br /&gt;
/usr/libexec/imv-wayland: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-x86_64.so.1, stripped}}&lt;br /&gt;
&lt;br /&gt;
It is an&lt;br /&gt;
[https://en.wikipedia.org/wiki/Executable_and_Linkable_Format Executable and Linkable Format (ELF)]&lt;br /&gt;
file.  So we know we need the ELF interpreter&lt;br /&gt;
{{Path|/lib/ld-musl-x86_64.so.1}}.  We also know we need&lt;br /&gt;
{{Path|/usr/libexec/imv-wayland}}, since it has to know where the command&lt;br /&gt;
is located.&lt;br /&gt;
&lt;br /&gt;
As the argument to {{Ic|/usr/libexec/imv-wayland}}, put&lt;br /&gt;
{{Ic|&amp;quot;${1:-./}&amp;quot;}}, this will pass &#039;&#039;&#039;only&#039;&#039;&#039; the first argument and if&lt;br /&gt;
there is none, will default to {{Path|./}}, the current directory.  We&lt;br /&gt;
will also need {{Ic|--ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \}},&lt;br /&gt;
since we are not passing the whole filesystem.  This will get the&lt;br /&gt;
absolute pathname using {{Ic|realpath}}, so you can pass a relative&lt;br /&gt;
argument and still bind the argument:&lt;br /&gt;
 --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
 /usr/libexec/imv-wayland &amp;quot;${1:-./}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
{{Warning|If you don&#039;t pass anything and it defaults to the current directory, it will have &#039;&#039;&#039;everything&#039;&#039;&#039; under that directory shown to {{Ic|imv}}, recursively.}}&lt;br /&gt;
{{Todo|How can you pass 2+ arguments?}}&lt;br /&gt;
&lt;br /&gt;
Find necessary shared libraries, except ones loaded at runtime:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ ldd /usr/libexec/imv-wayland}}&lt;br /&gt;
&lt;br /&gt;
It outputs a lot of things but we only need a few; the directory path of&lt;br /&gt;
the majority {{Path|/usr/lib/*}} and the 4 paths that start with&lt;br /&gt;
{{Path|/lib/*}}.  Filter the output to see those clearer:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ ldd /usr/libexec/imv-wayland {{!}} grep &#039; /lib/&#039;}}&lt;br /&gt;
&lt;br /&gt;
In total:&lt;br /&gt;
 --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
 --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
 --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
 --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
 --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
&lt;br /&gt;
{{Note|It is not worth the time to limit {{Path|/usr/lib/*}}, the churn is too great.}}&lt;br /&gt;
&lt;br /&gt;
{{Warning|The {{Ic|ldd}} manpage talks about some security implications.  It may not apply since they seem to be talking about glibc and {{Pkg|musl-utils|arch=}} makes {{Path|/lib/ld-musl-x86_64.so.1}} ldd [https://git.alpinelinux.org/aports/tree/main/musl/APKBUILD#n105].  Is this something to worry about?}}&lt;br /&gt;
&lt;br /&gt;
Since this is a shell script, lets use a helpful command:&lt;br /&gt;
 set -u&lt;br /&gt;
if the shell tries to expand an unset parameter, it will error (with a&lt;br /&gt;
few exceptions).&lt;br /&gt;
&lt;br /&gt;
Since this is for a GUI [[Wayland]] program, so lets also add some prerequisites:&lt;br /&gt;
&lt;br /&gt;
{{Note|Make sure you have dealt with [[Wayland#XDG_RUNTIME_DIR|XDG_RUNTIME_DIR]].}}&lt;br /&gt;
&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
for determining the directory for the wayland socket;&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
for determining the socket;&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
mount readonly.&lt;br /&gt;
&lt;br /&gt;
Lets also add some nice to haves:&lt;br /&gt;
 --unshare-all \&lt;br /&gt;
will create a new user/ipc/pid/net/utc namespaces and try to create a&lt;br /&gt;
new cgroup namespace if possible;&lt;br /&gt;
 --new-session&lt;br /&gt;
will create a new terminal session for the sandbox, disconnecting from&lt;br /&gt;
the controlling terminal so for example it can&#039;t inject input into the&lt;br /&gt;
terminal;&lt;br /&gt;
  --die-with-parent&lt;br /&gt;
will ensure child process ({{Ic|imv-wayland}} in this case) dies when&lt;br /&gt;
{{Ic|bwrap}} parent dies.&lt;br /&gt;
&lt;br /&gt;
We might also have a {{Path|config}} file:&lt;br /&gt;
 --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; \&lt;br /&gt;
this will add your local config to {{Ic|imv}} if you have one and if not&lt;br /&gt;
will still continue.&lt;br /&gt;
&lt;br /&gt;
Pass {{Path|&amp;quot;$XDG_CONFIG_HOME&amp;quot;}} to sandbox:&lt;br /&gt;
 --setenv XDG_CONFIG_HOME &amp;quot;$XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
but this isn&#039;t always defined, so lets fallback to the&lt;br /&gt;
[https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html XDG Base Directory]&lt;br /&gt;
default:&lt;br /&gt;
 XDG_CONFIG_HOME=&amp;quot;${XDG_CONFIG_HOME:=$HOME/.config}&amp;quot;&lt;br /&gt;
this will use {{Path|&amp;quot;$XDG_CONFIG_HOME&amp;quot;}} if it&#039;s set, otherwise&lt;br /&gt;
fallback to the default of {{Path|&amp;quot;$HOME/.config&amp;quot;}}.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /bin/sh /bin/sh \&lt;br /&gt;
Needed to use {{Path|config}} and have various information in the window&lt;br /&gt;
title.&lt;br /&gt;
&lt;br /&gt;
{{Todo|This was found using: [[Bubblewrap#Can&#039;t_find_what_path_is_missing]], any better way?}}&lt;br /&gt;
&lt;br /&gt;
{{Path|~/.local/bin/bwrap-imv}} now looks like:&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-imv|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# imv wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --ro-bind /bin/sh /bin/sh \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
  --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/libexec/imv-wayland /usr/libexec/imv-wayland \&lt;br /&gt;
  --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
  /usr/libexec/imv-wayland &amp;quot;${1:-./}&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
Now lets run {{Ic|bwrap-imv}}; go into a directory with an image:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ bwrap-imv IMAGE&lt;br /&gt;
sh: eval: line 0: can&#039;t create /dev/null: nonexistent directory&lt;br /&gt;
...&lt;br /&gt;
sh: eval: line 0: can&#039;t create /dev/null: nonexistent directory&lt;br /&gt;
xkbcommon: ERROR: failed to add default include path /usr/share/X11/xkb&lt;br /&gt;
Assertion failed: keyboard-&amp;gt;context (../src/keyboard.c: imv_keyboard_create: 20)}}&lt;br /&gt;
&lt;br /&gt;
Add:&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
to {{Ic|bwrap-imv}}.  [https://en.wikipedia.org/wiki/X_keyboard_extension XKB]&lt;br /&gt;
is a keyboard keymap support library.&lt;br /&gt;
&lt;br /&gt;
After adding the above, run it again:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ bwrap-imv IMAGE&lt;br /&gt;
sh: eval: line 0: can&#039;t create /dev/null: nonexistent directory&lt;br /&gt;
...&lt;br /&gt;
sh: eval: line 0: can&#039;t create /dev/null: nonexistent directory&lt;br /&gt;
libEGL warning: wayland-egl: could not open /dev/dri/renderD128 (No such file or directory)}}&lt;br /&gt;
&lt;br /&gt;
Add:&lt;br /&gt;
 --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
and run again:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ bwrap-imv IMAGE&lt;br /&gt;
libEGL warning: wayland-egl: drmGetMagic failed}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
Access to character devices.&lt;br /&gt;
&lt;br /&gt;
{{Todo|This was found using: [[Bubblewrap#Can&#039;t_find_what_path_is_missing]], any better way?}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
Access to PCI resources.&lt;br /&gt;
&lt;br /&gt;
{{Todo|This was found using: [[Bubblewrap#Can&#039;t_find_what_path_is_missing]], any better way?}}&lt;br /&gt;
&lt;br /&gt;
 --clearenv \&lt;br /&gt;
Finally we can unset all environment variables, except for&lt;br /&gt;
{{Path|&amp;quot;$PWD&amp;quot;}} and any we set with {{Ic|--setenv}}.&lt;br /&gt;
&lt;br /&gt;
Now {{Ic|imv}} should show images and your {{Path|config}} file should&lt;br /&gt;
work (if you have one).  If you do not use commands, the finished&lt;br /&gt;
{{Path|~/.local/bin/bwrap-imv}} should look like:&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-imv|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# imv wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --ro-bind /bin/sh /bin/sh \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
  --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/libexec/imv-wayland /usr/libexec/imv-wayland \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
  /usr/libexec/imv-wayland &amp;quot;${1:-./}&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
If you do use commands however, you will notice it is only showing&lt;br /&gt;
[https://en.wikipedia.org/wiki/Substitute_character substitute characters].&lt;br /&gt;
&lt;br /&gt;
{{Tip|Commands in {{Ic|imv}} are entered by pressing {{Ic|:}}.}}&lt;br /&gt;
&lt;br /&gt;
If you try to use a command it will say:&lt;br /&gt;
&lt;br /&gt;
 Fontconfig error: Cannot load default config file: No such file: (null)&lt;br /&gt;
&lt;br /&gt;
Look at the {{Ic|fonts-conf}} manpage (which is from&lt;br /&gt;
{{Pkg|fontconfig-doc|arch=}}) we see that {{Path|/etc/fonts/}} is the system&lt;br /&gt;
font configuration directory and&lt;br /&gt;
{{Path|&amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot;}} is the per-user configuration&lt;br /&gt;
directory.  {{Path|&amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot;}} is added with&lt;br /&gt;
{{Ic|--ro-bind-try}} so it doesn&#039;t have to exist:&lt;br /&gt;
 --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
 --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot; \&lt;br /&gt;
&lt;br /&gt;
The default directories scanned for font files are&lt;br /&gt;
{{Path|/usr/share/fonts/}} and {{Path|&amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot;}}.&lt;br /&gt;
{{Path|&amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot;}} added with {{Ic|--ro-bind-try}}:&lt;br /&gt;
 --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
 --ro-bind-try &amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot; &amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot; \&lt;br /&gt;
&lt;br /&gt;
Pass {{Path|&amp;quot;$XDG_DATA_HOME&amp;quot;}} to sandbox:&lt;br /&gt;
 --setenv XDG_DATA_HOME &amp;quot;$XDG_DATA_HOME&amp;quot; \&lt;br /&gt;
just like for {{Path|&amp;quot;$XDG_CONFIG_HOME&amp;quot;}}, this isn&#039;t always defined, so&lt;br /&gt;
fallback to&lt;br /&gt;
[https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html XDG Base Directory]&lt;br /&gt;
default:&lt;br /&gt;
 XDG_DATA_HOME=&amp;quot;${XDG_DATA_HOME:=$HOME/.local/share}&amp;quot;&lt;br /&gt;
use {{Path|&amp;quot;$XDG_DATA_HOME&amp;quot;}} if set, else use {{Path|&amp;quot;$HOME/.local/share&amp;quot;}}.&lt;br /&gt;
&lt;br /&gt;
The user cache of font information is also needed, by default&lt;br /&gt;
{{Path|&amp;quot;${XDG_CACHE_HOME}/fontconfig/&amp;quot;}}:&lt;br /&gt;
 --bind-try &amp;quot;${XDG_CACHE_HOME}/fontconfig/&amp;quot; &amp;quot;${XDG_CACHE_HOME}/fontconfig/&amp;quot; \&lt;br /&gt;
&lt;br /&gt;
Pass {{Path|&amp;quot;$XDG_CACHE_HOME&amp;quot;}} to sandbox:&lt;br /&gt;
 --setenv XDG_CACHE_HOME &amp;quot;$XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
just like for {{Path|&amp;quot;$XDG_CONFIG_HOME&amp;quot;}}, this isn&#039;t always defined; so&lt;br /&gt;
fallback to&lt;br /&gt;
[https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html XDG Base Directory]&lt;br /&gt;
default:&lt;br /&gt;
 XDG_CACHE_HOME=&amp;quot;${XDG_CACHE_HOME:=$HOME/.cache}&amp;quot;&lt;br /&gt;
use {{Path|&amp;quot;$XDG_CACHE_HOME&amp;quot;}} if set, else use {{Path|&amp;quot;$HOME/.cache&amp;quot;}}.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/icu/ /usr/share/icu/ \&lt;br /&gt;
Is also needed or when you do {{Ic|:&amp;lt;backspace&amp;gt;}} it will terminate the&lt;br /&gt;
process.  ICU provides Unicode and Globalization support.&lt;br /&gt;
&lt;br /&gt;
{{Todo|This was found using: [[Bubblewrap#Can&#039;t_find_what_path_is_missing]], any better way?}}&lt;br /&gt;
&lt;br /&gt;
The updated {{Path|~/.local/bin/bwrap-imv}} should look like this:&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-imv|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# imv wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CACHE_HOME{{=}}&amp;quot;${XDG_CACHE_HOME:{{=}}$HOME/.cache}&amp;quot;&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
XDG_DATA_HOME{{=}}&amp;quot;${XDG_DATA_HOME:{{=}}$HOME/.local/share}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CACHE_HOME &amp;quot;$XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_DATA_HOME &amp;quot;$XDG_DATA_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --ro-bind /bin/sh /bin/sh \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --bind-try &amp;quot;${XDG_CACHE_HOME}/fontconfig/&amp;quot; &amp;quot;${XDG_CACHE_HOME}/fontconfig/&amp;quot; \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot; \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot; &amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
  --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/libexec/imv-wayland /usr/libexec/imv-wayland \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/icu/ /usr/share/icu/ \&lt;br /&gt;
  --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
  /usr/libexec/imv-wayland &amp;quot;${1:-./}&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
==== See what exists in the sandbox ====&lt;br /&gt;
&lt;br /&gt;
Finally test what all is allowed by replacing&lt;br /&gt;
{{Ic|/usr/libexec/imv-wayland &amp;quot;${1:-./}&amp;quot;}} with {{Ic|/bin/sh}} and&lt;br /&gt;
adding {{Ic|--ro-bind /bin/ /bin/ \}}.  Check around and see what the&lt;br /&gt;
filesystem is like:&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-imv|  ...&lt;br /&gt;
  --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
  --ro-bind /bin/ /bin/ \&lt;br /&gt;
  /bin/sh}}&lt;br /&gt;
&lt;br /&gt;
Invoke {{Ic|bwrap-imv}}:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ bwrap-imv IMAGE}}&lt;br /&gt;
&lt;br /&gt;
Show what environment variables are active:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ printenv}}&lt;br /&gt;
&lt;br /&gt;
See what directories are at root:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ ls -la /&lt;br /&gt;
... bin&lt;br /&gt;
... dev&lt;br /&gt;
... etc&lt;br /&gt;
... home&lt;br /&gt;
... lib&lt;br /&gt;
... sys&lt;br /&gt;
... tmp&lt;br /&gt;
... usr}}&lt;br /&gt;
&lt;br /&gt;
{{Ic|exit}} when done:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ exit}}&lt;br /&gt;
&lt;br /&gt;
Do not forget to change it back:&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-imv|  ...&lt;br /&gt;
  --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
  /usr/libexec/imv-wayland &amp;quot;${1:-./}&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
All done with a basic {{Ic|bwrap}} wrapper.&lt;br /&gt;
&lt;br /&gt;
=== Seccomp ===&lt;br /&gt;
&lt;br /&gt;
{{Expand|}}&lt;br /&gt;
&lt;br /&gt;
== .desktop integration ==&lt;br /&gt;
&lt;br /&gt;
{{Obsolete|This should probably be documented in [[Default_applications]] and linked here.  Nothing is unique in using with {{Ic|bwrap}}.}}&lt;br /&gt;
&lt;br /&gt;
{{Note|This section is also using {{Pkg|imv|arch=}} as the example.}}&lt;br /&gt;
&lt;br /&gt;
[https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html XDG Desktop Entry Specification]&lt;br /&gt;
are a set of standards describing how a particular program is to be&lt;br /&gt;
launched, how it appears in menus, etc.&lt;br /&gt;
&lt;br /&gt;
The default &#039;&#039;.desktop&#039;&#039; file for {{Ic|imv}} is at&lt;br /&gt;
{{Path|/usr/share/applications/imv.desktop}}.  Move it to&lt;br /&gt;
{{Path|&amp;quot;${XDG_DATA_HOME}/applications/bwrap-imv.desktop&amp;quot;}}.&lt;br /&gt;
&lt;br /&gt;
Only 3 options will need to be changed: Name/Name[en_US], what shows up&lt;br /&gt;
in the application menu in a graphical file manager (if you have one&lt;br /&gt;
installed); Exec, program to execute:&lt;br /&gt;
&lt;br /&gt;
{{Cat|&amp;quot;${XDG_DATA_HOME}/applications/bwrap-imv.desktop&amp;quot;|...&amp;lt;nowiki&amp;gt;&lt;br /&gt;
Name=bwrap-imv&lt;br /&gt;
Name[en_US]=bwrap-imv&lt;br /&gt;
Exec=bwrap-imv %F&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;...}}&lt;br /&gt;
&lt;br /&gt;
The program {{Ic|xdg-open}} (from the {{Pkg|xdg-utils|arch=}} package) can be&lt;br /&gt;
used to open files based on the [https://en.wikipedia.org/wiki/MIME MIME]&lt;br /&gt;
type + corresponding entry in&lt;br /&gt;
{{Path|&amp;quot;${XDG_CONFIG_HOME}/mimeapps.list&amp;quot;}} and&lt;br /&gt;
{{Path|&amp;quot;${XDG_DATA_HOME}/applications/mimeinfo.cache&amp;quot;}}.&lt;br /&gt;
&lt;br /&gt;
Install {{Pkg|desktop-file-utils|arch=}} if it is not installed already, it&lt;br /&gt;
comes with two commands that are needed {{Ic|desktop-file-validate}} and&lt;br /&gt;
{{Ic|update-desktop-database}}:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add desktop-file-utils}}&lt;br /&gt;
&lt;br /&gt;
=== Validate ===&lt;br /&gt;
&lt;br /&gt;
It is a good idea to validate {{Ic|imv.desktop}} using&lt;br /&gt;
{{Ic|desktop-file-validate}}:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ desktop-file-validate &amp;quot;${XDG_DATA_HOME}/applications/bwrap-imv.desktop&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
=== Update database ===&lt;br /&gt;
&lt;br /&gt;
This will make entries in {{Path|&amp;quot;${XDG_DATA_HOME}/applications/&amp;quot;}} take&lt;br /&gt;
precedence over system-wide files ({{Path|/usr/share/applications/}}).&lt;br /&gt;
However {{Path|&amp;quot;${XDG_CONFIG_HOME}/mimeapps.list&amp;quot;}} has precedence over&lt;br /&gt;
both.&lt;br /&gt;
&lt;br /&gt;
Updating the database, will create&lt;br /&gt;
{{Path|&amp;quot;${XDG_DATA_HOME}/applications/mimeinfo.cache&amp;quot;}}:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ update-desktop-database &amp;quot;${XDG_DATA_HOME}/applications&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== Can&#039;t find what path is missing ===&lt;br /&gt;
&lt;br /&gt;
If all else fails start broad and work toward narrowing.  See if&lt;br /&gt;
{{Ic|bwrap}} works with the program at all:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ bwrap \&lt;br /&gt;
  --dev-bind / / PROGRAM}}&lt;br /&gt;
&lt;br /&gt;
If that works start to narrow:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ bwrap \&lt;br /&gt;
  --ro-bind /bin/ /bin/ \&lt;br /&gt;
  --dev-bind /dev/ /dev/ \&lt;br /&gt;
  --ro-bind /lib/ /lib/ \&lt;br /&gt;
  --ro-bind /sys/ /sys/ \&lt;br /&gt;
  --ro-bind /usr/ /usr/ \&lt;br /&gt;
  PROGRAM}}&lt;br /&gt;
&lt;br /&gt;
Keep going till you have narrowed as much as possible.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Bubblewrap/Examples]]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Bubblewrap ArchWiki: Bubblewrap]&lt;br /&gt;
** [https://wiki.archlinux.org/title/Bubblewrap/Examples ArchWiki: Bubblewrap/Examples]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Desktop_entries ArchWiki: Desktop entries (*.desktop files)]&lt;br /&gt;
&lt;br /&gt;
[[Category:Desktop]]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Bubblewrap/Examples&amp;diff=26776</id>
		<title>Bubblewrap/Examples</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Bubblewrap/Examples&amp;diff=26776"/>
		<updated>2024-05-24T07:24:12Z</updated>

		<summary type="html">&lt;p&gt;Encode: Pkg: Search every arch&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|Someone more experienced needs to look over this.}}&lt;br /&gt;
&lt;br /&gt;
{{Todo|&lt;br /&gt;
* Since bubblewrap can make use of [https://en.wikipedia.org/wiki/Seccomp seccomp], restrictive versions should be added.&lt;br /&gt;
* {{Ic|imv}}, {{Ic|mpv}} and {{Ic|zathura}} currently only accept 1 mandatory (except {{Ic|imv}}) argument.  This should (hopefully) be temporary, until I figure out how to pass multiple arguments (without including everything else).}}&lt;br /&gt;
&lt;br /&gt;
{{Warning|These were found by going backward; start with a complicated program and as restricted as possible sandbox, allowing more till the program appears to work.  Because of this, complicated and sensitive programs (for example: {{Pkg|firefox|arch=}} and {{Pkg|keepassxc|arch=}}) may be missing some things they need, which might lead to &#039;&#039;&#039;LESS SECURITY&#039;&#039;&#039;, &#039;&#039;&#039;LESS PRIVACY&#039;&#039;&#039; and &#039;&#039;&#039;DATA LOSS&#039;&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
{{Note|&lt;br /&gt;
* This page assumes you have already read [[Bubblewrap]].&lt;br /&gt;
* To try and avoid duplicates everything will be explained for [[Firefox]] and only when it differs (non obviously) for everything else.&lt;br /&gt;
* Where applicable, this assumes: [[Wayland]] only + [[PipeWire]].&lt;br /&gt;
: If Wayland is needed, make sure you have dealt with [[Wayland#XDG_RUNTIME_DIR|XDG_RUNTIME_DIR]].}}&lt;br /&gt;
&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
== Firefox ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-firefox|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# Firefox wrapped in bwrap with network access.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CACHE_HOME{{=}}&amp;quot;${XDG_CACHE_HOME:{{=}}$HOME/.cache}&amp;quot;&lt;br /&gt;
XDG_DATA_HOME{{=}}&amp;quot;${XDG_DATA_HOME:{{=}}$HOME/.local/share}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CACHE_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --share-net \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CACHE_HOME &amp;quot;$NEW_XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --hostname localhost \&lt;br /&gt;
  --dev /dev/ \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --ro-bind /etc/resolv.conf /etc/resolv.conf \&lt;br /&gt;
  --bind-try &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mozilla/&amp;quot; \&lt;br /&gt;
  --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
  --bind-try &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --proc /proc/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/glib-2.0/ /usr/share/glib-2.0/ \&lt;br /&gt;
  --ro-bind /usr/share/icons/ /usr/share/icons/ \&lt;br /&gt;
  --ro-bind /usr/share/icu/ /usr/share/icu/ \&lt;br /&gt;
  --ro-bind /usr/share/mime/ /usr/share/mime/ \&lt;br /&gt;
  /usr/lib/firefox/firefox}}&lt;br /&gt;
&lt;br /&gt;
 set -u&lt;br /&gt;
If the shell tries to expand an unset parameter, it will error (with a&lt;br /&gt;
few exceptions).&lt;br /&gt;
&lt;br /&gt;
 XDG_CACHE_HOME=&amp;quot;${XDG_CACHE_HOME:=$HOME/.cache}&amp;quot;&lt;br /&gt;
 XDG_DATA_HOME=&amp;quot;${XDG_DATA_HOME:=$HOME/.local/share}&amp;quot;&lt;br /&gt;
Take value if already set, else fallback to the [https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html XDG] default.&lt;br /&gt;
&lt;br /&gt;
 NEW_HOME=&#039;/home/user&#039;&lt;br /&gt;
User to appear as.&lt;br /&gt;
&lt;br /&gt;
 NEW_XDG_CACHE_HOME=&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
{{Path|&amp;quot;$XDG_CACHE_HOME&amp;quot;}} for the new user.&lt;br /&gt;
&lt;br /&gt;
 mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot;&lt;br /&gt;
Make sure the new (real) home for Firefox data exist.&lt;br /&gt;
&lt;br /&gt;
 --unshare-all \&lt;br /&gt;
Unshare all possible [https://en.wikipedia.org/wiki/Linux_namespaces namespaces].&lt;br /&gt;
&lt;br /&gt;
 --share-net \&lt;br /&gt;
Retain the network namespace.&lt;br /&gt;
&lt;br /&gt;
 --new-session \&lt;br /&gt;
New terminal session for the sandbox.&lt;br /&gt;
&lt;br /&gt;
 --die-with-parent \&lt;br /&gt;
Child process dies when {{Ic|bwrap}} parent dies.&lt;br /&gt;
&lt;br /&gt;
 --clearenv \&lt;br /&gt;
Unset all environment variables (except for {{Path|&amp;quot;$PWD&amp;quot;}}).&lt;br /&gt;
&lt;br /&gt;
 --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
Pass the path to {{Path|&amp;quot;$NEW_HOME&amp;quot;}} for {{Path|&amp;quot;$HOME&amp;quot;}}.&lt;br /&gt;
&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
Specify the Wayland display to run clients on.&lt;br /&gt;
&lt;br /&gt;
 --setenv XDG_CACHE_HOME &amp;quot;$NEW_XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
User-specific non-essential (cached) data.&lt;br /&gt;
&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
User-specific non-essential runtime files and other file objects.&lt;br /&gt;
&lt;br /&gt;
 --hostname localhost \&lt;br /&gt;
Use custom hostname in the sandbox.&lt;br /&gt;
&lt;br /&gt;
 --dev /dev/ \&lt;br /&gt;
New devtmpfs, access to special or device files.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
System font configuration directory.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /etc/resolv.conf /etc/resolv.conf \&lt;br /&gt;
Needed for DNS resolution.&lt;br /&gt;
&lt;br /&gt;
 --bind-try &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mozilla/&amp;quot; \&lt;br /&gt;
Per-user Mozilla cache.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 XDG_CACHE_HOME=&amp;quot;${XDG_CACHE_HOME:=$HOME/.cache}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;XDG_CONFIG_HOME &amp;quot;${XDG_CONFIG_HOME:=$HOME/.config}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 XDG_DATA_HOME=&amp;quot;${XDG_DATA_HOME:=$HOME/.local/share}&amp;quot;&lt;br /&gt;
 ...&lt;br /&gt;
 NEW_XDG_CACHE_HOME=&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;NEW_XDG_CONFIG_HOME=&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --bind-try &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mozilla/&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/fontconfig/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) Per-user font configuration directory.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 XDG_CACHE_HOME=&amp;quot;${XDG_CACHE_HOME:=$HOME/.cache}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;XDG_CONFIG_HOME &amp;quot;${XDG_CONFIG_HOME:=$HOME/.config}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 XDG_DATA_HOME=&amp;quot;${XDG_DATA_HOME:=$HOME/.local/share}&amp;quot;&lt;br /&gt;
 ...&lt;br /&gt;
 NEW_XDG_CACHE_HOME=&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;NEW_XDG_CONFIG_HOME=&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --bind-try &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/user-dirs.dirs&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/user-dirs.dirs&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) If you modify &amp;quot;well known&amp;quot; user directories, like&lt;br /&gt;
{{Path|~/Downloads/}}, you need this to have Firefox pick it up.&lt;br /&gt;
&lt;br /&gt;
{{Note|If you use {{Path|&amp;quot;${XDG_CONFIG_HOME}/user-dirs.dirs&amp;quot;}} you should also add the corresponding path(s).&lt;br /&gt;
For example if you set {{Path|XDG_DOWNLOAD_DIR}} to&lt;br /&gt;
{{Path|&amp;quot;${HOME}/downloads/&amp;quot;}} you would also add:&lt;br /&gt;
  ...&lt;br /&gt;
  --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
  &#039;&#039;&#039;--bind-try &amp;quot;${HOME}/downloads/&amp;quot; &amp;quot;${NEW_HOME}/downloads/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
{{Path|&amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot;}} is the location of Firefox data.  Shown to Firefox as {{Path|&amp;quot;${NEW_HOME}/.mozilla/&amp;quot;}}.&lt;br /&gt;
&lt;br /&gt;
{{Note|This has the added benefit of getting {{Path|~/.mozilla/}} out of your {{Path|&amp;quot;$HOME&amp;quot;}}, and conforming more to XDG.  This may one day not be necessary: [https://bugzilla.mozilla.org/show_bug.cgi?id{{=}}259356 Support for the Freedesktop.org XDG Base Directory Specification (2004-09-14)].}}&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 NEW_XDG_CACHE_HOME=&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;NEW_XDG_DATA_HOME=&amp;quot;${NEW_HOME}${XDG_DATA_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--setenv XDG_DATA_HOME &amp;quot;$NEW_XDG_DATA_HOME&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind-try &amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot; &amp;quot;${NEW_XDG_DATA_HOME}/fonts/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --bind-try &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) Per-user directory scanned for font files.&lt;br /&gt;
&lt;br /&gt;
 --bind-try &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
Default {{Path|~/Downloads/}} directory.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
 --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
 --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
 --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
 --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
Shared libraries.&lt;br /&gt;
&lt;br /&gt;
 --proc /proc/ \&lt;br /&gt;
New procfs, provides information about running processes and the kernel.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
Bind the Wayland socket file.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
Object files and libraries.&lt;br /&gt;
&lt;br /&gt;
{{Note|It is not worth the time to limit this, the churn is too great.}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
XKB is a keyboard keymap support library.&lt;br /&gt;
&lt;br /&gt;
{{Note|Even tho the path has {{Path|*/X11/*}} Wayland uses it too.}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
Font presets.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
Global directory scanned for font files.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/glib-2.0/ /usr/share/glib-2.0/ \&lt;br /&gt;
Needed for &amp;quot;Save Page As…&amp;quot;, &amp;quot;Export|Import Bookmarks File&amp;quot;, among others.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/icons/ /usr/share/icons/ \&lt;br /&gt;
Global icons directory.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/icu/ /usr/share/icu/ \&lt;br /&gt;
International Components for Unicode (ICU) provides support for Unicode&lt;br /&gt;
and globalization.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 --ro-bind /usr/share/icu/ /usr/share/icu/ \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind /usr/share/libdrm/ /usr/share/libdrm/ \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind /usr/share/mime/ /usr/share/mime/ \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) Direct Rendering Manager (DRM), Linux kernel subsystem for&lt;br /&gt;
interfacing with GPUs of video cards.  Programs can use this to have the&lt;br /&gt;
GPU do hardware-accelerated 3D rendering and video decoding.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/mime/ /usr/share/mime/ \&lt;br /&gt;
Global XDG MIME directory.&lt;br /&gt;
&lt;br /&gt;
 /usr/lib/firefox/firefox&lt;br /&gt;
Call Firefox.&lt;br /&gt;
&lt;br /&gt;
{{Tip|If you use multiple profiles you can have:&lt;br /&gt;
 /usr/lib/firefox/firefox -P &amp;quot;$@&amp;quot;&lt;br /&gt;
this will allow you to pass a profile name and go into that specific one or not pass anything and get prompted for which to choose.}}&lt;br /&gt;
&lt;br /&gt;
=== PipeWire audio ===&lt;br /&gt;
&lt;br /&gt;
{{Todo|}}&lt;br /&gt;
&lt;br /&gt;
=== Pulse audio ===&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 --proc /proc/ \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind &amp;quot;${XDG_RUNTIME_DIR}/pulse/&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/pulse/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) Pulse audio.&lt;br /&gt;
&lt;br /&gt;
=== Optional(?) stuff ===&lt;br /&gt;
&lt;br /&gt;
{{Draft|Are these needed?}}&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 --proc /proc/ \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind /sys/bus/pci/ /sys/bus/pci/ \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
Information about PCI bus type.&lt;br /&gt;
&lt;br /&gt;
Without this you get&lt;br /&gt;
 Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: cannot access /sys/bus/pci (t=0.177033) [GFX1-]: glxtest: cannot access /sys/bus/pci&lt;br /&gt;
but it still seems to work.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 --proc /proc/ \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
Contains a filesystem representation of the kernel device tree.&lt;br /&gt;
&lt;br /&gt;
With {{Ic|--ro-bind /sys/bus/pci/ /sys/bus/pci/ \}} but without this you get:&lt;br /&gt;
 Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: ManageChildProcess failed&lt;br /&gt;
  (t=0.189558) [GFX1-]: glxtest: ManageChildProcess failed&lt;br /&gt;
&lt;br /&gt;
 Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: ManageChildProcess failed&lt;br /&gt;
  (t=0.189558) |[1][GFX1-]: No GPUs detected via PCI&lt;br /&gt;
  (t=0.18958) [GFX1-]: No GPUs detected via PCI&lt;br /&gt;
but it still seems to work.&lt;br /&gt;
&lt;br /&gt;
== imv ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-imv|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# imv wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --ro-bind /bin/sh /bin/sh \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
  --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/libexec/imv-wayland /usr/libexec/imv-wayland \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
  /usr/libexec/imv-wayland &amp;quot;${1:-./}&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /bin/sh /bin/sh \&lt;br /&gt;
Needed to use {{Path|config}} and have various information in the window&lt;br /&gt;
title.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;XDG_CACHE_HOME{{=}}&amp;quot;${XDG_CACHE_HOME:{{=}}$HOME/.cache}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;XDG_DATA_HOME{{=}}&amp;quot;${XDG_DATA_HOME:{{=}}$HOME/.local/share}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--setenv XDG_CACHE_HOME &amp;quot;$XDG_CACHE_HOME&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --setenv XDG_CONFIG_HOME &amp;quot;$XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--setenv XDG_DATA_HOME &amp;quot;$XDG_DATA_HOME&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind /etc/fonts/ /etc/fonts/ \&#039;&#039;&#039;&lt;br /&gt;
 &#039;&#039;&#039;--bind-try &amp;quot;${XDG_CACHE_HOME}/fontconfig/&amp;quot; &amp;quot;${XDG_CACHE_HOME}/fontconfig/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind-try &amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot; &amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
 ...&lt;br /&gt;
 --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind /usr/share/fonts/ /usr/share/fonts/ \&#039;&#039;&#039;&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind /usr/share/icu/ /usr/share/icu/ \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) To use commands in {{Ic|imv}}.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
Access to character devices.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
Access to PCI resources.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
Get the absolute pathname using {{Ic|realpath}}, so you can pass a&lt;br /&gt;
relative argument and still bind the argument.  If you don&#039;t pass in&lt;br /&gt;
anything it will default to {{Path|./}}, the current directory.&lt;br /&gt;
&lt;br /&gt;
{{Warning|If you don&#039;t pass anything and it defaults to the current directory, it will have &#039;&#039;&#039;everything&#039;&#039;&#039; under that directory shown to {{Ic|imv}}, recursively.}}&lt;br /&gt;
&lt;br /&gt;
== KeePassXC ==&lt;br /&gt;
&lt;br /&gt;
{{Note|I only use the bare minimum functionality, so functionality you need is probably missing.  If you use functionality not here, your contribution will be most appreciated.  To kick things off: {{Ic|Unable to initialize libusb. USB devices may not be detected properly.}} can be silenced with {{Ic|--dev-bind /dev/bus/usb/ /dev/bus/usb/ \}}.}}&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-keepassxc|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# keepassxc wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
PASSWORD_DATABASE{{=}}&amp;quot;${HOME}/password database&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CONFIG_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
NEW_PASSWORD_DATABASE{{=}}&amp;quot;${NEW_HOME}${PASSWORD_DATABASE#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mkdir -pm 0700 &amp;quot;$PASSWORD_DATABASE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --setenv XDG_SESSION_TYPE &amp;quot;$XDG_SESSION_TYPE&amp;quot; \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --bind-try &amp;quot;${XDG_CONFIG_HOME}/keepassxc/&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/keepassxc/&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libssl.so.3 /lib/libssl.so.3 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind /usr/bin/keepassxc /usr/bin/keepassxc \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/ /usr/share/X11/ \&lt;br /&gt;
  --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/keepassxc/ /usr/share/keepassxc/ \&lt;br /&gt;
  --bind &amp;quot;$PASSWORD_DATABASE/&amp;quot; &amp;quot;$NEW_PASSWORD_DATABASE/&amp;quot; \&lt;br /&gt;
  /usr/bin/keepassxc &amp;quot;$@&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 PASSWORD_DATABASE=&amp;quot;${HOME}/password database&amp;quot;&lt;br /&gt;
Directory containing your {{Pkg|keepassxc|arch=}} password database.&lt;br /&gt;
&lt;br /&gt;
{{Tip|This is almost certainly not where &#039;&#039;&#039;your&#039;&#039;&#039; database is located.  You will need to change it to where you put your password database.}}&lt;br /&gt;
&lt;br /&gt;
 --setenv XDG_SESSION_TYPE &amp;quot;$XDG_SESSION_TYPE&amp;quot; \&lt;br /&gt;
Session type, since we are assuming Wayland only, this will be &amp;quot;wayland&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
Access to character devices.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
Access to PCI resources.&lt;br /&gt;
&lt;br /&gt;
 --bind &amp;quot;$PASSWORD_DATABASE/&amp;quot; &amp;quot;$NEW_PASSWORD_DATABASE/&amp;quot; \&lt;br /&gt;
Bind password database.&lt;br /&gt;
&lt;br /&gt;
== mpv ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-mpv|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# mpv wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; !{{=}} 1 ]&lt;br /&gt;
then&lt;br /&gt;
	printf &#039;Run mpv wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
  $ bwrap-mpv VIDEO\n&#039;&lt;br /&gt;
	exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
XDG_CACHE_HOME{{=}}&amp;quot;${XDG_CACHE_HOME:{{=}}$HOME/.cache}&amp;quot;&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CACHE_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
NEW_XDG_CONFIG_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CACHE_HOME &amp;quot;$NEW_XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --hostname localhost \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --ro-bind /etc/mpv/ /etc/mpv/ \&lt;br /&gt;
  --bind-try &amp;quot;${XDG_CACHE_HOME}/mesa_shader_cache/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mesa_shader_cache/&amp;quot; \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libacl.so.1 /lib/libacl.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libssl.so.3 /lib/libssl.so.3 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --proc /proc/ \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/pipewire-0&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/pipewire-0&amp;quot; \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/bin/mpv /usr/bin/mpv \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/pipewire/ /usr/share/pipewire/ \&lt;br /&gt;
  --ro-bind &amp;quot;$1&amp;quot; &amp;quot;$(realpath &amp;quot;$1&amp;quot;)&amp;quot; \&lt;br /&gt;
  /usr/bin/mpv \&lt;br /&gt;
    --player-operation-mode{{=}}pseudo-gui \&lt;br /&gt;
    --title{{=}}&#039;bwrap {{!}} ${media-title}&#039; \&lt;br /&gt;
    &amp;quot;$1&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
Access to character devices.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
Access to PCI resources.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;$1&amp;quot; &amp;quot;$(realpath &amp;quot;$1&amp;quot;)&amp;quot; \&lt;br /&gt;
Get the absolute pathname using {{Ic|realpath}}, so you can pass a&lt;br /&gt;
relative argument and still bind the argument.&lt;br /&gt;
&lt;br /&gt;
 --player-operation-mode=pseudo-gui \&lt;br /&gt;
Because {{Ic|--new-session}} is used, this is needed to have a way to&lt;br /&gt;
control {{Ic|mpv}} when it would otherwise not show a GUI.&lt;br /&gt;
&lt;br /&gt;
{{Tip|If you followed [[Bubblewrap#.desktop_integration]], you should remove it from {{Path|&amp;quot;${XDG_DATA_HOME}/applications/bwrap-mpv.desktop&amp;quot;}}.}}&lt;br /&gt;
&lt;br /&gt;
 --title=&#039;bwrap | ${media-title}&#039; \&lt;br /&gt;
Set the window title, showing at a glance that you are using {{Ic|bwrap}}.&lt;br /&gt;
&lt;br /&gt;
=== mpv-net ===&lt;br /&gt;
&lt;br /&gt;
If you want to use {{Ic|mpv}} to stream over the Internet, you will need&lt;br /&gt;
a few things more.&lt;br /&gt;
&lt;br /&gt;
{{Tip|You can use both {{Ic|bwrap-mpv}} and {{Ic|bwrap-mpv-net}}.  {{Ic|bwrap-mpv}} for local stuff and {{Ic|bwrap-mpv-net}} for watching over the Internet.}}&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-mpv-net|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# mpv wrapped in bwrap with network access.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CACHE_HOME{{=}}&amp;quot;${XDG_CACHE_HOME:{{=}}$HOME/.cache}&amp;quot;&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CACHE_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
NEW_XDG_CONFIG_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --share-net \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv PATH /usr/bin/ \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CACHE_HOME &amp;quot;$NEW_XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --hostname localhost \&lt;br /&gt;
  --dev /dev/ \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --ro-bind /etc/mpv/ /etc/mpv/ \&lt;br /&gt;
  --ro-bind /etc/resolv.conf /etc/resolv.conf \&lt;br /&gt;
  --ro-bind /etc/ssl/certs/ /etc/ssl/certs/ \&lt;br /&gt;
  --bind-try &amp;quot;${XDG_CACHE_HOME}/mesa_shader_cache/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mesa_shader_cache/&amp;quot; \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libacl.so.1 /lib/libacl.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libssl.so.3 /lib/libssl.so.3 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --proc /proc/ \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/pipewire-0&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/pipewire-0&amp;quot; \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/bin/mpv /usr/bin/mpv \&lt;br /&gt;
  --ro-bind /usr/bin/python3 /usr/bin/python3 \&lt;br /&gt;
  --ro-bind /usr/bin/yt-dlp /usr/bin/yt-dlp \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/pipewire/ /usr/share/pipewire/ \&lt;br /&gt;
  /usr/bin/mpv \&lt;br /&gt;
    --player-operation-mode{{=}}pseudo-gui \&lt;br /&gt;
    --title{{=}}&#039;bwrap {{!}} ${media-title}&#039; \&lt;br /&gt;
    &amp;quot;$@&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 --setenv PATH /usr/bin/ \&lt;br /&gt;
{{Todo|Document why this is needed.}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /etc/ssl/certs/ /etc/ssl/certs/ \&lt;br /&gt;
Certificate authorities that are &#039;&#039;trusted&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
Access to character devices.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
Access to PCI resources.&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;$@&amp;quot;&lt;br /&gt;
This is so you can pass more options to {{Ic|bwrap-mpv-net}}, for example:&lt;br /&gt;
 $ bwrap-mpv-net --video=no --sub=no &#039;URL1&#039; &#039;URL2&#039;&lt;br /&gt;
&lt;br /&gt;
=== Pulse audio ===&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/pulse&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/pulse&amp;quot; \&lt;br /&gt;
Pulse audio.&lt;br /&gt;
&lt;br /&gt;
=== Screenshots ===&lt;br /&gt;
&lt;br /&gt;
The default screenshots directory is {{Path|&amp;quot;$XDG_DESKTOP_DIR&amp;quot;}} (which is&lt;br /&gt;
{{Path|&amp;quot;${HOME}/Desktop/&amp;quot;}}, which will fallback to {{Path|&amp;quot;$HOME/&amp;quot;}} if&lt;br /&gt;
{{Path|&amp;quot;${HOME}/Desktop/&amp;quot;}} doesn&#039;t exist).  That means that by default&lt;br /&gt;
{{Ic|bwrap-mpv[-net]}} won&#039;t allow screenshots unless you change a few things.&lt;br /&gt;
Do the following to allow an XDG approved screenshots directory:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 XDG_CONFIG_HOME=&amp;quot;${XDG_CONFIG_HOME:=$HOME/.config}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;XDG_DATA_HOME=&amp;quot;${XDG_DATA_HOME:=$HOME/.local/share}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
 NEW_XDG_CONFIG_HOME=&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;NEW_XDG_DATA_HOME=&amp;quot;${NEW_HOME}${XDG_DATA_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/mpv/&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
 --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--setenv XDG_DATA_HOME &amp;quot;$NEW_XDG_DATA_HOME&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--bind &amp;quot;${XDG_DATA_HOME}/mpv/&amp;quot; &amp;quot;${NEW_XDG_DATA_HOME}/mpv/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
 ...&lt;br /&gt;
Now make {{Ic|mpv}} use that directory:&lt;br /&gt;
&lt;br /&gt;
{{Cat|&amp;quot;${XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot;|&amp;lt;nowiki&amp;gt;...&lt;br /&gt;
# Something like this, change to match &amp;quot;$XDG_DATA_HOME&amp;quot;&lt;br /&gt;
screenshot-template=&amp;quot;~/.local/share/mpv/screenshots/%F [%p] %02n&amp;quot;&lt;br /&gt;
...&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
== yt-dlp ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-yt-dlp|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# yt-dlp wrapped in bwrap with network access.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CONFIG_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mkdir -pm 0700 &amp;quot;${HOME}/Downloads/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --share-net \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --hostname localhost \&lt;br /&gt;
  --ro-bind /etc/resolv.conf /etc/resolv.conf \&lt;br /&gt;
  --ro-bind /etc/ssl/certs/ /etc/ssl/certs/ \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/yt-dlp/config&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/yt-dlp/config&amp;quot; \&lt;br /&gt;
  --bind &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libssl.so.3 /lib/libssl.so.3 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind /usr/bin/ffmpeg /usr/bin/ffmpeg \&lt;br /&gt;
  --ro-bind /usr/bin/python3 /usr/bin/python3 \&lt;br /&gt;
  --ro-bind /usr/bin/yt-dlp /usr/bin/yt-dlp \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  /usr/bin/yt-dlp &amp;quot;$@&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 --bind &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
Directory for writing the files.  This should match {{Ic|--output}} that&lt;br /&gt;
is either in {{Path|&amp;quot;${XDG_CONFIG_HOME}/yt-dlp/config&amp;quot;}} or passed on&lt;br /&gt;
the command line.&lt;br /&gt;
&lt;br /&gt;
 /usr/bin/yt-dlp &amp;quot;$@&amp;quot;&lt;br /&gt;
This is so you can pass more options to {{Ic|bwrap-yt-dlp}}, for example:&lt;br /&gt;
 $ bwrap-yt-dlp --no-playlist &#039;URL1&#039; &#039;URL2&#039;&lt;br /&gt;
&lt;br /&gt;
== zathura ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-zathura|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# zathura wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; !{{=}} 1 ]&lt;br /&gt;
then&lt;br /&gt;
	printf &#039;Run zathura wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
  $ bwrap-zathura PDF\n&#039;&lt;br /&gt;
	exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
XDG_DATA_HOME{{=}}&amp;quot;${XDG_DATA_HOME:{{=}}$HOME/.local/share}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$HOME&amp;quot; \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_DATA_HOME &amp;quot;$XDG_DATA_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/zathura/zathurarc&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/zathura/zathurarc&amp;quot; \&lt;br /&gt;
  --bind &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot; &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
  --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/bin/zathura /usr/bin/zathura \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/misc/magic.mgc /usr/share/misc/magic.mgc \&lt;br /&gt;
  --ro-bind &amp;quot;$1&amp;quot; &amp;quot;$(realpath &amp;quot;$1&amp;quot;)&amp;quot; \&lt;br /&gt;
  /usr/bin/zathura &amp;quot;$1&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot;&lt;br /&gt;
Have to premake the directory for {{Ic|zathura}} data.&lt;br /&gt;
&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot; &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot; \&lt;br /&gt;
Allow writing of: bookmarks, history, input history.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/misc/magic.mgc /usr/share/misc/magic.mgc \&lt;br /&gt;
Used for identifying what type a file should be.  Read the&lt;br /&gt;
{{Ic|file(1)}} man page for more information.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;$1&amp;quot; &amp;quot;$(realpath &amp;quot;$1&amp;quot;)&amp;quot; \&lt;br /&gt;
Get the absolute pathname using {{Ic|realpath}}, so you can pass a&lt;br /&gt;
relative argument and still bind the argument.&lt;br /&gt;
&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Bubblewrap/Examples&amp;diff=26775</id>
		<title>Bubblewrap/Examples</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Bubblewrap/Examples&amp;diff=26775"/>
		<updated>2024-05-24T07:09:55Z</updated>

		<summary type="html">&lt;p&gt;Encode: Update formatting&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|Someone more experienced needs to look over this.}}&lt;br /&gt;
&lt;br /&gt;
{{Todo|&lt;br /&gt;
* Since bubblewrap can make use of [https://en.wikipedia.org/wiki/Seccomp seccomp], restrictive versions should be added.&lt;br /&gt;
* {{Ic|imv}}, {{Ic|mpv}} and {{Ic|zathura}} currently only accept 1 mandatory (except {{Ic|imv}}) argument.  This should (hopefully) be temporary, until I figure out how to pass multiple arguments (without including everything else).}}&lt;br /&gt;
&lt;br /&gt;
{{Warning|These were found by going backward; start with a complicated program and as restricted as possible sandbox, allowing more till the program appears to work.  Because of this, complicated and sensitive programs (for example: {{Pkg|firefox}} and {{Pkg|keepassxc}}) may be missing some things they need, which might lead to &#039;&#039;&#039;LESS SECURITY&#039;&#039;&#039;, &#039;&#039;&#039;LESS PRIVACY&#039;&#039;&#039; and &#039;&#039;&#039;DATA LOSS&#039;&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
{{Note|&lt;br /&gt;
* This page assumes you have already read [[Bubblewrap]].&lt;br /&gt;
* To try and avoid duplicates everything will be explained for [[Firefox]] and only when it differs (non obviously) for everything else.&lt;br /&gt;
* Where applicable, this assumes: [[Wayland]] only + [[PipeWire]].&lt;br /&gt;
: If Wayland is needed, make sure you have dealt with [[Wayland#XDG_RUNTIME_DIR|XDG_RUNTIME_DIR]].}}&lt;br /&gt;
&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
== Firefox ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-firefox|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# Firefox wrapped in bwrap with network access.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CACHE_HOME{{=}}&amp;quot;${XDG_CACHE_HOME:{{=}}$HOME/.cache}&amp;quot;&lt;br /&gt;
XDG_DATA_HOME{{=}}&amp;quot;${XDG_DATA_HOME:{{=}}$HOME/.local/share}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CACHE_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --share-net \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CACHE_HOME &amp;quot;$NEW_XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --hostname localhost \&lt;br /&gt;
  --dev /dev/ \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --ro-bind /etc/resolv.conf /etc/resolv.conf \&lt;br /&gt;
  --bind-try &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mozilla/&amp;quot; \&lt;br /&gt;
  --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
  --bind-try &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --proc /proc/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/glib-2.0/ /usr/share/glib-2.0/ \&lt;br /&gt;
  --ro-bind /usr/share/icons/ /usr/share/icons/ \&lt;br /&gt;
  --ro-bind /usr/share/icu/ /usr/share/icu/ \&lt;br /&gt;
  --ro-bind /usr/share/mime/ /usr/share/mime/ \&lt;br /&gt;
  /usr/lib/firefox/firefox}}&lt;br /&gt;
&lt;br /&gt;
 set -u&lt;br /&gt;
If the shell tries to expand an unset parameter, it will error (with a&lt;br /&gt;
few exceptions).&lt;br /&gt;
&lt;br /&gt;
 XDG_CACHE_HOME=&amp;quot;${XDG_CACHE_HOME:=$HOME/.cache}&amp;quot;&lt;br /&gt;
 XDG_DATA_HOME=&amp;quot;${XDG_DATA_HOME:=$HOME/.local/share}&amp;quot;&lt;br /&gt;
Take value if already set, else fallback to the [https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html XDG] default.&lt;br /&gt;
&lt;br /&gt;
 NEW_HOME=&#039;/home/user&#039;&lt;br /&gt;
User to appear as.&lt;br /&gt;
&lt;br /&gt;
 NEW_XDG_CACHE_HOME=&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
{{Path|&amp;quot;$XDG_CACHE_HOME&amp;quot;}} for the new user.&lt;br /&gt;
&lt;br /&gt;
 mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot;&lt;br /&gt;
Make sure the new (real) home for Firefox data exist.&lt;br /&gt;
&lt;br /&gt;
 --unshare-all \&lt;br /&gt;
Unshare all possible [https://en.wikipedia.org/wiki/Linux_namespaces namespaces].&lt;br /&gt;
&lt;br /&gt;
 --share-net \&lt;br /&gt;
Retain the network namespace.&lt;br /&gt;
&lt;br /&gt;
 --new-session \&lt;br /&gt;
New terminal session for the sandbox.&lt;br /&gt;
&lt;br /&gt;
 --die-with-parent \&lt;br /&gt;
Child process dies when {{Ic|bwrap}} parent dies.&lt;br /&gt;
&lt;br /&gt;
 --clearenv \&lt;br /&gt;
Unset all environment variables (except for {{Path|&amp;quot;$PWD&amp;quot;}}).&lt;br /&gt;
&lt;br /&gt;
 --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
Pass the path to {{Path|&amp;quot;$NEW_HOME&amp;quot;}} for {{Path|&amp;quot;$HOME&amp;quot;}}.&lt;br /&gt;
&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
Specify the Wayland display to run clients on.&lt;br /&gt;
&lt;br /&gt;
 --setenv XDG_CACHE_HOME &amp;quot;$NEW_XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
User-specific non-essential (cached) data.&lt;br /&gt;
&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
User-specific non-essential runtime files and other file objects.&lt;br /&gt;
&lt;br /&gt;
 --hostname localhost \&lt;br /&gt;
Use custom hostname in the sandbox.&lt;br /&gt;
&lt;br /&gt;
 --dev /dev/ \&lt;br /&gt;
New devtmpfs, access to special or device files.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
System font configuration directory.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /etc/resolv.conf /etc/resolv.conf \&lt;br /&gt;
Needed for DNS resolution.&lt;br /&gt;
&lt;br /&gt;
 --bind-try &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mozilla/&amp;quot; \&lt;br /&gt;
Per-user Mozilla cache.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 XDG_CACHE_HOME=&amp;quot;${XDG_CACHE_HOME:=$HOME/.cache}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;XDG_CONFIG_HOME &amp;quot;${XDG_CONFIG_HOME:=$HOME/.config}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 XDG_DATA_HOME=&amp;quot;${XDG_DATA_HOME:=$HOME/.local/share}&amp;quot;&lt;br /&gt;
 ...&lt;br /&gt;
 NEW_XDG_CACHE_HOME=&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;NEW_XDG_CONFIG_HOME=&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --bind-try &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mozilla/&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/fontconfig/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) Per-user font configuration directory.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 XDG_CACHE_HOME=&amp;quot;${XDG_CACHE_HOME:=$HOME/.cache}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;XDG_CONFIG_HOME &amp;quot;${XDG_CONFIG_HOME:=$HOME/.config}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 XDG_DATA_HOME=&amp;quot;${XDG_DATA_HOME:=$HOME/.local/share}&amp;quot;&lt;br /&gt;
 ...&lt;br /&gt;
 NEW_XDG_CACHE_HOME=&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;NEW_XDG_CONFIG_HOME=&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --bind-try &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/user-dirs.dirs&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/user-dirs.dirs&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) If you modify &amp;quot;well known&amp;quot; user directories, like&lt;br /&gt;
{{Path|~/Downloads/}}, you need this to have Firefox pick it up.&lt;br /&gt;
&lt;br /&gt;
{{Note|If you use {{Path|&amp;quot;${XDG_CONFIG_HOME}/user-dirs.dirs&amp;quot;}} you should also add the corresponding path(s).&lt;br /&gt;
For example if you set {{Path|XDG_DOWNLOAD_DIR}} to&lt;br /&gt;
{{Path|&amp;quot;${HOME}/downloads/&amp;quot;}} you would also add:&lt;br /&gt;
  ...&lt;br /&gt;
  --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
  &#039;&#039;&#039;--bind-try &amp;quot;${HOME}/downloads/&amp;quot; &amp;quot;${NEW_HOME}/downloads/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
{{Path|&amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot;}} is the location of Firefox data.  Shown to Firefox as {{Path|&amp;quot;${NEW_HOME}/.mozilla/&amp;quot;}}.&lt;br /&gt;
&lt;br /&gt;
{{Note|This has the added benefit of getting {{Path|~/.mozilla/}} out of your {{Path|&amp;quot;$HOME&amp;quot;}}, and conforming more to XDG.  This may one day not be necessary: [https://bugzilla.mozilla.org/show_bug.cgi?id{{=}}259356 Support for the Freedesktop.org XDG Base Directory Specification (2004-09-14)].}}&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 NEW_XDG_CACHE_HOME=&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;NEW_XDG_DATA_HOME=&amp;quot;${NEW_HOME}${XDG_DATA_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--setenv XDG_DATA_HOME &amp;quot;$NEW_XDG_DATA_HOME&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind-try &amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot; &amp;quot;${NEW_XDG_DATA_HOME}/fonts/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --bind-try &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) Per-user directory scanned for font files.&lt;br /&gt;
&lt;br /&gt;
 --bind-try &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
Default {{Path|~/Downloads/}} directory.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
 --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
 --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
 --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
 --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
Shared libraries.&lt;br /&gt;
&lt;br /&gt;
 --proc /proc/ \&lt;br /&gt;
New procfs, provides information about running processes and the kernel.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
Bind the Wayland socket file.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
Object files and libraries.&lt;br /&gt;
&lt;br /&gt;
{{Note|It is not worth the time to limit this, the churn is too great.}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
XKB is a keyboard keymap support library.&lt;br /&gt;
&lt;br /&gt;
{{Note|Even tho the path has {{Path|*/X11/*}} Wayland uses it too.}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
Font presets.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
Global directory scanned for font files.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/glib-2.0/ /usr/share/glib-2.0/ \&lt;br /&gt;
Needed for &amp;quot;Save Page As…&amp;quot;, &amp;quot;Export|Import Bookmarks File&amp;quot;, among others.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/icons/ /usr/share/icons/ \&lt;br /&gt;
Global icons directory.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/icu/ /usr/share/icu/ \&lt;br /&gt;
International Components for Unicode (ICU) provides support for Unicode&lt;br /&gt;
and globalization.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 --ro-bind /usr/share/icu/ /usr/share/icu/ \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind /usr/share/libdrm/ /usr/share/libdrm/ \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind /usr/share/mime/ /usr/share/mime/ \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) Direct Rendering Manager (DRM), Linux kernel subsystem for&lt;br /&gt;
interfacing with GPUs of video cards.  Programs can use this to have the&lt;br /&gt;
GPU do hardware-accelerated 3D rendering and video decoding.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/mime/ /usr/share/mime/ \&lt;br /&gt;
Global XDG MIME directory.&lt;br /&gt;
&lt;br /&gt;
 /usr/lib/firefox/firefox&lt;br /&gt;
Call Firefox.&lt;br /&gt;
&lt;br /&gt;
{{Tip|If you use multiple profiles you can have:&lt;br /&gt;
 /usr/lib/firefox/firefox -P &amp;quot;$@&amp;quot;&lt;br /&gt;
this will allow you to pass a profile name and go into that specific one or not pass anything and get prompted for which to choose.}}&lt;br /&gt;
&lt;br /&gt;
=== PipeWire audio ===&lt;br /&gt;
&lt;br /&gt;
{{Todo|}}&lt;br /&gt;
&lt;br /&gt;
=== Pulse audio ===&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 --proc /proc/ \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind &amp;quot;${XDG_RUNTIME_DIR}/pulse/&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/pulse/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) Pulse audio.&lt;br /&gt;
&lt;br /&gt;
=== Optional(?) stuff ===&lt;br /&gt;
&lt;br /&gt;
{{Draft|Are these needed?}}&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 --proc /proc/ \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind /sys/bus/pci/ /sys/bus/pci/ \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
Information about PCI bus type.&lt;br /&gt;
&lt;br /&gt;
Without this you get&lt;br /&gt;
 Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: cannot access /sys/bus/pci (t=0.177033) [GFX1-]: glxtest: cannot access /sys/bus/pci&lt;br /&gt;
but it still seems to work.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 --proc /proc/ \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
Contains a filesystem representation of the kernel device tree.&lt;br /&gt;
&lt;br /&gt;
With {{Ic|--ro-bind /sys/bus/pci/ /sys/bus/pci/ \}} but without this you get:&lt;br /&gt;
 Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: ManageChildProcess failed&lt;br /&gt;
  (t=0.189558) [GFX1-]: glxtest: ManageChildProcess failed&lt;br /&gt;
&lt;br /&gt;
 Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: ManageChildProcess failed&lt;br /&gt;
  (t=0.189558) |[1][GFX1-]: No GPUs detected via PCI&lt;br /&gt;
  (t=0.18958) [GFX1-]: No GPUs detected via PCI&lt;br /&gt;
but it still seems to work.&lt;br /&gt;
&lt;br /&gt;
== imv ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-imv|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# imv wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --ro-bind /bin/sh /bin/sh \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
  --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/libexec/imv-wayland /usr/libexec/imv-wayland \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
  /usr/libexec/imv-wayland &amp;quot;${1:-./}&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /bin/sh /bin/sh \&lt;br /&gt;
Needed to use {{Path|config}} and have various information in the window&lt;br /&gt;
title.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;XDG_CACHE_HOME{{=}}&amp;quot;${XDG_CACHE_HOME:{{=}}$HOME/.cache}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;XDG_DATA_HOME{{=}}&amp;quot;${XDG_DATA_HOME:{{=}}$HOME/.local/share}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--setenv XDG_CACHE_HOME &amp;quot;$XDG_CACHE_HOME&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --setenv XDG_CONFIG_HOME &amp;quot;$XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--setenv XDG_DATA_HOME &amp;quot;$XDG_DATA_HOME&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind /etc/fonts/ /etc/fonts/ \&#039;&#039;&#039;&lt;br /&gt;
 &#039;&#039;&#039;--bind-try &amp;quot;${XDG_CACHE_HOME}/fontconfig/&amp;quot; &amp;quot;${XDG_CACHE_HOME}/fontconfig/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind-try &amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot; &amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
 ...&lt;br /&gt;
 --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind /usr/share/fonts/ /usr/share/fonts/ \&#039;&#039;&#039;&lt;br /&gt;
 &#039;&#039;&#039;--ro-bind /usr/share/icu/ /usr/share/icu/ \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) To use commands in {{Ic|imv}}.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
Access to character devices.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
Access to PCI resources.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
Get the absolute pathname using {{Ic|realpath}}, so you can pass a&lt;br /&gt;
relative argument and still bind the argument.  If you don&#039;t pass in&lt;br /&gt;
anything it will default to {{Path|./}}, the current directory.&lt;br /&gt;
&lt;br /&gt;
{{Warning|If you don&#039;t pass anything and it defaults to the current directory, it will have &#039;&#039;&#039;everything&#039;&#039;&#039; under that directory shown to {{Ic|imv}}, recursively.}}&lt;br /&gt;
&lt;br /&gt;
== KeePassXC ==&lt;br /&gt;
&lt;br /&gt;
{{Note|I only use the bare minimum functionality, so functionality you need is probably missing.  If you use functionality not here, your contribution will be most appreciated.  To kick things off: {{Ic|Unable to initialize libusb. USB devices may not be detected properly.}} can be silenced with {{Ic|--dev-bind /dev/bus/usb/ /dev/bus/usb/ \}}.}}&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-keepassxc|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# keepassxc wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
PASSWORD_DATABASE{{=}}&amp;quot;${HOME}/password database&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CONFIG_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
NEW_PASSWORD_DATABASE{{=}}&amp;quot;${NEW_HOME}${PASSWORD_DATABASE#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mkdir -pm 0700 &amp;quot;$PASSWORD_DATABASE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --setenv XDG_SESSION_TYPE &amp;quot;$XDG_SESSION_TYPE&amp;quot; \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --bind-try &amp;quot;${XDG_CONFIG_HOME}/keepassxc/&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/keepassxc/&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libssl.so.3 /lib/libssl.so.3 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind /usr/bin/keepassxc /usr/bin/keepassxc \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/ /usr/share/X11/ \&lt;br /&gt;
  --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/keepassxc/ /usr/share/keepassxc/ \&lt;br /&gt;
  --bind &amp;quot;$PASSWORD_DATABASE/&amp;quot; &amp;quot;$NEW_PASSWORD_DATABASE/&amp;quot; \&lt;br /&gt;
  /usr/bin/keepassxc &amp;quot;$@&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 PASSWORD_DATABASE=&amp;quot;${HOME}/password database&amp;quot;&lt;br /&gt;
Directory containing your {{Pkg|keepassxc}} password database.&lt;br /&gt;
&lt;br /&gt;
{{Tip|This is almost certainly not where &#039;&#039;&#039;your&#039;&#039;&#039; database is located.  You will need to change it to where you put your password database.}}&lt;br /&gt;
&lt;br /&gt;
 --setenv XDG_SESSION_TYPE &amp;quot;$XDG_SESSION_TYPE&amp;quot; \&lt;br /&gt;
Session type, since we are assuming Wayland only, this will be &amp;quot;wayland&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
Access to character devices.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
Access to PCI resources.&lt;br /&gt;
&lt;br /&gt;
 --bind &amp;quot;$PASSWORD_DATABASE/&amp;quot; &amp;quot;$NEW_PASSWORD_DATABASE/&amp;quot; \&lt;br /&gt;
Bind password database.&lt;br /&gt;
&lt;br /&gt;
== mpv ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-mpv|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# mpv wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; !{{=}} 1 ]&lt;br /&gt;
then&lt;br /&gt;
	printf &#039;Run mpv wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
  $ bwrap-mpv VIDEO\n&#039;&lt;br /&gt;
	exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
XDG_CACHE_HOME{{=}}&amp;quot;${XDG_CACHE_HOME:{{=}}$HOME/.cache}&amp;quot;&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CACHE_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
NEW_XDG_CONFIG_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CACHE_HOME &amp;quot;$NEW_XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --hostname localhost \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --ro-bind /etc/mpv/ /etc/mpv/ \&lt;br /&gt;
  --bind-try &amp;quot;${XDG_CACHE_HOME}/mesa_shader_cache/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mesa_shader_cache/&amp;quot; \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libacl.so.1 /lib/libacl.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libssl.so.3 /lib/libssl.so.3 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --proc /proc/ \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/pipewire-0&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/pipewire-0&amp;quot; \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/bin/mpv /usr/bin/mpv \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/pipewire/ /usr/share/pipewire/ \&lt;br /&gt;
  --ro-bind &amp;quot;$1&amp;quot; &amp;quot;$(realpath &amp;quot;$1&amp;quot;)&amp;quot; \&lt;br /&gt;
  /usr/bin/mpv \&lt;br /&gt;
    --player-operation-mode{{=}}pseudo-gui \&lt;br /&gt;
    --title{{=}}&#039;bwrap {{!}} ${media-title}&#039; \&lt;br /&gt;
    &amp;quot;$1&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
Access to character devices.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
Access to PCI resources.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;$1&amp;quot; &amp;quot;$(realpath &amp;quot;$1&amp;quot;)&amp;quot; \&lt;br /&gt;
Get the absolute pathname using {{Ic|realpath}}, so you can pass a&lt;br /&gt;
relative argument and still bind the argument.&lt;br /&gt;
&lt;br /&gt;
 --player-operation-mode=pseudo-gui \&lt;br /&gt;
Because {{Ic|--new-session}} is used, this is needed to have a way to&lt;br /&gt;
control {{Ic|mpv}} when it would otherwise not show a GUI.&lt;br /&gt;
&lt;br /&gt;
{{Tip|If you followed [[Bubblewrap#.desktop_integration]], you should remove it from {{Path|&amp;quot;${XDG_DATA_HOME}/applications/bwrap-mpv.desktop&amp;quot;}}.}}&lt;br /&gt;
&lt;br /&gt;
 --title=&#039;bwrap | ${media-title}&#039; \&lt;br /&gt;
Set the window title, showing at a glance that you are using {{Ic|bwrap}}.&lt;br /&gt;
&lt;br /&gt;
=== mpv-net ===&lt;br /&gt;
&lt;br /&gt;
If you want to use {{Ic|mpv}} to stream over the Internet, you will need&lt;br /&gt;
a few things more.&lt;br /&gt;
&lt;br /&gt;
{{Tip|You can use both {{Ic|bwrap-mpv}} and {{Ic|bwrap-mpv-net}}.  {{Ic|bwrap-mpv}} for local stuff and {{Ic|bwrap-mpv-net}} for watching over the Internet.}}&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-mpv-net|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# mpv wrapped in bwrap with network access.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CACHE_HOME{{=}}&amp;quot;${XDG_CACHE_HOME:{{=}}$HOME/.cache}&amp;quot;&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CACHE_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
NEW_XDG_CONFIG_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --share-net \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv PATH /usr/bin/ \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CACHE_HOME &amp;quot;$NEW_XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --hostname localhost \&lt;br /&gt;
  --dev /dev/ \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --ro-bind /etc/mpv/ /etc/mpv/ \&lt;br /&gt;
  --ro-bind /etc/resolv.conf /etc/resolv.conf \&lt;br /&gt;
  --ro-bind /etc/ssl/certs/ /etc/ssl/certs/ \&lt;br /&gt;
  --bind-try &amp;quot;${XDG_CACHE_HOME}/mesa_shader_cache/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mesa_shader_cache/&amp;quot; \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libacl.so.1 /lib/libacl.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libssl.so.3 /lib/libssl.so.3 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --proc /proc/ \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/pipewire-0&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/pipewire-0&amp;quot; \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/bin/mpv /usr/bin/mpv \&lt;br /&gt;
  --ro-bind /usr/bin/python3 /usr/bin/python3 \&lt;br /&gt;
  --ro-bind /usr/bin/yt-dlp /usr/bin/yt-dlp \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/pipewire/ /usr/share/pipewire/ \&lt;br /&gt;
  /usr/bin/mpv \&lt;br /&gt;
    --player-operation-mode{{=}}pseudo-gui \&lt;br /&gt;
    --title{{=}}&#039;bwrap {{!}} ${media-title}&#039; \&lt;br /&gt;
    &amp;quot;$@&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 --setenv PATH /usr/bin/ \&lt;br /&gt;
{{Todo|Document why this is needed.}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /etc/ssl/certs/ /etc/ssl/certs/ \&lt;br /&gt;
Certificate authorities that are &#039;&#039;trusted&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
Access to character devices.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
Access to PCI resources.&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;$@&amp;quot;&lt;br /&gt;
This is so you can pass more options to {{Ic|bwrap-mpv-net}}, for example:&lt;br /&gt;
 $ bwrap-mpv-net --video=no --sub=no &#039;URL1&#039; &#039;URL2&#039;&lt;br /&gt;
&lt;br /&gt;
=== Pulse audio ===&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/pulse&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/pulse&amp;quot; \&lt;br /&gt;
Pulse audio.&lt;br /&gt;
&lt;br /&gt;
=== Screenshots ===&lt;br /&gt;
&lt;br /&gt;
The default screenshots directory is {{Path|&amp;quot;$XDG_DESKTOP_DIR&amp;quot;}} (which is&lt;br /&gt;
{{Path|&amp;quot;${HOME}/Desktop/&amp;quot;}}, which will fallback to {{Path|&amp;quot;$HOME/&amp;quot;}} if&lt;br /&gt;
{{Path|&amp;quot;${HOME}/Desktop/&amp;quot;}} doesn&#039;t exist).  That means that by default&lt;br /&gt;
{{Ic|bwrap-mpv[-net]}} won&#039;t allow screenshots unless you change a few things.&lt;br /&gt;
Do the following to allow an XDG approved screenshots directory:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 XDG_CONFIG_HOME=&amp;quot;${XDG_CONFIG_HOME:=$HOME/.config}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;XDG_DATA_HOME=&amp;quot;${XDG_DATA_HOME:=$HOME/.local/share}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
 NEW_XDG_CONFIG_HOME=&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
 &#039;&#039;&#039;NEW_XDG_DATA_HOME=&amp;quot;${NEW_HOME}${XDG_DATA_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/mpv/&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
 --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--setenv XDG_DATA_HOME &amp;quot;$NEW_XDG_DATA_HOME&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; \&lt;br /&gt;
 &#039;&#039;&#039;--bind &amp;quot;${XDG_DATA_HOME}/mpv/&amp;quot; &amp;quot;${NEW_XDG_DATA_HOME}/mpv/&amp;quot; \&#039;&#039;&#039;&lt;br /&gt;
 --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
 ...&lt;br /&gt;
Now make {{Ic|mpv}} use that directory:&lt;br /&gt;
&lt;br /&gt;
{{Cat|&amp;quot;${XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot;|&amp;lt;nowiki&amp;gt;...&lt;br /&gt;
# Something like this, change to match &amp;quot;$XDG_DATA_HOME&amp;quot;&lt;br /&gt;
screenshot-template=&amp;quot;~/.local/share/mpv/screenshots/%F [%p] %02n&amp;quot;&lt;br /&gt;
...&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
== yt-dlp ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-yt-dlp|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# yt-dlp wrapped in bwrap with network access.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CONFIG_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mkdir -pm 0700 &amp;quot;${HOME}/Downloads/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --share-net \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --hostname localhost \&lt;br /&gt;
  --ro-bind /etc/resolv.conf /etc/resolv.conf \&lt;br /&gt;
  --ro-bind /etc/ssl/certs/ /etc/ssl/certs/ \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/yt-dlp/config&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/yt-dlp/config&amp;quot; \&lt;br /&gt;
  --bind &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libssl.so.3 /lib/libssl.so.3 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind /usr/bin/ffmpeg /usr/bin/ffmpeg \&lt;br /&gt;
  --ro-bind /usr/bin/python3 /usr/bin/python3 \&lt;br /&gt;
  --ro-bind /usr/bin/yt-dlp /usr/bin/yt-dlp \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  /usr/bin/yt-dlp &amp;quot;$@&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 --bind &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
Directory for writing the files.  This should match {{Ic|--output}} that&lt;br /&gt;
is either in {{Path|&amp;quot;${XDG_CONFIG_HOME}/yt-dlp/config&amp;quot;}} or passed on&lt;br /&gt;
the command line.&lt;br /&gt;
&lt;br /&gt;
 /usr/bin/yt-dlp &amp;quot;$@&amp;quot;&lt;br /&gt;
This is so you can pass more options to {{Ic|bwrap-yt-dlp}}, for example:&lt;br /&gt;
 $ bwrap-yt-dlp --no-playlist &#039;URL1&#039; &#039;URL2&#039;&lt;br /&gt;
&lt;br /&gt;
== zathura ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-zathura|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# zathura wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; !{{=}} 1 ]&lt;br /&gt;
then&lt;br /&gt;
	printf &#039;Run zathura wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
  $ bwrap-zathura PDF\n&#039;&lt;br /&gt;
	exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
XDG_DATA_HOME{{=}}&amp;quot;${XDG_DATA_HOME:{{=}}$HOME/.local/share}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$HOME&amp;quot; \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_DATA_HOME &amp;quot;$XDG_DATA_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/zathura/zathurarc&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/zathura/zathurarc&amp;quot; \&lt;br /&gt;
  --bind &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot; &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
  --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/bin/zathura /usr/bin/zathura \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/misc/magic.mgc /usr/share/misc/magic.mgc \&lt;br /&gt;
  --ro-bind &amp;quot;$1&amp;quot; &amp;quot;$(realpath &amp;quot;$1&amp;quot;)&amp;quot; \&lt;br /&gt;
  /usr/bin/zathura &amp;quot;$1&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot;&lt;br /&gt;
Have to premake the directory for {{Ic|zathura}} data.&lt;br /&gt;
&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot; &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot; \&lt;br /&gt;
Allow writing of: bookmarks, history, input history.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/misc/magic.mgc /usr/share/misc/magic.mgc \&lt;br /&gt;
Used for identifying what type a file should be.  Read the&lt;br /&gt;
{{Ic|file(1)}} man page for more information.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;$1&amp;quot; &amp;quot;$(realpath &amp;quot;$1&amp;quot;)&amp;quot; \&lt;br /&gt;
Get the absolute pathname using {{Ic|realpath}}, so you can pass a&lt;br /&gt;
relative argument and still bind the argument.&lt;br /&gt;
&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Release_Notes_for_Alpine_3.20.0&amp;diff=26774</id>
		<title>Release Notes for Alpine 3.20.0</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Release_Notes_for_Alpine_3.20.0&amp;diff=26774"/>
		<updated>2024-05-24T05:06:51Z</updated>

		<summary type="html">&lt;p&gt;Encode: Added page to Category:News&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Base System ==&lt;br /&gt;
&lt;br /&gt;
=== grub 2.12 ===&lt;br /&gt;
&lt;br /&gt;
When upgrading existing installations using grub on UEFI systems, make sure to update the installed bootloader before rebooting otherwise your machine might not boot.&lt;br /&gt;
&lt;br /&gt;
The problem is that grub added a new configuration that executes &amp;lt;code&amp;gt;fwsetup --is-supported&amp;lt;/code&amp;gt;, but grub 2.06 does not support the &amp;lt;code&amp;gt;--is-supported&amp;lt;/code&amp;gt; argument yet, causing grub to try to reboot into firmware unconditionally.&lt;br /&gt;
&lt;br /&gt;
Here is an example assuming the default setup. Don&#039;t blindly copy this example, but verify what&#039;s applicable to your system.&lt;br /&gt;
 &lt;br /&gt;
==== EFI ====&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&lt;br /&gt;
 # grub-install --target{{=}}&amp;lt;var&amp;gt;$target&amp;lt;/var&amp;gt; --efi-directory{{=}}&amp;lt;var&amp;gt;$efi_directory&amp;lt;/var&amp;gt; \&lt;br /&gt;
    --bootloader-id{{=}}alpine --boot-directory{{=}}/boot --no-nvram&lt;br /&gt;
 # install -D &amp;lt;var&amp;gt;$efi_directory&amp;lt;/var&amp;gt;/EFI/alpine/grub&amp;lt;var&amp;gt;$fwa&amp;lt;/var&amp;gt;.efi &amp;lt;var&amp;gt;$efi_directory&amp;lt;/var&amp;gt;/EFI/boot/boot&amp;lt;var&amp;gt;$fwa&amp;lt;/var&amp;gt;.efi&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
; target : The relevant [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-disk.in#L320-324 target] for your system&lt;br /&gt;
; efi_directory : Either {{Path|/boot/efi}} or {{Path|/boot}}. Run &amp;lt;code&amp;gt;awk &#039;$2 ~ /boot/ &amp;amp;&amp;amp; $3 ~ /fat|msdos/ { print $2 }&#039; /proc/mounts&amp;lt;/code&amp;gt; to confirm.&lt;br /&gt;
; fwa : The respective [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-disk.in#L320-324 firmware architecture] for your system&lt;br /&gt;
&lt;br /&gt;
==== Short-term workaround ====&lt;br /&gt;
&lt;br /&gt;
A short-term workaround to get the system bootable again is to restore the backup configuration:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cp /boot/grub/grub.cfg.backup /boot/grub.cfg }}&lt;br /&gt;
&lt;br /&gt;
This should allow you to boot the system again in order to fix it permanently. This will be reverted when either grub or the kernel is updated again.&lt;br /&gt;
&lt;br /&gt;
This will only work if &amp;lt;code&amp;gt;update-grub&amp;lt;/code&amp;gt; has not been executed any more since the upgrade to grub 2.12.&lt;br /&gt;
&lt;br /&gt;
== Others ==&lt;br /&gt;
&lt;br /&gt;
=== Redis ===&lt;br /&gt;
Due to [https://github.com/redis/redis/pull/13157 the relicensing of Redis] to [https://redis.io/legal/rsalv2-agreement/ RSALv2]+[https://redis.io/legal/server-side-public-license-sspl/ SSPLv1], a non-free license model, the [https://spdx.org/licenses/BSD-3-Clause.html BSD-3-Clause] licensed fork [https://valkey.io/ Valkey] has replaced Redis in the main package repository.&lt;br /&gt;
&lt;br /&gt;
A {{#ifexpr: {{AlpineLatest}} &amp;gt;= 3.20 |{{pkg|valkey-compat|branch=v3.20|arch=}}|{{pkg|valkey-compat|branch=edge|arch=}}}} package is provided with symlinks and group for easy Redis replacement.&lt;br /&gt;
&lt;br /&gt;
The {{#ifexpr: {{AlpineLatest}} &amp;gt;= 3.20 |{{pkg|redis|branch=v3.20|arch=}}|{{pkg|redis|branch=edge|arch=}}}} aport has been moved to the community repository, with a shorter support cycle, and will not be upgraded past 7.2.x due to the license change.&lt;br /&gt;
&lt;br /&gt;
Another replacement alternative, the [https://spdx.org/licenses/LGPL-3.0-only.html LGPL-3.0-only] licensed fork [https://redict.io/ Redict] is also available in the community repository.&lt;br /&gt;
&lt;br /&gt;
=== yq ===&lt;br /&gt;
yq was renamed to yq-go. [https://gitlab.alpinelinux.org/alpine/aports/-/issues/16052 #16052]&lt;br /&gt;
&lt;br /&gt;
=== aws-cli ===&lt;br /&gt;
Due to incompatibility issues with Python 3.12, aws-cli has been temporarily disabled until the issue is resolved by upstream. See the corresponding problem upstream: [https://github.com/aws/aws-cli/issues/8342 #8342]&lt;br /&gt;
&lt;br /&gt;
=== GNOME 46 ===&lt;br /&gt;
&lt;br /&gt;
New upstream release of GNOME.&lt;br /&gt;
&lt;br /&gt;
Depending on how you installed GNOME, you may have to manually add &amp;lt;code&amp;gt;gcr-ssh-agent&amp;lt;/code&amp;gt; after upgrading to retain GNOME Keyring ssh integration.&lt;br /&gt;
&lt;br /&gt;
=== KDE 6 ===&lt;br /&gt;
&lt;br /&gt;
KDE Plasma has been upgraded to Plasma 6, bringing the major update to Qt6 with it. This also includes applications from KDE Gear although some individual applications remain on Qt5 for now. The update makes the Wayland session the default and this Alpine release is the last one to support the X11 session.&lt;br /&gt;
&lt;br /&gt;
=== podman [https://github.com/containers/podman/releases/tag/v5.0.0 5.x] ===&lt;br /&gt;
&lt;br /&gt;
The default tool for rootless networking has been swapped from &amp;lt;code&amp;gt;slirp4netns&amp;lt;/code&amp;gt; to&lt;br /&gt;
&amp;lt;code&amp;gt;pasta&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;passt&amp;lt;/code&amp;gt;) for improved performance. As a result, networks named pasta are&lt;br /&gt;
no longer supported.&lt;br /&gt;
&lt;br /&gt;
== Upgrades ==&lt;br /&gt;
&lt;br /&gt;
* Crystal 1.12&lt;br /&gt;
* LLVM 18&lt;br /&gt;
* nginx 1.26&lt;br /&gt;
* .NET 8&lt;br /&gt;
* Nim 2.0&lt;br /&gt;
* OpenJDK 22&lt;br /&gt;
* Python 3.12&lt;br /&gt;
* Racket 8.13&lt;br /&gt;
* Ruby 3.3&lt;br /&gt;
* Rust 1.78&lt;br /&gt;
* R 4.4&lt;br /&gt;
* Sway 1.9&lt;br /&gt;
&lt;br /&gt;
[[Category:News]]&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Bubblewrap/Examples&amp;diff=26752</id>
		<title>Bubblewrap/Examples</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Bubblewrap/Examples&amp;diff=26752"/>
		<updated>2024-05-21T06:34:52Z</updated>

		<summary type="html">&lt;p&gt;Encode: Add a general warning about potential problems from using stuff from here&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|Someone more experienced needs to look over this.}}&lt;br /&gt;
&lt;br /&gt;
{{Todo|Since bubblewrap can make use of [https://en.wikipedia.org/wiki/Seccomp seccomp], restrictive versions should be added.  {{Ic|imv}}, {{Ic|mpv}} and {{Ic|zathura}} currently only accept 1 mandatory (except {{Ic|imv}}) argument.  This should (hopefully) be temporary, until I figure out how to pass multiple arguments (without including everything else).}}&lt;br /&gt;
&lt;br /&gt;
{{Warning|These were found by going backward; start with a complicated program and as restricted as possible sandbox, allowing more till the program appears to work.  Because of this, complicated and sensitive programs (for example: {{Pkg|firefox}} and {{Pkg|keepassxc}}) may be missing some things they need, which might lead to &#039;&#039;&#039;LESS SECURITY&#039;&#039;&#039;, &#039;&#039;&#039;LESS PRIVACY&#039;&#039;&#039; and &#039;&#039;&#039;DATA LOSS&#039;&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
{{Note|This page assumes you have already read over [[Bubblewrap]].  To try and avoid duplicates, everything will be explained for [[Firefox]] and only when it differs (non obviously) for everything else.  Where applicable this also assumes: [[Wayland]] only + [[PipeWire]].  If you use Wayland, make sure you have dealt with [[Wayland#XDG_RUNTIME_DIR|XDG_RUNTIME_DIR]].}}&lt;br /&gt;
&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
== Firefox ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-firefox|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# Firefox wrapped in bwrap with network access.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CACHE_HOME{{=}}&amp;quot;${XDG_CACHE_HOME:{{=}}$HOME/.cache}&amp;quot;&lt;br /&gt;
XDG_DATA_HOME{{=}}&amp;quot;${XDG_DATA_HOME:{{=}}$HOME/.local/share}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CACHE_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --share-net \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CACHE_HOME &amp;quot;$NEW_XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --hostname localhost \&lt;br /&gt;
  --dev /dev/ \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --ro-bind /etc/resolv.conf /etc/resolv.conf \&lt;br /&gt;
  --bind-try &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mozilla/&amp;quot; \&lt;br /&gt;
  --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
  --bind-try &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --proc /proc/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/glib-2.0/ /usr/share/glib-2.0/ \&lt;br /&gt;
  --ro-bind /usr/share/icons/ /usr/share/icons/ \&lt;br /&gt;
  --ro-bind /usr/share/icu/ /usr/share/icu/ \&lt;br /&gt;
  --ro-bind /usr/share/mime/ /usr/share/mime/ \&lt;br /&gt;
  /usr/lib/firefox/firefox}}&lt;br /&gt;
&lt;br /&gt;
 set -u&lt;br /&gt;
If the shell tries to expand an unset parameter, it will error (with a&lt;br /&gt;
few exceptions).&lt;br /&gt;
&lt;br /&gt;
 XDG_CACHE_HOME=&amp;quot;${XDG_CACHE_HOME:=$HOME/.cache}&amp;quot;&lt;br /&gt;
 XDG_DATA_HOME=&amp;quot;${XDG_DATA_HOME:=$HOME/.local/share}&amp;quot;&lt;br /&gt;
Take value if already set, else fallback to the [https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html XDG] default.&lt;br /&gt;
&lt;br /&gt;
 NEW_HOME=&#039;/home/user&#039;&lt;br /&gt;
User to appear as.&lt;br /&gt;
&lt;br /&gt;
 NEW_XDG_CACHE_HOME=&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
{{Path|&amp;quot;$XDG_CACHE_HOME&amp;quot;}} for the new user.&lt;br /&gt;
&lt;br /&gt;
 mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot;&lt;br /&gt;
Make sure the new (real) home for Firefox data exist.&lt;br /&gt;
&lt;br /&gt;
 --unshare-all \&lt;br /&gt;
Unshare all possible [https://en.wikipedia.org/wiki/Linux_namespaces namespaces].&lt;br /&gt;
&lt;br /&gt;
 --share-net \&lt;br /&gt;
Retain the network namespace.&lt;br /&gt;
&lt;br /&gt;
 --new-session \&lt;br /&gt;
New terminal session for the sandbox.&lt;br /&gt;
&lt;br /&gt;
 --die-with-parent \&lt;br /&gt;
Child process dies when {{Ic|bwrap}} parent dies.&lt;br /&gt;
&lt;br /&gt;
 --clearenv \&lt;br /&gt;
Unset all environment variables (except for {{Path|&amp;quot;$PWD&amp;quot;}}).&lt;br /&gt;
&lt;br /&gt;
 --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
Pass the path to {{Path|&amp;quot;$NEW_HOME&amp;quot;}} for {{Path|&amp;quot;$HOME&amp;quot;}}.&lt;br /&gt;
&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
Specify the Wayland display to run clients on.&lt;br /&gt;
&lt;br /&gt;
 --setenv XDG_CACHE_HOME &amp;quot;$NEW_XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
User-specific non-essential (cached) data.&lt;br /&gt;
&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
User-specific non-essential runtime files and other file objects.&lt;br /&gt;
&lt;br /&gt;
 --hostname localhost \&lt;br /&gt;
Use custom hostname in the sandbox.&lt;br /&gt;
&lt;br /&gt;
 --dev /dev/ \&lt;br /&gt;
New devtmpfs, access to special or device files.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
System font configuration directory.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /etc/resolv.conf /etc/resolv.conf \&lt;br /&gt;
Needed for DNS resolution.&lt;br /&gt;
&lt;br /&gt;
 --bind-try &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mozilla/&amp;quot; \&lt;br /&gt;
Per-user Mozilla cache.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 XDG_CACHE_HOME=&amp;quot;${XDG_CACHE_HOME:=$HOME/.cache}&amp;quot;&lt;br /&gt;
 &amp;lt;b&amp;gt;XDG_CONFIG_HOME &amp;quot;${XDG_CONFIG_HOME:=$HOME/.config}&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
 XDG_DATA_HOME=&amp;quot;${XDG_DATA_HOME:=$HOME/.local/share}&amp;quot;&lt;br /&gt;
 ...&lt;br /&gt;
 NEW_XDG_CACHE_HOME=&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
 &amp;lt;b&amp;gt;NEW_XDG_CONFIG_HOME=&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
 &amp;lt;b&amp;gt;--setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --bind-try &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mozilla/&amp;quot; \&lt;br /&gt;
 &amp;lt;b&amp;gt;--ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/fontconfig/&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) Per-user font configuration directory.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 XDG_CACHE_HOME=&amp;quot;${XDG_CACHE_HOME:=$HOME/.cache}&amp;quot;&lt;br /&gt;
 &amp;lt;b&amp;gt;XDG_CONFIG_HOME &amp;quot;${XDG_CONFIG_HOME:=$HOME/.config}&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
 XDG_DATA_HOME=&amp;quot;${XDG_DATA_HOME:=$HOME/.local/share}&amp;quot;&lt;br /&gt;
 ...&lt;br /&gt;
 NEW_XDG_CACHE_HOME=&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
 &amp;lt;b&amp;gt;NEW_XDG_CONFIG_HOME=&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
 &amp;lt;b&amp;gt;--setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --bind-try &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; \&lt;br /&gt;
 &amp;lt;b&amp;gt;--ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/user-dirs.dirs&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/user-dirs.dirs&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) If you modify &amp;quot;well known&amp;quot; user directories, like&lt;br /&gt;
{{Path|~/Downloads/}}, you need this to have Firefox pick it up.&lt;br /&gt;
&lt;br /&gt;
{{Note|If you use {{Path|&amp;quot;${XDG_CONFIG_HOME}/user-dirs.dirs&amp;quot;}} you should also add the corresponding path(s).&lt;br /&gt;
For example if you set {{Path|XDG_DOWNLOAD_DIR}} to&lt;br /&gt;
{{Path|&amp;quot;${HOME}/downloads/&amp;quot;}} you would also add:&lt;br /&gt;
  ...&lt;br /&gt;
  --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
  &amp;lt;b&amp;gt;--bind-try &amp;quot;${HOME}/downloads/&amp;quot; &amp;quot;${NEW_HOME}/downloads/&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
{{Path|&amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot;}} is the location of Firefox data.  Shown to Firefox as {{Path|&amp;quot;${NEW_HOME}/.mozilla/&amp;quot;}}.&lt;br /&gt;
&lt;br /&gt;
{{Note|This has the added benefit of getting {{Path|~/.mozilla/}} out of your {{Path|&amp;quot;$HOME&amp;quot;}}, and conforming more to XDG.  This may one day not be necessary: [https://bugzilla.mozilla.org/show_bug.cgi?id{{=}}259356 Support for the Freedesktop.org XDG Base Directory Specification (2004-09-14)].}}&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 NEW_XDG_CACHE_HOME=&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
 &amp;lt;b&amp;gt;NEW_XDG_DATA_HOME=&amp;quot;${NEW_HOME}${XDG_DATA_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
 &amp;lt;b&amp;gt;--setenv XDG_DATA_HOME &amp;quot;$NEW_XDG_DATA_HOME&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
 &amp;lt;b&amp;gt;--ro-bind-try &amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot; &amp;quot;${NEW_XDG_DATA_HOME}/fonts/&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --bind-try &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) Per-user directory scanned for font files.&lt;br /&gt;
&lt;br /&gt;
 --bind-try &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
Default {{Path|~/Downloads/}} directory.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
 --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
 --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
 --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
 --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
Shared libraries.&lt;br /&gt;
&lt;br /&gt;
 --proc /proc/ \&lt;br /&gt;
New procfs, provides information about running processes and the kernel.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
Bind the Wayland socket file.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
Object files and libraries.&lt;br /&gt;
&lt;br /&gt;
{{Note|It is not worth the time to limit this, the churn is too great.}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
XKB is a keyboard keymap support library.&lt;br /&gt;
&lt;br /&gt;
{{Note|Even tho the path has {{Path|*/X11/*}} Wayland uses it too.}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
Font presets.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
Global directory scanned for font files.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/glib-2.0/ /usr/share/glib-2.0/ \&lt;br /&gt;
Needed for &amp;quot;Save Page As…&amp;quot;, &amp;quot;Export|Import Bookmarks File&amp;quot;, among others.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/icons/ /usr/share/icons/ \&lt;br /&gt;
Global icons directory.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/icu/ /usr/share/icu/ \&lt;br /&gt;
International Components for Unicode (ICU) provides support for Unicode&lt;br /&gt;
and globalization.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 --ro-bind /usr/share/icu/ /usr/share/icu/ \&lt;br /&gt;
 &amp;lt;b&amp;gt;--ro-bind /usr/share/libdrm/ /usr/share/libdrm/ \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --ro-bind /usr/share/mime/ /usr/share/mime/ \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) Direct Rendering Manager (DRM), Linux kernel subsystem for&lt;br /&gt;
interfacing with GPUs of video cards.  Programs can use this to have the&lt;br /&gt;
GPU do hardware-accelerated 3D rendering and video decoding.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/mime/ /usr/share/mime/ \&lt;br /&gt;
Global XDG MIME directory.&lt;br /&gt;
&lt;br /&gt;
 /usr/lib/firefox/firefox&lt;br /&gt;
Call Firefox.&lt;br /&gt;
&lt;br /&gt;
{{Tip|If you use multiple profiles you can have:&lt;br /&gt;
 /usr/lib/firefox/firefox -P &amp;quot;$@&amp;quot;&lt;br /&gt;
this will allow you to pass a profile name and go into that specific one or not pass anything and get prompted for which to choose.}}&lt;br /&gt;
&lt;br /&gt;
=== PipeWire audio ===&lt;br /&gt;
&lt;br /&gt;
{{Todo|}}&lt;br /&gt;
&lt;br /&gt;
=== Pulse audio ===&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 --proc /proc/ \&lt;br /&gt;
 &amp;lt;b&amp;gt;--ro-bind &amp;quot;${XDG_RUNTIME_DIR}/pulse/&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/pulse/&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) Pulse audio.&lt;br /&gt;
&lt;br /&gt;
=== Optional(?) stuff ===&lt;br /&gt;
&lt;br /&gt;
{{Draft|Are these needed?}}&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 --proc /proc/ \&lt;br /&gt;
 &amp;lt;b&amp;gt;--ro-bind /sys/bus/pci/ /sys/bus/pci/ \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
Information about PCI bus type.&lt;br /&gt;
&lt;br /&gt;
Without this you get&lt;br /&gt;
 Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: cannot access /sys/bus/pci (t=0.177033) [GFX1-]: glxtest: cannot access /sys/bus/pci&lt;br /&gt;
but it still seems to work.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 --proc /proc/ \&lt;br /&gt;
 &amp;lt;b&amp;gt;--ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
Contains a filesystem representation of the kernel device tree.&lt;br /&gt;
&lt;br /&gt;
With {{Ic|--ro-bind /sys/bus/pci/ /sys/bus/pci/ \}} but without this you get:&lt;br /&gt;
 Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: ManageChildProcess failed&lt;br /&gt;
  (t=0.189558) [GFX1-]: glxtest: ManageChildProcess failed&lt;br /&gt;
&lt;br /&gt;
 Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: ManageChildProcess failed&lt;br /&gt;
  (t=0.189558) |[1][GFX1-]: No GPUs detected via PCI&lt;br /&gt;
  (t=0.18958) [GFX1-]: No GPUs detected via PCI&lt;br /&gt;
but it still seems to work.&lt;br /&gt;
&lt;br /&gt;
== imv ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-imv|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# imv wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --ro-bind /bin/sh /bin/sh \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
  --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/libexec/imv-wayland /usr/libexec/imv-wayland \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
  /usr/libexec/imv-wayland &amp;quot;${1:-./}&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /bin/sh /bin/sh \&lt;br /&gt;
Needed to use {{Path|config}} and have various information in the window&lt;br /&gt;
title.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;b&amp;gt;XDG_CACHE_HOME{{=}}&amp;quot;${XDG_CACHE_HOME:{{=}}$HOME/.cache}&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
 XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
 &amp;lt;b&amp;gt;XDG_DATA_HOME{{=}}&amp;quot;${XDG_DATA_HOME:{{=}}$HOME/.local/share}&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
 &amp;lt;b&amp;gt;--setenv XDG_CACHE_HOME &amp;quot;$XDG_CACHE_HOME&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --setenv XDG_CONFIG_HOME &amp;quot;$XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
 &amp;lt;b&amp;gt;--setenv XDG_DATA_HOME &amp;quot;$XDG_DATA_HOME&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
 &amp;lt;b&amp;gt;--ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
 --bind-try &amp;quot;${XDG_CACHE_HOME}/fontconfig/&amp;quot; &amp;quot;${XDG_CACHE_HOME}/fontconfig/&amp;quot; \&lt;br /&gt;
 --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; \&lt;br /&gt;
 &amp;lt;b&amp;gt;--ro-bind-try &amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot; &amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
 ...&lt;br /&gt;
 --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
 &amp;lt;b&amp;gt;--ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
 --ro-bind /usr/share/icu/ /usr/share/icu/ \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) To use commands in {{Ic|imv}}.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
Access to character devices.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
Access to PCI resources.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
Get the absolute pathname using {{Ic|realpath}}, so you can pass a&lt;br /&gt;
relative argument and still bind the argument.  If you don&#039;t pass in&lt;br /&gt;
anything it will default to {{Path|./}}, the current directory.&lt;br /&gt;
&lt;br /&gt;
{{Warning|If you don&#039;t pass anything and it defaults to the current directory, it will have &#039;&#039;&#039;everything&#039;&#039;&#039; under that directory shown to {{Ic|imv}}, recursively.}}&lt;br /&gt;
&lt;br /&gt;
== KeePassXC ==&lt;br /&gt;
&lt;br /&gt;
{{Note|I only use the bare minimum functionality, so functionality you need is probably missing.  If you use functionality not here, your contribution will be most appreciated.  To kick things off: {{Ic|Unable to initialize libusb. USB devices may not be detected properly.}} can be silenced with {{Ic|--dev-bind /dev/bus/usb/ /dev/bus/usb/ \}}.}}&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-keepassxc|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# keepassxc wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
PASSWORD_DATABASE{{=}}&amp;quot;${HOME}/password database&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CONFIG_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
NEW_PASSWORD_DATABASE{{=}}&amp;quot;${NEW_HOME}${PASSWORD_DATABASE#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mkdir -pm 0700 &amp;quot;$PASSWORD_DATABASE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --setenv XDG_SESSION_TYPE &amp;quot;$XDG_SESSION_TYPE&amp;quot; \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --bind-try &amp;quot;${XDG_CONFIG_HOME}/keepassxc/&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/keepassxc/&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libssl.so.3 /lib/libssl.so.3 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind /usr/bin/keepassxc /usr/bin/keepassxc \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/ /usr/share/X11/ \&lt;br /&gt;
  --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/keepassxc/ /usr/share/keepassxc/ \&lt;br /&gt;
  --bind &amp;quot;$PASSWORD_DATABASE/&amp;quot; &amp;quot;$NEW_PASSWORD_DATABASE/&amp;quot; \&lt;br /&gt;
  /usr/bin/keepassxc &amp;quot;$@&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 PASSWORD_DATABASE=&amp;quot;${HOME}/password database&amp;quot;&lt;br /&gt;
Directory containing your {{Pkg|keepassxc}} password database.&lt;br /&gt;
&lt;br /&gt;
{{Tip|This is almost certainly not where &#039;&#039;&#039;your&#039;&#039;&#039; database is located.  You will need to change it to where you put your password database.}}&lt;br /&gt;
&lt;br /&gt;
 --setenv XDG_SESSION_TYPE &amp;quot;$XDG_SESSION_TYPE&amp;quot; \&lt;br /&gt;
Session type, since we are assuming Wayland only, this will be &amp;quot;wayland&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
Access to character devices.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
Access to PCI resources.&lt;br /&gt;
&lt;br /&gt;
 --bind &amp;quot;$PASSWORD_DATABASE/&amp;quot; &amp;quot;$NEW_PASSWORD_DATABASE/&amp;quot; \&lt;br /&gt;
Bind password database.&lt;br /&gt;
&lt;br /&gt;
== mpv ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-mpv|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# mpv wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; !{{=}} 1 ]&lt;br /&gt;
then&lt;br /&gt;
	printf &#039;Run mpv wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
  $ bwrap-mpv VIDEO\n&#039;&lt;br /&gt;
	exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
XDG_CACHE_HOME{{=}}&amp;quot;${XDG_CACHE_HOME:{{=}}$HOME/.cache}&amp;quot;&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CACHE_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
NEW_XDG_CONFIG_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CACHE_HOME &amp;quot;$NEW_XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --hostname localhost \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --ro-bind /etc/mpv/ /etc/mpv/ \&lt;br /&gt;
  --bind-try &amp;quot;${XDG_CACHE_HOME}/mesa_shader_cache/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mesa_shader_cache/&amp;quot; \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libacl.so.1 /lib/libacl.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libssl.so.3 /lib/libssl.so.3 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --proc /proc/ \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/pipewire-0&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/pipewire-0&amp;quot; \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/bin/mpv /usr/bin/mpv \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/pipewire/ /usr/share/pipewire/ \&lt;br /&gt;
  --ro-bind &amp;quot;$1&amp;quot; &amp;quot;$(realpath &amp;quot;$1&amp;quot;)&amp;quot; \&lt;br /&gt;
  /usr/bin/mpv \&lt;br /&gt;
    --player-operation-mode{{=}}pseudo-gui \&lt;br /&gt;
    --title{{=}}&#039;bwrap {{!}} ${media-title}&#039; \&lt;br /&gt;
    &amp;quot;$1&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
Access to character devices.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
Access to PCI resources.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;$1&amp;quot; &amp;quot;$(realpath &amp;quot;$1&amp;quot;)&amp;quot; \&lt;br /&gt;
Get the absolute pathname using {{Ic|realpath}}, so you can pass a&lt;br /&gt;
relative argument and still bind the argument.&lt;br /&gt;
&lt;br /&gt;
 --player-operation-mode=pseudo-gui \&lt;br /&gt;
Because {{Ic|--new-session}} is used, this is needed to have a way to&lt;br /&gt;
control {{Ic|mpv}} when it would otherwise not show a GUI.&lt;br /&gt;
&lt;br /&gt;
{{Tip|If you followed [[Bubblewrap#.desktop_integration]], you should remove it from {{Path|&amp;quot;${XDG_DATA_HOME}/applications/bwrap-mpv.desktop&amp;quot;}}.}}&lt;br /&gt;
&lt;br /&gt;
 --title=&#039;bwrap | ${media-title}&#039; \&lt;br /&gt;
Set the window title, showing at a glance that you are using {{Ic|bwrap}}.&lt;br /&gt;
&lt;br /&gt;
=== mpv-net ===&lt;br /&gt;
&lt;br /&gt;
If you want to use {{Ic|mpv}} to stream over the Internet, you will need&lt;br /&gt;
a few things more.&lt;br /&gt;
&lt;br /&gt;
{{Tip|You can use both {{Ic|bwrap-mpv}} and {{Ic|bwrap-mpv-net}}.  {{Ic|bwrap-mpv}} for local stuff and {{Ic|bwrap-mpv-net}} for watching over the Internet.}}&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-mpv-net|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# mpv wrapped in bwrap with network access.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CACHE_HOME{{=}}&amp;quot;${XDG_CACHE_HOME:{{=}}$HOME/.cache}&amp;quot;&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CACHE_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
NEW_XDG_CONFIG_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --share-net \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv PATH /usr/bin/ \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CACHE_HOME &amp;quot;$NEW_XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --hostname localhost \&lt;br /&gt;
  --dev /dev/ \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --ro-bind /etc/mpv/ /etc/mpv/ \&lt;br /&gt;
  --ro-bind /etc/resolv.conf /etc/resolv.conf \&lt;br /&gt;
  --ro-bind /etc/ssl/certs/ /etc/ssl/certs/ \&lt;br /&gt;
  --bind-try &amp;quot;${XDG_CACHE_HOME}/mesa_shader_cache/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mesa_shader_cache/&amp;quot; \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libacl.so.1 /lib/libacl.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libssl.so.3 /lib/libssl.so.3 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --proc /proc/ \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/pipewire-0&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/pipewire-0&amp;quot; \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/bin/mpv /usr/bin/mpv \&lt;br /&gt;
  --ro-bind /usr/bin/python3 /usr/bin/python3 \&lt;br /&gt;
  --ro-bind /usr/bin/yt-dlp /usr/bin/yt-dlp \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/pipewire/ /usr/share/pipewire/ \&lt;br /&gt;
  /usr/bin/mpv \&lt;br /&gt;
    --player-operation-mode{{=}}pseudo-gui \&lt;br /&gt;
    --title{{=}}&#039;bwrap {{!}} ${media-title}&#039; \&lt;br /&gt;
    &amp;quot;$@&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 --setenv PATH /usr/bin/ \&lt;br /&gt;
{{Todo|Document why this is needed.}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /etc/ssl/certs/ /etc/ssl/certs/ \&lt;br /&gt;
Certificate authorities that are &#039;&#039;trusted&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
Access to character devices.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
Access to PCI resources.&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;$@&amp;quot;&lt;br /&gt;
This is so you can pass more options to {{Ic|bwrap-mpv-net}}, for example:&lt;br /&gt;
 $ bwrap-mpv-net --video=no --sub=no &#039;URL1&#039; &#039;URL2&#039;&lt;br /&gt;
&lt;br /&gt;
=== Pulse audio ===&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/pulse&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/pulse&amp;quot; \&lt;br /&gt;
Pulse audio.&lt;br /&gt;
&lt;br /&gt;
=== Screenshots ===&lt;br /&gt;
&lt;br /&gt;
The default screenshots directory is {{Path|&amp;quot;$XDG_DESKTOP_DIR&amp;quot;}} (which is&lt;br /&gt;
{{Path|&amp;quot;${HOME}/Desktop/&amp;quot;}}, which will fallback to {{Path|&amp;quot;$HOME/&amp;quot;}} if&lt;br /&gt;
{{Path|&amp;quot;${HOME}/Desktop/&amp;quot;}} doesn&#039;t exist).  That means that by default&lt;br /&gt;
{{Ic|bwrap-mpv[-net]}} won&#039;t allow screenshots unless you change a few things.&lt;br /&gt;
Do the following to allow an XDG approved screenshots directory:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 XDG_CONFIG_HOME=&amp;quot;${XDG_CONFIG_HOME:=$HOME/.config}&amp;quot;&lt;br /&gt;
 &amp;lt;b&amp;gt;XDG_DATA_HOME=&amp;quot;${XDG_DATA_HOME:=$HOME/.local/share}&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 NEW_XDG_CONFIG_HOME=&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
 &amp;lt;b&amp;gt;NEW_XDG_DATA_HOME=&amp;quot;${NEW_HOME}${XDG_DATA_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;b&amp;gt;mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/mpv/&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
 &amp;lt;b&amp;gt;--setenv XDG_DATA_HOME &amp;quot;$NEW_XDG_DATA_HOME&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; \&lt;br /&gt;
 &amp;lt;b&amp;gt;--bind &amp;quot;${XDG_DATA_HOME}/mpv/&amp;quot; &amp;quot;${NEW_XDG_DATA_HOME}/mpv/&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
 ...&lt;br /&gt;
Now make {{Ic|mpv}} use that directory:&lt;br /&gt;
&lt;br /&gt;
{{Cat|&amp;quot;${XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot;|&amp;lt;nowiki&amp;gt;...&lt;br /&gt;
# Something like this, change to match &amp;quot;$XDG_DATA_HOME&amp;quot;&lt;br /&gt;
screenshot-template=&amp;quot;~/.local/share/mpv/screenshots/%F [%p] %02n&amp;quot;&lt;br /&gt;
...&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
== yt-dlp ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-yt-dlp|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# yt-dlp wrapped in bwrap with network access.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CONFIG_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mkdir -pm 0700 &amp;quot;${HOME}/Downloads/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --share-net \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --hostname localhost \&lt;br /&gt;
  --ro-bind /etc/resolv.conf /etc/resolv.conf \&lt;br /&gt;
  --ro-bind /etc/ssl/certs/ /etc/ssl/certs/ \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/yt-dlp/config&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/yt-dlp/config&amp;quot; \&lt;br /&gt;
  --bind &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libssl.so.3 /lib/libssl.so.3 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind /usr/bin/ffmpeg /usr/bin/ffmpeg \&lt;br /&gt;
  --ro-bind /usr/bin/python3 /usr/bin/python3 \&lt;br /&gt;
  --ro-bind /usr/bin/yt-dlp /usr/bin/yt-dlp \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  /usr/bin/yt-dlp &amp;quot;$@&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 --bind &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
Directory for writing the files.  This should match {{Ic|--output}} that&lt;br /&gt;
is either in {{Path|&amp;quot;${XDG_CONFIG_HOME}/yt-dlp/config&amp;quot;}} or passed on&lt;br /&gt;
the command line.&lt;br /&gt;
&lt;br /&gt;
 /usr/bin/yt-dlp &amp;quot;$@&amp;quot;&lt;br /&gt;
This is so you can pass more options to {{Ic|bwrap-yt-dlp}}, for example:&lt;br /&gt;
 $ bwrap-yt-dlp --no-playlist &#039;URL1&#039; &#039;URL2&#039;&lt;br /&gt;
&lt;br /&gt;
== zathura ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-zathura|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# zathura wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; !{{=}} 1 ]&lt;br /&gt;
then&lt;br /&gt;
	printf &#039;Run zathura wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
  $ bwrap-zathura PDF\n&#039;&lt;br /&gt;
	exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
XDG_DATA_HOME{{=}}&amp;quot;${XDG_DATA_HOME:{{=}}$HOME/.local/share}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$HOME&amp;quot; \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_DATA_HOME &amp;quot;$XDG_DATA_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/zathura/zathurarc&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/zathura/zathurarc&amp;quot; \&lt;br /&gt;
  --bind &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot; &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
  --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/bin/zathura /usr/bin/zathura \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/misc/magic.mgc /usr/share/misc/magic.mgc \&lt;br /&gt;
  --ro-bind &amp;quot;$1&amp;quot; &amp;quot;$(realpath &amp;quot;$1&amp;quot;)&amp;quot; \&lt;br /&gt;
  /usr/bin/zathura &amp;quot;$1&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot;&lt;br /&gt;
Have to premake the directory for {{Ic|zathura}} data.&lt;br /&gt;
&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot; &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot; \&lt;br /&gt;
Allow writing of: bookmarks, history, input history.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/misc/magic.mgc /usr/share/misc/magic.mgc \&lt;br /&gt;
Used for identifying what type a file should be.  Read the&lt;br /&gt;
{{Ic|file(1)}} man page for more information.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;$1&amp;quot; &amp;quot;$(realpath &amp;quot;$1&amp;quot;)&amp;quot; \&lt;br /&gt;
Get the absolute pathname using {{Ic|realpath}}, so you can pass a&lt;br /&gt;
relative argument and still bind the argument.&lt;br /&gt;
&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Bubblewrap/Examples&amp;diff=26751</id>
		<title>Bubblewrap/Examples</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Bubblewrap/Examples&amp;diff=26751"/>
		<updated>2024-05-21T05:19:22Z</updated>

		<summary type="html">&lt;p&gt;Encode: KeePassXC example&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|Someone more experienced needs to look over this.}}&lt;br /&gt;
&lt;br /&gt;
{{Todo|Since bubblewrap can make use of [https://en.wikipedia.org/wiki/Seccomp seccomp], restrictive versions should be added.  {{Ic|imv}}, {{Ic|mpv}} and {{Ic|zathura}} currently only accept 1 mandatory (except {{Ic|imv}}) argument.  This should (hopefully) be temporary, until I figure out how to pass multiple arguments (without including everything else).}}&lt;br /&gt;
&lt;br /&gt;
{{Note|This page assumes you have already read over [[Bubblewrap]].  To try and avoid duplicates, everything will be explained for [[Firefox]] and only when it differs (non obviously) for everything else.  Where applicable this also assumes: [[Wayland]] only + [[PipeWire]].  If you use Wayland, make sure you have dealt with [[Wayland#XDG_RUNTIME_DIR|XDG_RUNTIME_DIR]].}}&lt;br /&gt;
&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
== Firefox ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-firefox|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# Firefox wrapped in bwrap with network access.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CACHE_HOME{{=}}&amp;quot;${XDG_CACHE_HOME:{{=}}$HOME/.cache}&amp;quot;&lt;br /&gt;
XDG_DATA_HOME{{=}}&amp;quot;${XDG_DATA_HOME:{{=}}$HOME/.local/share}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CACHE_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --share-net \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CACHE_HOME &amp;quot;$NEW_XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --hostname localhost \&lt;br /&gt;
  --dev /dev/ \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --ro-bind /etc/resolv.conf /etc/resolv.conf \&lt;br /&gt;
  --bind-try &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mozilla/&amp;quot; \&lt;br /&gt;
  --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
  --bind-try &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --proc /proc/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/glib-2.0/ /usr/share/glib-2.0/ \&lt;br /&gt;
  --ro-bind /usr/share/icons/ /usr/share/icons/ \&lt;br /&gt;
  --ro-bind /usr/share/icu/ /usr/share/icu/ \&lt;br /&gt;
  --ro-bind /usr/share/mime/ /usr/share/mime/ \&lt;br /&gt;
  /usr/lib/firefox/firefox}}&lt;br /&gt;
&lt;br /&gt;
 set -u&lt;br /&gt;
If the shell tries to expand an unset parameter, it will error (with a&lt;br /&gt;
few exceptions).&lt;br /&gt;
&lt;br /&gt;
 XDG_CACHE_HOME=&amp;quot;${XDG_CACHE_HOME:=$HOME/.cache}&amp;quot;&lt;br /&gt;
 XDG_DATA_HOME=&amp;quot;${XDG_DATA_HOME:=$HOME/.local/share}&amp;quot;&lt;br /&gt;
Take value if already set, else fallback to the [https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html XDG] default.&lt;br /&gt;
&lt;br /&gt;
 NEW_HOME=&#039;/home/user&#039;&lt;br /&gt;
User to appear as.&lt;br /&gt;
&lt;br /&gt;
 NEW_XDG_CACHE_HOME=&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
{{Path|&amp;quot;$XDG_CACHE_HOME&amp;quot;}} for the new user.&lt;br /&gt;
&lt;br /&gt;
 mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot;&lt;br /&gt;
Make sure the new (real) home for Firefox data exist.&lt;br /&gt;
&lt;br /&gt;
 --unshare-all \&lt;br /&gt;
Unshare all possible [https://en.wikipedia.org/wiki/Linux_namespaces namespaces].&lt;br /&gt;
&lt;br /&gt;
 --share-net \&lt;br /&gt;
Retain the network namespace.&lt;br /&gt;
&lt;br /&gt;
 --new-session \&lt;br /&gt;
New terminal session for the sandbox.&lt;br /&gt;
&lt;br /&gt;
 --die-with-parent \&lt;br /&gt;
Child process dies when {{Ic|bwrap}} parent dies.&lt;br /&gt;
&lt;br /&gt;
 --clearenv \&lt;br /&gt;
Unset all environment variables (except for {{Path|&amp;quot;$PWD&amp;quot;}}).&lt;br /&gt;
&lt;br /&gt;
 --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
Pass the path to {{Path|&amp;quot;$NEW_HOME&amp;quot;}} for {{Path|&amp;quot;$HOME&amp;quot;}}.&lt;br /&gt;
&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
Specify the Wayland display to run clients on.&lt;br /&gt;
&lt;br /&gt;
 --setenv XDG_CACHE_HOME &amp;quot;$NEW_XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
User-specific non-essential (cached) data.&lt;br /&gt;
&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
User-specific non-essential runtime files and other file objects.&lt;br /&gt;
&lt;br /&gt;
 --hostname localhost \&lt;br /&gt;
Use custom hostname in the sandbox.&lt;br /&gt;
&lt;br /&gt;
 --dev /dev/ \&lt;br /&gt;
New devtmpfs, access to special or device files.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
System font configuration directory.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /etc/resolv.conf /etc/resolv.conf \&lt;br /&gt;
Needed for DNS resolution.&lt;br /&gt;
&lt;br /&gt;
 --bind-try &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mozilla/&amp;quot; \&lt;br /&gt;
Per-user Mozilla cache.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 XDG_CACHE_HOME=&amp;quot;${XDG_CACHE_HOME:=$HOME/.cache}&amp;quot;&lt;br /&gt;
 &amp;lt;b&amp;gt;XDG_CONFIG_HOME &amp;quot;${XDG_CONFIG_HOME:=$HOME/.config}&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
 XDG_DATA_HOME=&amp;quot;${XDG_DATA_HOME:=$HOME/.local/share}&amp;quot;&lt;br /&gt;
 ...&lt;br /&gt;
 NEW_XDG_CACHE_HOME=&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
 &amp;lt;b&amp;gt;NEW_XDG_CONFIG_HOME=&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
 &amp;lt;b&amp;gt;--setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --bind-try &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mozilla/&amp;quot; \&lt;br /&gt;
 &amp;lt;b&amp;gt;--ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/fontconfig/&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) Per-user font configuration directory.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 XDG_CACHE_HOME=&amp;quot;${XDG_CACHE_HOME:=$HOME/.cache}&amp;quot;&lt;br /&gt;
 &amp;lt;b&amp;gt;XDG_CONFIG_HOME &amp;quot;${XDG_CONFIG_HOME:=$HOME/.config}&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
 XDG_DATA_HOME=&amp;quot;${XDG_DATA_HOME:=$HOME/.local/share}&amp;quot;&lt;br /&gt;
 ...&lt;br /&gt;
 NEW_XDG_CACHE_HOME=&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
 &amp;lt;b&amp;gt;NEW_XDG_CONFIG_HOME=&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
 &amp;lt;b&amp;gt;--setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --bind-try &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; \&lt;br /&gt;
 &amp;lt;b&amp;gt;--ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/user-dirs.dirs&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/user-dirs.dirs&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) If you modify &amp;quot;well known&amp;quot; user directories, like&lt;br /&gt;
{{Path|~/Downloads/}}, you need this to have Firefox pick it up.&lt;br /&gt;
&lt;br /&gt;
{{Note|If you use {{Path|&amp;quot;${XDG_CONFIG_HOME}/user-dirs.dirs&amp;quot;}} you should also add the corresponding path(s).&lt;br /&gt;
For example if you set {{Path|XDG_DOWNLOAD_DIR}} to&lt;br /&gt;
{{Path|&amp;quot;${HOME}/downloads/&amp;quot;}} you would also add:&lt;br /&gt;
  ...&lt;br /&gt;
  --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
  &amp;lt;b&amp;gt;--bind-try &amp;quot;${HOME}/downloads/&amp;quot; &amp;quot;${NEW_HOME}/downloads/&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
{{Path|&amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot;}} is the location of Firefox data.  Shown to Firefox as {{Path|&amp;quot;${NEW_HOME}/.mozilla/&amp;quot;}}.&lt;br /&gt;
&lt;br /&gt;
{{Note|This has the added benefit of getting {{Path|~/.mozilla/}} out of your {{Path|&amp;quot;$HOME&amp;quot;}}, and conforming more to XDG.  This may one day not be necessary: [https://bugzilla.mozilla.org/show_bug.cgi?id{{=}}259356 Support for the Freedesktop.org XDG Base Directory Specification (2004-09-14)].}}&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 NEW_XDG_CACHE_HOME=&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
 &amp;lt;b&amp;gt;NEW_XDG_DATA_HOME=&amp;quot;${NEW_HOME}${XDG_DATA_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
 &amp;lt;b&amp;gt;--setenv XDG_DATA_HOME &amp;quot;$NEW_XDG_DATA_HOME&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
 &amp;lt;b&amp;gt;--ro-bind-try &amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot; &amp;quot;${NEW_XDG_DATA_HOME}/fonts/&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --bind-try &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) Per-user directory scanned for font files.&lt;br /&gt;
&lt;br /&gt;
 --bind-try &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
Default {{Path|~/Downloads/}} directory.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
 --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
 --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
 --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
 --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
Shared libraries.&lt;br /&gt;
&lt;br /&gt;
 --proc /proc/ \&lt;br /&gt;
New procfs, provides information about running processes and the kernel.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
Bind the Wayland socket file.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
Object files and libraries.&lt;br /&gt;
&lt;br /&gt;
{{Note|It is not worth the time to limit this, the churn is too great.}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
XKB is a keyboard keymap support library.&lt;br /&gt;
&lt;br /&gt;
{{Note|Even tho the path has {{Path|*/X11/*}} Wayland uses it too.}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
Font presets.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
Global directory scanned for font files.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/glib-2.0/ /usr/share/glib-2.0/ \&lt;br /&gt;
Needed for &amp;quot;Save Page As…&amp;quot;, &amp;quot;Export|Import Bookmarks File&amp;quot;, among others.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/icons/ /usr/share/icons/ \&lt;br /&gt;
Global icons directory.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/icu/ /usr/share/icu/ \&lt;br /&gt;
International Components for Unicode (ICU) provides support for Unicode&lt;br /&gt;
and globalization.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 --ro-bind /usr/share/icu/ /usr/share/icu/ \&lt;br /&gt;
 &amp;lt;b&amp;gt;--ro-bind /usr/share/libdrm/ /usr/share/libdrm/ \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --ro-bind /usr/share/mime/ /usr/share/mime/ \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) Direct Rendering Manager (DRM), Linux kernel subsystem for&lt;br /&gt;
interfacing with GPUs of video cards.  Programs can use this to have the&lt;br /&gt;
GPU do hardware-accelerated 3D rendering and video decoding.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/mime/ /usr/share/mime/ \&lt;br /&gt;
Global XDG MIME directory.&lt;br /&gt;
&lt;br /&gt;
 /usr/lib/firefox/firefox&lt;br /&gt;
Call Firefox.&lt;br /&gt;
&lt;br /&gt;
{{Tip|If you use multiple profiles you can have:&lt;br /&gt;
 /usr/lib/firefox/firefox -P &amp;quot;$@&amp;quot;&lt;br /&gt;
this will allow you to pass a profile name and go into that specific one or not pass anything and get prompted for which to choose.}}&lt;br /&gt;
&lt;br /&gt;
=== PipeWire audio ===&lt;br /&gt;
&lt;br /&gt;
{{Todo|}}&lt;br /&gt;
&lt;br /&gt;
=== Pulse audio ===&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 --proc /proc/ \&lt;br /&gt;
 &amp;lt;b&amp;gt;--ro-bind &amp;quot;${XDG_RUNTIME_DIR}/pulse/&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/pulse/&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) Pulse audio.&lt;br /&gt;
&lt;br /&gt;
=== Optional(?) stuff ===&lt;br /&gt;
&lt;br /&gt;
{{Draft|Are these needed?}}&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 --proc /proc/ \&lt;br /&gt;
 &amp;lt;b&amp;gt;--ro-bind /sys/bus/pci/ /sys/bus/pci/ \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
Information about PCI bus type.&lt;br /&gt;
&lt;br /&gt;
Without this you get&lt;br /&gt;
 Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: cannot access /sys/bus/pci (t=0.177033) [GFX1-]: glxtest: cannot access /sys/bus/pci&lt;br /&gt;
but it still seems to work.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 --proc /proc/ \&lt;br /&gt;
 &amp;lt;b&amp;gt;--ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
Contains a filesystem representation of the kernel device tree.&lt;br /&gt;
&lt;br /&gt;
With {{Ic|--ro-bind /sys/bus/pci/ /sys/bus/pci/ \}} but without this you get:&lt;br /&gt;
 Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: ManageChildProcess failed&lt;br /&gt;
  (t=0.189558) [GFX1-]: glxtest: ManageChildProcess failed&lt;br /&gt;
&lt;br /&gt;
 Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: ManageChildProcess failed&lt;br /&gt;
  (t=0.189558) |[1][GFX1-]: No GPUs detected via PCI&lt;br /&gt;
  (t=0.18958) [GFX1-]: No GPUs detected via PCI&lt;br /&gt;
but it still seems to work.&lt;br /&gt;
&lt;br /&gt;
== imv ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-imv|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# imv wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --ro-bind /bin/sh /bin/sh \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
  --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/libexec/imv-wayland /usr/libexec/imv-wayland \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
  /usr/libexec/imv-wayland &amp;quot;${1:-./}&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /bin/sh /bin/sh \&lt;br /&gt;
Needed to use {{Path|config}} and have various information in the window&lt;br /&gt;
title.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;b&amp;gt;XDG_CACHE_HOME{{=}}&amp;quot;${XDG_CACHE_HOME:{{=}}$HOME/.cache}&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
 XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
 &amp;lt;b&amp;gt;XDG_DATA_HOME{{=}}&amp;quot;${XDG_DATA_HOME:{{=}}$HOME/.local/share}&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
 &amp;lt;b&amp;gt;--setenv XDG_CACHE_HOME &amp;quot;$XDG_CACHE_HOME&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --setenv XDG_CONFIG_HOME &amp;quot;$XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
 &amp;lt;b&amp;gt;--setenv XDG_DATA_HOME &amp;quot;$XDG_DATA_HOME&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
 &amp;lt;b&amp;gt;--ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
 --bind-try &amp;quot;${XDG_CACHE_HOME}/fontconfig/&amp;quot; &amp;quot;${XDG_CACHE_HOME}/fontconfig/&amp;quot; \&lt;br /&gt;
 --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; \&lt;br /&gt;
 &amp;lt;b&amp;gt;--ro-bind-try &amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot; &amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
 ...&lt;br /&gt;
 --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
 &amp;lt;b&amp;gt;--ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
 --ro-bind /usr/share/icu/ /usr/share/icu/ \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) To use commands in {{Ic|imv}}.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
Access to character devices.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
Access to PCI resources.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
Get the absolute pathname using {{Ic|realpath}}, so you can pass a&lt;br /&gt;
relative argument and still bind the argument.  If you don&#039;t pass in&lt;br /&gt;
anything it will default to {{Path|./}}, the current directory.&lt;br /&gt;
&lt;br /&gt;
{{Warning|If you don&#039;t pass anything and it defaults to the current directory, it will have &#039;&#039;&#039;everything&#039;&#039;&#039; under that directory shown to {{Ic|imv}}, recursively.}}&lt;br /&gt;
&lt;br /&gt;
== KeePassXC ==&lt;br /&gt;
&lt;br /&gt;
{{Note|I only use the bare minimum functionality, so functionality you need is probably missing.  If you use functionality not here, your contribution will be most appreciated.  To kick things off: {{Ic|Unable to initialize libusb. USB devices may not be detected properly.}} can be silenced with {{Ic|--dev-bind /dev/bus/usb/ /dev/bus/usb/ \}}.}}&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-keepassxc|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# keepassxc wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
PASSWORD_DATABASE{{=}}&amp;quot;${HOME}/password database&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CONFIG_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
NEW_PASSWORD_DATABASE{{=}}&amp;quot;${NEW_HOME}${PASSWORD_DATABASE#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mkdir -pm 0700 &amp;quot;$PASSWORD_DATABASE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --setenv XDG_SESSION_TYPE &amp;quot;$XDG_SESSION_TYPE&amp;quot; \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --bind-try &amp;quot;${XDG_CONFIG_HOME}/keepassxc/&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/keepassxc/&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libssl.so.3 /lib/libssl.so.3 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind /usr/bin/keepassxc /usr/bin/keepassxc \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/ /usr/share/X11/ \&lt;br /&gt;
  --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/keepassxc/ /usr/share/keepassxc/ \&lt;br /&gt;
  --bind &amp;quot;$PASSWORD_DATABASE/&amp;quot; &amp;quot;$NEW_PASSWORD_DATABASE/&amp;quot; \&lt;br /&gt;
  /usr/bin/keepassxc &amp;quot;$@&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 PASSWORD_DATABASE=&amp;quot;${HOME}/password database&amp;quot;&lt;br /&gt;
Directory containing your {{Pkg|keepassxc}} password database.&lt;br /&gt;
&lt;br /&gt;
{{Tip|This is almost certainly not where &#039;&#039;&#039;your&#039;&#039;&#039; database is located.  You will need to change it to where you put your password database.}}&lt;br /&gt;
&lt;br /&gt;
 --setenv XDG_SESSION_TYPE &amp;quot;$XDG_SESSION_TYPE&amp;quot; \&lt;br /&gt;
Session type, since we are assuming Wayland only, this will be &amp;quot;wayland&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
Access to character devices.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
Access to PCI resources.&lt;br /&gt;
&lt;br /&gt;
 --bind &amp;quot;$PASSWORD_DATABASE/&amp;quot; &amp;quot;$NEW_PASSWORD_DATABASE/&amp;quot; \&lt;br /&gt;
Bind password database.&lt;br /&gt;
&lt;br /&gt;
== mpv ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-mpv|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# mpv wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; !{{=}} 1 ]&lt;br /&gt;
then&lt;br /&gt;
	printf &#039;Run mpv wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
  $ bwrap-mpv VIDEO\n&#039;&lt;br /&gt;
	exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
XDG_CACHE_HOME{{=}}&amp;quot;${XDG_CACHE_HOME:{{=}}$HOME/.cache}&amp;quot;&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CACHE_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
NEW_XDG_CONFIG_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CACHE_HOME &amp;quot;$NEW_XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --hostname localhost \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --ro-bind /etc/mpv/ /etc/mpv/ \&lt;br /&gt;
  --bind-try &amp;quot;${XDG_CACHE_HOME}/mesa_shader_cache/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mesa_shader_cache/&amp;quot; \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libacl.so.1 /lib/libacl.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libssl.so.3 /lib/libssl.so.3 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --proc /proc/ \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/pipewire-0&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/pipewire-0&amp;quot; \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/bin/mpv /usr/bin/mpv \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/pipewire/ /usr/share/pipewire/ \&lt;br /&gt;
  --ro-bind &amp;quot;$1&amp;quot; &amp;quot;$(realpath &amp;quot;$1&amp;quot;)&amp;quot; \&lt;br /&gt;
  /usr/bin/mpv \&lt;br /&gt;
    --player-operation-mode{{=}}pseudo-gui \&lt;br /&gt;
    --title{{=}}&#039;bwrap {{!}} ${media-title}&#039; \&lt;br /&gt;
    &amp;quot;$1&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
Access to character devices.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
Access to PCI resources.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;$1&amp;quot; &amp;quot;$(realpath &amp;quot;$1&amp;quot;)&amp;quot; \&lt;br /&gt;
Get the absolute pathname using {{Ic|realpath}}, so you can pass a&lt;br /&gt;
relative argument and still bind the argument.&lt;br /&gt;
&lt;br /&gt;
 --player-operation-mode=pseudo-gui \&lt;br /&gt;
Because {{Ic|--new-session}} is used, this is needed to have a way to&lt;br /&gt;
control {{Ic|mpv}} when it would otherwise not show a GUI.&lt;br /&gt;
&lt;br /&gt;
{{Tip|If you followed [[Bubblewrap#.desktop_integration]], you should remove it from {{Path|&amp;quot;${XDG_DATA_HOME}/applications/bwrap-mpv.desktop&amp;quot;}}.}}&lt;br /&gt;
&lt;br /&gt;
 --title=&#039;bwrap | ${media-title}&#039; \&lt;br /&gt;
Set the window title, showing at a glance that you are using {{Ic|bwrap}}.&lt;br /&gt;
&lt;br /&gt;
=== mpv-net ===&lt;br /&gt;
&lt;br /&gt;
If you want to use {{Ic|mpv}} to stream over the Internet, you will need&lt;br /&gt;
a few things more.&lt;br /&gt;
&lt;br /&gt;
{{Tip|You can use both {{Ic|bwrap-mpv}} and {{Ic|bwrap-mpv-net}}.  {{Ic|bwrap-mpv}} for local stuff and {{Ic|bwrap-mpv-net}} for watching over the Internet.}}&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-mpv-net|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# mpv wrapped in bwrap with network access.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CACHE_HOME{{=}}&amp;quot;${XDG_CACHE_HOME:{{=}}$HOME/.cache}&amp;quot;&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CACHE_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
NEW_XDG_CONFIG_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --share-net \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv PATH /usr/bin/ \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CACHE_HOME &amp;quot;$NEW_XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --hostname localhost \&lt;br /&gt;
  --dev /dev/ \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --ro-bind /etc/mpv/ /etc/mpv/ \&lt;br /&gt;
  --ro-bind /etc/resolv.conf /etc/resolv.conf \&lt;br /&gt;
  --ro-bind /etc/ssl/certs/ /etc/ssl/certs/ \&lt;br /&gt;
  --bind-try &amp;quot;${XDG_CACHE_HOME}/mesa_shader_cache/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mesa_shader_cache/&amp;quot; \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libacl.so.1 /lib/libacl.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libssl.so.3 /lib/libssl.so.3 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --proc /proc/ \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/pipewire-0&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/pipewire-0&amp;quot; \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/bin/mpv /usr/bin/mpv \&lt;br /&gt;
  --ro-bind /usr/bin/python3 /usr/bin/python3 \&lt;br /&gt;
  --ro-bind /usr/bin/yt-dlp /usr/bin/yt-dlp \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/pipewire/ /usr/share/pipewire/ \&lt;br /&gt;
  /usr/bin/mpv \&lt;br /&gt;
    --player-operation-mode{{=}}pseudo-gui \&lt;br /&gt;
    --title{{=}}&#039;bwrap {{!}} ${media-title}&#039; \&lt;br /&gt;
    &amp;quot;$@&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 --setenv PATH /usr/bin/ \&lt;br /&gt;
{{Todo|Document why this is needed.}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /etc/ssl/certs/ /etc/ssl/certs/ \&lt;br /&gt;
Certificate authorities that are &#039;&#039;trusted&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
Access to character devices.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
Access to PCI resources.&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;$@&amp;quot;&lt;br /&gt;
This is so you can pass more options to {{Ic|bwrap-mpv-net}}, for example:&lt;br /&gt;
 $ bwrap-mpv-net --video=no --sub=no &#039;URL1&#039; &#039;URL2&#039;&lt;br /&gt;
&lt;br /&gt;
=== Pulse audio ===&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/pulse&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/pulse&amp;quot; \&lt;br /&gt;
Pulse audio.&lt;br /&gt;
&lt;br /&gt;
=== Screenshots ===&lt;br /&gt;
&lt;br /&gt;
The default screenshots directory is {{Path|&amp;quot;$XDG_DESKTOP_DIR&amp;quot;}} (which is&lt;br /&gt;
{{Path|&amp;quot;${HOME}/Desktop/&amp;quot;}}, which will fallback to {{Path|&amp;quot;$HOME/&amp;quot;}} if&lt;br /&gt;
{{Path|&amp;quot;${HOME}/Desktop/&amp;quot;}} doesn&#039;t exist).  That means that by default&lt;br /&gt;
{{Ic|bwrap-mpv[-net]}} won&#039;t allow screenshots unless you change a few things.&lt;br /&gt;
Do the following to allow an XDG approved screenshots directory:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 XDG_CONFIG_HOME=&amp;quot;${XDG_CONFIG_HOME:=$HOME/.config}&amp;quot;&lt;br /&gt;
 &amp;lt;b&amp;gt;XDG_DATA_HOME=&amp;quot;${XDG_DATA_HOME:=$HOME/.local/share}&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 NEW_XDG_CONFIG_HOME=&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
 &amp;lt;b&amp;gt;NEW_XDG_DATA_HOME=&amp;quot;${NEW_HOME}${XDG_DATA_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;b&amp;gt;mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/mpv/&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
 &amp;lt;b&amp;gt;--setenv XDG_DATA_HOME &amp;quot;$NEW_XDG_DATA_HOME&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; \&lt;br /&gt;
 &amp;lt;b&amp;gt;--bind &amp;quot;${XDG_DATA_HOME}/mpv/&amp;quot; &amp;quot;${NEW_XDG_DATA_HOME}/mpv/&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
 ...&lt;br /&gt;
Now make {{Ic|mpv}} use that directory:&lt;br /&gt;
&lt;br /&gt;
{{Cat|&amp;quot;${XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot;|&amp;lt;nowiki&amp;gt;...&lt;br /&gt;
# Something like this, change to match &amp;quot;$XDG_DATA_HOME&amp;quot;&lt;br /&gt;
screenshot-template=&amp;quot;~/.local/share/mpv/screenshots/%F [%p] %02n&amp;quot;&lt;br /&gt;
...&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
== yt-dlp ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-yt-dlp|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# yt-dlp wrapped in bwrap with network access.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CONFIG_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mkdir -pm 0700 &amp;quot;${HOME}/Downloads/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --share-net \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --hostname localhost \&lt;br /&gt;
  --ro-bind /etc/resolv.conf /etc/resolv.conf \&lt;br /&gt;
  --ro-bind /etc/ssl/certs/ /etc/ssl/certs/ \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/yt-dlp/config&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/yt-dlp/config&amp;quot; \&lt;br /&gt;
  --bind &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libssl.so.3 /lib/libssl.so.3 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind /usr/bin/ffmpeg /usr/bin/ffmpeg \&lt;br /&gt;
  --ro-bind /usr/bin/python3 /usr/bin/python3 \&lt;br /&gt;
  --ro-bind /usr/bin/yt-dlp /usr/bin/yt-dlp \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  /usr/bin/yt-dlp &amp;quot;$@&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 --bind &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
Directory for writing the files.  This should match {{Ic|--output}} that&lt;br /&gt;
is either in {{Path|&amp;quot;${XDG_CONFIG_HOME}/yt-dlp/config&amp;quot;}} or passed on&lt;br /&gt;
the command line.&lt;br /&gt;
&lt;br /&gt;
 /usr/bin/yt-dlp &amp;quot;$@&amp;quot;&lt;br /&gt;
This is so you can pass more options to {{Ic|bwrap-yt-dlp}}, for example:&lt;br /&gt;
 $ bwrap-yt-dlp --no-playlist &#039;URL1&#039; &#039;URL2&#039;&lt;br /&gt;
&lt;br /&gt;
== zathura ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-zathura|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# zathura wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; !{{=}} 1 ]&lt;br /&gt;
then&lt;br /&gt;
	printf &#039;Run zathura wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
  $ bwrap-zathura PDF\n&#039;&lt;br /&gt;
	exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
XDG_DATA_HOME{{=}}&amp;quot;${XDG_DATA_HOME:{{=}}$HOME/.local/share}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$HOME&amp;quot; \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_DATA_HOME &amp;quot;$XDG_DATA_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/zathura/zathurarc&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/zathura/zathurarc&amp;quot; \&lt;br /&gt;
  --bind &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot; &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
  --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/bin/zathura /usr/bin/zathura \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/misc/magic.mgc /usr/share/misc/magic.mgc \&lt;br /&gt;
  --ro-bind &amp;quot;$1&amp;quot; &amp;quot;$(realpath &amp;quot;$1&amp;quot;)&amp;quot; \&lt;br /&gt;
  /usr/bin/zathura &amp;quot;$1&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot;&lt;br /&gt;
Have to premake the directory for {{Ic|zathura}} data.&lt;br /&gt;
&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot; &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot; \&lt;br /&gt;
Allow writing of: bookmarks, history, input history.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/misc/magic.mgc /usr/share/misc/magic.mgc \&lt;br /&gt;
Used for identifying what type a file should be.  Read the&lt;br /&gt;
{{Ic|file(1)}} man page for more information.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;$1&amp;quot; &amp;quot;$(realpath &amp;quot;$1&amp;quot;)&amp;quot; \&lt;br /&gt;
Get the absolute pathname using {{Ic|realpath}}, so you can pass a&lt;br /&gt;
relative argument and still bind the argument.&lt;br /&gt;
&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Bubblewrap/Examples&amp;diff=26750</id>
		<title>Bubblewrap/Examples</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Bubblewrap/Examples&amp;diff=26750"/>
		<updated>2024-05-20T23:02:53Z</updated>

		<summary type="html">&lt;p&gt;Encode: env isn&amp;#039;t necessary&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|Someone more experienced needs to look over this.}}&lt;br /&gt;
&lt;br /&gt;
{{Todo|Since bubblewrap can make use of [https://en.wikipedia.org/wiki/Seccomp seccomp], restrictive versions should be added.  {{Ic|imv}}, {{Ic|mpv}} and {{Ic|zathura}} currently only accept 1 mandatory (except {{Ic|imv}}) argument.  This should (hopefully) be temporary, until I figure out how to pass multiple arguments (without including everything else).}}&lt;br /&gt;
&lt;br /&gt;
{{Note|This page assumes you have already read over [[Bubblewrap]].  To try and avoid duplicates, everything will be explained for [[Firefox]] and only when it differs (non obviously) for everything else.  Where applicable this also assumes: [[Wayland]] only + [[PipeWire]].  If you use Wayland, make sure you have dealt with [[Wayland#XDG_RUNTIME_DIR|XDG_RUNTIME_DIR]].}}&lt;br /&gt;
&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
== Firefox ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-firefox|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# Firefox wrapped in bwrap with network access.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CACHE_HOME{{=}}&amp;quot;${XDG_CACHE_HOME:{{=}}$HOME/.cache}&amp;quot;&lt;br /&gt;
XDG_DATA_HOME{{=}}&amp;quot;${XDG_DATA_HOME:{{=}}$HOME/.local/share}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CACHE_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --share-net \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CACHE_HOME &amp;quot;$NEW_XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --hostname localhost \&lt;br /&gt;
  --dev /dev/ \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --ro-bind /etc/resolv.conf /etc/resolv.conf \&lt;br /&gt;
  --bind-try &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mozilla/&amp;quot; \&lt;br /&gt;
  --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
  --bind-try &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --proc /proc/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/glib-2.0/ /usr/share/glib-2.0/ \&lt;br /&gt;
  --ro-bind /usr/share/icons/ /usr/share/icons/ \&lt;br /&gt;
  --ro-bind /usr/share/icu/ /usr/share/icu/ \&lt;br /&gt;
  --ro-bind /usr/share/mime/ /usr/share/mime/ \&lt;br /&gt;
  /usr/lib/firefox/firefox}}&lt;br /&gt;
&lt;br /&gt;
 set -u&lt;br /&gt;
If the shell tries to expand an unset parameter, it will error (with a&lt;br /&gt;
few exceptions).&lt;br /&gt;
&lt;br /&gt;
 XDG_CACHE_HOME=&amp;quot;${XDG_CACHE_HOME:=$HOME/.cache}&amp;quot;&lt;br /&gt;
 XDG_DATA_HOME=&amp;quot;${XDG_DATA_HOME:=$HOME/.local/share}&amp;quot;&lt;br /&gt;
Take value if already set, else fallback to the [https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html XDG] default.&lt;br /&gt;
&lt;br /&gt;
 NEW_HOME=&#039;/home/user&#039;&lt;br /&gt;
User to appear as.&lt;br /&gt;
&lt;br /&gt;
 NEW_XDG_CACHE_HOME=&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
{{Path|&amp;quot;$XDG_CACHE_HOME&amp;quot;}} for the new user.&lt;br /&gt;
&lt;br /&gt;
 mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot;&lt;br /&gt;
Make sure the new (real) home for Firefox data exist.&lt;br /&gt;
&lt;br /&gt;
 --unshare-all \&lt;br /&gt;
Unshare all possible [https://en.wikipedia.org/wiki/Linux_namespaces namespaces].&lt;br /&gt;
&lt;br /&gt;
 --share-net \&lt;br /&gt;
Retain the network namespace.&lt;br /&gt;
&lt;br /&gt;
 --new-session \&lt;br /&gt;
New terminal session for the sandbox.&lt;br /&gt;
&lt;br /&gt;
 --die-with-parent \&lt;br /&gt;
Child process dies when {{Ic|bwrap}} parent dies.&lt;br /&gt;
&lt;br /&gt;
 --clearenv \&lt;br /&gt;
Unset all environment variables (except for {{Path|&amp;quot;$PWD&amp;quot;}}).&lt;br /&gt;
&lt;br /&gt;
 --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
Pass the path to {{Path|&amp;quot;$NEW_HOME&amp;quot;}} for {{Path|&amp;quot;$HOME&amp;quot;}}.&lt;br /&gt;
&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
Specify the Wayland display to run clients on.&lt;br /&gt;
&lt;br /&gt;
 --setenv XDG_CACHE_HOME &amp;quot;$NEW_XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
User-specific non-essential (cached) data.&lt;br /&gt;
&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
User-specific non-essential runtime files and other file objects.&lt;br /&gt;
&lt;br /&gt;
 --hostname localhost \&lt;br /&gt;
Use custom hostname in the sandbox.&lt;br /&gt;
&lt;br /&gt;
 --dev /dev/ \&lt;br /&gt;
New devtmpfs, access to special or device files.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
System font configuration directory.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /etc/resolv.conf /etc/resolv.conf \&lt;br /&gt;
Needed for DNS resolution.&lt;br /&gt;
&lt;br /&gt;
 --bind-try &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mozilla/&amp;quot; \&lt;br /&gt;
Per-user Mozilla cache.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 XDG_CACHE_HOME=&amp;quot;${XDG_CACHE_HOME:=$HOME/.cache}&amp;quot;&lt;br /&gt;
 &amp;lt;b&amp;gt;XDG_CONFIG_HOME &amp;quot;${XDG_CONFIG_HOME:=$HOME/.config}&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
 XDG_DATA_HOME=&amp;quot;${XDG_DATA_HOME:=$HOME/.local/share}&amp;quot;&lt;br /&gt;
 ...&lt;br /&gt;
 NEW_XDG_CACHE_HOME=&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
 &amp;lt;b&amp;gt;NEW_XDG_CONFIG_HOME=&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
 &amp;lt;b&amp;gt;--setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --bind-try &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mozilla/&amp;quot; \&lt;br /&gt;
 &amp;lt;b&amp;gt;--ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/fontconfig/&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) Per-user font configuration directory.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 XDG_CACHE_HOME=&amp;quot;${XDG_CACHE_HOME:=$HOME/.cache}&amp;quot;&lt;br /&gt;
 &amp;lt;b&amp;gt;XDG_CONFIG_HOME &amp;quot;${XDG_CONFIG_HOME:=$HOME/.config}&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
 XDG_DATA_HOME=&amp;quot;${XDG_DATA_HOME:=$HOME/.local/share}&amp;quot;&lt;br /&gt;
 ...&lt;br /&gt;
 NEW_XDG_CACHE_HOME=&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
 &amp;lt;b&amp;gt;NEW_XDG_CONFIG_HOME=&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
 &amp;lt;b&amp;gt;--setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --bind-try &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; &amp;quot;${XDG_CACHE_HOME}/mozilla/&amp;quot; \&lt;br /&gt;
 &amp;lt;b&amp;gt;--ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/user-dirs.dirs&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/user-dirs.dirs&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) If you modify &amp;quot;well known&amp;quot; user directories, like&lt;br /&gt;
{{Path|~/Downloads/}}, you need this to have Firefox pick it up.&lt;br /&gt;
&lt;br /&gt;
{{Note|If you use {{Path|&amp;quot;${XDG_CONFIG_HOME}/user-dirs.dirs&amp;quot;}} you should also add the corresponding path(s).&lt;br /&gt;
For example if you set {{Path|XDG_DOWNLOAD_DIR}} to&lt;br /&gt;
{{Path|&amp;quot;${HOME}/downloads/&amp;quot;}} you would also add:&lt;br /&gt;
  ...&lt;br /&gt;
  --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
  &amp;lt;b&amp;gt;--bind-try &amp;quot;${HOME}/downloads/&amp;quot; &amp;quot;${NEW_HOME}/downloads/&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
{{Path|&amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot;}} is the location of Firefox data.  Shown to Firefox as {{Path|&amp;quot;${NEW_HOME}/.mozilla/&amp;quot;}}.&lt;br /&gt;
&lt;br /&gt;
{{Note|This has the added benefit of getting {{Path|~/.mozilla/}} out of your {{Path|&amp;quot;$HOME&amp;quot;}}, and conforming more to XDG.  This may one day not be necessary: [https://bugzilla.mozilla.org/show_bug.cgi?id{{=}}259356 Support for the Freedesktop.org XDG Base Directory Specification (2004-09-14)].}}&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 NEW_XDG_CACHE_HOME=&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
 &amp;lt;b&amp;gt;NEW_XDG_DATA_HOME=&amp;quot;${NEW_HOME}${XDG_DATA_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
 &amp;lt;b&amp;gt;--setenv XDG_DATA_HOME &amp;quot;$NEW_XDG_DATA_HOME&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/firefox/&amp;quot; &amp;quot;${NEW_HOME}/.mozilla/&amp;quot; \&lt;br /&gt;
 &amp;lt;b&amp;gt;--ro-bind-try &amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot; &amp;quot;${NEW_XDG_DATA_HOME}/fonts/&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --bind-try &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) Per-user directory scanned for font files.&lt;br /&gt;
&lt;br /&gt;
 --bind-try &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
Default {{Path|~/Downloads/}} directory.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
 --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
 --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
 --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
 --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
Shared libraries.&lt;br /&gt;
&lt;br /&gt;
 --proc /proc/ \&lt;br /&gt;
New procfs, provides information about running processes and the kernel.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
Bind the Wayland socket file.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
Object files and libraries.&lt;br /&gt;
&lt;br /&gt;
{{Note|It is not worth the time to limit this, the churn is too great.}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
XKB is a keyboard keymap support library.&lt;br /&gt;
&lt;br /&gt;
{{Note|Even tho the path has {{Path|*/X11/*}} Wayland uses it too.}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
Font presets.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
Global directory scanned for font files.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/glib-2.0/ /usr/share/glib-2.0/ \&lt;br /&gt;
Needed for &amp;quot;Save Page As…&amp;quot;, &amp;quot;Export|Import Bookmarks File&amp;quot;, among others.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/icons/ /usr/share/icons/ \&lt;br /&gt;
Global icons directory.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/icu/ /usr/share/icu/ \&lt;br /&gt;
International Components for Unicode (ICU) provides support for Unicode&lt;br /&gt;
and globalization.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 --ro-bind /usr/share/icu/ /usr/share/icu/ \&lt;br /&gt;
 &amp;lt;b&amp;gt;--ro-bind /usr/share/libdrm/ /usr/share/libdrm/ \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --ro-bind /usr/share/mime/ /usr/share/mime/ \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) Direct Rendering Manager (DRM), Linux kernel subsystem for&lt;br /&gt;
interfacing with GPUs of video cards.  Programs can use this to have the&lt;br /&gt;
GPU do hardware-accelerated 3D rendering and video decoding.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/mime/ /usr/share/mime/ \&lt;br /&gt;
Global XDG MIME directory.&lt;br /&gt;
&lt;br /&gt;
 /usr/lib/firefox/firefox&lt;br /&gt;
Call Firefox.&lt;br /&gt;
&lt;br /&gt;
{{Tip|If you use multiple profiles you can have:&lt;br /&gt;
 /usr/lib/firefox/firefox -P &amp;quot;$@&amp;quot;&lt;br /&gt;
this will allow you to pass a profile name and go into that specific one or not pass anything and get prompted for which to choose.}}&lt;br /&gt;
&lt;br /&gt;
=== PipeWire audio ===&lt;br /&gt;
&lt;br /&gt;
{{Todo|}}&lt;br /&gt;
&lt;br /&gt;
=== Pulse audio ===&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 --proc /proc/ \&lt;br /&gt;
 &amp;lt;b&amp;gt;--ro-bind &amp;quot;${XDG_RUNTIME_DIR}/pulse/&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/pulse/&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) Pulse audio.&lt;br /&gt;
&lt;br /&gt;
=== Optional(?) stuff ===&lt;br /&gt;
&lt;br /&gt;
{{Draft|Are these needed?}}&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 --proc /proc/ \&lt;br /&gt;
 &amp;lt;b&amp;gt;--ro-bind /sys/bus/pci/ /sys/bus/pci/ \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
Information about PCI bus type.&lt;br /&gt;
&lt;br /&gt;
Without this you get&lt;br /&gt;
 Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: cannot access /sys/bus/pci (t=0.177033) [GFX1-]: glxtest: cannot access /sys/bus/pci&lt;br /&gt;
but it still seems to work.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 --proc /proc/ \&lt;br /&gt;
 &amp;lt;b&amp;gt;--ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
Contains a filesystem representation of the kernel device tree.&lt;br /&gt;
&lt;br /&gt;
With {{Ic|--ro-bind /sys/bus/pci/ /sys/bus/pci/ \}} but without this you get:&lt;br /&gt;
 Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: ManageChildProcess failed&lt;br /&gt;
  (t=0.189558) [GFX1-]: glxtest: ManageChildProcess failed&lt;br /&gt;
&lt;br /&gt;
 Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: ManageChildProcess failed&lt;br /&gt;
  (t=0.189558) |[1][GFX1-]: No GPUs detected via PCI&lt;br /&gt;
  (t=0.18958) [GFX1-]: No GPUs detected via PCI&lt;br /&gt;
but it still seems to work.&lt;br /&gt;
&lt;br /&gt;
== imv ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-imv|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# imv wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --ro-bind /bin/sh /bin/sh \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
  --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/libexec/imv-wayland /usr/libexec/imv-wayland \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
  /usr/libexec/imv-wayland &amp;quot;${1:-./}&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /bin/sh /bin/sh \&lt;br /&gt;
Needed to use {{Path|config}} and have various information in the window&lt;br /&gt;
title.&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;b&amp;gt;XDG_CACHE_HOME{{=}}&amp;quot;${XDG_CACHE_HOME:{{=}}$HOME/.cache}&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
 XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
 &amp;lt;b&amp;gt;XDG_DATA_HOME{{=}}&amp;quot;${XDG_DATA_HOME:{{=}}$HOME/.local/share}&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
 &amp;lt;b&amp;gt;--setenv XDG_CACHE_HOME &amp;quot;$XDG_CACHE_HOME&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --setenv XDG_CONFIG_HOME &amp;quot;$XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
 &amp;lt;b&amp;gt;--setenv XDG_DATA_HOME &amp;quot;$XDG_DATA_HOME&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
 &amp;lt;b&amp;gt;--ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
 --bind-try &amp;quot;${XDG_CACHE_HOME}/fontconfig/&amp;quot; &amp;quot;${XDG_CACHE_HOME}/fontconfig/&amp;quot; \&lt;br /&gt;
 --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/fontconfig/&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/imv/config&amp;quot; \&lt;br /&gt;
 &amp;lt;b&amp;gt;--ro-bind-try &amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot; &amp;quot;${XDG_DATA_HOME}/fonts/&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
 ...&lt;br /&gt;
 --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
 &amp;lt;b&amp;gt;--ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
 --ro-bind /usr/share/icu/ /usr/share/icu/ \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
(Optional) To use commands in {{Ic|imv}}.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
Access to character devices.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
Access to PCI resources.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;${1:-./}&amp;quot; &amp;quot;$(realpath &amp;quot;${1:-./}&amp;quot;)&amp;quot; \&lt;br /&gt;
Get the absolute pathname using {{Ic|realpath}}, so you can pass a&lt;br /&gt;
relative argument and still bind the argument.  If you don&#039;t pass in&lt;br /&gt;
anything it will default to {{Path|./}}, the current directory.&lt;br /&gt;
&lt;br /&gt;
{{Warning|If you don&#039;t pass anything and it defaults to the current directory, it will have &#039;&#039;&#039;everything&#039;&#039;&#039; under that directory shown to {{Ic|imv}}, recursively.}}&lt;br /&gt;
&lt;br /&gt;
== mpv ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-mpv|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# mpv wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; !{{=}} 1 ]&lt;br /&gt;
then&lt;br /&gt;
	printf &#039;Run mpv wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
  $ bwrap-mpv VIDEO\n&#039;&lt;br /&gt;
	exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
XDG_CACHE_HOME{{=}}&amp;quot;${XDG_CACHE_HOME:{{=}}$HOME/.cache}&amp;quot;&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CACHE_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
NEW_XDG_CONFIG_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CACHE_HOME &amp;quot;$NEW_XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --hostname localhost \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --ro-bind /etc/mpv/ /etc/mpv/ \&lt;br /&gt;
  --bind-try &amp;quot;${XDG_CACHE_HOME}/mesa_shader_cache/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mesa_shader_cache/&amp;quot; \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libacl.so.1 /lib/libacl.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libssl.so.3 /lib/libssl.so.3 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --proc /proc/ \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/pipewire-0&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/pipewire-0&amp;quot; \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/bin/mpv /usr/bin/mpv \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/pipewire/ /usr/share/pipewire/ \&lt;br /&gt;
  --ro-bind &amp;quot;$1&amp;quot; &amp;quot;$(realpath &amp;quot;$1&amp;quot;)&amp;quot; \&lt;br /&gt;
  /usr/bin/mpv \&lt;br /&gt;
    --player-operation-mode{{=}}pseudo-gui \&lt;br /&gt;
    --title{{=}}&#039;bwrap {{!}} ${media-title}&#039; \&lt;br /&gt;
    &amp;quot;$1&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
Access to character devices.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
Access to PCI resources.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;$1&amp;quot; &amp;quot;$(realpath &amp;quot;$1&amp;quot;)&amp;quot; \&lt;br /&gt;
Get the absolute pathname using {{Ic|realpath}}, so you can pass a&lt;br /&gt;
relative argument and still bind the argument.&lt;br /&gt;
&lt;br /&gt;
 --player-operation-mode=pseudo-gui \&lt;br /&gt;
Because {{Ic|--new-session}} is used, this is needed to have a way to&lt;br /&gt;
control {{Ic|mpv}} when it would otherwise not show a GUI.&lt;br /&gt;
&lt;br /&gt;
{{Tip|If you followed [[Bubblewrap#.desktop_integration]], you should remove it from {{Path|&amp;quot;${XDG_DATA_HOME}/applications/bwrap-mpv.desktop&amp;quot;}}.}}&lt;br /&gt;
&lt;br /&gt;
 --title=&#039;bwrap | ${media-title}&#039; \&lt;br /&gt;
Set the window title, showing at a glance that you are using {{Ic|bwrap}}.&lt;br /&gt;
&lt;br /&gt;
=== mpv-net ===&lt;br /&gt;
&lt;br /&gt;
If you want to use {{Ic|mpv}} to stream over the Internet, you will need&lt;br /&gt;
a few things more.&lt;br /&gt;
&lt;br /&gt;
{{Tip|You can use both {{Ic|bwrap-mpv}} and {{Ic|bwrap-mpv-net}}.  {{Ic|bwrap-mpv}} for local stuff and {{Ic|bwrap-mpv-net}} for watching over the Internet.}}&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-mpv-net|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# mpv wrapped in bwrap with network access.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CACHE_HOME{{=}}&amp;quot;${XDG_CACHE_HOME:{{=}}$HOME/.cache}&amp;quot;&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CACHE_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CACHE_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
NEW_XDG_CONFIG_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --share-net \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv PATH /usr/bin/ \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CACHE_HOME &amp;quot;$NEW_XDG_CACHE_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --hostname localhost \&lt;br /&gt;
  --dev /dev/ \&lt;br /&gt;
  --dev-bind /dev/dri/renderD128 /dev/dri/renderD128 \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --ro-bind /etc/mpv/ /etc/mpv/ \&lt;br /&gt;
  --ro-bind /etc/resolv.conf /etc/resolv.conf \&lt;br /&gt;
  --ro-bind /etc/ssl/certs/ /etc/ssl/certs/ \&lt;br /&gt;
  --bind-try &amp;quot;${XDG_CACHE_HOME}/mesa_shader_cache/&amp;quot; &amp;quot;${NEW_XDG_CACHE_HOME}/mesa_shader_cache/&amp;quot; \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libacl.so.1 /lib/libacl.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libssl.so.3 /lib/libssl.so.3 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --proc /proc/ \&lt;br /&gt;
  --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
  --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/pipewire-0&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/pipewire-0&amp;quot; \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/bin/mpv /usr/bin/mpv \&lt;br /&gt;
  --ro-bind /usr/bin/python3 /usr/bin/python3 \&lt;br /&gt;
  --ro-bind /usr/bin/yt-dlp /usr/bin/yt-dlp \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind /usr/share/fontconfig/ /usr/share/fontconfig/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/pipewire/ /usr/share/pipewire/ \&lt;br /&gt;
  /usr/bin/mpv \&lt;br /&gt;
    --player-operation-mode{{=}}pseudo-gui \&lt;br /&gt;
    --title{{=}}&#039;bwrap {{!}} ${media-title}&#039; \&lt;br /&gt;
    &amp;quot;$@&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 --setenv PATH /usr/bin/ \&lt;br /&gt;
{{Todo|Document why this is needed.}}&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /etc/ssl/certs/ /etc/ssl/certs/ \&lt;br /&gt;
Certificate authorities that are &#039;&#039;trusted&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/dev/char/ /sys/dev/char/ \&lt;br /&gt;
Access to character devices.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /sys/devices/pci0000:00/ /sys/devices/pci0000:00/ \&lt;br /&gt;
Access to PCI resources.&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;$@&amp;quot;&lt;br /&gt;
This is so you can pass more options to {{Ic|bwrap-mpv-net}}, for example:&lt;br /&gt;
 $ bwrap-mpv-net --video=no --sub=no &#039;URL1&#039; &#039;URL2&#039;&lt;br /&gt;
&lt;br /&gt;
=== Pulse audio ===&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/pulse&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/pulse&amp;quot; \&lt;br /&gt;
Pulse audio.&lt;br /&gt;
&lt;br /&gt;
=== Screenshots ===&lt;br /&gt;
&lt;br /&gt;
The default screenshots directory is {{Path|&amp;quot;$XDG_DESKTOP_DIR&amp;quot;}} (which is&lt;br /&gt;
{{Path|&amp;quot;${HOME}/Desktop/&amp;quot;}}, which will fallback to {{Path|&amp;quot;$HOME/&amp;quot;}} if&lt;br /&gt;
{{Path|&amp;quot;${HOME}/Desktop/&amp;quot;}} doesn&#039;t exist).  That means that by default&lt;br /&gt;
{{Ic|bwrap-mpv[-net]}} won&#039;t allow screenshots unless you change a few things.&lt;br /&gt;
Do the following to allow an XDG approved screenshots directory:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 XDG_CONFIG_HOME=&amp;quot;${XDG_CONFIG_HOME:=$HOME/.config}&amp;quot;&lt;br /&gt;
 &amp;lt;b&amp;gt;XDG_DATA_HOME=&amp;quot;${XDG_DATA_HOME:=$HOME/.local/share}&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 NEW_XDG_CONFIG_HOME=&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
 &amp;lt;b&amp;gt;NEW_XDG_DATA_HOME=&amp;quot;${NEW_HOME}${XDG_DATA_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;b&amp;gt;mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/mpv/&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
 &amp;lt;b&amp;gt;--setenv XDG_DATA_HOME &amp;quot;$NEW_XDG_DATA_HOME&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
 ...&lt;br /&gt;
 --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot; \&lt;br /&gt;
 &amp;lt;b&amp;gt;--bind &amp;quot;${XDG_DATA_HOME}/mpv/&amp;quot; &amp;quot;${NEW_XDG_DATA_HOME}/mpv/&amp;quot; \&amp;lt;/b&amp;gt;&lt;br /&gt;
 --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
 ...&lt;br /&gt;
Now make {{Ic|mpv}} use that directory:&lt;br /&gt;
&lt;br /&gt;
{{Cat|&amp;quot;${XDG_CONFIG_HOME}/mpv/mpv.conf&amp;quot;|&amp;lt;nowiki&amp;gt;...&lt;br /&gt;
# Something like this, change to match &amp;quot;$XDG_DATA_HOME&amp;quot;&lt;br /&gt;
screenshot-template=&amp;quot;~/.local/share/mpv/screenshots/%F [%p] %02n&amp;quot;&lt;br /&gt;
...&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
== yt-dlp ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-yt-dlp|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# yt-dlp wrapped in bwrap with network access.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
NEW_HOME{{=}}&#039;/home/user&#039;&lt;br /&gt;
NEW_XDG_CONFIG_HOME{{=}}&amp;quot;${NEW_HOME}${XDG_CONFIG_HOME#&amp;quot;$HOME&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mkdir -pm 0700 &amp;quot;${HOME}/Downloads/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --share-net \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$NEW_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$NEW_XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --hostname localhost \&lt;br /&gt;
  --ro-bind /etc/resolv.conf /etc/resolv.conf \&lt;br /&gt;
  --ro-bind /etc/ssl/certs/ /etc/ssl/certs/ \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/yt-dlp/config&amp;quot; &amp;quot;${NEW_XDG_CONFIG_HOME}/yt-dlp/config&amp;quot; \&lt;br /&gt;
  --bind &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libcrypto.so.3 /lib/libcrypto.so.3 \&lt;br /&gt;
  --ro-bind /lib/libssl.so.3 /lib/libssl.so.3 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind /usr/bin/ffmpeg /usr/bin/ffmpeg \&lt;br /&gt;
  --ro-bind /usr/bin/python3 /usr/bin/python3 \&lt;br /&gt;
  --ro-bind /usr/bin/yt-dlp /usr/bin/yt-dlp \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  /usr/bin/yt-dlp &amp;quot;$@&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 --bind &amp;quot;${HOME}/Downloads/&amp;quot; &amp;quot;${NEW_HOME}/Downloads/&amp;quot; \&lt;br /&gt;
Directory for writing the files.  This should match {{Ic|--output}} that&lt;br /&gt;
is either in {{Path|&amp;quot;${XDG_CONFIG_HOME}/yt-dlp/config&amp;quot;}} or passed on&lt;br /&gt;
the command line.&lt;br /&gt;
&lt;br /&gt;
 /usr/bin/yt-dlp &amp;quot;$@&amp;quot;&lt;br /&gt;
This is so you can pass more options to {{Ic|bwrap-yt-dlp}}, for example:&lt;br /&gt;
 $ bwrap-yt-dlp --no-playlist &#039;URL1&#039; &#039;URL2&#039;&lt;br /&gt;
&lt;br /&gt;
== zathura ==&lt;br /&gt;
&lt;br /&gt;
{{Cat|~/.local/bin/bwrap-zathura|#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# zathura wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
set -u&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; !{{=}} 1 ]&lt;br /&gt;
then&lt;br /&gt;
	printf &#039;Run zathura wrapped in bwrap.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
  $ bwrap-zathura PDF\n&#039;&lt;br /&gt;
	exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
XDG_CONFIG_HOME{{=}}&amp;quot;${XDG_CONFIG_HOME:{{=}}$HOME/.config}&amp;quot;&lt;br /&gt;
XDG_DATA_HOME{{=}}&amp;quot;${XDG_DATA_HOME:{{=}}$HOME/.local/share}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/bwrap \&lt;br /&gt;
  --unshare-all \&lt;br /&gt;
  --new-session \&lt;br /&gt;
  --die-with-parent \&lt;br /&gt;
  --clearenv \&lt;br /&gt;
  --setenv HOME &amp;quot;$HOME&amp;quot; \&lt;br /&gt;
  --setenv WAYLAND_DISPLAY &amp;quot;$WAYLAND_DISPLAY&amp;quot; \&lt;br /&gt;
  --setenv XDG_CONFIG_HOME &amp;quot;$XDG_CONFIG_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_DATA_HOME &amp;quot;$XDG_DATA_HOME&amp;quot; \&lt;br /&gt;
  --setenv XDG_RUNTIME_DIR &amp;quot;$XDG_RUNTIME_DIR&amp;quot; \&lt;br /&gt;
  --ro-bind /etc/fonts/ /etc/fonts/ \&lt;br /&gt;
  --ro-bind-try &amp;quot;${XDG_CONFIG_HOME}/zathura/zathurarc&amp;quot; &amp;quot;${XDG_CONFIG_HOME}/zathura/zathurarc&amp;quot; \&lt;br /&gt;
  --bind &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot; &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot; \&lt;br /&gt;
  --ro-bind /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 \&lt;br /&gt;
  --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \&lt;br /&gt;
  --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \&lt;br /&gt;
  --ro-bind /lib/libz.so.1 /lib/libz.so.1 \&lt;br /&gt;
  --ro-bind &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; &amp;quot;${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}&amp;quot; \&lt;br /&gt;
  --ro-bind /usr/bin/zathura /usr/bin/zathura \&lt;br /&gt;
  --ro-bind /usr/lib/ /usr/lib/ \&lt;br /&gt;
  --ro-bind /usr/share/X11/xkb/ /usr/share/X11/xkb/ \&lt;br /&gt;
  --ro-bind /usr/share/fonts/ /usr/share/fonts/ \&lt;br /&gt;
  --ro-bind /usr/share/misc/magic.mgc /usr/share/misc/magic.mgc \&lt;br /&gt;
  --ro-bind &amp;quot;$1&amp;quot; &amp;quot;$(realpath &amp;quot;$1&amp;quot;)&amp;quot; \&lt;br /&gt;
  /usr/bin/zathura &amp;quot;$1&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
 mkdir -pm 0700 &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot;&lt;br /&gt;
Have to premake the directory for {{Ic|zathura}} data.&lt;br /&gt;
&lt;br /&gt;
 --bind &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot; &amp;quot;${XDG_DATA_HOME}/zathura/&amp;quot; \&lt;br /&gt;
Allow writing of: bookmarks, history, input history.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind /usr/share/misc/magic.mgc /usr/share/misc/magic.mgc \&lt;br /&gt;
Used for identifying what type a file should be.  Read the&lt;br /&gt;
{{Ic|file(1)}} man page for more information.&lt;br /&gt;
&lt;br /&gt;
 --ro-bind &amp;quot;$1&amp;quot; &amp;quot;$(realpath &amp;quot;$1&amp;quot;)&amp;quot; \&lt;br /&gt;
Get the absolute pathname using {{Ic|realpath}}, so you can pass a&lt;br /&gt;
relative argument and still bind the argument.&lt;br /&gt;
&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>Encode</name></author>
	</entry>
</feed>