
{"id":33726,"date":"2021-05-10T14:26:04","date_gmt":"2021-05-10T14:26:04","guid":{"rendered":"https:\/\/ubuntuhandbook.org\/?p=33726"},"modified":"2022-04-24T16:41:20","modified_gmt":"2022-04-24T16:41:20","slug":"enable-pipewire-audio-service-ubuntu-21-04","status":"publish","type":"post","link":"https:\/\/ubuntuhandbook.org\/index.php\/2021\/05\/enable-pipewire-audio-service-ubuntu-21-04\/","title":{"rendered":"How to Enable PipeWire Audio Service to Replace PulseAudio in Ubuntu 21.10 &#038; 21.04"},"content":{"rendered":"<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/pipewire-icon.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/pipewire-icon-250x250.png\" alt=\"\" width=\"250\" height=\"250\" class=\"alignleft size-thumbnail wp-image-35380\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/pipewire-icon-250x250.png 250w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/pipewire-icon-300x300.png 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/pipewire-icon-600x600.png 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/pipewire-icon-768x768.png 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/pipewire-icon.png 1200w\" sizes=\"auto, (max-width: 250px) 100vw, 250px\" \/><\/a><\/p>\n<p><b>UPDATE: for Ubuntu 22.04, see <a href=\"https:\/\/ubuntuhandbook.org\/index.php\/2022\/04\/pipewire-replace-pulseaudio-ubuntu-2204\/\" rel=\"noopener\" target=\"_blank\">this new tutorial instead<\/a>!<\/b><\/p>\n<p>Want to try out the Pipewire sound server? It&#8217;s easy to do this in Ubuntu 21.10 \/ Ubuntu 21.04, and here&#8217;s how!<\/p>\n<p>PipeWire is a server for handling multimedia on Linux. Its most common use is for Wayland and Flatpak apps to implement audio and video playback and capture with minimal latency. And it offers seamless support for PulseAudio, JACK, ALSA, and GStreamer based applications.<\/p>\n<div class=\"arconix-box arconix-box-red\"><i class='fa fa-2x pull-left fa-exclamation-triangle'><\/i><div class=\"arconix-box-content\">Don&#8217;t do this in production machine! Replacing existing audio service in Ubuntu is possible but the experience is currently not guaranteed to be perfect or free of issues and bugs. <\/div><\/div>\n<h3>Use Pipewire to replace PulseAudio in Ubuntu 21.10 &#038; Ubuntu 21.04:<\/h3>\n<p>Ubuntu now has better Pipewire support in recent releases. The service is even running out-of-the-box in Ubuntu 21.10. <\/p>\n<h4>1.) Update system<\/h4>\n<p>Firstly, press <b>Ctrl+Alt+T<\/b> on keyboard to open terminal and run command to install all available package updates (<i>recommend for those still running Ubuntu 21.04<\/i>).<\/p>\n<pre>sudo apt update && sudo apt upgrade<\/pre>\n<p>A system restart may be required if you haven&#8217;t done system package update for long period of time.<\/p>\n<h4>2.) Install the latest Pipewire libraries:<\/h4>\n<p>Thanks to the &#8220;<a href=\"https:\/\/launchpad.net\/~pipewire-debian\/+archive\/ubuntu\/pipewire-upstream\" rel=\"noopener\" target=\"_blank\">PipeWire Upstream PPA<\/a>&#8220;, it contains the latest Pipewire libraries to make all the things easy!<\/p>\n<p>Open terminal and run the command below to add the PPA:<\/p>\n<pre>sudo add-apt-repository ppa:pipewire-debian\/pipewire-upstream<\/pre>\n<p><i>Type user password when it asks, while no visual feedback, and hit Enter to continue.<\/i><\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/10\/pipewire-ppa-impish.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/10\/pipewire-ppa-impish.png\" alt=\"\" width=\"600\" height=\"246\" class=\"aligncenter size-full wp-image-35374\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/10\/pipewire-ppa-impish.png 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/10\/pipewire-ppa-impish-300x123.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a> <\/p>\n<p>After adding PPA, run command to install pipewire:<\/p>\n<pre>sudo apt install pipewire<\/pre>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/10\/apt-pipewire-impish.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/10\/apt-pipewire-impish.png\" alt=\"\" width=\"600\" height=\"362\" class=\"aligncenter size-full wp-image-35375\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/10\/apt-pipewire-impish.png 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/10\/apt-pipewire-impish-300x181.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>For <b>GStreamer<\/b>, <b>JACK<\/b>, <b>Bluetooth<\/b> support, install more libraries via command:<\/p>\n<pre>sudo apt install gstreamer1.0-pipewire libpipewire-0.3-{0,dev,modules} libspa-0.2-{bluetooth,dev,jack,modules} pipewire{,-{audio-client-libraries,pulse,media-session,bin,locales,tests}}<\/pre>\n<p>After installation, <b>restart your system<\/b>.<\/p>\n<h4>3.) Verify Pipewire:<\/h4>\n<p>In next boot, open terminal and run &#8220;<code>pactl info<\/code>&#8221; command will tell that Pipewire is in use even without any configuration.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/verify-pipewire.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/verify-pipewire.png\" alt=\"\" width=\"600\" height=\"289\" class=\"aligncenter size-full wp-image-35383\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/verify-pipewire.png 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/verify-pipewire-300x145.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<h3>[OBSOLETE] Replace PulseAudio with Pipewire in Ubuntu 21.04:<\/h3>\n<p>Ubuntu 21.04 has enabled support for pipewire officially. And here&#8217;s how I enabled it in my laptop:<\/p>\n<p><b>1.)<\/b> Firstly, open terminal either from system application launcher or by pressing Ctrl+Alt+T on keyboard. <\/p>\n<p>When it opens, run command to install the <code>pipewire-audio-client-libraries<\/code> package:<\/p>\n<pre style=\"border:none;\">sudo apt install pipewire-audio-client-libraries <\/pre>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/apt-pipewire-audioclientlibraries.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/apt-pipewire-audioclientlibraries-600x351.jpg\" alt=\"\" width=\"600\" height=\"351\" class=\"aligncenter size-large wp-image-33727\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/apt-pipewire-audioclientlibraries-600x351.jpg 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/apt-pipewire-audioclientlibraries-300x175.jpg 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/apt-pipewire-audioclientlibraries-768x449.jpg 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/apt-pipewire-audioclientlibraries.jpg 806w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p><b>2.)<\/b> Then create an empty file by running command:<\/p>\n<pre style=\"border:none;\">sudo touch \/etc\/pipewire\/media-session.d\/with-pulseaudio<\/pre>\n<p><b>3.)<\/b> Create <code>pipewire-pulse<\/code> service files by copying the example files:<\/p>\n<pre style=\"border:none;\">sudo cp \/usr\/share\/doc\/pipewire\/examples\/systemd\/user\/pipewire-pulse.* \/etc\/systemd\/user\/<\/pre>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/mv-pipewire-pulse.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/mv-pipewire-pulse-600x184.jpg\" alt=\"\" width=\"600\" height=\"184\" class=\"aligncenter size-large wp-image-33728\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/mv-pipewire-pulse-600x184.jpg 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/mv-pipewire-pulse-300x92.jpg 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/mv-pipewire-pulse.jpg 768w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p><b>4.)<\/b> You don&#8217;t have to remove the PulseAudio, just disable it and enable Pipewire:<\/p>\n<ul>\n<li>Run command to reload the new service files:\n<pre style=\"border:none;\">systemctl --user daemon-reload<\/pre>\n<\/li>\n<li>Disable PulseAudio service via command:\n<pre style=\"border:none;\">systemctl --user --now disable pulseaudio.service pulseaudio.socket<\/pre>\n<\/li>\n<li>And finally enable the Pipewire services:\n<pre style=\"border:none;\">systemctl --user --now enable pipewire pipewire-pulse<\/pre>\n<\/li>\n<\/ul>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/enable-pipewire-pulse.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/enable-pipewire-pulse-600x262.jpg\" alt=\"\" width=\"600\" height=\"262\" class=\"aligncenter size-large wp-image-33729\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/enable-pipewire-pulse-600x262.jpg 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/enable-pipewire-pulse-300x131.jpg 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/enable-pipewire-pulse-768x335.jpg 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/enable-pipewire-pulse.jpg 789w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p><b>5.)<\/b> I followed the previous steps via <a href=\"https:\/\/wiki.debian.org\/PipeWire\" rel=\"noopener\" target=\"_blank\">Debian Wiki<\/a>, but it didn&#8217;t work. The system tray sound icon&#8217;s gone, and <code>pactl info<\/code> outputs &#8220;Connection failure: Connection refused&#8221;.<\/p>\n<p>To workaround the issue, enable <code>pipewire-media-session<\/code> service may work by running command:<\/p>\n<pre style=\"border:none;\">systemctl --user --now enable pipewire-media-session.service<\/pre>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/enable-pipewire-media-session.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/enable-pipewire-media-session-600x140.jpg\" alt=\"\" width=\"600\" height=\"140\" class=\"aligncenter size-large wp-image-33730\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/enable-pipewire-media-session-600x140.jpg 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/enable-pipewire-media-session-300x70.jpg 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/enable-pipewire-media-session.jpg 769w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<div class=\"arconix-box arconix-box-yellow\"><i class='fa fa-2x pull-left fa-lightbulb-o'><\/i><div class=\"arconix-box-content\">If you&#8217;re trying to get it work in <b>Ubuntu 20.04<\/b>, try &#8220;mask&#8221; the PulseAudio service before reboot, by running command:<\/p>\n<pre style=\"border:none\">systemctl --user mask pulseaudio<\/pre>\n<\/div><\/div>\n<p><del>Finally <b>reboot<\/b> your machine.<\/del><\/p>\n<p>And check if Pipewire is working, run <code style=\"border:none;\">pactl info<\/code> command. And it&#8217;s working if you see &#8220;PulseAudio (on PipeWire 0.3.24)&#8221; in output.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/if-pipewire-working.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/if-pipewire-working-600x295.jpg\" alt=\"\" width=\"600\" height=\"295\" class=\"aligncenter size-large wp-image-33731\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/if-pipewire-working-600x295.jpg 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/if-pipewire-working-300x147.jpg 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/if-pipewire-working-768x377.jpg 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/05\/if-pipewire-working.jpg 786w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>UPDATE: for Ubuntu 22.04, see this new tutorial instead! Want to try out the Pipewire sound server? It&#8217;s easy to do this in Ubuntu 21.10 \/ Ubuntu 21.04, and here&#8217;s how! PipeWire is a server for handling multimedia on Linux. Its most common use is for Wayland and Flatpak apps to implement audio and video [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":33722,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[2031],"class_list":["post-33726","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","tag-pipewire"],"_links":{"self":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/33726","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/comments?post=33726"}],"version-history":[{"count":0,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/33726\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media\/33722"}],"wp:attachment":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media?parent=33726"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/categories?post=33726"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/tags?post=33726"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}