Mac Pro 安装 Ubuntu 后 MCE 设备初始化失败分析一、事件概述1. 事件背景在苹果 Mac Pro（俗称垃圾桶）上安装 Ubuntu 22.04 系统后，内核日志出现 MCE 设备初始化失败的错误信息。2. 影响范围A. 影响硬件苹果 Mac Pro 2013-2019 系列（使用 Intel Xeon 处理器）B. 影响系统Ubuntu 22.04 及其他 Linux 发行版C. 影响功能MCE 硬件错误监控功能失效3. 严重程度低（不影响系统正常运行）二、问题表现1. 错误信息Apr 01 18:39:59 xlab-ecs-node2 kernel: mce: Unable to init MCE device (rc: -5)2. 错误码说明错误码：-5对应错误：EIO（Input/Output Error，输入输出错误）含义：MCE 设备初始化时发生 I/O 错误3. 出现位置内核日志，可通过以下命令查看：dmesg | grep mce journalctl -k | grep mce三、问题分析1. MCE 机制概述A. 什么是 MCEMCE（Machine Check Exception，机器检查异常）是 x86/x86_64 架构处理器提供的硬件错误检测和报告机制。B. MCE 功能检测硬件错误：内存错误、缓存错误、总线错误、热失控等错误上报：通过中断或轮询方式向操作系统报告错误错误恢复：某些错误可纠正，某些需要系统重启C. 工作原理graph TB CPU[CPU 硬件] -->|检测到错误| MCE[MCE 机制] MCE -->|中断/轮询| Kernel[Linux 内核] Kernel -->|注册设备| MceDev[mcelog 设备] Kernel -->|记录日志| Dmesg[dmesg 日志] MceDev -->|用户态读取| Mcelog[mcelog 工具] Mcelog -->|解析分析| Report[错误报告]2. 根本原因A. 硬件层面Mac Pro 使用定制的主板和 EFI 固件，虽然配备标准 Intel Xeon 处理器，但芯片组和主板设计为 Apple 定制，与标准 PC 存在差异。B. 固件层面Apple EFI 固件对 MCE 功能的支持与标准 PC 不同某些 MCE 相关的 MSRs（Model-Specific Registers）可能被限制或禁用ACPI 表中 MCE 设备的定义可能不完整C. 软件层面Ubuntu 通用内核 mce 驱动按照标准 PC 规范编写，无法完全适配 Mac Pro 的定制硬件。3. 5 Whys 分析A. 为什么 MCE 设备初始化失败？因为内核 mce 驱动无法正确访问 Mac Pro 的 MCE 相关硬件资源。B. 为什么无法访问硬件资源？因为 Mac Pro 的 EFI 固件和芯片组实现与标准 PC 不兼容。C. 为什么与标准 PC 不兼容？因为 Apple 使用定制的主板设计和固件，未完全遵循 PC 行业标准。D. 为什么 Apple 使用定制设计？为了优化硬件与 macOS 的集成，实现更好的性能和功耗控制。E. 为什么 Linux 无法完美适配？因为 Apple 未提供完整的硬件规格文档，Linux 社区只能通过逆向工程适配。四、影响评估1. 功能影响MCE 错误自动检测功能失效无法通过 mcelog 工具获取硬件错误信息硬件故障预警能力降低2. 实际影响对于大多数用途：无影响，系统可正常运行对于关键应用：影响较小，可通过其他方式监控硬件健康3. 风险评估风险等级：低风险场景：硬件故障无法被自动检测和提前预警缓解措施：使用其他硬件监控手段五、解决方案1. 方案一：禁用 MCE（推荐）A. 实施方法编辑 GRUB 配置文件，添加内核参数禁用 MCE：sudo nano /etc/default/grub修改以下行：GRUB_CMDLINE_LINUX_DEFAULT="quiet splash mce=off"更新 GRUB 配置：sudo update-grub sudo rebootB. 效果消除内核日志中的错误信息减少系统启动时的初始化尝试不影响系统正常运行C. 适用场景桌面使用、开发测试、非关键应用不需要硬件级错误监控的场景2. 方案二：使用替代监控手段A. SMART 监控监控硬盘健康状态：sudo smartctl -a /dev/sdaB. 温度监控使用 lm-sensors 监控系统温度：sudo apt install lm-sensors sudo sensors-detect sensorsC. 日志监控定期检查系统日志：journalctl -xe dmesg | tail3. 方案三：使用专用内核（高级用户）A. 使用 Mac Linux 专用内核某些项目提供针对 Mac 硬件优化的内核，可能更好地支持 MCE 功能。B. 编译定制内核根据具体硬件型号调整内核配置，手动启用/禁用相关驱动。C. 注意事项需要一定的 Linux 内核知识可能影响系统稳定性更新维护复杂六、预防措施1. 硬件监控定期检查硬盘 SMART 状态监控系统温度和风扇转速关注系统日志中的异常信息2. 备份策略建立完善的数据备份机制使用 RAID 提供数据冗余定期验证备份可用性3. 系统维护保持系统更新定期检查硬件健康建立硬件故障应急预案七、经验总结1. 问题特点Apple 硬件运行 Linux 的兼容性问题普遍存在定制硬件与通用操作系统的适配存在固有挑战社区驱动的逆向工程适配存在局限性2. 解决思路接受硬件功能的适度损失通过软件手段弥补硬件监控的不足建立完善的运维监控体系3. 最佳实践在 Apple 硬件上运行 Linux 需要有合理的预期优先使用成熟的发行版和内核版本重视数据备份和硬件监控加入相关社区获取支持参考资料
Mac Pro Thunderbolt 控制器 PCIe 资源分配失败问题排查一、事件概述1. 事件背景Mac Pro (Late 2013) 在 Linux 系统下，Thunderbolt 接口外接 HDMI 显示器无法正常工作。系统启动日志显示 Thunderbolt 驱动初始化失败。2. 影响范围A. 影响用户数单台工作站B. 影响时长问题持续存在，影响日常使用C. 影响功能Thunderbolt 接口外接显示器不识别PCIe 设备资源分配异常3. 严重程度P2 级问题（硬件功能受限，但系统可正常运行）二、事件时间线1. 问题发现（启动时）A. 现象描述系统启动时内核日志显示 Thunderbolt 驱动探测失败B. 监控告警通过 journalctl 查看错误级别日志，发现以下关键错误：thunderbolt 0000:a4:00.0: error -EINVAL: cannot obtain PCI resources, aborting thunderbolt 0000:a4:00.0: probe with driver thunderbolt failed with error -222. 问题诊断（分析阶段）A. 系统硬件配置通过 lspci 确认系统配置：设备：Mac Pro 6,1 (Late 2013)Thunderbolt 控制器：Intel DSL5520 (Falcon Ridge 4C 2013)数量：4 个 Thunderbolt NHI (Native Host Interface) 控制器GPU：双 AMD FirePro D500 (Tahiti LE)B. 详细日志分析查看内核日志发现关键问题：pci 0000:a4:00.0: BAR 0 [mem size 0x00040000]: can't assign; no space pci 0000:a4:00.0: BAR 1 [mem size 0x00001000]: can't assign; no spacePCIe MMIO (Memory-Mapped I/O) 地址空间耗尽，导致第 4 个 Thunderbolt 控制器无法获取必要的内存资源。三、问题分析1. 直接原因系统 32 位 PCIe MMIO 地址空间不足以支持 4 个 Thunderbolt 控制器同时工作。2. 根本原因（5 Whys 分析）A. 为什么出现这个问题？Mac Pro 采用多 GPU 设计，配备 4 个 Thunderbolt 控制器（每个 GPU 对应 2 个）。Linux 内核默认分配的 32 位 MMIO 窗口空间有限，无法满足所有控制器的资源需求。B. 为什么只有第 4 个控制器失败？前 3 个控制器 (16:00.0, 5d:00.0, 另一个) 成功分配了资源，第 4 个 (a4:00.0) 尝试分配时空间已耗尽。C. 为什么现有参数无效？当前内核配置已包含 pci=realloc 参数，但仍无法解决问题，表明需要更积极的资源重新分配策略。3. 系统架构分析Mac Pro Thunderbolt 架构：graph TB subgraph "Mac Pro PCIe 拓扑" TB1[Thunderbolt NHI 1 16:00.0] TB2[Thunderbolt NHI 2 5d:00.0] TB3[Thunderbolt NHI 3 a4:00.0] TB4[Thunderbolt NHI 4] GPU1[FirePro D500 #1 02:00.0] GPU2[FirePro D500 #2 06:00.0] end MMIO["32-bit PCIe MMIO 有限空间"] TB1 -->|占用| MMIO TB2 -->|占用| MMIO TB3 -->|分配失败| MMIO TB4 -->|未尝试| MMIO style TB3 fill:#f9f,stroke:#f33,stroke-width:2px4. 深层反思这是早期 Mac Pro 硬件设计与 Linux 内核资源分配策略的兼容性问题。Apple 的硬件设计假设 macOS 的资源管理方式，而 Linux 的默认策略无法完全适配。四、解决方案1. 方案一：优化内核 PCIe 参数（推荐）A. 实施措施修改 GRUB 配置，添加以下内核参数：GRUB_CMDLINE_LINUX_DEFAULT='... amdgpu.si_support=1 pcie_realloc=on'关键参数说明：amdgpu.si_support=1：启用 AMD Southern Islands GPU 支持pcie_realloc=on：更积极的 PCIe 资源重新分配B. 实施步骤# 1. 备份 GRUB 配置 sudo cp /etc/default/grub /etc/default/grub.backup # 2. 编辑配置文件 sudo nano /etc/default/grub # 3. 更新 GRUB sudo update-grub # 4. 重启系统 sudo rebootC. 效果评估重启后检查 Thunderbolt 控制器状态：# 检查是否仍有错误 sudo journalctl -b -p err | grep thunderbolt # 检查活跃的 Thunderbolt 设备 cat /sys/bus/thunderbolt/devices/*/device_name2. 方案二：禁用第 4 个控制器（备用）A. 实施措施若系统只需使用 3 个 Thunderbolt 接口，可禁用第 4 个控制器：# 临时禁用（测试用） sudo bash -c 'echo 1 > /sys/bus/pci/devices/0000:a4:00.0/remove'B. 效果评估释放 PCIe 资源，其他控制器可正常工作。3. 方案三：BIOS 配置调整A. 实施措施进入 Mac Pro Boot Camp 设置，调整 PCIe 资源分配选项。B. 限制Mac Pro BIOS 选项有限，此方案可行性较低。五、经验总结1. 问题诊断要点使用 journalctl -b -p err 过滤错误级别日志lspci -nnk 确认硬件和驱动状态查看内核日志中的 "can't assign" 和 "no space" 关键词2. 相关问题发现诊断过程中发现 GPU 驱动问题：amdgpu 0000:02:00.0: amdgpu: SI support provided by radeon. amdgpu 0000:02:00.0: amdgpu: Use radeon.si_support=0 amdgpu.si_support=1 to override.FirePro D500 (Tahiti LE) 属于 Southern Islands 架构，需要显式启用 amdgpu 支持。3. Mac Pro Linux 兼容性建议使用较新的内核版本（6.0+），对 Mac Pro 硬件支持更好考虑使用 AMDGPU 官方发布的驱动关注 linux-t2pi 项目，针对 Mac Pro 优化六、参考资料1. 内核参数说明pci=realloc重新分配 PCIe 桥接窗口，尝试为所有设备分配足够资源。pcie_realloc=on更积极的 PCIe 资源重新分配策略。amdgpu.si_support=1启用 AMD Southern Islands (HD 7000 系列) GPU 的 amdgpu 驱动支持。2. 相关文档Linux 内核 PCIe 参数文档AMDGPU 驱动配置指南Mac Pro Linux 社区指南3. 硬件规格Intel DSL5520 Thunderbolt 2 ControllerAMD Tahiti LE (Radeon HD 7870 XT)Mac Pro 6,1 (Late 2013) 技术规格参考资料Linux Kernel PCI ParametersAMDGPU Driver DocumentationMac Pro Linux Community
Linux 字体安装与默认字体配置一、概述1. 简介A. 是什么本文介绍在 Linux 系统上安装字体文件，并通过 fontconfig 配置系统默认字体的完整流程。B. 为什么需要Linux 系统默认缺少部分中文字体（如宋体、仿宋等）部分场景需要特定的英文字体（如 Times New Roman）统一字体设置可以提升文档阅读和编辑体验C. 学完能做什么安装用户级别的 TTF/TTC 字体文件更新系统字体缓存配置 fontconfig 设置默认字体2. 前置知识A. 必备技能基本 Linux 命令操作了解目录结构概念B. 推荐知识了解 XML 配置文件格式二、环境准备1. 系统要求Linux 发行版：Ubuntu、Debian、Kubuntu 等已安装 fontconfig 包（默认通常已安装）2. 字体文件中文字体：TTF 或 TTC 格式英文字体：TTF 格式三、核心概念1. 基本术语fontconfig：Linux 系统的字体配置框架fc-cache：字体缓存更新工具fc-list：字体列表查询工具fc-match：字体匹配查询工具2. 字体目录结构graph TD A[字体目录] --> B[用户级别] A --> C[系统级别] B --> D[~/.local/share/fonts] C --> E[/usr/share/fonts] D --> F[chinese] D --> G[english] E --> H[truetype] E --> I[opentype]3. 工作原理fontconfig 通过以下步骤管理字体：扫描字体目录构建字体缓存根据配置文件匹配字体返回最佳匹配结果四、安装步骤1. 创建字体目录mkdir -p ~/.local/share/fonts/chinese mkdir -p ~/.local/share/fonts/english2. 复制字体文件将中文字体复制到 chinese 目录：cp /path/to/simsun.ttc ~/.local/share/fonts/chinese/ cp /path/to/simhei.ttf ~/.local/share/fonts/chinese/ cp /path/to/simfang.ttf ~/.local/share/fonts/chinese/将英文字体复制到 english 目录：cp /path/to/times.ttf ~/.local/share/fonts/english/3. 更新字体缓存fc-cache -fv ~/.local/share/fonts/成功输出示例：/home/lab/.local/share/fonts/chinese: caching, new cache contents: 6 fonts, 0 dirs /home/lab/.local/share/fonts/english: caching, new cache contents: 1 fonts, 0 dirs fc-cache: succeeded五、配置默认字体1. 创建配置文件mkdir -p ~/.config/fontconfig2. 编辑配置文件创建 ~/.config/fontconfig/fonts.conf 文件：<?xml version="1.0"?> <fontconfig> <alias> <family>serif</family> <prefer> <family>Times New Roman</family> </prefer> </alias> <match> <test name="lang"> <string>zh-cn</string> </test> <test name="family"> <string>serif</string> </test> <edit name="family" mode="prepend" binding="strong"> <string>SimSun</string> </edit> </match> </fontconfig>3. 配置说明fontconfig 配置文件结构：graph LR A[fontconfig] --> B[alias 别名] A --> C[match 匹配规则] B --> D[family 字体族] B --> E[prefer 优先级] C --> F[test 条件] C --> G[edit 编辑动作]六、验证安装1. 查看已安装字体# 查看所有中文字体 fc-list :lang=zh-cn # 查看特定字体 fc-list | grep -i "simsun" fc-list | grep -i "times new roman"2. 验证默认字体# 查看默认 serif 字体 fc-match serif # 查看中文环境下的默认字体 fc-match "sans-serif" :lang=zh-cn七、常用命令1. 字体管理命令命令功能fc-cache更新字体缓存fc-list列出已安装字体fc-match查询字体匹配结果fc-cat显示字体缓存内容fc-pattern显示字体匹配模式2. 常用参数-f：自定义输出格式-v：显示详细信息:lang=xx：指定语言环境八、常见问题1. 字体未生效问题症状安装字体后，应用程序仍未显示新字体解决方法确认字体缓存已更新重启应用程序检查字体文件是否完整2. 配置文件语法错误问题症状fontconfig 无法读取配置文件解决方法使用 XML 验证工具检查语法：xmllint --noout ~/.config/fontconfig/fonts.conf3. 权限问题问题症状无法安装字体到系统目录解决方法使用用户级别目录 ~/.local/share/fonts/ 无需 sudo 权限参考资料Fontconfig User DocumentationLinux 字体配置指南
Linux 内核 TSS 描述符符号扩展 bug 修复案例分析一、事件概述1. 事件背景作者在开发 Type-2 虚拟化管理程序时，发现了一个隐藏在 Linux 内核 KVM selftests 中的 C 语言符号扩展 bug。该 bug 导致跨 CPU 核心迁移时系统崩溃。2. 影响范围A. 影响组件Linux 内核 KVM selftests使用受影响代码的虚拟化管理程序B. 触发条件跨 CPU 核心迁移TSS 基地址的高位字节（base2）最高位为 13. 严重程度中等级别，可能导致系统崩溃或死锁二、技术背景1. x86 任务状态段（TSS）x86 架构在保护模式下定义了一个任务状态段（Task State Segment，TSS），它是内存中用于保存任务信息的区域。虽然现代操作系统已经放弃了硬件任务切换，但 TSS 仍然被保留用于保存关键的栈指针。在 64 位系统中，内核采用每核心一个 TSS 的方式，TSS 的主要作用包括：保存当前线程的内核栈指针（用户态到内核态切换时使用）保存关键事件的已知良好栈（NMI、Double Fault 等）2. TR 寄存器任务寄存器（Task Register，TR）包含：可见部分：16 位偏移量隐藏部分：TSS 基地址、限制、访问权限隐藏部分的设计避免了 CPU 每次都需要索引 GDT 来查找 TSS 信息。graph TB subgraph TR["TR 寄存器"] Visible["可见部分 (16 位偏移)"] Hidden["隐藏部分"] Base["基地址"] Limit["限制"] Access["访问权限"] end Visible --> Hidden Hidden --> Base Hidden --> Limit Hidden --> Access GDT["GDT 表"] -->|"通过偏移索引"| TSSDesc["TSS 段描述符"] TSSDesc --> TSS["TSS 内存区域"] Base -->|"直接指向"| TSS3. 虚拟化管理程序与 TSS虚拟化管理程序本质上是一个任务切换器，任务就是操作系统。为了在同一块硅片上运行多个操作系统，管理程序必须交换整个 CPU 状态，包括 TR 寄存器的隐藏部分。Intel VT-x 扩展通过 VMCS（Virtual Machine Control Structure）来保存和恢复 vCPU 状态：graph LR subgraph VMCS["VMCS 结构"] HostState["Host 状态区"] GuestState["Guest 状态区"] Control["控制字段"] ExitInfo["VM 退出信息"] end subgraph HostTR["Host TR 字段"] H1["HOST_TR_SELECTOR (16 位)"] H2["HOST_TR_BASE (自然宽度)"] end subgraph GuestTR["Guest TR 字段"] G1["GUEST_TR_SELECTOR (16 位)"] G2["GUEST_TR_BASE (自然宽度)"] G3["GUEST_TR_LIMIT (32 位)"] G4["GUEST_TR_ACCESS_RIGHTS (32 位)"] end HostState --> HostTR GuestState --> GuestTR三、问题发现1. 开发场景作者在开发 Type-2 虚拟化管理程序时，从 Linux 内核 KVM selftests 中借用了以下代码来设置 HOST_TR_BASE：vmwrite(HOST_TR_BASE, get_desc64_base((struct desc64 *)(get_gdt().address + get_tr())));这段代码的功能是：获取 GDT 地址使用 TR 寄存器值索引到 GDT解析 TSS 段描述符并提取 TSS 内存地址使用 VMWRITE 指令将地址写入 VMCS 的 HOST_TR_BASE 字段2. 故障现象在虚拟化开发环境（3 个 vCPU）中一切正常，但在物理机（Intel Core i7-12700H，14 核 20 线程）上运行时系统崩溃。崩溃模式 1：系统死锁sequenceDiagram participant C5 as CPU 5 participant C6 as CPU 6 participant Others as 其他 CPU Note over C5: NMI 触发 VM 退出 C5->>C5: 尝试从 TSS 读取内核栈 C5->>C5: 致命页错误（读取未映射地址） Note over C5: Kernel Oops，CPU 5 瘫痪 C6->>C5: 发送 IPI（内核文本修补） C5--xC5: 无响应（已死） Note over C6: 陷入无限循环等待 Others->>C5: 尝试 TLB 刷新/RCU 同步 Others--xC5: 无响应 Note over Others: 级联瘫痪 Note over Others: RCU 饥饿，外设驱动超时 Note over Others: 系统完全死锁崩溃模式 2：系统重启在某些情况下（特别是在虚拟化环境中增加 vCore 数量时），系统会立即重启，重启后没有任何日志痕迹。这表明发生了 triple fault。3. 排查过程初步发现将管理程序固定到单个核心时运行正常问题与跨核心迁移有关代码审查作者一开始没有质疑从内核源码"借用"的代码，尝试重写管理程序中与跨核心迁移相关的部分。关键线索在虚拟化环境中增加 vCore 数量可以复现问题，有时会触发 triple fault 导致系统重启。这引导作者关注 TR 和 TSS。发现替代方案作者发现 KVM 本身（而非 selftests）使用了不同的方法设置 HOST_TR_BASE：vmcs_writel(HOST_TR_BASE, (unsigned long)&get_cpu_entry_area(cpu)->tss.x86_tss);使用这种方法成功修复了问题。四、根本原因分析1. 问题函数KVM selftests 中的 get_desc64_base 函数：static inline uint64_t get_desc64_base(const struct desc64 *desc) { return ((uint64_t)desc->base3 << 32) | (desc->base0 | ((desc->base1) << 16) | ((desc->base2) << 24)); }TSS 段描述符的基地址由四个字段拼接而成：base0：uint16_tbase1：uint8_tbase2：uint8_tbase3：uint32_t2. 符号扩展问题C 语言整数提升规则根据 C 标准，当表达式中使用小于 int 的类型时，编译器会自动将其提升为 int（在现代 x86-64 上是 32 位有符号整数）。问题触发条件当 base2（uint8_t）的最高位为 1 时：graph TB A["base2 = 0xf8 (11111000)"] --> B["左移 24 位"] B --> C["11001100000000000000000000000000"] C --> D["编译器视为 int（有符号）"] D --> E["与 uint64_t 进行 OR 运算"] E --> F["符号扩展为 64 位"] F --> G["11111111...11111111000000000000000000000000"] G --> H["覆盖 base3 的值"]实际案例base0 = 0x5000 base1 = 0xd6 base2 = 0xf8 ← 最高位为 1 base3 = 0xfffffe7c 期望返回值: 0xfffffe7cf8d65000 实际返回值: 0xfffffffff8d65000由于符号扩展，高 32 位被全 1（0xFFFFFFFF）覆盖，base3 的值被破坏。3. 问题特征仅当 base2 的最高位为 1 时触发在某些系统上可能永远不会触发（取决于 TSS 地址）跨核心迁移时触发率高（每次重新设置 HOST_TR_BASE）五、解决方案1. 补丁内容修复非常简单：在位移操作前将值转换为无符号类型：static inline uint64_t get_desc64_base(const struct desc64 *desc) { return (uint64_t)desc->base3 << 32 | (uint64_t)desc->base2 << 24 | (uint64_t)desc->base1 << 16 | (uint64_t)desc->base0; }这样可以防止符号扩展发生。2. 提交与合并补丁已提交至 Linux 内核邮件列表并被批准合并。六、经验总结1. 技术要点C 语言整数提升小于 int 的类型在表达式中会提升为 int符号扩展可能导致意外的结果位操作前应明确转换为无符号类型x86 虚拟化细节TSS 和 TR 寄存器在虚拟化中的关键作用VMCS 状态保存和恢复机制跨核心迁移的复杂性2. 调试经验借用代码的风险即使是从内核源码"借用"的代码也可能包含 bug，需要仔细审查。环境差异的重要性虚拟化环境可能掩盖某些问题多核物理机更容易暴露并发相关的问题系统崩溃模式分析死锁 vs 重启（triple fault）的区别IPI 等待导致的级联瘫痪3. AI 辅助调试的局限性作者尝试使用 LLM 辅助调试：有助于：总结内核日志、提取关键信息局限性：得出"CPU 硬件故障"的错误结论这表明在复杂的底层系统调试中，AI 仍无法替代深入的技术理解。七、参考资料Linux 内核邮件列表补丁My First Patch to the Linux Kernel
The Linux Programming Interface 作为大学课程教材
The Linux Programming Interface 作为大学课程教材一、概述1. 书籍简介A. 书籍信息The Linux Programming Interface（简称 TLPI）是由 Michael Kerrisk 编写的 Linux/UNIX 系统编程权威指南。这本书深入介绍了 Linux 系统编程的各个方面，包括文件 I/O、进程管理、线程、网络编程等核心技术。B. 目标读者虽然作者在编写本书时并未专门针对大学市场，但如今已有许多大学教师将 TLPI 用作 Linux 或 UNIX 系统编程课程的必读教材或推荐读物。C. 教学价值TLPI 内容全面、讲解深入，适合作为大学计算机相关课程的系统编程教材，帮助学生掌握 Linux 系统级编程的核心知识和实践技能。2. 使用现状A. 大学应用多所高校已将 TLPI 纳入课程体系，用作系统编程、操作系统原理等相关课程的教材。B. 课程级别主要用于高年级本科生（大三、大四）或研究生课程。二、作者反馈征集1. 反馈目的作者 Michael Kerrisk 希望了解更多关于 TLPI 在大学课程中使用情况的细节，以便在未来版本的书籍改进中更好地满足大学教学需求。2. 征集对象正在使用或计划使用 TLPI 作为课程教材的大学教师。3. 调查问题A. 基本信息您所在的机构名称和网站地址是什么？您能否提供或指向使用 TLPI 的课程大纲？该课程属于哪个年级？（如大三、大四等）课程有多少学生？B. 使用情况TLPI 是作为必读教材，还是推荐读物？C. 改进建议在您看来，如何改进 TLPI 以更好地作为大学课程教材使用？作者欢迎详细建议，内容越多越好！三、使用建议1. 适用课程类型A. 系统编程课程涵盖 Linux 系统调用、库函数、进程管理等核心内容。B. 操作系统课程实践性强的操作系统原理课程配套教材。C. 高级编程课程需要深入理解系统级编程概念的高级编程课程。2. 教学优势A. 内容全面覆盖 Linux 系统编程的各个方面，从基础到高级。B. 实践导向包含大量代码示例和练习，便于实践教学。C. 权威性强作者 Michael Kerrisk 是 Linux man-pages 项目的维护者，内容具有高度权威性。四、联系方式如果正在使用 TLPI 作为大学课程教材，欢迎发送邮件联系作者，分享您的使用经验和改进建议。参考资料The Linux Programming Interface as a university course textThe Linux Programming Interface - Official Site
NVMe 驱动自动加载配置指南一、概述1. 简介A. 是什么NVMe（Non-Volatile Memory Express）是一种专为闪存存储设计的通信协议和驱动接口。Linux 内核 6.12.63 已内置完整的 NVMe 驱动模块，但默认情况下未配置为启动时自动加载。B. 为什么需要配置虽然现代 Linux 系统支持 udev 按需自动加载模块，但显式配置自动加载有以下优势：确保 NVMe 设备驱动在设备插入前已就绪，避免竞态条件系统启动时提前加载驱动，减少设备识别延迟明确的配置便于系统维护和故障排查C. 配置后效果系统启动时自动加载 nvme 及其依赖模块插入 NVMe 设备后系统可立即识别可通过 lsmod、lsblk 等命令快速验证模块状态2. 前置知识A. 必备技能基本 Linux 命令行操作了解 systemd 管理机制B. 推荐知识了解 Linux 内核模块管理熟悉 systemd 配置目录结构二、系统环境1. 系统要求Linux 内核版本：6.12.63+（已内置 NVMe 驱动）systemd 管理的系统（大多数现代 Linux 发行版）root 权限或 sudo 访问权限2. 模块依赖关系graph TD A[nvme] -->|依赖| B[nvme_core] B -->|依赖| C[nvme_auth] D[modules-load配置] -->|加载| A三、配置原理1. systemd modules-load 机制systemd-modules-load.service 是 systemd 提供的一个服务，负责在系统启动早期阶段自动加载内核模块。该服务会读取 /etc/modules-load.d/ 目录下的配置文件，并将列出的模块传递给 modprobe 命令进行加载。2. 配置目录结构graph LR A[/etc/modules-load.d] -->|优先级高| B[nvme.conf] C[/usr/lib/modules-load.d] -->|优先级低| D[系统默认配置] E[systemd-modules-load.service] -->|读取| A E -->|读取| C三、配置原理1. systemd modules-load 机制systemd-modules-load.service 是 systemd 提供的一个服务，负责在系统启动早期阶段自动加载内核模块。该服务会读取 /etc/modules-load.d/ 目录下的配置文件，并将列出的模块传递给 modprobe 命令进行加载。2. 配置目录结构/etc/modules-load.d/ 目录中的配置文件优先级高于 /usr/lib/modules-load.d/，系统会自动合并两个目录中的配置，冲突时以 /etc/ 目录为准。四、配置步骤1. 创建模块自动加载配置文件创建 /etc/modules-load.d/nvme.conf 文件，添加 nvme 模块：sudo tee /etc/modules-load.d/nvme.conf > /dev/null << 'EOF' # NVMe 驱动模块自动加载配置 # 添加 nvme 模块以确保 NVMe 设备驱动在启动时加载 # nvme 模块会自动加载依赖的 nvme-core 模块 nvme EOF2. 配置文件说明配置文件内容简洁，仅包含模块名称 nvme。模块加载时会自动处理依赖关系：模块名大小说明nvme约 57KBNVMe 主驱动模块nvme_core约 225KBNVMe 核心功能模块（自动加载）nvme_auth约 24KBNVMe 认证模块（自动加载）3. 可选扩展配置如需支持 NVMe over TCP 或 RDMA 传输，可在配置文件中添加额外模块：# 编辑配置文件添加 sudo nano /etc/modules-load.d/nvme.conf # 添加以下模块（按需选择） nvme-tcp # NVMe over TCP 传输 nvme-rdma # NVMe over RDMA 传输 nvme-fabrics # Fabric 传输核心模块五、验证配置1. 验证配置文件使用 systemd-analyze 命令验证配置是否正确：systemd-analyze cat-config modules-load.d/nvme.conf预期输出显示配置文件路径和内容。2. 重载 systemd 配置sudo systemctl daemon-reload3. 检查服务状态sudo systemctl status systemd-modules-load.service --no-pager服务状态应显示为 active（exited），表示模块加载服务已正常运行。六、测试模块加载1. 手动加载模块验证使用 modprobe 手动加载模块测试：sudo modprobe nvme2. 检查已加载模块lsmod | grep nvme预期输出：nvme 57344 0 nvme_core 225280 1 nvme nvme_auth 24576 1 nvme_core3. 模块加载流程sequenceDiagram participant A as 系统启动 participant B as systemd-modules-load participant C as modprobe participant D as 内核 A->>B: 启动阶段 B->>B: 读取 /etc/modules-load.d/*.conf B->>C: 调用 modprobe nvme C->>D: 加载 nvme 模块 D->>C: 返回依赖 nvme_core C->>D: 加载 nvme_core D->>C: 返回依赖 nvme_auth C->>D: 加载 nvme_auth D-->>B: 模块加载完成 B-->>A: 服务退出七、设备验证1. 检查 NVMe 设备系统重启后，插入 NVMe 设备，使用以下命令验证设备识别：# 查看块设备 lsblk | grep nvme # 或使用 nvme 命令（需安装 nvme-cli） sudo nvme list2. 设备识别成功标志lsblk 输出中显示 nvme 开头的设备（如 nvme0n1）dmesg 日志中显示 NVMe 设备识别信息/dev/nvme* 设备节点存在3. 安装 nvme-cli 工具（可选）如需查看详细的 NVMe 设备信息，可安装 nvme-cli：# Ubuntu/Debian sudo apt install nvme-cli # CentOS/RHEL sudo yum install nvme-cli # Arch Linux sudo pacman -S nvme-cli八、故障排查1. 模块加载失败如果模块加载失败，检查以下事项：问题排查解决方案模块不存在确认内核版本包含 NVMe 驱动配置文件语法错误检查配置文件内容格式权限不足使用 sudo 或 root 权限操作2. 设备未识别如果设备插入后未识别：# 检查内核日志 dmesg | grep -i nvme # 检查模块是否加载 lsmod | grep nvme # 检查硬件信息 sudo lspci | grep -i nvme3. 常见问题A. 重启后模块未加载确认配置文件位置正确，使用 systemd-analyze 验证配置。B. 设备识别慢可能是 udev 按需加载导致延迟，确认配置生效后应解决。C. 多个 NVMe 设备配置无需修改，驱动会自动支持多个 NVMe 设备。九、总结配置 NVMe 驱动自动加载的完整流程如下：flowchart TD A[开始] --> B[创建配置文件] B --> C[验证配置语法] C --> D{验证通过?} D -->|否| E[修正配置] E --> C D -->|是| F[重载 systemd] F --> G[手动测试加载] G --> H{加载成功?} H -->|否| I[排查故障] I --> J[检查内核日志] J --> G H -->|是| K[重启系统] K --> L[验证自动加载] L --> M{设备识别正常?} M -->|是| N[配置完成] M -->|否| O[检查硬件连接] O --> L参考资料systemd-modules-load.service(8) - Linux manual pagemodprobe(8) - Linux manual pageNVMe Technical Specifications
Zig 编程语言 zig libc 子项目取得重大进展一、新闻概述1. 标题Zig 发布 zig libc 子项目进展报告：250 个 C 源文件已删除2. 发布时间2026 年 1 月 31 日3. 来源Zig 官方开发日志4. 作者Andrew Kelley（Zig 创始人）二、核心内容1. 事件摘要A. 主要内容Zig 编程语言团队宣布 zig libc 子项目取得显著进展，通过用 Zig 标准库封装替代 C 源代码的方式，已从 Zig 代码库中删除约 250 个 C 源文件。B. 核心亮点约 250 个 C 源文件已删除，剩余 2032 个zig libc 现在与 Zig 代码共享编译单元编译速度提升，安装体积减小静态链接 libc 的应用程序二进制体积减小2. 关键信息A. 项目名称zig libc subproject（zig libc 子项目）B. 重要数据已删除 C 源文件：约 250 个剩余 C 源文件：2032 个删除进度：约 11%C. 涉及技术Zig 标准库libc（musl、mingw-w64、wasi-libc）Zig Compilation Unit（ZCU）3. 背景介绍A. 前置背景Zig 是一个现代系统级编程语言，旨在替代 C 语言。zig libc 子项目的目标是让 Zig 成为静态 libc 提供者，而不是依赖第三方 C 实现。B. 相关上下文该项目通过将 libc 函数重新实现为 Zig 标准库封装，逐步删除代码库中托管的 C 源文件，实现技术独立。三、详细报道1. 主要内容A. 技术原理zig libc 的核心思想是增量删除冗余代码。通过将 libc 函数提供为 Zig 标准库封装，而不是托管的 C 源文件。大多数情况下，这些函数是一对一映射，例如 memcpy 或 atan2，或者简单地封装一个通用函数，如 strnlen：fn strnlen(str: [*:0]const c_char, max: usize) callconv(.c) usize { return std.mem.findScalar(u8, @ptrCast(str[0..max]), 0) orelse max; }B. 架构变化graph TB subgraph 传统架构 A1[用户代码] --> A2[C 源文件 约 2282 个文件] A2 --> A3[独立静态库] A3 --> A4[链接器] end subgraph zig libc 架构 B1[用户代码] --> B2[Zig 标准库封装] B2 --> B3[共享 ZCU] B3 --> B4[集成编译器] end A3 -.->|逐步迁移| B2C. 技术优势每个完成迁移的函数都带来以下好处：Zig 从第三方项目和 C 语言中获得独立性编译速度提升Zig 安装体积简化并减小静态链接 libc 的用户应用程序二进制体积减小2. 技术细节A. 编译单元共享最近的增强功能使 zig libc 与其他 Zig 代码共享 Zig Compilation Unit（ZCU），而不是作为稍后链接在一起的独立静态库。graph LR subgraph 旧模式 A1[用户代码] --> A2[独立 ZCU] B1[libc] --> B2[独立 ZCU] A2 --> C[链接器] B2 --> C end subgraph 新模式 D1[用户代码] --> E[共享 ZCU] F1[libc] --> E E --> G[集成编译器] end这是 Zig 拥有集成编译器和链接器的优势之一。当导出的 libc 函数共享 ZCU 时，冗余代码被消除，因为函数可以一起优化。这类似于在 libc 边界上启用 LTO（链接时优化），但它是在前端正确完成的，而不是在链接器中太晚完成。B. I/O 控制潜力当这项工作与最近的 std.Io 更改结合时，用户有可能无缝控制 libc 如何执行 I/O 操作。例如：强制所有对 read 和 write 的调用参与 io_uring 事件循环即使这些代码在编写时没有考虑到这样的用例为第三方 C 代码启用资源泄露检测目前这只是一个尚未实验的想法，但这个想法很有趣。C. 测试验证特别感谢 Szabolcs Nagy 提供的 libc-test 项目。该项目在确保不回归任何数学函数方面提供了巨大帮助。四、影响分析1. 行业影响A. 技术趋势Zig 正在逐步实现自举，减少对 C 生态的依赖系统级编程语言的自主化趋势B. 竞争格局对比 Rust：Rust 仍依赖 liblibc 绑定对比 C：Zig 提供更现代的开发体验2. 用户影响A. 现有用户编译速度提升二进制体积减小更好的跨平台一致性B. 潜在用户更有吸引力的 C 语言替代方案更简洁的工具链C. 迁移建议Zig 团队提醒用户：由于 Zig 正在过渡成为静态 libc 提供者，如果遇到 Zig 提供的 musl、mingw-w64 或 wasi-libc libc 功能问题，请先在 Zig 中提交 bug 报告，以免因为 Zig 中的 bug 而打扰独立 libc 实现项目的维护者，因为这些代码不再由它们托管。3. 技术趋势A. 技术方向编程语言自举（self-hosting）减少对 C 语言的依赖集成编译器和链接器的设计优势B. 生态影响更清晰的 ABI 稳定性更好的跨平台支持简化的工具链五、各方反应1. 官方回应Andrew Kelley 表示这是 Zig 走向技术独立的重要里程碑。2. 社区反馈A. 积极评价编译单元共享的优化方式得到认可减少对 C 依赖的方向受到支持B. 关注点剩余 2032 个 C 文件的迁移工作量兼容性保证3. 技术评价集成编译器设计的前瞻性得到验证前端优化的方式比传统 LTO 更高效六、相关链接1. 官方资源zig libc 子项目 issue：https://codeberg.org/ziglang/zig/issues/30978ZCU 共享 PR：https://codeberg.org/ziglang/zig/pulls/31037std.Io 更改：https://codeberg.org/ziglang/zig/issues/30150资源泄露检测：https://codeberg.org/ziglang/zig/pulls/307882. 测试工具libc-test 项目：https://wiki.musl-libc.org/libc-test.html3. 相关资源Zig 官方网站：https://ziglang.org/Zig 开发日志 RSS：https://ziglang.org/devlog/index.xml参考资料Zig Devlog - January 31, 2026
Linux From Scratch 宣布停止开发 System V 版本一、新闻概述1. 标题Linux From Scratch 宣布停止开发 System V 版本，未来将仅支持 systemd2. 发布时间2026 年 2 月 1 日3. 来源Linux From Scratch 官方公告邮件列表二、核心内容1. 事件摘要A. 主要内容Linux From Scratch（LFS）项目官方宣布，将停止开发 System V 版本的图书。这是一个重大的架构决策变更，意味着未来的 LFS 和 BLFS 将仅支持 systemd 初始化系统。B. 核心亮点停止 System V 版本的持续开发维护LFS/BLFS 12.4 System V 版本将作为最后版本继续可用下一版本 13.0 将仅支持 systemd目标发布日期为 2026 年 3 月 1 日2. 关键信息A. 涉及版本LFS/BLFS 12.4 System V：最后维护版本LFS/BLFS 13.0：首个仅支持 systemd 的版本B. 重要数据LFS 包含 88 个软件包BLFS 包含超过 1000 个软件包本发布周期（9 月 1 日至今）已有 70 次 LFS 提交、1155 次 BLFS 提交systemd 约 1678 个 C 文件System V 仅 22 个 C 文件加约 50 个简短的 bash 脚本C. 涉及产品LFS（Linux From Scratch）主书籍BLFS（Beyond Linux From Scratch）扩展书籍3. 背景介绍A. 项目历史Linux From Scratch 是一个著名的 Linux 发行版构建指南项目，帮助用户从源代码构建自定义 Linux 系统。项目长期以来同时支持 System V 和 systemd 两种初始化系统。B. 技术背景System V 和 systemd 是两种不同的 Linux 初始化系统。System V 是传统的 init 系统，代码简洁但功能有限；systemd 是现代化的 init 系统，功能强大但代码复杂。三、详细报道1. 决策原因A. 工作负载压力LFS 项目完全依靠志愿者维护，没有付费开发人员。当前的维护工作量已经超过团队能力：graph LR A[LFS/BLFS 项目] --> B{工作负载压力} A --> C{上游依赖} B --> D[88 个 LFS 包] B --> E[1000+ 个 BLFS 包] C --> F[GNOME/KDE Plasma] F --> G[需要 systemd 特性] G --> H[System V 不支持] D --> I[双重维护负担] E --> I I --> J[决定：放弃 System V]每个软件包更新需要检查 System V 和 systemd 两种配置发布准备时需要为每个 init 系统检查所有软件包本周期已有 70 次 LFS 提交和 1155 次 BLFS 提交B. 上游软件依赖现代桌面环境如 GNOME 和即将推出的 KDE Plasma 正在构建需要 systemd 特性的依赖，这些特性在 System V 中不可用。C. 技术可行性考虑虽然理论上可以使用 OpenRC 等其他 init 系统作为过渡，但这无法解决持续的工作负载问题。2. 技术对比A. 代码复杂度特性System VsystemdC 文件数量22 个1678 个脚本数量约 50 个 bash 脚本大量数据文件总体复杂度简洁易理解复杂但功能丰富学习价值高，便于理解启动过程低，黑盒化程度高B. 功能特性System V：传统初始化，依赖脚本，功能基础systemd：现代化初始化，并行启动，功能丰富C. 生态系统System V：逐渐被上游项目放弃systemd：成为主流发行版标准3. 未来计划A. 版本发布计划12.4 System V 版本：继续可用，但不再更新13.0 版本：仅支持 systemd，目标发布日期 2026 年 3 月 1 日B. 兼容性说明12.4 System V 书籍中的大部分说明仍可用于构建较新版本的软件包但这些软件包将不再经过 LFS 编辑团队测试4. 项目负责人观点Bruce Dubbs 在公告中表达了个人看法："对我个人而言，我不喜欢这个决定。LFS 的核心在于学习系统如何工作。理解启动过程是其中的重要部分。systemd 约 1678 个 C 文件加上许多数据文件。System V 是 22 个 C 文件加上约 50 个简短的 bash 脚本和数据文件。是的，systemd 提供了很多功能，但我们将失去一些我认为重要的东西。"这反映了项目创始理念（教育性和可理解性）与现实约束（维护工作量）之间的矛盾。四、影响分析1. 行业影响A. Linux 发行版生态反映了 System V init 系统在 Linux 生态中的边缘化趋势systemd 已成为事实上的行业标准B. 教育领域传统 Linux 系统学习路径受到影响System V 简洁的代码结构曾是理解 Linux 启动过程的优秀教材2. 用户影响A. 现有用户已使用 System V 版本的用户：现有版本仍可使用，但新软件包未经测试计划学习 LFS 的用户：将只能通过 systemd 版本学习，难以深入了解传统启动流程B. 迁移建议需要 System V 兼容性的用户：继续使用 LFS/BLFS 12.4 System V 版本追求最新软件版本的用户：使用未来的 13.0 systemd 版本3. 技术趋势A. 初始化系统统一化systemd 在 Linux 发行版中的统治地位进一步巩固System V 逐渐成为历史遗产B. 教育与实用的权衡开源教育项目面临理想与现实的双重压力志愿者维护模式在应对快速变化的上游项目时显得力不从心五、各方反应1. 官方立场项目负责人承认这是一个艰难的决定强调这是工作负载和上游依赖共同作用的结果保留了 System V 版本的可用性，供有需要的用户使用2. 社区预期A. 支持意见认可维护团队的工作压力，理解放弃双重维护的必要性接受 systemd 成为行业标准的现实B. 保留意见担心 LFS 的教育价值降低认为复杂化的 systemd 不利于初学者理解 Linux 系统本质C. 替代方案讨论社区可能出现基于 OpenRC 或其他 init 系统的分支项目Gentoo 等仍支持多种 init 系统的发行版可能成为相关学习资源六、相关链接1. 官方资源LFS 官方网站LFS 邮件列表归档2. 相关项目BLFS（Beyond Linux From Scratch）CLFS（Cross Linux From Scratch）HLFS（Hardened Linux From Scratch）3. 技术参考systemd 官方文档System V init 历史资料参考资料lfs-announce 邮件列表 - Future direction for LinuxFromScratch
Guix System First Impressions as a Nix User
Guix System First Impressions as a Nix UserTable of ContentsMy Journey to Guix SystemInstaller ImpressionsI Can't Find my Way-landSympathy for the DevilGoalsResultsOverallNotes1. My Journey to Guix SystemI've been a Linux-only user for about ten years now and, like many others, I too embarked on the arduous journey of distro-hopping. I started with Mint and when that felt too slow, I switched to Ubuntu. When Ubuntu felt too handholdy, I switched to Arch, which proved to be my main driver for well over five or so years. And when I couldn't resist the Siren's call, I moved on to Gentoo, thinking surely "harder is better". Which resulted in severe burnout in a few months, so I capitulated and switched to Fedora, which was very stable and honestly an all around excellent system. But once more, my interest was piqued, and (before today's adventure) I finally switched to NixOS.I've always had a passing interest towards Nix ever since I've first heard about it, but until fairly recently, I always dismissed it as a tool for DevOps guys. The syntax was weird, the need for reproducible environments seemingly irrelevant, and stuff like the oft-recommended Nix Pills seemed anything but newbie-friendly.So then why would someone like me, who's so adamant about not needing Nix eventually choose to go all-in? I guess it was at first less about Nix being better and just the rest being worse.Of the two big reasons for the switch, one was that I realized that having per-directory environments for your projects is actually a very handy thing to do when you like to toy around with many technologies. I used to generate my other blog using Jekyll and, no matter which distro I used, it was always a pain in the neck to have a good Ruby environment set up. bundler install didn't really want to work without privileges and I wasn't really a fan of unleashing sudo on it, but usually that was the only way I could get things to work.With Nix, however, it was a matter of just describing a few packages in a shell and boom, Ruby in one folder, no Ruby (and thus no mess) everywhere else. I was hooked! I started adding shell.nix files to all my little projects, hell, I started planning projects by first adding a shell.nix with all the dependencies I would reasonably need.The other reason, which ultimately cemented that I need to commit, was that I was getting tired of my installed packages slowly drifting out of control. Sure, every package manager has some method of listing what's installed, but these are usually cumbersome and completely ephemeral (in the sense that any listing becomes invalid the moment you change anything).With NixOS, the equation is flipped on its head: No longer did I query the system to tell me what's installed and what's not, it was now the system that worked based on files that I edit. The difference sounds small on paper, but for me it was an extremely liberating feeling to know that I could edit my system configuration in a versionable, explicit, and centralized way.But NixOS isn't the only declarative distro out there. In fact GNU forked Nix fairly early and made their own spin called Guix, whose big innovation is that, instead of using the unwieldy Nix-language, it uses Scheme. Specifically Guile Scheme, GNU's sanctioned configuration language. I've been following Guix for a bit, but it never felt quite ready to me with stuff like KDE being only barely supported and a lot of hardware not working out of the box.However, now that (after three years) Guix announced its 1.5.0 release with a lot of stuff stabilized and KDE finally a first-party citizen, I figured now is the best time to give it a fresh shot. This post captures my experiences from installation to the first 3-4 days.2. Installer ImpressionsPlug your USB in, dd the file onto the drive, reboot, nothing unusual. If you've ever installed a Linux system, it's more of the same.After selecting the pendrive in my BIOS settings, the monitor began to glow in a deep, radiant blue as the Guix System logo appeared on my screen… only to suddenly switch to a menacing red: My CPU's integrated GPU is not supported by free firmware. A helpful popup gave me a gentle nudge about picking free hardware next time (buddy, have you seen the PC part prices these days?) and off I went into the installer proper.The installer itself is refreshingly barebones and I mean this in a positive way. It asks all the necessary questions and provides a nice basic configuration file, all done in a retro Ncurses-based TUI. I was really happy to see that, unlike my last attempt at using Guix System in the early 2020-s, KDE Plasma is now a first-party choice during installation. I never really vibed too much with GNOME and the other options didn't appeal either, so the choice was obvious.Now, I'm not sure if I just picked the worst possible time or if the Guix servers were facing unusual load or whatever may have happened, but after such a breeze of a setup, the moment I pressed install, my PC became unusable for the next 2.5 hours. Which is unacceptable for an installation process these days in my opinion. I am lucky enough to live in a household with fiber-optic internet, that merely shrugs at bandwidth of up to a gigabyte per second and yet nearly all packages downloaded with a whopping 50 kilobytes per second, meaning even small-ish 5-10 megabyte packages took long minutes to download.A reboot later my issues only got worse.3. I Can't Find my Way-landI was assuming I'd get SDDM after having chosen KDE Plasma, but (what a later, closer read of the manual made me realize is the expected outcome for a default config) it was GDM that loaded in. I entered my name and password, and I was greeted with the familiar Plasma 6 spinner. The first hint that something might be off was that it loaded a bit longer than usual, but I was not going to get mad at waiting 10 seconds instead of 3. After all, I did just wait magnitudes longer to get here.With practically nothing installed beyond the very basics, I clicked on Konsole, hoping to start prodding around my config and add some of my day to day apps. To my horror, it opened in the top left corner, without a titlebar and without any borders. What's more, no matter what I did, I couldn't move it. It also didn't show up on the menu bar, despite the application launcher still being completely usable. At this point I was fairly exhausted by these antics, but I figured,Well, it's a brand new release, perhaps this just snuck in. Let's give updating a shot and see if that helps.So I issued guix pull… The download whizzed by with speed quite unexpected after what I experienced with the installer… Only to crash into the brick wall that's indexing. Okay, whatever, another 10-12 minutes down the drain, at least now I have newest version.Except I didn't. Because, unlike Nix, the guix executable is not an omnipresent, unique thing that anyone and everyone uses on your PC. Not only does every user have their own instance, if you don't issue a certain set of commands, you won't start using the new version, despite updating it.To Guix's credit, the CLI does scream at you to update your environment or else you'll keep using the old version, but I still find this system very disorientating compared to Nix. I'm certain experienced Guixheads are long past being tripped up by this sort of stuff and might even struggle to remember that there was a time they had to do these special steps too, but as a new user it felt a bit rough, especially consdering this is Guix System, i.e. the system whose whole purpose is to be integrate Guix as much as it can.Back to our issue at hand. I issued sudo -s and guix pull-ed again. Once more 10-12 minutes passed indexing. But at least I could finally call guix system reconfigure /etc/config.scm. Interestingly things are much faster this time around, I saw speeds up to 30-50 Mbps. Before long the system was updated to the newest commit and I rebooted with high hopes.High hopes, that were immediately dashed when Plasma loaded in the same messed up way. At this point I started to suspect this might be an issue with the GPU driver, so I enabled the LXQT desktop environment and rebooted once more. Thankfully that one worked like a charm and I was able to boot up both Emacs (editing Scheme with GNU Nano is a pain I do not wish on anyone) and LibreWolf (Firefox's de-Mozilla-d variant).Not having found anything too useful in the docs, I decided to make my problem someone else's so I fired up ERC and connected to Libera.chat's #guix channel. After around half an hour of wait, a user by the name of Rutherther stepped up and offered me some help. We were able to figure it out that Nouveau wasn't able to drive my GPU (an RTX 5070), so his recommendation was that I should try booting with nomodeset. I did, but it sadly didn't help much either.4. Sympathy for the DevilAt this point I was out of ideas. Ideas of solving this using pure-Guix System, that is. There was still one option I wanted to avoid as long as I could, but alas, it seemed like the only option, that still had a realistic chance of working.Enter Nonguix, the Mr. Hyde to Guix's Dr. Jekyll, the shady guy who offers you a hit and first time's for free, the… Erm, in a nutshell, it's the repository for non-free applications and drivers packages for Guix System, basically. Interestingly enough, by Guix's own findings about 64% of users utilize the Nonguix channel, which is perhaps not "literally everyone", but it does paint a picture that there is still stuff out there that you simply cannot replace with FOSS software yet.Listing 1: At the time of writing, this is all one has to do to enable Nonguix.(cons* (channel (name 'nonguix) (url "https://gitlab.com/nonguix/nonguix") (introduction (make-channel-introduction "897c1a470da759236cc11798f4e0a5f7d4d59fbc" (openpgp-fingerprint "2A39 3FFF 68F4 EF7A 3D29 12AF 6F51 20A0 22FB B2D5")))) %default-channels)Enabling the repo wasn't exactly difficult. You just paste the short excerpt from above (also found in the README) into your ~/.config/guix/channels.scm and /etc/guix/channels.scm files, guix pull, let it index to its heart's content again, and then you have access to all that is nasty (yet occasionally useful) in the world.I figured perhaps if Linux-libre and its free firmware couldn't deal with my GPU, then surely Linux proper with its binary blobs could. Hell, for good measure I threw in the NVIDIA transform, which is supposed to automagically translate all dependencies to use the proprietary drivers.Turns out my eagerness was a mistake. Not only did the process take yet another half an hour (if not more, I stopped counting), upon reboot all I was met with was a kernel panic about the driver not being able to cope with the GPU it found and a massive spew of FSCK logs.With no better ideas in mind, I took out my pendrive again and burned Nonguix's own pre-built ISO on it using my partner's PC. While it ultimately did get me a working system, this version has three unfortunate hindrances:It was built in 2022, far before Guix's migration to Codeberg, meaning it still attempts to pull content from the unfathomably slow GNU Savannah mirror. I had to manually override my channels.scm to point at the Codeberg repo instead, but with no easy means of finding its "channel introduction", I had to pass in --disable-authentication to Guix when updating my system. A bit scary, but I trust the Codeberg repo.Because of its age, I got a lot of somewhat intimidating errors about hardware not being recognized and other stuff I couldn't even decipher, but ultimately the system booted to the installer without issue.For some reason while the installer itself does include Nonguix stuff, it actually does not include the repo in the resulting channels files, nor the substitution server for the project. The README has a warning about this, but if you happen to miss it, you could accidentally install a non-Nonguix Guix System (say that three times fast).None of these were particularly hard to fix, however, and soon enough I was back where I started. That is to say, in a nomodeset X11 session, except this time running i3, as LXQT wasn't an available option on an installer this old. There was certainly a bit of a hacker-ish vibe to messing with code files in an environment like that, but I was honestly much more looking forward to finally having a usable desktop.Having learned from my hastiness, this time I was smarter. I only enabled the full kernel and firmware blobs, without going anywhere near the NVIDIA transform. I issued another guix system reconfigure and, after having time for another tea session, my update was finally finished.I rebooted with tentative nervousness and… Success? Huh.5. GoalsObviously there is little point in throwing Guix System on my PC and declaring success. I wanted to be able to at least reproduce the kind of workflow I'm used to using NixOS. For that, I need the following:A browser: preferably Firefox, as I'm not a huge fan of Chrome / ChromiumAn E-mail client: preferably ThunderbirdA basic office suite: preferably LibreOfficeDev environments: for Rust, Zig, Scheme, and TypeScript (with the option for more, if possible)Emacs: I do almost all my text editing in it these days, falling back to Neovim for quick tasksDiscord: for chatting with friendsTelegram: for chatting with familySteam: for the very rare occasions I want to gameNVIDIA drivers: I prefer to offload day-to-day usage to my CPU's integrated GPU, as it cuts my energy usage in half.Of these it was obvious that two would be relatively hard and one "outright impossible". The two being Steam and the drivers (as both are non-free and thus not in Guix's default repos) and the "impossible" one being Discord (which not even the non-free repo has packaged). But I was ready to compromise a little bit since I am requesting stuff that's explicitly against Guix's goals.6. ResultsWhile there has been occasional bumps and hitches along the ride, I must say I'm very impressed with Guix System so far. Let's go through this list in order:Browser: So far I'm really enjoying LibreWolf. It feels a lot snappier than Firefox and I'm really baffled how much speed I was apparently missing out on.E-mails: I installed Icedove, which is basically just Thunderbird without Mozilla branding. It works as expected.Office suite: LibreOffice is available as expected. Not much to say about it. I guess it's interesting that Guix isn't following the usual -stale / -fresh packaging schema, but I don't really mind not having cutting edge versions of an office suite :)Dev environments: I've only briefly toyed with development environments so far, but to me it seems like for simple use-cases it might be even easier to use than shell.nix (you don't need any sort of ceremony, just a manifest.scm file with a (specifications->manifest ) form inside and you have a dev env ready to go.)Emacs: Installed just fine. I had to install emacs-vterm to make Vterm work, but all that took was the very simple process of adding the library to my home configuration and then referencing it in my Emacs config as per this Reddit post.Discord: I decided to just use Discord's browser version, which works just as fine (if not better). It's trading a tiny bit of convenience in return for not having to figure out how to manually add a package for it from some random third-party source. From what I've read elsewhere Flatpak is also an option, but I prefer having just one package manager at a time.Steam: Installed shockingly easily. I have to really give props to the Nonguix team. I tested Portal 2 with the Nouveau driver, it is a little disheartening to see a 15 years old game lag, but I understand the people's hands are tied when it comes to the free drivers. After I managed to install the proprietary drivers, I was able to play even Portal RTX, which is something I never managed to get to work using NixOS.NVIDIA drivers: This time I actually read the docs properly and it didn't take long for me to realize the initial problem that caused my previous install to be unbootable was of course found between the chair and keyboard. This time, after making sure I enabled the open drivers and kernel mode-setting, I crossed my fingers, issued a reconfigure and it works beautifully!6.1. The GoodHelpful community: While I do feel like Guix's community could be much larger (see below), the one that exists is very helpful and nice from my limited experience. In all places I've looked so far (Libera's #guix, /r/Guix, and the guix/guix Codeberg repository) I was met with genuinely kind and helpful people.Home configuration: Having guix home be a built-in, first class citizen, instead of a community made "extension" is excellent. Instead of needing to consult a third-party resource like Home Manager's documentation you can simply use what you already know about Guix and, if you happen to hit a wall, you can just read the official handbook which is guaranteed to always stay up to date with the rest of the system.Package availability: As long as you largely use FOSS stuff (which is much easier than one might think), the amount of choice is awesome. I could basically just copy over the list of packages from my Nix config and practically everything had an equivalent.Scheme: I'm not really a seasoned Schemer, but I have dabbled in the language previously and it feels so much better to me than Nix (the language) ever did. One great benefit of this is that it's a lot easier to start digging into package definitions to figure things out for yourself.This is "Freedom 1" of GNU's Four Essential Freedoms in effect. Since the code is pretty much just Scheme and the different mechanisms available are fairly well documented, the barrier to entry is much lower than with Nix in my opinion.Another nice benefit of this is that you can use Emacs' extensive Scheme support to help your configuration. Tools like Geiser can plug right into Guix and help you find package and function names and, once you're experienced enough, debug your config/packages on the fly.Ease of hacking: In the "to tinker on" sense, rather than "being insecure". With Nix, merely pulling in Nixpkgs is an effort, due to the repository being massive. My otherwise beefy machine struggled to switch between branches and make commits, which doesn't exactly inspire confidence in contributing, even though it was otherwise something I was excited to do. Meanwhile, with Guix I was able to get a fully functioning development environment in 15 minutes tops, which includes cloning the repo, authenticating all commits, generating bytecode for the entire repository, and getting Emacs set up to work nice with the codebase.6.2. The AmbiguousSearch: guix search not taking an extra parameter like nix search is both very convenient and a bit of a bummer.Its absence is not a deal breaker, but I really loved how with Nix, you could search in anything, that has a flake. Be that Nixpkgs, a repo you downloaded, a repo that's on a git forge, etc. I remember being awestruck that I could just do nix search github:mozilla/nixpkgs-mozilla and search for their builds of Firefox without having to manually check out anything.The documentation: Oof, this one is a bit hard to pass definite judgment on.On one hand I love the thoroughness of it all. You can get a fairly decent idea of what Guix, what it can do for your, how to use it, and how to extend it, just by reading the manual. It is evident that the Guix team and GNU in general takes its mission to educate using free software very seriously. Stuff like the Packaging tutorial make it very easy for complete beginners to hack together package definitions without needing to consult any other resource.On the other hand, it really is just a manual, not a tutorial. What I mean by this is that concepts that could belong together aren't placed near each other. A simple example would be services and customizing them. Assuming, you're in one of the sub-pages of Services and you suddenly realize you want to replace/modify one of the services, you are left completely clueless how that works. You have to go to a completely different chapter and find one particular function's description and then apply what you learn there. The Guix Cookbook has some examples, but you have to know about the cookbook in the first place.6.3. The BadSubstitute server stability: I imagine this is an issue that only a massive bag of money could fix, but the CI/CD servers could definitely use some more processing power. It's really annoying when you're trying to test something and you're suddenly forced to wait 10-15 minutes because the server can only spare 50-100 kbps for you.Content out there: Clearly this isn't the Guix team's fault (and it's something I'm trying to lessen with this post, even if just a tiny bit), but it's really hard to find good quality material when it comes to Guix.I mean, sure, there is the excellent System Crafters tutorial series, and the odd gems like DThompson's dev env tutorial, but as a whole you're largely left to your own to trawl through the manual, IRC logs, Reddit threads, Codeberg and the previous issue tracker, etc.Guix's own build speed: Nix excels in speed, so I was hoping Guix would be the same. Yet stuff like guix pull really bog things down. Doubly so, if you want to update not just your own guix instance, but also root's.Clarity of commands: The fact that all concerns are lumped together (unlike Nix's many utilities) means that to the new user the many commands such as guix pull, guix {system, home} reconfigure, guix update can easily feel overwhelming and unclear what's updating/changing what.7. OverallIn a nutshell I'm very positively surprised by Guix System. After struggling so much with it years ago, this time everything just clicked after a much shorter battle. So much so that I'm happy to make it my daily driver for the foreseeable future. Beyond the slightly slower execution speed, I'm getting a comparable experience to NixOS, with all the usual pros a declarative environment brings and without having to put up with Nixlang.My only recurring issues so far are the occasional slow download speeds and that I have to start my kernel in nomodeset because otherwise the graphical environment crashes without me being able to switch to a TTY. It's a bummer, but honestly, I'm not too bothered by it so far. I'm trusting a driver update will fix it soon enough and, if not, it's not exactly difficult to throw in a kernel parameter into your config.I'm hoping to do a followup post about packaging in Guix, because I've been dipping my toes into it by trying to package Wezterm and the journey there was similarly arduous as installing the system itself.8. NotesThe installer is decently simpleI appreciate the warning about incompatible hardware2.5 hours at least to install (mirrors throttle connection to 50kbps)KDE is simply not working out of the box (titlebars are missing)It seems to also default to X11, when I'm looking for WaylandThe first guix pull is horrendously slowWayland continues to elude me, seems to be an Nvidia issueIRC recommends nomodeset, doesn't helpTry enabling Nonguix, system no longer bootsTry installing using the Nonguix ISOLots of errors, terribly old releaseHaving to guix pull myself to the present day againAlso I'm missing the introduction, so I have to run it using --disable-authentication, not great, but I trust the Codeberg repoAt least the download speed seems to have normalizedIt isn't entirely clear when you have to use sudoRunning i3 on a shitty low-res has a certain vibe to it, but I'd prefer a system working out of the boxReferencesOriginal article: https://nemin.hu/guix.htmlGNU Guix: https://www.gnu.org/software/guix/Nonguix Repository: https://gitlab.com/nonguix/nonguix
GOG 称 Linux 为游戏下一个主要前沿，着手开发原生客户端技术分析
GOG 称 Linux 为游戏下一个主要前沿，着手开发原生客户端技术分析一、新闻概述1. 标题GOG 称 Linux 为游戏下一个主要前沿，着手开发原生客户端2. 发布时间2026 年 1 月 28 日3. 来源XDA Developers二、核心内容1. 事件摘要A. 主要内容GOG（Good Old Games）正在招聘高级软件工程师，计划将 GOG Galaxy 客户端原生移植到 Linux 平台，公司称 Linux 为下一个主要前沿。B. 核心亮点GOG 计划开发 Linux 原生版本的 GOG Galaxy 客户端招聘高级工程师从零开始构建 Linux 版本的架构GOG 将 Linux 定位为游戏领域的下一个主要前沿原生客户端将让 Linux 用户能够无障碍地体验经典游戏2. 关键信息A. 产品信息产品名称：GOG Galaxy（GOG 的桌面客户端和生态系统中心）当前平台：Windows、macOS目标平台：Linux（原生支持）B. 技术需求编程语言：C++工作性质：架构设计、工具链开发、开发标准制定代码库规模：大型且复杂的 C++ 代码库C. 历史背景GOG 曾在多年前停止对 Linux 的支持原联合创始人从 CD Projekt Red 手中回购 GOG新战略侧重于与 Steam 差异化竞争3. 背景介绍A. 前置发展Linux 游戏曾陷入两难境地：开发者不为 Linux 开发游戏是因为玩家不用 Linux，玩家不用 Linux 是因为开发者不为 Linux 开发游戏。B. 技术突破随着 Proton 等技术的发展，Linux 正逐渐被认真对待为游戏平台。三、详细报道1. 主要内容A. 战略转变GOG 在其官方网站发布的招聘公告中明确表示：GOG Galaxy 目前在 Windows 和 macOS 上提供服务，但 Linux 是下一个主要前沿。B. 技术要求招聘职位为高级软件工程师，职责包括：从零开始为 Linux 设计 GOG Galaxy 的架构开发相关工具链制定开发标准处理大型 C++ 代码库的移植工作C. 产品定位GOG Galaxy 被定义为：桌面客户端和生态系统中心玩家管理游戏库的场所社区连接平台提供超越商店功能的综合服务2. 技术细节A. GOG 平台架构graph TB User[玩家] --> Galaxy[GOG Galaxy 客户端] Galaxy --> Library[游戏库管理] Galaxy --> Community[社区功能] Galaxy --> Store[商店服务] Galaxy --> Features[增值功能] Store --> Classic[经典游戏] Store --> Retro[复古风格新作] Store --> New[新发行游戏] Library --> Windows[Windows 支持] Library --> MacOS[macOS 支持] Library --> Linux[Linux 原生支持-开发中] Features --> Cloud[云同步] Features --> Achievements[成就系统] Features --> Social[社交功能]B. Linux 游戏生态系统graph LR Game[游戏] --> Proton[Proton/Wine 兼容层] Proton --> Linux[Linux 系统] Native[原生 Linux 游戏] --> Linux Galaxy[GOG Galaxy Linux] --> Linux Linux --> SteamDeck[Steam Deck] Linux --> Desktop[桌面 Linux] Linux --> Handheld[其他掌机] Galaxy -.云同步.- Proton Galaxy -.社区功能.- NativeC. 技术挑战C++ 代码库跨平台移植确保 Linux 版本功能完整性与现有 Windows/macOS 版本保持一致性优化 Linux 系统性能3. 数据与事实A. 市场趋势Steam Deck 推动 Linux 游戏普及Proton 使 Windows 游戏在 Linux 上运行性能提升越来越多的游戏发行商关注 Linux 平台B. 用户反馈根据文章评论区，用户反应包括：积极期待 Linux 原生支持部分用户记得 GOG 曾经放弃 Linux 支持希望能通过原生客户端玩到更多游戏四、影响分析1. 行业影响A. 竞争格局GOG 与 Steam 形成差异化竞争Linux 游戏平台选择增多可能推动其他平台跟进 Linux 支持B. 技术趋势Linux 作为游戏平台的地位进一步巩固原生支持优于兼容层运行的认可度提升开源游戏生态系统的繁荣2. 用户影响A. 现有 Linux 用户获得原生游戏平台支持更好的游戏体验和性能无需依赖 Wine/Proton 兼容层B. 潜在用户降低 Linux 游戏入门门槛吸引更多玩家尝试 Linux 系统推动桌面 Linux 普及C. 游戏体验提升原生客户端性能优于兼容层完整的云同步和社区功能更好的系统集成3. 技术趋势A. 技术方向从兼容层运行转向原生支持C++ 跨平台开发的重要性游戏平台 Linux 化加速B. 生态影响Linux 游戏库进一步丰富经典游戏在 Linux 上的可玩性提升推动游戏开发工具链 Linux 支持五、各方反应1. 官方立场GOG 在招聘公告中明确表示：Linux 是下一个主要前沿需要从第一天起就为 Linux 设计架构重视 Linux 平台的长期发展2. 业内评价A. 技术社区对 GOG 回归 Linux 表示欢迎认为这是 Linux 游戏发展的重要里程碑期待更多发行商跟进B. 用户反馈积极反应：终于可以原生体验 GOG 游戏库与 Steam Deck 形成良好互补经典游戏在 Linux 上重获新生关注点：开发进度和发布时间支持的 Linux 发行版范围与现有 Linux 游戏工具的兼容性六、相关链接1. 官方公告GOG 高级软件工程师招聘页面GOG 官方网站2. 相关报道XDA Developers 原始报道VideoCardz 新闻追踪3. 技术背景Proton 兼容层技术介绍Steam Deck Linux 游戏系统Linux 游戏发展历史参考资料GOG calls Linux "the next major frontier" for gaming as it works on a native clientGOG Senior Software Engineer Job PostingVideoCardz News Report