ubuntu 25 突破pipewire 不能以root帐号运行 系统没有声音输入输出设备

ubuntu 25 系统以root帐号进入图形界面的话是没有声音的,并且录屏也不可用,原因是pipewire 不能以root帐号运行,检查pipewire状态可以发现:

bash 复制代码
root@lm:~# systemctl --user status pipewire pipewire-pulse wireplumber
○ pipewire.service - PipeWire Multimedia Service
     Loaded: loaded (/usr/lib/systemd/user/pipewire.service; enabled; preset: enabled)
     Active: inactive (dead)
TriggeredBy: ○ pipewire.socket
  Condition: start condition unmet at Thu 2026-05-14 13:46:32 CST; 12min ago
             └─ ConditionUser=!root was not met

5月 14 13:46:32 lm systemd[1859]: pipewire.service - PipeWire Multimedia Service was skipped because of an unmet cond>

○ pipewire-pulse.service - PipeWire PulseAudio
     Loaded: loaded (/usr/lib/systemd/user/pipewire-pulse.service; enabled; preset: enabled)
     Active: inactive (dead)
TriggeredBy: ○ pipewire-pulse.socket
  Condition: start condition unmet at Thu 2026-05-14 13:46:32 CST; 12min ago
             └─ ConditionUser=!root was not met

5月 14 13:46:32 lm systemd[1859]: pipewire-pulse.service - PipeWire PulseAudio was skipped because of an unmet condit>

○ wireplumber.service - Multimedia Service Session Manager
     Loaded: loaded (/usr/lib/systemd/user/wireplumber.service; enabled; preset: enabled)
     Active: inactive (dead)

5月 14 13:46:32 lm systemd[1859]: wireplumber.service: Bound to unit pipewire.service, but unit isn't active.
5月 14 13:46:32 lm systemd[1859]: Dependency failed for wireplumber.service - Multimedia Service Session Manager.
5月 14 13:46:32 lm systemd[1859]: wireplumber.service: Job wireplumber.service/start failed with result 'dependency'.

编辑启动文件

/usr/lib/systemd/user/pipewire.service

bash 复制代码
# 注释掉 ConditionUser=!root

root@lm:~# cat /usr/lib/systemd/user/pipewire.service
[Unit]
Description=PipeWire Multimedia Service

# We require pipewire.socket to be active before starting the daemon, because
# while it is possible to use the service without the socket, it is not clear
# why it would be desirable.
#
# A user installing pipewire and doing `systemctl --user start pipewire`
# will not get the socket started, which might be confusing and problematic if
# the server is to be restarted later on, as the client autospawn feature
# might kick in. Also, a start of the socket unit will fail, adding to the
# confusion.
#
# After=pipewire.socket is not needed, as it is already implicit in the
# socket-service relationship, see systemd.socket(5).
Requires=pipewire.socket dbus.service 
#ConditionUser=!root

[Service]
LockPersonality=yes
MemoryDenyWriteExecute=yes
NoNewPrivileges=yes
RestrictNamespaces=yes
SystemCallArchitectures=native
SystemCallFilter=@system-service
Type=simple
ExecStart=/usr/bin/pipewire
Restart=on-failure
Slice=session.slice

[Install]
Also=pipewire.socket
WantedBy=default.target
root@lm:~# 

编辑启动文件

/usr/lib/systemd/user/pipewire-pulse.service

bash 复制代码
# 注释掉 ConditionUser=!root

root@lm:~# cat /usr/lib/systemd/user/pipewire-pulse.service
[Unit]
Description=PipeWire PulseAudio

# We require pipewire-pulse.socket to be active before starting the daemon, because
# while it is possible to use the service without the socket, it is not clear
# why it would be desirable.
#
# A user installing pipewire and doing `systemctl --user start pipewire-pulse`
# will not get the socket started, which might be confusing and problematic if
# the server is to be restarted later on, as the client autospawn feature
# might kick in. Also, a start of the socket unit will fail, adding to the
# confusion.
#
# After=pipewire-pulse.socket is not needed, as it is already implicit in the
# socket-service relationship, see systemd.socket(5).
Requires=pipewire-pulse.socket
#ConditionUser=!root
Wants=pipewire.service wireplumber.service pipewire-media-session.service
After=pipewire.service wireplumber.service pipewire-media-session.service
Conflicts=pulseaudio.service

[Service]
LockPersonality=yes
MemoryDenyWriteExecute=yes
NoNewPrivileges=yes
RestrictNamespaces=yes
SystemCallArchitectures=native
SystemCallFilter=@system-service
Type=simple
ExecStart=/usr/bin/pipewire-pulse
Restart=on-failure
Slice=session.slice

[Install]
Also=pipewire-pulse.socket
WantedBy=default.target
root@lm:~# 

重新加载服务

bash 复制代码
# 启动 PipeWire 用户服务
systemctl --user daemon-reload
systemctl --user start pipewire pipewire-pulse
systemctl --user enable pipewire pipewire-pulse
相关推荐
牢姐与蒯1 小时前
Linux基本指令及知识点(二)
linux·运维·服务器
小玮看世界1 小时前
[Python]从“脏”数据到优雅实现:一个IoT滑动窗口最大值问题的测试驱动优化实录
linux·前端·python
ᥬ 小月亮2 小时前
SonarQube使用教程(Docker安装)
运维·docker·容器
去伪存真20252 小时前
数字样机、态势推演与3D汇报场景下的平台选型对比
运维·服务器
自动化测试行业观察2 小时前
从“自动化”到“智能化”:TestMan AI测试平台引领软件测试范式转移
运维·自动化测试·人工智能·测试工具·自动化·app测试·移动应用测试
xiaoxiangsiyan2 小时前
运维之前端反调试学习
运维·前端·学习·状态模式
BLi4ee3 小时前
WSL 文件资源管理器左侧 Linux / Ubuntu 入口恢复
linux·ubuntu
深圳市恒星物联科技有限公司3 小时前
破解复杂水务监测难题:投入式压力液位计如何实现“零中断”长效运维?
运维·物联网·智慧城市
自律最差的编程狗3 小时前
从零搭建:VMware + Ubuntu + Docker + MySQL 完整指南
mysql·ubuntu·docker
RPA机器人就用八爪鱼4 小时前
八爪鱼RPA客服质检自动化:会话记录采集与关键词分析方案
运维·自动化·rpa