Pipewire using 100% of 1 cpu constantly Ubuntu 22.04.1

The /usr/bin/pipewire takes all of one cpu right from boot, with no multimedia playing.

Trying to stop the service takes more than a minute and it seem to get automatically restarted.

If I play media, it seems to work okay. That said, my Linux/Ubuntu skills are limited, I have no idea if media playing is using pipewire or pulse-audio or “mama’s squeeze box”…

Any ideas would be appreciated!

user@Khadas:~$ systemctl --user stop pipewire pipewire-session-manager
Warning: Stopping pipewire.service, but it can still be activated by:
  pipewire.socket
Welcome to Fenix 1.1 Ubuntu 22.04.1 LTS Linux 5.4.125
 _  ___               _            __     _____ __  __ _  _
| |/ / |__   __ _  __| | __ _ ___  \ \   / /_ _|  \/  | || |
| ' /| '_ \ / _` |/ _` |/ _` / __|  \ \ / / | || |\/| | || |_
| . \| | | | (_| | (_| | (_| \__ \   \ V /  | || |  | |__   _|
|_|\_\_| |_|\__,_|\__,_|\__,_|___/    \_/  |___|_|  |_|  |_|


 * Website:        https://www.khadas.com
 * Documentation:  https://docs.khadas.com
 * Forum:          https://forum.khadas.com

Last login: Tue Sep 20 12:16:44 2022 from 192.168.2.240
user@Khadas:~$ systemctl --user status pipewire pipewire-session-manager
● pipewire.service - PipeWire Multimedia Service
     Loaded: loaded (/usr/lib/systemd/user/pipewire.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2022-09-20 12:16:31 PDT; 1min 5s ago
TriggeredBy: ● pipewire.socket
   Main PID: 1120 (pipewire)
      Tasks: 2 (limit: 8262)
     Memory: 3.8M
        CPU: 1min 6.468s
     CGroup: /user.slice/user-1001.slice/user@1001.service/session.slice/pipewire.service
             └─1120 /usr/bin/pipewire

Sep 20 12:16:31 Khadas systemd[1102]: Started PipeWire Multimedia Service.
Sep 20 12:16:31 Khadas pipewire[1120]: mod.rt: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown
Sep 20 12:16:31 Khadas pipewire[1120]: mod.rt: could not set nice-level to -11: No such file or directory
Sep 20 12:16:31 Khadas pipewire[1120]: mod.rt: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown
Sep 20 12:16:31 Khadas pipewire[1120]: mod.rt: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown
Sep 20 12:16:31 Khadas pipewire[1120]: mod.rt: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown
Sep 20 12:16:31 Khadas pipewire[1120]: mod.rt: could not make thread 1162 realtime using RTKit: No such file or directory

● pipewire-media-session.service - PipeWire Media Session Manager
     Loaded: loaded (/usr/lib/systemd/user/pipewire-media-session.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2022-09-20 12:16:31 PDT; 1min 5s ago
   Main PID: 1121 (pipewire-media-)
      Tasks: 2 (limit: 8262)
     Memory: 3.8M
        CPU: 85ms
     CGroup: /user.slice/user-1001.slice/user@1001.service/session.slice/pipewire-media-session.service
             └─1121 /usr/bin/pipewire-media-session

Sep 20 12:16:31 Khadas systemd[1102]: Started PipeWire Media Session Manager.
Sep 20 12:16:31 Khadas pipewire-media-session[1121]: mod.rt: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown
Sep 20 12:16:31 Khadas pipewire-media-session[1121]: mod.rt: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown
Sep 20 12:16:31 Khadas pipewire-media-session[1121]: mod.rt: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown
Sep 20 12:16:31 Khadas pipewire-media-session[1121]: mod.rt: could not make thread 1148 realtime using RTKit: No such file or directory
Sep 20 12:16:31 Khadas pipewire-media-session[1121]: spa.v4l2: Cannot open '/dev/video70': 1, Operation not permitted
Sep 20 12:16:31 Khadas pipewire-media-session[1121]: spa.v4l2: Cannot open '/dev/video71': 1, Operation not permitted

Linux Khadas 5.4.125 #1.1.1 SMP PREEMPT Mon Sep 19 11:07:40 CST 2022 aarch64 aarch64 aarch64 GNU/Linux
user@Khadas:~$ cat /etc/fenix-release
# PLEASE DO NOT EDIT THIS FILE
BOARD=VIM4
VENDOR=Amlogic
VERSION=1.1
ARCH=arm64
INITRD_ARCH=arm64
IMAGE_VERSION=1.1-220721
################ GIT VERSION ################
UBOOT_GIT_VERSION=khadas-vims-u-boot-2019.01-v1.1-release
LINUX_GIT_VERSION=khadas-vims-linux-5.4-v1.1-release
FENIX_GIT_VERSION=v1.1
#############################################
user@Khadas:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.1 LTS"

Hello @deepvim

Have you did other things?

I just login and use htop to monitor the usage and can’t reproduce.

As I said, from boot.

I don’t know how to align configs with you.

I am struggling with this VIM4 hardware and software. I was hopeful when I first saw the product, however after working with it some now, there are a number of issues that really need to be addressed.

This pipewire one seems lower priority.

That said, the wifi freezing is back on my machine again. I am wondering if it has some tie in to peripherals disconnecting, whether just a HDMI monitor going to sleep or using a KVM to disconnect USB and HDMI. There is something really wrong with the VIM4’s wifi.

VNC and RDP not working. If you can not remote into the GUI, that is a big problem IMHO. ssh and a remote desktop are just a basic function that I think is expected to work out of box, no questions/no problems.

nVME disks not working. Microphone Drop! How can Khadas sell a product where basic storage that they advertise does NOT work. It took me 20 minutes to know this did not work.

I would like to get on to using the 40 pin IO devices, HDMI in, camera interface. These were the things that I saw and want to use. But if I can buy a MeLe intel based SBC at same price point where Ubuntu works out of box, I think I am going to have look hard at doing these functions via USB 3 / USB-C on a SBC where I am not frustrated by the basics of the OS.

We will follow this issue on another topic.

We will follow this issue on another topic.

Sorry for trouble, we are working on it now.

I am going to do another full reinstall from oowow and update from your update steps and patch from your patch instructions.

Please let me know on the following issue first, can I ignore or what steps to fix. This is part of the upgrade steps listed on your VIM4 instructions on web site:

this error during the 'sudo do-fenix-full-upgrade', not sure if it is significant to installing your patch:
E: Unable to locate package fenix-updater-package-jammy-vim4-mainline

I think the upgrade you mention is yet another thing that doesn’t work.

I feel your pain and am getting very frustrated as well.

This device was released too early as It is not ready for primetime yet IMHO. Not with Ubuntu at least - there are too many issues. I wish I had bought something else instead.

My investigation is stalled because of all the problems.

Hello @deepvim

It doesn’t matter, sudo do-fenix-full-upgrade is no longer needed any more for VIM4, so just ignore this command.

Thanks for info. I will do a reinstall and report what I see.

I had this thing with pipewire and spent ages searching and it seems that pipewire requires quite a lot of configuration to avoid these problems. Anyway, I eventually found this info: (High CPU usage while nothing is playing for pipewire and pipewire-pulse (#1968) · Issues · PipeWire / pipewire · GitLab)

I know it says it is relevant to older versions (whatever old is these days) but i disabled the setting mentioned in firefox and the problem went away. What can I tell you?

1 Like

Hi @technodevotee unfortunately for me on VIM4 with Ubuntu this did not have any effect. First, firefox is not installed on the Khadas image. I did install the snap of firefox and tried this change is firefox setting, however did not have any effect.

I will continue to search.

If you look at the audio section of the configuration of the Khadas Ubuntu 22.04 image, it looks like it was setup to run a Rolling Stones concert…

sudo inxi -Fc0
...
Audio:
  Device-1: audio- driver: aml_audio_controller
  Device-2: snd-iomap driver: auge_snd_iomap
  Device-3: audio_data driver: audio_data_debug
  Device-4: t7-audio-clocks driver: audio_clocks
  Device-5: t5-audio-ddr-manager driver: audio_ddr_manager
  Device-6: tm2-revb-snd-pdm driver: snd_pdm
  Device-7: audio-pinctrl driver: pinctrl_audio
  Device-8: t5-resample-a driver: audioresample
  Device-9: t5-resample-b driver: audioresample
  Device-10: tm2-revb-snd-spdif-a driver: snd_spdif
  Device-11: tm2-revb-snd-spdif-b driver: snd_spdif
  Device-12: t7-snd-tdma driver: snd_tdm
  Device-13: t7-snd-tdmb driver: snd_tdm
  Device-14: t7-snd-tdmc driver: snd_tdm
  Device-15: hifi4dsp driver: hifi4dsp
  Device-16: amhdmitx-t7 driver: amhdmitx21
  Device-17: hifi4dsp driver: N/A
  Device-18: hifi4dsp driver: N/A
  Sound Server-1: ALSA v: k5.4.125 running: yes
  Sound Server-2: PulseAudio v: 15.99.1 running: yes
  Sound Server-3: PipeWire v: 0.3.48 running: yes

my suggestion try to change/increase audio buffer size/beriod setting for pipewire/alsa/pulse

Hi @hyphop Thank you for the information. I’m not versed on these audio systems well enough to understand your recommendations. I found that pipewire and pipewire.socket seem to be throwing some errors that seems related when they start up, see below. My solution so far is to disable and mask both of these services. Audio still seems to play okay after doing this and rebooting. /usr/bin/pipewire no longer seems to be running and the VIM4 no longer has one of it’s 8 cores maxed out all the time.

user@Khadas:~$ systemctl --user  status pipewire pipewire.socket
● pipewire.service - PipeWire Multimedia Service
     Loaded: loaded (/usr/lib/systemd/user/pipewire.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2022-09-27 10:26:12 PDT; 2min 13s ago
TriggeredBy: ● pipewire.socket
   Main PID: 1176 (pipewire)
      Tasks: 2 (limit: 8262)
     Memory: 3.8M
        CPU: 2min 12.848s
     CGroup: /user.slice/user-1001.slice/user@1001.service/session.slice/pipewire.service
             └─1176 /usr/bin/pipewire

Sep 27 10:26:12 Khadas systemd[1169]: Started PipeWire Multimedia Service.
Sep 27 10:26:12 Khadas pipewire[1176]: mod.rt: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown
Sep 27 10:26:12 Khadas pipewire[1176]: mod.rt: could not set nice-level to -11: No such file or directory
Sep 27 10:26:12 Khadas pipewire[1176]: mod.rt: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown
Sep 27 10:26:12 Khadas pipewire[1176]: mod.rt: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown
Sep 27 10:26:12 Khadas pipewire[1176]: mod.rt: RTKit error: org.freedesktop.DBus.Error.ServiceUnknown
Sep 27 10:26:12 Khadas pipewire[1176]: mod.rt: could not make thread 1219 realtime using RTKit: No such file or directory

● pipewire.socket - PipeWire Multimedia System Socket
     Loaded: loaded (/usr/lib/systemd/user/pipewire.socket; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2022-09-27 10:26:12 PDT; 2min 13s ago
   Triggers: ● pipewire.service
     Listen: /run/user/1001/pipewire-0 (Stream)
     CGroup: /user.slice/user-1001.slice/user@1001.service/app.slice/pipewire.socket

Sep 27 10:26:12 Khadas systemd[1169]: Listening on PipeWire Multimedia System Socket.
user@Khadas:~$ systemctl --user  disable pipewire pipewire.socket
user@Khadas:~$ systemctl --user  mask pipewire pipewire.socket
Created symlink /home/user/.config/systemd/user/pipewire.service → /dev/null.
Created symlink /home/user/.config/systemd/user/pipewire.socket → /dev/null.

maybe this link can help you : https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1069

To clarify my situation, I installed Firefox immediately after setting up Ubuntu and everything was working fine until I tried to use the built in Desktop Sharing feature. That was when I found the information about the setting in firefox that I posted. Changing media.webspeech.synth.enabled to false in about:config resolved the issue for me.

I am not using the Desktop Sharing feature any more and everything seems to be running fine but since this seems to be an ongoing issue, I had another look at some more of the pipewire issues and the wiki and checked some of the settings mentioned.

It seems that pipewire is disabled on my system as pw-top returns ‘Can’t connect: Host is down’. Also, pactl info tells me that my system is using the native pulseaudio server.

The wiki states that pipewire can be used as a replacement pulse server but the two can’t be used together.

Is it possible that the Desktop Sharing feature causes a conflict by enabling pipewire and pipewire-pulse without disabling native pulseaudio or am I talking out of my hat?

edit: looks like I was because I uninstalled xrdp and re-enable Desktop Sharing for both RDP and VNC and nothing changed. I still can’t connect in using either though.

Clearly, I’m out of my depth here!

Hi @technodevotee Thanks for the further info. Lotta topics covered :wink: I am not sure I have found the pipewire problem I have to be related to the remote desktop problem I have. I have a separate thread here on this forum on that. I found the pipewire runaway problem to occur on a clean install and then update of the VIM4 and Ubuntu 22.04, did nothing with desktop sharing at that point or install Firefox. Yet experienced the pipewire runaway. Doing the steps I describe above I am able to get rid of pipewire problem and still play music and watch videos on the VIM4 with full sound coming out of a small USB attached speaker set.

On the remote desktop issue I am having, you can see the info in the other thread. But as brief summary, nothing I have tried has been able to get the stock Ubuntu 22.04.1 remote sharing to work on the VIM4. This works out of the box for both VNC and RDP into a logged in GUI session on the desktop of the machine on a Intel based MeLE SBC running the stock x64 Ubuntu 22.04 and it is running Wayland. I have been able to get the work around described in the other thread using xrds to allow me to get a RDP session into the VIM4, no VNC. And I must use a 2nd account on the RDP session, it cannot be the session logged to the physical desktop of the VIM4. The RDP session is bit slow, but useable. And again, I am not seeing any connection between my pipewire issue and my remote desktop issue, however I a noob. Good Hunting!

I now accept that the pipewire issue doesn’t seem related to the remote desktop issue but, I was convinced that I only had it happen after I tried to get RDP and VNC working.

I don’t know what your experience of it is, but it was really noticeable when it started for me - everything was taking ages to load and the fan was running more-or-less constantly.

As soon as I disabled the webspeech synth feature in Firefox it went back to normal so I guess that should have been a clue.

It is a shame that wasn’t the same as the issue you have.

Are you using pipewire-pulseaudio or the native pulseaudio server?

I have a feeling there’s something up with the implementation of Wayland on the current release but without being able to disable it, there no way of proving it. It certainly seems to be causing issues with installing other things.

Unfortunately, it is going to require someone with a lot more knowledge than me to figure it out.

I am the same boat as you I think, there are number of things that am trying to understand about the VIM4 in parallel, combined with been a linux noob. It is difficult to make sure ‘not to cross the streams’ :wink: when making changes.

To your question ‘Are you using pipewire-pulseaudio or the native pulseaudio server?’, to my ‘noobism’, I don’t know, I could guess ‘native’, however if you told me ‘The Wall of Sound’ was running the show I would believe you… below is the audio section of inxi currently after disabling pipewire and pipewire.socket as shown in my prior post. Where would you look to answer your question? Ubuntu ‘About’ or ‘Sound’ in the control panel does not seem to give me any clue.

inxi -Fc0

System:
  Host: Khadas Kernel: 5.4.125 aarch64 bits: 64 Console: pty pts/1
    Distro: Ubuntu 22.04.1 LTS (Jammy Jellyfish)
Machine:
...
Audio:
  Device-1: audio- driver: aml_audio_controller
  Device-2: snd-iomap driver: auge_snd_iomap
  Device-3: audio_data driver: audio_data_debug
  Device-4: t7-audio-clocks driver: audio_clocks
  Device-5: t5-audio-ddr-manager driver: audio_ddr_manager
  Device-6: tm2-revb-snd-pdm driver: snd_pdm
  Device-7: audio-pinctrl driver: pinctrl_audio
  Device-8: t5-resample-a driver: audioresample
  Device-9: t5-resample-b driver: audioresample
  Device-10: tm2-revb-snd-spdif-a driver: snd_spdif
  Device-11: tm2-revb-snd-spdif-b driver: snd_spdif
  Device-12: t7-snd-tdma driver: snd_tdm
  Device-13: t7-snd-tdmb driver: snd_tdm
  Device-14: t7-snd-tdmc driver: snd_tdm
  Device-15: hifi4dsp driver: hifi4dsp
  Device-16: amhdmitx-t7 driver: amhdmitx21
  Device-17: hifi4dsp driver: N/A
  Device-18: hifi4dsp driver: N/A
  Device-19: GEMBIRD Honk HK-5002 USB Speaker type: USB
    driver: hid-generic,snd-usb-audio,usbhid
  Sound Server-1: ALSA v: k5.4.125 running: yes
  Sound Server-2: PulseAudio v: 15.99.1 running: yes

I used pactl info, but inxi shows you are using native pulseaudio same as me.

I’m not so much a noob with Linux as extremely rusty because I used to install and support it in a former life but given the way that everything changes so quickly in computing and especially Linux, I may as well be.

Ok… so I just noticed this on my Ubuntu 22.04 install too… one CPU saturated by Pipewire… and for whatever reason i can’t kill it… I guess I’ll see if I can uninstall it…

Have you tried the firefox setting or disabling it first?

IDK if it actually used by anything (other than Firefox speech synth) but I was reading the FAQ on the pipewire GitLab site and it said pipewire had been the default server for something or other on Fedora for a while.

Is PipeWire Ready Yet?
It is pretty much ready for most users. It has been used since Fedora 27 (November 2017) for Wayland screen sharing and has been the default audio server since Fedora 34 (April 2021).

So maybe I was right about my problem only starting after I tried to set up screen sharing after all. I mean, we know that the Khadas version of Ubuntu-Gnome uses Wayland exclusively so is pipewire the default server for it here as well? IDK