debian-ubuntu

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Debian-Ubuntu: Debian and Debian-Based Distro Administration

Debian-Ubuntu:Debian及Debian系发行版管理

Administer Debian, Ubuntu, Linux Mint, Pop!_OS, Devuan, and other Debian-derived systems, with partial coverage for Kali when the question is about base OS administration rather than security-distro workflow. Focus on Debian stable and Ubuntu LTS first, then layer in derivative-specific behavior, PPA workflows, snap confinement, Ubuntu HWE, and explicit checks for derivatives that diverge on init, packaging defaults, or intended use.
Versions worth pinning (verified April 2026):
Only pin versions here when they materially affect compatibility or troubleshooting shape. For ordinary Debian and Ubuntu package work, prefer the live distro lane and package policy over a stale package-version table.
ComponentVersionWhy it matters
Debian stable13 (trixie)current stable baseline and repo behavior
Ubuntu LTS26.04 (Resolute Raccoon)current LTS baseline for most Ubuntu guidance
Ubuntu interim laneverify liveinterim releases move fast; check the active upgrade path instead of memorizing one short-lived codename
Ubuntu HWE laneverify livekernel metapackage and hardware-enablement behavior matter more than one exact kernel number
NVIDIA driver branchverify liveproprietary branch choice affects Wayland, gaming, and DKMS behavior
Mesa stackverify liveAMD and Intel graphics behavior tracks the shipped Mesa lane
管理Debian、Ubuntu、Linux Mint、Pop!_OS、Devuan及其他Debian衍生系统,当问题涉及基础操作系统管理而非安全发行版工作流时,部分覆盖Kali系统。优先聚焦Debian稳定版和Ubuntu LTS版本,再逐步加入衍生版特定行为、PPA工作流、snap沙箱限制、Ubuntu HWE,以及针对在初始化、包管理默认设置或预期用途上存在差异的衍生版的明确检查。
值得固定的版本(2026年4月验证):
仅当版本对兼容性或故障排查产生实质性影响时,才在此处固定版本。对于普通Debian和Ubuntu包管理工作,优先使用当前发行版渠道和包策略,而非过时的包版本表。
组件版本重要性说明
Debian稳定版13 (trixie)当前稳定基线及仓库行为
Ubuntu LTS26.04 (Resolute Raccoon)大多数Ubuntu指导的当前LTS基线
Ubuntu临时版本渠道实时验证临时版本迭代快;请检查当前升级路径,而非记忆某个短命版本代号
Ubuntu HWE渠道实时验证内核元包和硬件支持行为比具体内核版本号更重要
NVIDIA驱动分支实时验证专有分支选择会影响Wayland、游戏和DKMS行为
Mesa栈实时验证AMD和Intel显卡行为随预装Mesa渠道变化

When to use

适用场景

  • Package management with
    apt
    ,
    apt-get
    ,
    dpkg
    ,
    apt-cache
    , pinning, or holds
  • PPA management on Ubuntu, Mint, or Pop!_OS (
    add-apt-repository
    , key handling)
  • Snap and Flatpak workflow, confinement issues, and alternatives
  • systemd service, timer, boot, and journal troubleshooting on Debian-style systems
  • GRUB, initramfs, EFI, kernel, and recovery work on Debian or Ubuntu
  • Release maintenance: dist-upgrades, HWE transitions, release upgrades (
    do-release-upgrade
    )
  • Desktop stack: Wayland vs X11, GNOME, KDE, Cinnamon, COSMIC, portals, PipeWire, Bluetooth
  • Session startup and laptop work: GDM, SDDM, LightDM, suspend/resume, power profiles, hybrid graphics
  • GPU and gaming: NVIDIA proprietary vs nouveau, AMD Mesa, Intel, Vulkan, Steam, Proton, Gamescope
  • Capture and communication: OBS, WebRTC screen sharing, Discord/Teams, portals, virtual cameras
  • Storage: ext4, Btrfs, LUKS, LVM, TRIM, hibernation
  • Firmware and hardware enablement:
    fwupd
    ,
    ubuntu-drivers
    , HWE stacks, backports
  • Security: AppArmor profiles, unattended-upgrades, needrestart, debian-security updates
  • Remote gaming and input: Moonlight, Sunshine, Steam Remote Play, controllers
  • Base Linux ops on Debian-style systems:
    journalctl
    ,
    dmesg
    ,
    lsblk
    ,
    update-alternatives
  • 使用
    apt
    apt-get
    dpkg
    apt-cache
    、版本固定或包保留进行包管理
  • 在Ubuntu、Mint或Pop!_OS上管理PPA(
    add-apt-repository
    、密钥处理)
  • Snap和Flatpak工作流、沙箱限制问题及替代方案
  • Debian风格系统上的systemd服务、定时器、启动和日志故障排查
  • Debian或Ubuntu上的GRUB、initramfs、EFI、内核和恢复操作
  • 版本维护:发行版升级、HWE过渡、版本更新(
    do-release-upgrade
  • 桌面栈:Wayland与X11、GNOME、KDE、Cinnamon、COSMIC、门户、PipeWire、蓝牙
  • 会话启动与笔记本操作:GDM、SDDM、LightDM、休眠/唤醒、电源配置、混合显卡
  • GPU与游戏:NVIDIA专有驱动与nouveau开源驱动、AMD Mesa、Intel、Vulkan、Steam、Proton、Gamescope
  • 捕获与通信:OBS、WebRTC屏幕共享、Discord/Teams、门户、虚拟摄像头
  • 存储:ext4、Btrfs、LUKS、LVM、TRIM、休眠
  • 固件与硬件支持:
    fwupd
    ubuntu-drivers
    、HWE栈、回溯包
  • 安全:AppArmor配置文件、无人值守更新、needrestart、debian-security更新
  • 远程游戏与输入:Moonlight、Sunshine、Steam Remote Play、控制器
  • Debian风格系统上的基础Linux操作:
    journalctl
    dmesg
    lsblk
    update-alternatives

When NOT to use

不适用场景

  • Shell syntax, quoting, or script portability - use command-prompt
  • Network architecture, DNS, VPNs, reverse proxies, or firewall design - use networking
  • Docker, Podman, image builds, or container runtime - use docker
  • Kubernetes cluster or manifest work - use kubernetes
  • Fleet-wide Linux configuration via playbooks - use ansible
  • Security review, vulnerability triage, or offensive testing - use security-audit or lockpick
  • RPM-family distros and tooling - use rhel-fedora. That includes RHEL, Fedora, Rocky, AlmaLinux, Oracle Linux, and Amazon Linux.
  • Ubuntu Core and snap-only transactional workflows - outside this skill; do not treat them like ordinary apt-managed Ubuntu hosts
  • NixOS or declarative system management - outside this skill; route to a dedicated NixOS skill when one exists
  • Kali offensive tooling, pentest workflow, or training-image specifics - use kali-linux
  • OPNsense or pfSense appliance work - use firewall-appliance

  • Shell语法、引用或脚本可移植性 - 使用command-prompt技能
  • 网络架构、DNS、VPN、反向代理或防火墙设计 - 使用networking技能
  • Docker、Podman、镜像构建或容器运行时 - 使用docker技能
  • Kubernetes集群或清单操作 - 使用kubernetes技能
  • 通过剧本进行跨主机Linux配置 - 使用ansible技能
  • 安全审查、漏洞分类或攻击性测试 - 使用security-auditlockpick技能
  • RPM系发行版及工具 - 使用rhel-fedora技能。包括RHEL、Fedora、Rocky、AlmaLinux、Oracle Linux和Amazon Linux。
  • Ubuntu Core及纯snap事务性工作流 - 超出本技能范围;请勿将其视为普通apt管理的Ubuntu主机
  • NixOS或声明式系统管理 - 超出本技能范围;如有专用NixOS技能,请转至该技能
  • Kali攻击性工具、渗透测试工作流或训练镜像细节 - 使用kali-linux技能
  • OPNsense或pfSense设备操作 - 使用firewall-appliance技能

AI Self-Check

AI自检

Before returning Debian or Ubuntu commands, verify:
  • Distro and release identified: Debian stable/testing/unstable, Ubuntu LTS/interim, Mint, Pop!_OS, Devuan, Kali, or another derivative. Advice diverges quickly.
  • Init system identified: do not assume systemd on Devuan or other Debian derivatives without checking PID 1, service manager, and boot tooling first.
  • Release model respected: do not suggest
    apt upgrade
    when
    apt full-upgrade
    or
    apt dist-upgrade
    is required for package transitions. Do not suggest
    apt dist-upgrade
    casually on Ubuntu without context.
  • Ubuntu 24.04 -> 26.04 delta accounted for: Ubuntu 24.04 LTS upgraders inherit 24.10, 25.04, 25.10, and 26.04 changes. Do not treat 26.04 as a small point refresh of 24.04.
  • Repository state clean: no broken apt lists, missing GPG keys, or mixed releases without pinning.
  • Boot stack identified: GRUB vs other loader, EFI vs BIOS, initramfs generator, and kernel metapackage before changing boot files.
  • Fallback path exists: do not remove the only known-good kernel or break the only boot entry on a remote system.
  • PPA trust boundary respected: review PPA source, key, and maintenance status before adding.
  • systemd scope is correct: distinguish system units from user units and use
    systemctl --user
    only when appropriate.
  • Wayland stack is coherent: compositor, portal backend, Xwayland compatibility, and user-session services line up.
  • Session startup path identified: display manager, greeter, or TTY launch path known before debugging env propagation.
  • Audio stack is coherent: PipeWire,
    pipewire-pulse
    , and WirePlumber are not fighting a leftover PulseAudio setup.
  • Bluetooth path is complete:
    bluetooth.service
    alone is not enough if audio routing, trust, pairing, or profile selection is broken.
  • GPU stack matches hardware: proprietary NVIDIA vs nouveau vs Mesa. Verify actual driver in use before debugging graphics issues.
  • Gaming stack includes 32-bit userspace when needed: Steam and Proton failures often come from missing
    i386
    graphics libraries.
  • Capture stack is coherent: portal backend, PipeWire, WebRTC or Electron client path, and any virtual camera module choice line up.
  • Suspend and hibernation claims are real: hibernation advice matches actual swap layout, initramfs resume hook, and Secure Boot state.
  • AppArmor state is considered: on Ubuntu, AppArmor denials can silently break services, snaps, or custom binaries.
  • Snap confinement is not ignored: when a snap misbehaves, check interfaces and confinement level before reinstalling.
  • Ubuntu desktop session assumptions are current: on Ubuntu 26.04 Desktop, do not assume a stock Xorg session or the old
    Software & Updates
    GUI are present by default.
  • HWE kernel path is understood: Ubuntu HWE stacks transition kernel metapackages. Know whether the system tracks
    generic
    or
    hwe
    .
  • Diagnostic errors are not silenced: do not mask failures with
    2>/dev/null
    on commands whose error reason matters. Use
    2>&1 || true
    to surface errors without aborting.
  • Firmware updates are not conflated with package updates:
    fwupd
    and vendor tools (e.g.,
    system76-firmware
    ) are separate from
    apt upgrade
    .
  • Debian alternatives are checked: when a command behaves oddly, verify
    update-alternatives
    for that binary.

返回Debian或Ubuntu命令前,请验证:
  • 已识别发行版和版本:Debian稳定版/测试版/不稳定版、Ubuntu LTS/临时版、Mint、Pop!_OS、Devuan、Kali或其他衍生版。建议内容差异很大。
  • 已识别初始化系统:在Devuan或其他Debian衍生版上,未检查PID 1、服务管理器和启动工具前,不要默认使用systemd。
  • 遵循版本模型:当包过渡需要
    apt full-upgrade
    apt dist-upgrade
    时,不要建议使用
    apt upgrade
    。在Ubuntu上,若无上下文,不要随意建议
    apt dist-upgrade
  • 考虑Ubuntu 24.04 -> 26.04的差异:Ubuntu 24.04 LTS升级会继承24.10、25.04、25.10和26.04的变更。不要将26.04视为24.04的小版本更新。
  • 仓库状态干净:无损坏的apt列表、缺失的GPG密钥或未固定版本的混合发行版。
  • 已识别启动栈:修改启动文件前,确认GRUB或其他加载器、EFI或BIOS、initramfs生成器和内核元包。
  • 存在回退路径:不要在远程系统上移除唯一已知可用的内核或破坏唯一启动项。
  • 遵循PPA信任边界:添加PPA前,审查其来源、密钥和维护状态。
  • systemd范围正确:区分系统单元与用户单元,仅在合适时使用
    systemctl --user
  • Wayland栈一致: compositor、门户后端、Xwayland兼容性和用户会话服务匹配。
  • 已识别会话启动路径:调试环境传播前,了解显示管理器、登录界面或TTY启动路径。
  • 音频栈一致:PipeWire、
    pipewire-pulse
    和WirePlumber未与遗留PulseAudio设置冲突。
  • 蓝牙路径完整:若音频路由、信任、配对或配置选择出现问题,仅
    bluetooth.service
    不足以解决。
  • GPU栈匹配硬件:NVIDIA专有驱动、nouveau开源驱动或Mesa。调试显卡问题前,验证实际使用的驱动。
  • 游戏栈包含必要的32位用户空间:Steam和Proton故障通常源于缺失
    i386
    图形库。
  • 捕获栈一致:门户后端、PipeWire、WebRTC或Electron客户端路径以及虚拟摄像头模块选择匹配。
  • 休眠和唤醒声明真实:休眠建议与实际交换分区布局、initramfs唤醒钩子和Secure Boot状态匹配。
  • 考虑AppArmor状态:在Ubuntu上,AppArmor拒绝可能会静默破坏服务、snaps或自定义二进制文件。
  • 未忽略snap沙箱限制:当snap应用行为异常时,重新安装前先检查接口和沙箱级别。
  • Ubuntu桌面会话假设符合当前情况:在Ubuntu 26.04桌面版上,不要默认全新安装会包含原生Xorg会话或旧版
    Software & Updates
    图形界面。
  • 理解HWE内核路径:Ubuntu HWE栈会转换内核元包。了解系统跟踪的是
    generic
    还是
    hwe
  • 未掩盖诊断错误:对于错误原因重要的命令,不要用
    2>/dev/null
    掩盖失败。使用
    2>&1 || true
    显示错误而不终止执行。
  • 未混淆固件更新与包更新
    fwupd
    和厂商工具(如
    system76-firmware
    )与
    apt upgrade
    是分开的。
  • 检查Debian替代方案:当命令行为异常时,验证该二进制文件的
    update-alternatives
    设置。

Workflow

工作流

Step 1: Identify the distro lane first

步骤1:首先识别发行版渠道

DistroDefault stanceWhat changes
Debian stableConservative, pin-oriented
stable
repo only unless testing/unstable explicitly requested. Backports for select packages.
Debian testingRolling-ish, with freezesCloser to Ubuntu but without Ubuntu-specific tooling.
Debian unstable (sid)True rollingNo release, just
sid
. Higher breakage risk.
Ubuntu LTSDefault baseline
do-release-upgrade
for release jumps. Treat Ubuntu 26.04 as the current baseline, but remember that 24.04 LTS upgraders also inherit 24.10, 25.04, and 25.10 changes. HWE kernel optional. Snap presence.
Ubuntu interimShort-livedCommon stepping stone into the current LTS. Quick to EOL.
Linux MintUbuntu LTS derivativeCinnamon/XFCE focus. Mint-specific repos and update manager. PPAs from Ubuntu often work.
Pop!_OSUbuntu derivative with extrasSystem76 firmware, COSMIC desktop, Pop repos,
system76-power
. NVIDIA ISO available.
DevuanDebian derivative with a major service-model splitDo not assume systemd,
systemctl
, or Ubuntu-style desktop/session plumbing. Verify init and service tooling first.
KaliDebian-derived security distroFine for base apt, kernel, boot, or service administration, but use kali-linux for Kali-specific branches, images, metapackages, training-image workflow, and offensive-distro context.
Other Debian-basedConfirm repo modelDo not assume vanilla Debian or Ubuntu behavior.
发行版默认立场变更点
Debian稳定版保守、版本固定导向仅使用
stable
仓库,除非明确请求测试版/不稳定版。选择性使用回溯包。
Debian测试版类滚动更新,含冻结期接近Ubuntu,但无Ubuntu特定工具。
Debian不稳定版(sid)纯滚动更新无版本号,仅
sid
。更高故障风险。
Ubuntu LTS默认基线使用
do-release-upgrade
进行版本跳转。将Ubuntu 26.04视为当前基线,但需记住24.04 LTS升级也会继承24.10、25.04和25.10的变更。HWE内核可选。包含snap。
Ubuntu临时版生命周期短通常是当前LTS的过渡版本。很快会终止支持。
Linux MintUbuntu LTS衍生版聚焦Cinnamon/XFCE。Mint专属仓库和更新管理器。Ubuntu的PPA通常可用。
Pop!_OS带附加功能的Ubuntu衍生版System76固件、COSMIC桌面、Pop仓库、
system76-power
。提供NVIDIA镜像。
Devuan服务模型大幅拆分的Debian衍生版不要默认使用systemd、
systemctl
或Ubuntu风格的桌面/会话 plumbing。首先验证初始化和服务工具。
KaliDebian衍生的安全发行版适用于基础apt、内核、启动或服务管理,但针对Kali专属分支、镜像、元包、训练镜像工作流和攻击性发行版上下文,使用kali-linux技能。
其他Debian系发行版确认仓库模型不要默认其行为与原生Debian或Ubuntu一致。

Step 2: Gather current system state

步骤2:收集当前系统状态

bash
cat /etc/os-release
uname -r
ps -p 1 -o comm=
dpkg-query -W -f='${Package}\t${Version}\n' 'linux-image*' systemd grub-common grub-efi-amd64 2>&1 || true
dpkg -l | grep -E "^ii.*(systemd|grub|pipewire|nvidia|mesa)" | head -15
apt-cache policy
command -v systemctl >/dev/null 2>&1 && systemctl --failed
journalctl -b -p warning..alert 2>&1 || true
findmnt /boot
findmnt /boot/efi
command -v grub-install >/dev/null 2>&1 && grub-install --version
lsblk -f
echo "Session=$XDG_SESSION_TYPE Desktop=$XDG_CURRENT_DESKTOP"
loginctl list-sessions 2>&1 || true
command -v systemctl >/dev/null 2>&1 && systemctl status display-manager 2>&1 || true
command -v systemctl >/dev/null 2>&1 && systemctl --user --failed 2>&1 || true
command -v systemctl >/dev/null 2>&1 && systemctl --user status pipewire pipewire-pulse wireplumber 2>&1 || true
command -v systemctl >/dev/null 2>&1 && systemctl --user status xdg-desktop-portal 2>&1 || true
command -v systemctl >/dev/null 2>&1 && systemctl status apparmor 2>&1 || true
command -v aa-status >/dev/null 2>&1 && aa-status 2>&1 || true
command -v wpctl >/dev/null 2>&1 && wpctl status
command -v bluetoothctl >/dev/null 2>&1 && bluetoothctl show
command -v snap >/dev/null 2>&1 && snap list | head -10
command -v flatpak >/dev/null 2>&1 && flatpak list | head -10
lspci -k | grep -Ei 'vga|3d|display'
journalctl -b | grep -Ei 'nvrm|nvidia|amdgpu|i915|xe|drm' 2>&1 || true
journalctl --user -b | grep -Ei 'portal|pipewire|webrtc|obs' 2>&1 || true
lsmod | grep '^v4l2loopback'
command -v dkms >/dev/null 2>&1 && dkms status
findmnt -t btrfs
command -v systemctl >/dev/null 2>&1 && systemctl status fstrim.timer 2>&1 || true
apt list --upgradable 2>&1 | tail -n +2
bash
cat /etc/os-release
uname -r
ps -p 1 -o comm=
dpkg-query -W -f='${Package}\t${Version}\n' 'linux-image*' systemd grub-common grub-efi-amd64 2>&1 || true
dpkg -l | grep -E "^ii.*(systemd|grub|pipewire|nvidia|mesa)" | head -15
apt-cache policy
command -v systemctl >/dev/null 2>&1 && systemctl --failed
journalctl -b -p warning..alert 2>&1 || true
findmnt /boot
findmnt /boot/efi
command -v grub-install >/dev/null 2>&1 && grub-install --version
lsblk -f
echo "Session=$XDG_SESSION_TYPE Desktop=$XDG_CURRENT_DESKTOP"
loginctl list-sessions 2>&1 || true
command -v systemctl >/dev/null 2>&1 && systemctl status display-manager 2>&1 || true
command -v systemctl >/dev/null 2>&1 && systemctl --user --failed 2>&1 || true
command -v systemctl >/dev/null 2>&1 && systemctl --user status pipewire pipewire-pulse wireplumber 2>&1 || true
command -v systemctl >/dev/null 2>&1 && systemctl --user status xdg-desktop-portal 2>&1 || true
command -v systemctl >/dev/null 2>&1 && systemctl status apparmor 2>&1 || true
command -v aa-status >/dev/null 2>&1 && aa-status 2>&1 || true
command -v wpctl >/dev/null 2>&1 && wpctl status
command -v bluetoothctl >/dev/null 2>&1 && bluetoothctl show
command -v snap >/dev/null 2>&1 && snap list | head -10
command -v flatpak >/dev/null 2>&1 && flatpak list | head -10
lspci -k | grep -Ei 'vga|3d|display'
journalctl -b | grep -Ei 'nvrm|nvidia|amdgpu|i915|xe|drm' 2>&1 || true
journalctl --user -b | grep -Ei 'portal|pipewire|webrtc|obs' 2>&1 || true
lsmod | grep '^v4l2loopback'
command -v dkms >/dev/null 2>&1 && dkms status
findmnt -t btrfs
command -v systemctl >/dev/null 2>&1 && systemctl status fstrim.timer 2>&1 || true
apt list --upgradable 2>&1 | tail -n +2

Step 3: Load only the relevant reference

步骤3:仅加载相关参考文档

If the host is Ubuntu 24.04 LTS or the user is planning a 24.04 -> 26.04 move, load
references/derivatives-and-hwe.md
early. That path bundles interim-release churn, desktop-session changes, app swaps, and GUI-tool changes that do not show up if you treat 26.04 like a routine point upgrade.
Task typeReference
apt
,
dpkg
, pinning, PPAs, snaps,
.deb
handling
references/packages-and-repos.md
systemd units, timers, journal, overrides
references/systemd-and-journal.md
GRUB, kernel, initramfs, EFI, recovery
references/boot-kernel-and-recovery.md
Ubuntu HWE, release upgrades, Debian lanes, Mint/Pop/Devuan/Kali specifics
references/derivatives-and-hwe.md
Wayland, X11, GNOME, KDE, Cinnamon, COSMIC, PipeWire
references/desktop-audio-and-bluetooth.md
Display managers, session startup, suspend/resume, power, hybrid graphics
references/session-display-and-mobile.md
GPU drivers, Vulkan, Steam, Proton, gaming
references/graphics-and-gaming.md
OBS, WebRTC, screen sharing, virtual cameras
references/capture-and-sharing.md
ext4, Btrfs, LUKS, LVM, TRIM, hibernation
references/storage-and-rollback.md
AppArmor, unattended-upgrades, debian-security
references/security-and-updates.md
Remote gaming, controllers, input
references/remote-gaming-input-and-tooling.md
Core Linux ops commands and Debian tools
references/base-linux-and-cli.md
Recurring Debian/Ubuntu failure patterns
references/gotchas-and-special-situations.md
Do not load every reference by default. Pick the one that matches the failure mode, then widen only if the first layer is clean.
如果主机是Ubuntu 24.04 LTS,或者用户计划从24.04升级到26.04,请尽早加载
references/derivatives-and-hwe.md
。该文档包含临时版本变更、桌面会话变更、应用替换和图形工具变更,若将26.04视为常规小版本升级,这些内容不会显现。
任务类型参考文档
apt
dpkg
、版本固定、PPAs、snaps、
.deb
处理
references/packages-and-repos.md
systemd单元、定时器、日志、覆盖配置
references/systemd-and-journal.md
GRUB、内核、initramfs、EFI、恢复
references/boot-kernel-and-recovery.md
Ubuntu HWE、版本升级、Debian渠道差异、Mint/Pop/Devuan/Kali细节说明
references/derivatives-and-hwe.md
Wayland、X11、GNOME、KDE、Cinnamon、COSMIC、PipeWire
references/desktop-audio-and-bluetooth.md
显示管理器、会话启动、休眠/唤醒、电源、混合显卡
references/session-display-and-mobile.md
GPU驱动、Vulkan、Steam、Proton、游戏
references/graphics-and-gaming.md
OBS、WebRTC、屏幕共享、虚拟摄像头
references/capture-and-sharing.md
ext4、Btrfs、LUKS、LVM、TRIM、休眠
references/storage-and-rollback.md
AppArmor、无人值守更新、debian-security
references/security-and-updates.md
远程游戏、控制器、输入
references/remote-gaming-input-and-tooling.md
核心Linux操作命令和Debian工具
references/base-linux-and-cli.md
Debian/Ubuntu常见故障模式
references/gotchas-and-special-situations.md
不要默认加载所有参考文档。选择与故障模式匹配的文档,仅在第一层排查无问题时再扩大范围。

Step 4: Change one layer at a time

步骤4:一次修改一个层级

  • Fix package state before debugging services that may be broken by stale libraries.
  • Fix service configuration before declaring systemd broken.
  • Fix mountpoints and loader state before rebuilding initramfs.
  • On Ubuntu, separate "vanilla Debian behavior" from "Ubuntu snap/HWE/PPA behavior."
  • On Pop!_OS, separate "Ubuntu behavior" from "System76 firmware and power behavior."
  • Prefer reversible steps: package holds, backup kernels,
    apt-mark
    , saved configs.
  • 在调试可能因过期库损坏的服务前,先修复包状态。
  • 在判定systemd损坏前,先修复服务配置。
  • 在重建initramfs前,先修复挂载点和加载器状态。
  • 在Ubuntu上,区分“原生Debian行为”与“Ubuntu snap/HWE/PPA行为”。
  • 在Pop!_OS上,区分“Ubuntu行为”与“System76固件和电源行为”。
  • 优先选择可逆步骤:包保留、备份内核、
    apt-mark
    、保存配置。

Step 5: Validate before closing

步骤5:关闭前验证

bash
apt-cache policy package_name
systemctl status unit_name
journalctl -u unit_name -b
command -v update-grub >/dev/null 2>&1 && update-grub
command -v grub-install >/dev/null 2>&1 && grub-install --version
Reboot only when the boot path is understood and at least one known-good entry remains.

bash
apt-cache policy package_name
systemctl status unit_name
journalctl -u unit_name -b
command -v update-grub >/dev/null 2>&1 && update-grub
command -v grub-install >/dev/null 2>&1 && grub-install --version
仅在理解启动路径且至少保留一个已知可用启动项时,才重启系统。

Troubleshooting Pattern

故障排查模式

Keep triage cross-layer and boring:
  1. Confirm active distro, release, session type, kernel, and package lane.
  2. Identify failing layer: package state, system service, user service, boot path, desktop session, graphics, or app.
  3. Pull logs before changing config.
  4. Change one layer at a time and retest.
  5. Prefer known-good baseline over tweak stacking.
Core log sweep:
bash
journalctl -b -p warning..alert
journalctl --user -b
dmesg --level=err,warn
journalctl -u unit_name -b
journalctl --user -u pipewire -u wireplumber -u xdg-desktop-portal -b
Broad pattern sweeps when you need correlation, not first-pass precision:
bash
journalctl -b | grep -Ei 'nvrm|nvidia|amdgpu|i915|xe|drm' 2>&1 || true
journalctl --user -b | grep -Ei 'portal|pipewire|webrtc|obs' 2>&1 || true
When a bug looks desktop-only, compare one clean baseline:
  • GNOME vs KDE vs Cinnamon vs COSMIC
  • browser WebRTC vs packaged client
  • plain game launch vs Gamescope or MangoHud
  • stock kernel vs HWE kernel

保持跨层级分类且简洁:
  1. 确认当前发行版、版本、会话类型、内核和包渠道。
  2. 识别故障层级:包状态、系统服务、用户服务、启动路径、桌面会话、显卡或应用。
  3. 修改配置前先提取日志。
  4. 一次修改一个层级并重新测试。
  5. 优先选择已知可用的基线,而非叠加调整。
核心日志扫描:
bash
journalctl -b -p warning..alert
journalctl --user -b
dmesg --level=err,warn
journalctl -u unit_name -b
journalctl --user -u pipewire -u wireplumber -u xdg-desktop-portal -b
需要关联而非初步排查时,进行广泛模式扫描:
bash
journalctl -b | grep -Ei 'nvrm|nvidia|amdgpu|i915|xe|drm' 2>&1 || true
journalctl --user -b | grep -Ei 'portal|pipewire|webrtc|obs' 2>&1 || true
当故障仅出现在桌面环境时,对比一个干净基线:
  • GNOME vs KDE vs Cinnamon vs COSMIC
  • 浏览器WebRTC vs 打包客户端
  • 普通游戏启动 vs Gamescope或MangoHud
  • 原生内核 vs HWE内核

Default Decisions

默认决策

  • Debian stable means conservative updates. Pin when mixing repos. Use backports selectively. Avoid
    testing
    or
    sid
    packages on stable without a transition plan.
  • Ubuntu LTS means predictable cadence. Ubuntu 26.04 is the current baseline, but 24.04 -> 26.04 upgrades bundle three interim releases plus the final LTS delta. Expect bigger desktop, app, and workflow changes than the version jump alone suggests.
  • Ubuntu Desktop assumptions changed in 26.04. Stock Ubuntu Desktop is Wayland-only, and the old
    Software & Updates
    GUI is no longer installed by default on new installs. GUI-first troubleshooting advice from 24.04-era blog posts may be wrong on fresh 26.04 systems.
  • Use systemd-native tools first. Reach for
    systemctl
    ,
    journalctl
    ,
    timedatectl
    , and
    localectl
    before distro wrappers.
  • Treat PPAs as exceptions, not defaults. Review maintainer, signing key, freshness, and package origin before adding one. Remove dead PPAs promptly.
  • Prefer distro packages before third-party repos. Use Debian backports, Ubuntu official repos, or vendor packages first; escalate to PPAs only when the distro lane is genuinely insufficient.
  • Treat snaps as sandboxed first. Interface and confinement issues explain more snap failures than package bugs.
  • GRUB and initramfs are one subsystem. Kernel metapackage,
    update-initramfs
    ,
    update-grub
    , and EFI fallback all have to agree.
  • Desktop failures are often session failures. On Wayland, user units, portals, and session env matter as much as the package list.
  • Gaming failures are often stack mismatches. Wrong driver branch, missing
    i386
    userspace, absent firmware, or broken Proton path is more common than "Linux gaming is bad."
  • Capture failures are portal/PipeWire failures. OBS, browser WebRTC, Discord, and Teams often fail at the screencast path.
  • AppArmor is invisible until it is not. On Ubuntu, check
    aa-status
    and journal denials when a service or binary mysteriously fails.
  • Firmware is separate from packages.
    fwupd
    and vendor tools update hardware firmware. Do not expect
    apt upgrade
    to fix BIOS or SSD firmware.

  • Debian稳定版意味着保守更新:混合仓库时固定版本。选择性使用回溯包。若无过渡计划,避免在稳定版上使用
    testing
    sid
    包。
  • Ubuntu LTS意味着可预测的节奏:Ubuntu 26.04是当前基线,但24.04 -> 26.04升级包含三个临时版本加上最终LTS差异。版本号跳跃背后,桌面、应用和工作流的变更比预期更大。
  • Ubuntu 26.04改变了部分桌面默认设置:原生Ubuntu桌面仅支持Wayland,全新安装默认不再包含旧版
    Software & Updates
    图形界面。24.04时代博客中的图形化优先故障排查建议在全新26.04系统上可能失效。
  • 优先使用systemd原生工具:优先使用
    systemctl
    journalctl
    timedatectl
    localectl
    ,而非发行版包装器。
  • 将PPAs视为例外而非默认:添加PPA前,审查维护者、签名密钥、时效性和包来源。及时移除废弃PPA。
  • 优先使用发行版包而非第三方仓库:优先使用Debian回溯包、Ubuntu官方仓库或厂商包;仅当发行版渠道确实无法满足需求时,再使用PPAs。
  • 首先将snaps视为沙箱化应用:接口和沙箱限制解释的snap故障比包bug更多。
  • GRUB和initramfs是一个子系统:内核元包、
    update-initramfs
    update-grub
    和EFI回退必须保持一致。
  • 桌面故障通常是会话故障:在Wayland上,用户单元、门户和会话环境与包列表同样重要。
  • 游戏故障通常是栈不匹配:错误的驱动分支、缺失的
    i386
    用户空间、固件缺失或Proton路径损坏比“Linux游戏差”更常见。
  • 捕获故障通常是门户/PipeWire故障:OBS、浏览器WebRTC、Discord和Teams经常在屏幕捕获路径上失败。
  • AppArmor平时不可见,出问题时才显现:在Ubuntu上,当服务或二进制文件莫名失败时,检查
    aa-status
    和日志中的拒绝记录。
  • 固件与包是分开的
    fwupd
    和厂商工具更新硬件固件。不要期望
    apt upgrade
    修复BIOS或SSD固件。

Quick Triage Checklist

快速分类检查表

SymptomFirst checks
Package weirdness after install
apt update
first. Broken dependencies?
apt -f install
. Held packages?
apt-mark showhold
. Mixed releases?
apt-cache policy
Service fails after updateConfig merge needed?
ucf
or
dpkg --configure -a
. Check unit overrides and
journalctl -b
Won't boot after kernel workGRUB menu, fallback kernel, initramfs. From live media, mount root and the ESP, then bind-mount
/dev
,
/proc
,
/sys
, and
/run
before
chroot
; use the boot recovery reference instead of a one-line chroot recipe.
PPA broke the system
ppa-purge
if available, or manual downgrade + remove after checking package origin with
apt-cache policy
Snap app misbehaves
snap connections
,
snap info
, confinement level, interfaces
Desktop weirdness after update
XDG_SESSION_TYPE
, portal, Xwayland, user services. On Ubuntu 26.04, verify the user is not expecting the old Ubuntu Xorg session to exist by default.
Bluetooth audio issuesBlueZ pairing, PipeWire nodes, card profile
Game blackscreen/crashGPU driver (proprietary vs Mesa), Vulkan, Steam
i386
libs, Gamescope/MangoHud
Screen share brokenWayland vs X11, portal backend, PipeWire user units
Suspend/resume breaks desktopSleep state, GPU logs, lock-screen, display manager
NVIDIA/module vanished after kernel changeDKMS drift:
dkms status
, confirm module built for
uname -r
, check HWE transition
Nothing makes senseCheck gotchas reference - mixed repos, stale PPAs, DKMS drift, AppArmor denials, HWE metapackage mismatch

症状首次检查项
安装后包行为异常先执行
apt update
。存在依赖损坏?执行
apt -f install
。存在保留包?执行
apt-mark showhold
。存在混合发行版?执行
apt-cache policy
更新后服务失败需要合并配置?使用
ucf
dpkg --configure -a
。检查单元覆盖配置和
journalctl -b
内核操作后无法启动GRUB菜单、回退内核、initramfs。从 live 介质挂载根分区和ESP,然后绑定挂载
/dev
/proc
/sys
/run
再执行
chroot
;使用启动恢复参考文档,而非单行chroot命令。
PPA破坏系统若可用则使用
ppa-purge
,或通过
apt-cache policy
检查包来源后手动降级并移除PPA
Snap应用行为异常
snap connections
snap info
、沙箱级别、接口
更新后桌面行为异常
XDG_SESSION_TYPE
、门户、Xwayland、用户服务。在Ubuntu 26.04上,验证用户是否默认期望旧版Ubuntu Xorg会话存在。
蓝牙音频问题BlueZ配对、PipeWire节点、声卡配置文件
游戏黑屏/崩溃GPU驱动(专有 vs Mesa)、Vulkan、Steam
i386
库、Gamescope/MangoHud
屏幕共享失败Wayland vs X11、门户后端、PipeWire用户单元
休眠/唤醒后桌面损坏睡眠状态、GPU日志、锁屏、显示管理器
内核变更后NVIDIA/模块消失DKMS漂移:执行
dkms status
,确认模块为
uname -r
版本构建,检查HWE过渡
完全无法理解故障检查陷阱参考文档 - 混合仓库、过时PPA、DKMS漂移、AppArmor拒绝、HWE元包不匹配

Reference Files

参考文件

  • references/packages-and-repos.md
    - apt workflow, dpkg, pinning, PPAs, snaps, flatpaks,
    .deb
    handling
  • references/systemd-and-journal.md
    - systemd service debugging, unit overrides, user units, journal triage
  • references/boot-kernel-and-recovery.md
    - GRUB, kernel metapackages, initramfs, EFI, recovery, and live-ISO chroot
  • references/derivatives-and-hwe.md
    - Ubuntu HWE, release upgrades, Debian lane differences, Mint, Pop!_OS, Devuan, and Kali scope notes
  • references/desktop-audio-and-bluetooth.md
    - X11 vs Wayland, GNOME, KDE, Cinnamon, COSMIC, portals, PipeWire, Bluetooth
  • references/session-display-and-mobile.md
    - GDM, SDDM, LightDM, session env, suspend/resume, power profiles, hybrid graphics
  • references/graphics-and-gaming.md
    - NVIDIA, AMD, Intel, Vulkan, Steam, Proton, Gamescope, MangoHud
  • references/capture-and-sharing.md
    - OBS, WebRTC screen sharing, Discord/Teams, hardware encoding, virtual cameras
  • references/storage-and-rollback.md
    - ext4, Btrfs, LUKS, LVM, TRIM, hibernation, resume
  • references/security-and-updates.md
    - AppArmor, unattended-upgrades, debian-security, needrestart
  • references/remote-gaming-input-and-tooling.md
    - Moonlight, Sunshine, controllers, Steam Remote Play
  • references/base-linux-and-cli.md
    - core Linux inspection commands and Debian tools such as
    update-alternatives
  • references/gotchas-and-special-situations.md
    - recurring Debian/Ubuntu failure patterns and edge cases

  • references/packages-and-repos.md
    - apt工作流、dpkg、版本固定、PPAs、snaps、flatpaks、
    .deb
    处理
  • references/systemd-and-journal.md
    - systemd服务调试、单元覆盖配置、用户单元、日志分类
  • references/boot-kernel-and-recovery.md
    - GRUB、内核元包、initramfs、EFI、恢复和live-ISO chroot
  • references/derivatives-and-hwe.md
    - Ubuntu HWE、版本升级、Debian渠道差异、Mint、Pop!_OS、Devuan和Kali范围说明
  • references/desktop-audio-and-bluetooth.md
    - X11 vs Wayland、GNOME、KDE、Cinnamon、COSMIC、门户、PipeWire、蓝牙
  • references/session-display-and-mobile.md
    - GDM、SDDM、LightDM、会话环境、休眠/唤醒、电源配置、混合显卡
  • references/graphics-and-gaming.md
    - NVIDIA、AMD、Intel、Vulkan、Steam、Proton、Gamescope、MangoHud
  • references/capture-and-sharing.md
    - OBS、WebRTC屏幕共享、Discord/Teams、硬件编码、虚拟摄像头
  • references/storage-and-rollback.md
    - ext4、Btrfs、LUKS、LVM、TRIM、休眠、唤醒
  • references/security-and-updates.md
    - AppArmor、无人值守更新、debian-security、needrestart
  • references/remote-gaming-input-and-tooling.md
    - Moonlight、Sunshine、控制器、Steam Remote Play
  • references/base-linux-and-cli.md
    - 核心Linux检查命令和Debian工具,如
    update-alternatives
  • references/gotchas-and-special-situations.md
    - Debian/Ubuntu常见故障模式和边缘情况

Related Skills

相关技能

  • command-prompt - shell syntax, zsh or bash behavior, script portability
  • networking - network services, DNS, VPNs, firewall design
  • docker - container runtime and image concerns instead of host distro administration
  • kubernetes - cluster and manifest work that sits above host OS administration
  • ansible - codifying Linux changes across many machines
  • security-audit - hardening and security review rather than normal package/service administration
  • rhel-fedora - RPM-family distro administration rather than Debian-family behavior
  • kali-linux - Kali-specific branch, image, and offensive-workflow concerns
  • firewall-appliance - OPNsense and pfSense appliance work rather than Linux host administration
  • arch-btw - Arch Linux and CachyOS administration (the upstream inspiration for this skill)
  • update-docs - after substantial system administration changes that introduce new operational gotchas

  • command-prompt - Shell语法、zsh或bash行为、脚本可移植性
  • networking - 网络服务、DNS、VPN、防火墙设计
  • docker - 容器运行时和镜像问题,而非主机发行版管理
  • kubernetes - 集群和清单操作,位于主机OS管理之上
  • ansible - 跨多台机器编码Linux变更
  • security-audit - 加固和安全审查,而非常规包/服务管理
  • rhel-fedora - RPM系发行版管理,而非Debian系行为
  • kali-linux - Kali专属分支、镜像和攻击性工作流问题
  • firewall-appliance - OPNsense和pfSense设备操作,而非Linux主机管理
  • arch-btw - Arch Linux和CachyOS管理(本技能的上游灵感来源)
  • update-docs - 在引入新操作陷阱的重大系统管理变更后使用

Rules

规则

  1. Identify the distro and release before prescribing commands. Debian stable, testing, sid, Ubuntu LTS or interim, Mint, Pop!_OS, Devuan, and Kali differ where it matters: repos, init systems, kernels, and recovery assumptions.
  2. No mixed-release advice without pinning context. Adding
    testing
    or
    sid
    sources to Debian stable without apt pinning is usually wrong.
  3. Keep PPAs in perspective. Prefer distro packages, Debian backports, or vendor-supported repos first. Use PPAs only when the distro lane is genuinely insufficient, and verify package origin before adding one.
  4. Know the boot chain before touching it. Confirm GRUB stage, ESP mount, kernel metapackage, initramfs hooks, and EFI fallback path first.
  5. Never remove the last known-good kernel path casually. Especially on remote or encrypted systems.
  6. Prefer systemd-native diagnostics.
    systemctl
    ,
    journalctl
    , and
    update-grub
    usually tell you more than distro wrappers or generic forum folklore.
  7. Ubuntu 26.04 changed some desktop defaults in ways that affect support. Do not assume a stock Ubuntu Xorg session, the old
    Software & Updates
    GUI, or 24.04-era desktop app names are still present on fresh installs.
  8. Ubuntu HWE is opt-in complexity. Treat HWE kernels as additions that must be validated, not magic defaults.
  9. For Wayland issues, inspect the user session first. Portals, user units, and Xwayland compatibility usually matter more than package reinstall churn.
  10. For gaming issues, identify the GPU vendor and userspace first. Driver branch, Vulkan stack,
    i386
    multilib, and launch wrappers usually explain more than random tweak cargo cults.
  11. For capture issues, debug portals and PipeWire before app folklore. OBS, browser WebRTC, Discord, and Teams often fail at the screencast path.
  12. AppArmor can silently break things. On Ubuntu, check
    aa-status
    and AppArmor denials when a service or binary mysteriously fails.
  13. Do not oversell hibernation or resume. These depend on exact swap layout, initramfs resume hook, and Secure Boot state.
  14. Reach for common Debian/Ubuntu failure patterns before exotic explanations. Mixed repos, stale PPAs, DKMS drift, AppArmor denials, HWE metapackage mismatch, and snap confinement explain a large share of the chaos.
  1. 在给出命令前先识别发行版和版本:Debian稳定版、测试版、sid、Ubuntu LTS或临时版、Mint、Pop!_OS、Devuan和Kali在重要方面存在差异:仓库、初始化系统、内核和恢复假设。
  2. 无版本固定上下文时,不要给出混合发行版建议:在Debian稳定版中添加
    testing
    sid
    源而不进行apt版本固定通常是错误的。
  3. 正确看待PPAs:优先使用发行版包、Debian回溯包或厂商支持的仓库。仅当发行版渠道确实无法满足需求时使用PPAs,且添加前验证包来源。
  4. 修改启动链前先了解它:先确认GRUB阶段、ESP挂载、内核元包、initramfs钩子和EFI回退路径。
  5. 不要随意移除最后一个已知可用的内核路径:尤其是在远程或加密系统上。
  6. 优先使用systemd原生诊断工具
    systemctl
    journalctl
    update-grub
    通常比发行版包装器或通用论坛传说提供更多信息。
  7. Ubuntu 26.04改变了部分桌面默认设置,影响支持工作:不要默认全新安装会包含原生Ubuntu Xorg会话、旧版
    Software & Updates
    图形界面或24.04时代的桌面应用名称。
  8. Ubuntu HWE是可选的复杂性:将HWE内核视为必须验证的附加项,而非神奇的默认设置。
  9. 对于Wayland问题,先检查用户会话:门户、用户单元和Xwayland兼容性通常比重新安装包更重要。
  10. 对于游戏问题,先识别GPU厂商和用户空间:驱动分支、Vulkan栈、
    i386
    多库和启动包装器通常比随机调整的迷信做法更能解释问题。
  11. 对于捕获问题,先调试门户和PipeWire,而非应用传说:OBS、浏览器WebRTC、Discord和Teams经常在屏幕捕获路径上失败。
  12. AppArmor可能静默破坏功能:在Ubuntu上,当服务或二进制文件莫名失败时,检查
    aa-status
    和AppArmor拒绝记录。
  13. 不要过度承诺休眠或唤醒功能:这些功能依赖精确的交换分区布局、initramfs唤醒钩子和Secure Boot状态。
  14. 优先考虑Debian/Ubuntu常见故障模式,而非奇特解释:混合仓库、过时PPA、DKMS漂移、AppArmor拒绝、HWE元包不匹配和snap沙箱限制解释了大部分混乱情况。