sysprog21 / vsnd

Virtual Linux soundcard driver
MIT License
25 stars 9 forks source link

Add note for Linux distributions powered by PipeWire #5

Closed freshLiver closed 6 months ago

freshLiver commented 6 months ago

This PR adds a simple guide to solve the rmmod problem in PipeWire-enabled system.

Similar to the problem in PulseAudio-enabled system, for systems using pipewire, we might also not able to remove the vsnd module from kernel directly.

vm@vm:~/mnt/vsnd$ sudo rmmod vsnd 
rmmod: ERROR: Module vsnd is in use

vm@vm:~/mnt/vsnd$ systemctl --user status pipewire
● pipewire.service - PipeWire Multimedia Service
     Loaded: loaded (/usr/lib/systemd/user/pipewire.service; enabled; preset: enabled)
     Active: active (running) since Sat 2024-05-04 19:05:17 CST; 4h 45min ago
TriggeredBy: ● pipewire.socket
   Main PID: 12797 (pipewire)
      Tasks: 3 (limit: 4615)
     Memory: 4.3M (peak: 4.5M)
        CPU: 38ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/pipewire.service
             └─12797 /usr/bin/pipewire

May 04 19:05:17 vm systemd[2077]: Started pipewire.service - PipeWire Multimedia Service.
May 04 19:05:17 vm pipewire[12797]: mod.jackdbus-detect: Failed to receive jackdbus reply: org.freedesktop.DBus.Error.ServiceUnknown:>
vm@vm:~/mnt/vsnd$ systemctl --user status pipewire.socket 
● pipewire.socket - PipeWire Multimedia System Sockets
     Loaded: loaded (/usr/lib/systemd/user/pipewire.socket; enabled; preset: enabled)
     Active: active (running) since Sat 2024-05-04 19:05:17 CST; 4h 45min ago
   Triggers: ● pipewire.service
     Listen: /run/user/1000/pipewire-0 (Stream)
             /run/user/1000/pipewire-0-manager (Stream)
     CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/pipewire.socket

May 04 19:05:17 vm systemd[2077]: Listening on pipewire.socket - PipeWire Multimedia System Sockets.

To address this problem, we can stop the pipewire service before using the rmmod command:

vm@vm:~/mnt/vsnd$ systemctl --user stop pipewire.socket 
vm@vm:~/mnt/vsnd$ systemctl --user stop pipewire
vm@vm:~/mnt/vsnd$ sudo rmmod vsnd
vm@vm:~/mnt/vsnd$ echo $?
0

And we should restart the pipewire service after rmmod:

vm@vm:~/mnt/vsnd$ systemctl --user start pipewire
vm@vm:~/mnt/vsnd$ systemctl --user status pipewire
● pipewire.service - PipeWire Multimedia Service
     Loaded: loaded (/usr/lib/systemd/user/pipewire.service; enabled; preset: enabled)
     Active: active (running) since Sat 2024-05-04 23:54:18 CST; 6s ago
TriggeredBy: ● pipewire.socket
   Main PID: 13335 (pipewire)
      Tasks: 3 (limit: 4615)
     Memory: 4.2M (peak: 4.4M)
        CPU: 42ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/pipewire.service
             └─13335 /usr/bin/pipewire

May 04 23:54:18 vm systemd[2077]: Started pipewire.service - PipeWire Multimedia Service.
May 04 23:54:18 vm pipewire[13335]: mod.jackdbus-detect: Failed to receive jackdbus reply: org.freedesktop.DBus.Error.ServiceUnknown:>
vm@vm:~/mnt/vsnd$ systemctl --user status pipewire.socket
● pipewire.socket - PipeWire Multimedia System Sockets
     Loaded: loaded (/usr/lib/systemd/user/pipewire.socket; enabled; preset: enabled)
     Active: active (running) since Sat 2024-05-04 23:54:18 CST; 10s ago
   Triggers: ● pipewire.service
     Listen: /run/user/1000/pipewire-0 (Stream)
             /run/user/1000/pipewire-0-manager (Stream)
     CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/pipewire.socket

May 04 23:54:18 vm systemd[2077]: Listening on pipewire.socket - PipeWire Multimedia System Sockets.
freshLiver commented 6 months ago

The original README also contains some markdown lint problems, should I fix these in this PR, or separate into another PR?

$ docker run --rm -v `pwd`:/data markdownlint/markdownlint README.md

Unable to find image 'markdownlint/markdownlint:latest' locally
latest: Pulling from markdownlint/markdownlint
213ec9aee27d: Pull complete 
5bedfe54446b: Pull complete 
Digest: sha256:25c930bb03b1ea50a2e6e377e4ab6f1fe89a760f85e56d189cc007caa4301b0b
Status: Downloaded newer image for markdownlint/markdownlint:latest
README.md:90: MD014 Dollar signs used before commands without showing output
README.md:97: MD014 Dollar signs used before commands without showing output
README.md:8: MD022 Headers should be surrounded by blank lines
README.md:22: MD022 Headers should be surrounded by blank lines
README.md:101: MD022 Headers should be surrounded by blank lines
README.md:105: MD022 Headers should be surrounded by blank lines
README.md:13: MD031 Fenced code blocks should be surrounded by blank lines
README.md:18: MD031 Fenced code blocks should be surrounded by blank lines
README.md:26: MD031 Fenced code blocks should be surrounded by blank lines
README.md:32: MD031 Fenced code blocks should be surrounded by blank lines
README.md:37: MD031 Fenced code blocks should be surrounded by blank lines
README.md:43: MD031 Fenced code blocks should be surrounded by blank lines
README.md:48: MD031 Fenced code blocks should be surrounded by blank lines
README.md:62: MD031 Fenced code blocks should be surrounded by blank lines
README.md:71: MD031 Fenced code blocks should be surrounded by blank lines
README.md:78: MD031 Fenced code blocks should be surrounded by blank lines
README.md:106: MD032 Lists should be surrounded by blank lines
jserv commented 6 months ago

The original README also contains some markdown lint problems, should I fix these in this PR, or separate into another PR?

You can fix that here.

freshLiver commented 6 months ago

You can fix that here.

There is a rule about the leading dollar sign in the code blocks, do I need to ignore this rule?

For example, the dollar sign in:

$ sudo apt install linux-headers-$(uname -r)

will disappear after being formatted:

sudo apt install linux-headers-$(uname -r)
jserv commented 6 months ago

There is a rule about the leading dollar sign in the code blocks, do I need to ignore this rule?

Only C source files require adherence to a consistent style. For other files, proceed as you wish.

jserv commented 6 months ago

Thank @freshLiver for contributing!