AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-286615

Seamus's questions

Martin Hope
Seamus
Asked: 2025-04-14 18:34:54 +0800 CST

关于“evtest”命令的问题

  • 5

我正在做一个项目,打算用一个小型(6键键盘)来控制树莓派上mpd(和)播放的音乐。显然,我需要“捕获”键盘输入,并将其转换为命令。我完全没有使用键盘的经验,但经过一番研究并以这篇问答为起点,我现在已经写出了一个简短的脚本,可以用来监控键盘的输出。mpcmpdevtest

Debian 网站上有一份关于这个evtest软件包的声明,我想咨询一下:

evtest 现在处于维护模式,不支持最新内核的所有功能;应该使用 evemu-tools 包中的 evemu-record。

我也尝试过evemu-record脚本中的命令;它的工作方式似乎与非常相似evtest。

我有两个问题:首先,evtest鉴于以下情况,上述问题是否真的值得关注:

  • 目标系统是无头 Raspberry Pi('bookworm',64 位)
  • 键盘只有 6 个键,通过 USB 连接

我对这句话也有一个疑问man evtest:

如果在捕获模式下指定了 --grab 标志,evtest 会在设备上保留一个 EVIOCGRAB。当此捕获处于活动状态时,其他进程将不会接收来自内核设备的事件。

这是否意味着,如果我的脚本启动了@reboot(cron),6键键盘的输出将永远不会进入任何其他进程?如果是这样,这对我来说似乎是“一件好事”,并且比……更具潜在优势evemu-record。

我想第二个问题是一个“意见问题”,但我想知道在 中编写这个键盘监视器与像我一样C在 中编写相比是否具有真正的“令人信服的优势”?bash

keyboard
  • 1 个回答
  • 23 Views
Martin Hope
Seamus
Asked: 2025-04-10 14:33:00 +0800 CST

将软件包从“测试”版本安装到“稳定”版本

  • 5

我运行的是“bookworm stable”发行版。最近开始尝试一个叫 的软件包mpd。不知何故,负责mpdGitHub 仓库的人没有提供旧版本的文档(例如“bookworm stable”中包含的 0.23.12 版本)。系统手册简略得毫无用处。

我遇到了一些问题,mpd而且没有详细的文档也帮不上忙。在这种情况下,我决定尝试一个更新的软件包。我认为可以使用的版本是 0.24.2-1 - 目前位于“测试”仓库中。Debianmpd中最新的软件包是 0.24.3-1,现在处于“不稳定”状态……这可能是一个更好的选择,并且完全符合现有的文档。

当我从“backports”安装软件包时,我遵循了与此类似的步骤(已更新以反映使用“testing”而不是“backports”):

  • 修改/etc/apt/sources.list以添加“测试”
  • 安装:sudo apt install -t testing mpd mpc ...
  • 删除测试/etc/apt/sources.list(“安全”措施:)

这看起来大致正确吗?我做了一些研究,但找不到将单个软件包从“测试版”升级到“稳定版”的具体示例——它们都反映了将(所有软件包)整体升级到“测试版”——这不是我想要的!

如果这不起作用,我将非常感激有关如何最好地安装最新版本的建议mpd。

debian
  • 4 个回答
  • 73 Views
Martin Hope
Seamus
Asked: 2025-03-29 14:21:22 +0800 CST

如何向在‘cron’下启动的‘mpg123’实例发送“按键”?

  • 6

我习惯mpg123在工作时播放歌曲列表。实际运行mpg123并播放音乐的主机是一个本地无头系统,但我可以通过 SSH 连接到它。我mpg123在此主机上启动cron;它会连续循环播放我的“播放列表”中的音轨。但是有时我需要暂停音乐(来电、访客等)。

man mpg123说按一下s键就可以暂停播放,再按一次就可以重新开始。如果我mpg123在终端中启动并让它运行,这就可以正常工作。我还了解到,可以在会话中播放时发送“暂停”信号( s):mpg123screen

$ screen -S mpg123                                   # to start the screen session 
$ /usr/bin/mpg123 --loop -1 /home/pi/rainstorm.mp3   # for example
'ctrl+a, d'                                          # quit screen 

... 

$ screen -S mpg123 -X stuff "s"   # pauses play

我在这里发现了一个与我类似的问题,但答案似乎没有切中要点——至少我不明白!

如果是在 下启动的,我找不到允许我向 发送“暂停”( s) 命令的方法。我更喜欢一种比向 发送此命令更直接的路线,而且我不确定是否可以使用 进行设置。mpg123cronscreenmpg123cron

有人能就一种方法提出建议吗?我更喜欢“bash解决方案”,而不是需要(例如)C 程序的解决方案 - 但我很高兴能得到任何我能得到的东西!

linux
  • 1 个回答
  • 33 Views
Martin Hope
Seamus
Asked: 2025-03-21 15:33:03 +0800 CST

Debian 设置 systemd networking.service 和 NetworkManager.service

  • 4

我的系统只有一个接口:通过 wifi。NetworkManagerwlan0是默认接口。但是,系统启用了几个“网络服务”。以下是与“网络”相关的已启用服务的列表(默认):

$ systemctl list-unit-files --state=enabled

ModemManager.service               enabled enabled
networking.service                 enabled enabled
NetworkManager-dispatcher.service  enabled enabled
NetworkManager-wait-online.service enabled enabled
NetworkManager.service             enabled enabled

wpa_supplicant.service             enabled enabled  # underlined??

我想尝试一下networking.service,所以我添加了所需的条目/etc/network/interfaces以使其工作,并禁用了NetworkManager.service。重新启动后,“网络”即可运行(这意味着我可以做我需要做的所有事情:通过连接到主机SSH,进行apt更新等)。

接下来,我想尝试重新启用NetworkManager.service和禁用networking.service。我注释掉了我对所做的所有添加/etc/network/interfaces,然后禁用networking.service并重新启动。重新启动后,我无法通过 SSH 重新连接到主机。

然后我将主机连接到控制台,重新启用networking.service并重新启动。网络已恢复(这意味着我可以通过 SSH 连接到主机,执行apt等)。

我进行了搜索,但未能找到与我的 Debian“书虫”系统有关的这个问题的答案:

如果我禁用networking.service,但保持NetworkManager.service启用状态,为什么会“破坏”网络?

编辑...

向所有人道歉 - 我搞砸了!在@grawity下方评论中,我意识到我的问题是由NetworkManager几个月前创建的配置引起的,但networking.service自从那以后我一直在使用配置,所以它被我遗忘了。

所以 - 这里的所有答案都是正确的,而我的问题是这里唯一不正确的帖子。

再次向大家致歉。

debian
  • 3 个回答
  • 78 Views
Martin Hope
Seamus
Asked: 2025-03-05 13:04:00 +0800 CST

控制 systemd“切片”中包含哪些服务

  • 5

我重写了开头这段话……试图掩饰我对的蔑视systemd。我只能说我发现systemd的“逻辑”令人费解,就此打住。回到问题:

systemd-analyze time我一直在尝试减少小型Raspberry Pi Zero 2W上报告的启动时间。该操作系统约 95% 是 Debian,并加入了一些 Raspberry Pi 来处理硬件。

我首先列出活动的单元文件,然后从该列表中我找到了几个service我相信可以毫无影响地删除的文件:

$ systemctl list-unit-files --state=enabled
...
rpi-display-backlight.service      enabled enabled
rpi-eeprom-update.service          enabled enabled
...
$

我选择disable这两项服务如下:

$ sudo systemctl disable rpi-eeprom-update.service rpi-display-backlight.service
Removed "/etc/systemd/system/halt.target.wants/rpi-display-backlight.service".
Removed "/etc/systemd/system/poweroff.target.wants/rpi-display-backlight.service".
Removed "/etc/systemd/system/reboot.target.wants/rpi-display-backlight.service".
Removed "/etc/systemd/system/multi-user.target.wants/rpi-eeprom-update.service".

令人失望的是,我发现启动时间(据报告systemd-analyze time)实际上增加了约 3 秒。我重新启动了几次以获得“平均值”;3 秒的增加看起来是真实且持续的。我想知道这种增加是否可能是由于systemd 重新尝试启动这些服务造成的。因此我寻找与其他“单元”的依赖关系systemd:

$ systemctl list-dependencies rpi-eeprom-update.service
rpi-eeprom-update.service

$ systemctl list-dependencies rpi-display-backlight.service
rpi-display-backlight.service
● └─system.slice
$

我认为第一个结果 (rpi-eeprom) 表明没有其他依赖项。第二个结果 (rpi-display) 让我感到困惑。.slice从那时起,我做了一些研究,但它对我来说仍然没有什么意义(实际上没有意义)。这引出了我的问题:

有人能解释一下如何编辑这个system.slice并删除吗rpi-display-backlight.service?

debian
  • 1 个回答
  • 24 Views
Martin Hope
Seamus
Asked: 2025-02-25 05:26:21 +0800 CST

SSH 访问中断;可能是因为我不喜欢“NetworkManager”

  • 9

我似乎“破坏”了运行在 Raspberry Pi 硬件上的 Debian“书虫”系统的网络访问。这是因为我显然不了解各种“网络工具”如何运作的细节。损坏的系统是一个“无头”单元;我无法再与它建立 SSH 连接。它甚至不响应ping。

我在这里提出这个问题,希望有人能解释一下是否有办法在不对系统进行任何更改的情况下重新获得 SSH 访问权限。我目前的办法是移除 NVME SSD,并将其安装在另一个系统上以纠正配置错误,或者连接显示器和键盘,但由于缺少硬件/电缆等,这些都很困难。

我做了什么:对 NM 晦涩难懂的界面感到“厌烦” nmcli,并认为“一定有更好的方法”。我在 Debian 网站上阅读了此页面;具体来说:

NetworkManager 仅处理未在 /etc/network/interfaces 中声明的接口

我将其解释为,如果我wlan0在 中声明了我的 WiFi 接口 ( ) /etc/network/interfaces,那么NetworkManager它将“退出”,并systemd使用ifup、ifdown等来管理wlan0我添加到 的内容/etc/network/interfaces。这是我创建的文件的内容interfaces:

iface wlan0 inet static
    address 192.168.1.222
    netmask 255.255.255.0
    gateway 192.168.1.1
    dns-nameservers 192.168.1.1

之后reboot我发现我无法再通过 SSH 访问该系统。

我有两个问题:

  1. 有没有什么方法可以在不更改系统的情况下重新获得 SSH 访问权限?
  2. 为什么我输入的数据/etc/network/interfaces无法建立有效的 WiFi 连接?
debian
  • 1 个回答
  • 1085 Views
Martin Hope
Seamus
Asked: 2025-02-18 13:53:11 +0800 CST

如何确认内核是否正在更新 hwclock/RTC

  • 5

这个问题是这个答案的后续。总的来说,我的目标是了解我的系统(Debian/Raspberry Pi 5“书虫”)是否正在根据系统时间更新我的 RTC/硬件时钟。请注意,RPi 5(与其 Pi 祖先不同)确实有一个内置的RTC/硬件时钟。

以下是我目前能够确定的情况:

1. 我觉得我已经确定系统时钟正在从 hwclock 更新:
$ dmesg | grep "system clock" 

[    1.588793] rpi-rtc soc:rpi_rtc: setting system clock to 2025-02-18T04:59:13 UTC (1739854753)

然而,经过一番搜索dmesg,我找不到任何迹象表明 hwclock 正在从系统时间更新。不过,我确实找到了对时钟的引用fake-hardware(这似乎很奇怪)。:

[    4.037230] systemd[1]: Starting fake-hwclock.service - Restore / save the current clock...
2. 内核显然配置为“双向”进行时钟更新:
$ cat /boot/config-$(uname -r) | grep -i HCTOSYS
CONFIG_RTC_HCTOSYS=y
CONFIG_RTC_HCTOSYS_DEVICE="rtc0"  

$ cat /boot/config-$(uname -r) | grep -i SYSTOHC
CONFIG_RTC_SYSTOHC=y
CONFIG_RTC_SYSTOHC_DEVICE="rtc0"

我突然想到内核可能仅在关机期间执行 SYSTOHC 同步,并且可能没有被捕获dmesg...但这是一个 WAG。

有人能解释一下如何确认内核正在(或未)更新 hwclock/RTC 吗?

linux-kernel
  • 2 个回答
  • 34 Views
Martin Hope
Seamus
Asked: 2025-02-07 13:02:03 +0800 CST

如何从“此处字符串”中删除“换行符”

  • 7

“此处字符串”(<<<)是一种有用的构造,在许多情况下可以代替使用echo。但是,在计算哈希值时(作为一个例子),添加换行符会改变哈希值。

我一直在寻找一种紧凑的方法来防止“此处字符串”添加换行符,但一无所获。这个问题已经在 SO 上提出并得到回答,但奇怪的是,据我所知,接受的答案(或任何答案)实际上并没有回答这个问题。

有些人可能会考虑用echo -n <string> | md5sum或printf ... | md5sum来代替来回答这个问题。但我的问题具体与“此处字符串”有关。

bash
  • 3 个回答
  • 430 Views
Martin Hope
Seamus
Asked: 2025-01-20 07:29:06 +0800 CST

使用“set -u”时如何处理缺少的环境变量

  • 5

我有一个bash脚本,需要从以下任一位置启动:

  1. cron
  2. 交互式(登录)shell

此脚本需要知道它是从 启动的cron,还是从交互式 shell 启动的。当我在 中声明环境变量时,我以为我已经解决了这个问题root crontab:

RUN_BY_CRON="TRUE"

在脚本中,我测试RUN_BY_CRON并使用结果来设置另一个变量:

if [ "$RUN_BY_CRON" = "TRUE" ]; then            
    ((wait_time=DELAY_HALT*60))
fi

set -u在我将其添加到脚本中(作为“常见的防御性编程策略” )之前,此方法一直有效。从那时起,当我从命令行运行脚本时,set -u会标记RUN_BY_CRON为“未绑定变量”错误:

$ sudo ./skedrtc.sh
./skedrtc.sh: line 24: RUN_BY_CRON: unbound variable

值得一提的是,我运行了shellcheck这个脚本,没有收到任何警告或错误。

我尝试添加测试RUN_BY_CRON,但得到了同样的错误。我尝试测试交互式 shell,但从脚本内部进行测试没有帮助:

...
if [ -z "$RUN_BY_CRON" ]; then        # test for null string
    RUN_BY_CRON="FALSE"
fi
...

if [[ $- == *i* ]]; then              # test for interactive shell
    RUN_BY_CRON="FALSE"
fi

这感觉就像是“第 22 条军规”的情况。我曾寻找过创建try-catch块的方法,但 AIUI 中没有类似的东西bash。

问:如何在不删除的情况下避免出现“未绑定变量”错误set -u?

bash
  • 1 个回答
  • 31 Views
Martin Hope
Seamus
Asked: 2024-11-26 17:20:56 +0800 CST

我的“逃避”是错误的吗——或者是其他原因?

  • 7

以下是我想做的事情(在脚本中):

#!/usr/bin/env bash

if [[ ! $("/usr/bin/scp [email protected]:/Users/seamus/Downloads/imgutils/image-utils* /home/pi/testscp") ]]; then
    printf "\nERROR & EXIT: 'scp' failed \n"
    exit 1
fi
printf "success!\n"

我尝试过几种方法,但似乎都不起作用。以下是我从上面得到的结果:

./testscp.sh: line 3: /usr/bin/scp [email protected]:/Users/seamus/Downloads/imgutils/image-utils* /home/pi/testscp: No such file or directory

ERROR & EXIT: 'scp' failed

命令scp单独一行时可以正常运行。如果我这样做,我可以测试$0- 运行正常...但我更喜欢在一行中完成所有操作。我遗漏了什么?

bash
  • 2 个回答
  • 196 Views
Martin Hope
Seamus
Asked: 2024-10-19 15:21:22 +0800 CST

为什么“pipe-to-awk”在函数内部的行为不同?

  • 7

我用它alsa来调整我连接的蓝牙扬声器的音量。这是一个单扬声器设置;只是为了提供一些背景信息。

我可以通过 CLI 来“获取”音量设置,如下所示:

$ amixer sget Master
Simple mixer control 'Master',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 65536
  Mono:
  Front Left: Playback 22938 [35%] [on]
  Front Right: Playback 22938 [35%] [on]

我可以通过 CLI 来“设置”音量,如下所示:

$ amixer sset Master 50%
Simple mixer control 'Master',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 65536
  Mono:
  Front Left: Playback 32768 [50%] [on]
  Front Right: Playback 32768 [50%] [on]

我不需要这么冗长的内容,所以我决定在文件中创建一个函数和两个别名~/.bashrc来减少它。该函数没有按我预期的方式工作:

从 CLI 来看,这可以正常工作:

$ amixer sget Master | awk -F"[][]" '/Right:/ { print $2 }'
35%

但是当我将其放入我的函数语句中时~/.bashrc,它的工作方式有所不同:

# functions & aliases for alsa mixer/volume control
function vol-get() {
   amixer sget Master | awk -F"[][]" '/Left:/ { print $2 }'
}
export -f vol-get

alias vol-up='amixer sset Master 5%+ > /dev/null && vol-get'
alias vol-dn='amixer sset Master 5%- > /dev/null && vol-get'

重新读取~/.bashrc并运行该vol-get函数得到以下结果:

$ . ~/.bashrc
$ vol-get
  Front Left: Playback 22938 [35%] [on]
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ?? what happened here ??
$ vol-up
  Front Left: Playback 26215 [40%] [on]
$ 

所以 - 我很接近了,但我不明白为什么我| awk ...在函数内部的行为与在命令行上的行为不同。有人可以解释并纠正这个问题吗?


对评论中提出的一些问题的答案进行编辑:

编辑#1:

$ command -V vol-get
vol-get is a function
vol-get ()
{
    amixer sget Master | awk -F"[][]" '/Left:/ { print $2 }'
} 

$ awk --version
awk: not an option: --version
$ man awk
# reveals that I am actually calling `mawk`, Version 1.3.4

编辑#2:

RE:非打印字符;请注意,这是输出的部分 c&p(即逐字):

$ cat -vet ~/.bashrc
...
function vol-get() {$
    amixer sget Master | awk -F'[][]' '/Left:/ { print $2 }'$
}$
...
bash
  • 1 个回答
  • 139 Views
Martin Hope
Seamus
Asked: 2024-10-16 14:09:38 +0800 CST

如何在脚本中使用“findmnt --poll”

  • 5

Raspberry Pi 通常在启动时安装两个分区;这里是/etc/fstab:

proc            /proc           proc    defaults          0       0
PARTUUID=8a6020b5-01  /boot/firmware  vfat    defaults          0       2
PARTUUID=8a6020b5-02  /               ext4    defaults,noatime  0       1

我遇到一个问题,在很多情况下,/boot/firmware(vfat)分区(显然是随机的)变为“未安装”状态;我在输出中注意到了这一点lsblk --fs:

# 'boot/firmware' mounted correctly: 

$ lsblk --fs
NAME        FSTYPE FSVER LABEL  UUID                                 FSAVAIL FSUSE% MOUNTPOINTS 
nvme0n1
├─nvme0n1p1 vfat   FAT32 bootfs 146B-AD94                             444.8M    13% /boot/firmware
└─nvme0n1p2 ext4   1.0   rootfs ece25014-1cd7-4874-9bfc-f91e486bc000  364.9G     2% /

# 'boot/firmware' becomes "un-mounted": 

$ lsblk --fs 
NAME        FSTYPE FSVER LABEL  UUID                                 FSAVAIL FSUSE% MOUNTPOINTS 
nvme0n1
├─nvme0n1p1 vfat   FAT32 bootfs 146B-AD94                             444.8M    13% 
└─nvme0n1p2 ext4   1.0   rootfs ece25014-1cd7-4874-9bfc-f91e486bc000  364.9G     2% /  

在考虑了一些有助于“解决”此问题的选项之后,我认为使用--poll带有选项findmnt是一个不错的选择;即:

$ nohup /usr/bin/findmnt -n --poll=umount,mount --target /boot/firmware & 

我已经运行了此命令,并使用umount和mount触发对其进行了测试findmnt --poll:

$ nohup /usr/bin/findmnt --poll=umount,mount --target /boot/firmware &
[1] 10904

# wait a while, then

$ sudo umount /boot/firmware 
$ sudo mount -a

# check nohup.out: 

$ cat nohup.out
umount     /boot/firmware /dev/nvme0n1p1 vfat   rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro
mount      /boot/firmware /dev/nvme0n1p1 vfat   rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro 

我需要做的是在输出产生时触发例程umount ...。到目前为止,我还无法做到这一点,这就是我需要帮助的地方。我需要一个启动findmnt --poll命令的脚本,然后等待以 开头的输出umount。当该输出到达时,我想运行dmesg(?),将该输出捕获到日志文件,也许还有一些其他诊断,最后发出sudo mount -a。

findmnt --poll在输出另一行之后mount,我认为脚本应该返回到“等待”状态以捕获下一个umount事件。

我已经阅读了一些有关wait命令的内容,但想知道这是否是正确的方法,因为:

wait 命令使 shell 脚本或终端会话等待后台进程完成。

在这种情况下,它findmnt --poll 不会完成- 它会继续运行,轮询另一个可报告的状态变化。关于如何处理这个问题有什么建议吗?

bash
  • 1 个回答
  • 34 Views
Martin Hope
Seamus
Asked: 2024-10-11 14:05:55 +0800 CST

apt 升级后的问题

  • 7

我遇到了昨天刚发生的情况apt full-upgrade。受影响的应用程序似乎是我之前从安装的应用程序debian-backports。以下是我能找到的所有历史记录的概要:

1. 修改/etc/apt/sources.list以添加bookworm-backports;2024 年 8 月 15 日生效:

大约 2.5 个月前,我得出结论,我需要和 的backports版本。为了实现这一点,我修改了我的文件以添加:pipewirewireplumber/etc/apt/sources.listbackports

$ cat /etc/apt/sources.list
deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
deb http://deb.debian.org/debian-security/ bookworm-security main contrib non-free non-free-firmware
deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
# Uncomment deb-src lines below then 'apt-get update' to enable 'apt-get source'
#deb-src http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
#deb-src http://deb.debian.org/debian-security/ bookworm-security main contrib non-free non-free-firmware
#deb-src http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
deb http://deb.debian.org/debian bookworm-backports main contrib non-free

未对以下项进行任何更改/etc/apt/sources.list.d/raspi.list:

$ cat /etc/apt/sources.list.d/raspi.list
deb http://archive.raspberrypi.com/debian/ bookworm main
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://archive.raspberrypi.com/debian/ bookworm main

2. 安装pipewire等bookworm-backports;2024 年 8 月 15 日生效:

$ sudo apt install -t bookworm-backports pipewire pipewire-audio-client-libraries libspa-0.2-bluetooth 
...
$ sudo reboot

之后,我的系统上安装的pipewire&wireplumber版本(来自)如下:backports

$ pipewire --version
pipewire
Compiled with libpipewire 1.2.1
Linked with libpipewire 1.2.1 

$ wireplumber --version
wireplumber
Compiled with libwireplumber 0.4.17
Linked with libwireplumber 0.4.17

3. 测试完成后快进至 2024 年 10 月 9 日

这个系统已经两个月没有升级了,因为我正在测试现在有问题的应用程序。这是我昨天看到的情况:

请注意bookworm-backports以下列表:

$ sudo apt update
Hit:1 http://deb.debian.org/debian bookworm InRelease
Get:2 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
Get:3 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]
Get:4 http://deb.debian.org/debian bookworm-backports InRelease [59.0 kB]
Get:5 http://archive.raspberrypi.com/debian bookworm InRelease [39.0 kB]
Get:6 http://deb.debian.org/debian-security bookworm-security/main armhf Packages [181 kB]
Get:7 http://deb.debian.org/debian-security bookworm-security/main arm64 Packages [185 kB]
Get:8 http://deb.debian.org/debian-security bookworm-security/main Translation-en [114 kB]
Get:9 http://deb.debian.org/debian bookworm-backports/main arm64 Packages [249 kB]
Get:10 http://deb.debian.org/debian bookworm-backports/main armhf Packages [250 kB]
Get:11 http://deb.debian.org/debian bookworm-backports/main Translation-en [210 kB]
Get:12 http://deb.debian.org/debian bookworm-backports/contrib arm64 Packages [4,964 B]
Get:13 http://deb.debian.org/debian bookworm-backports/contrib armhf Packages [4,740 B]
Get:14 http://deb.debian.org/debian bookworm-backports/non-free arm64 Packages [6,864 B]
Get:15 http://deb.debian.org/debian bookworm-backports/non-free armhf Packages [1,516 B]
Get:16 http://archive.raspberrypi.com/debian bookworm/main armhf Packages [515 kB]
Get:17 http://archive.raspberrypi.com/debian bookworm/main arm64 Packages [485 kB]
Fetched 2,409 kB in 4s (614 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
59 packages can be upgraded. Run 'apt list --upgradable' to see them.

我已标记(*)以下 12 个条目backports:

apt list --upgradable
Listing... Done
base-files/stable 12.4+deb12u7 arm64 [upgradable from: 12.4+deb12u6]
curl/stable 7.88.1-10+deb12u7 arm64 [upgradable from: 7.88.1-10+deb12u6]
git-man/stable-security,stable-security 1:2.39.5-0+deb12u1 all [upgradable from: 1:2.39.2-1.1]
git/stable-security 1:2.39.5-0+deb12u1 arm64 [upgradable from: 1:2.39.2-1.1]
initramfs-tools-core/stable,stable 0.142+deb12u1 all [upgradable from: 0.142]
initramfs-tools/stable,stable 0.142+deb12u1 all [upgradable from: 0.142]
libc-bin/stable 2.36-9+rpt2+deb12u8 arm64 [upgradable from: 2.36-9+rpt2+deb12u7]
libc-dev-bin/stable 2.36-9+rpt2+deb12u8 arm64 [upgradable from: 2.36-9+rpt2+deb12u7]
libc-devtools/stable 2.36-9+rpt2+deb12u8 arm64 [upgradable from: 2.36-9+rpt2+deb12u7]
libc-l10n/stable,stable 2.36-9+rpt2+deb12u8 all [upgradable from: 2.36-9+rpt2+deb12u7]
libc6-dbg/stable 2.36-9+rpt2+deb12u8 arm64 [upgradable from: 2.36-9+rpt2+deb12u7]
libc6-dev/stable 2.36-9+rpt2+deb12u8 arm64 [upgradable from: 2.36-9+rpt2+deb12u7]
libc6/stable 2.36-9+rpt2+deb12u8 arm64 [upgradable from: 2.36-9+rpt2+deb12u7]
libcamera-ipa/stable 0.3.2+rpt20240927-1 arm64 [upgradable from: 0.3.0+rpt20240617-1]
libcamera0.3/stable 0.3.2+rpt20240927-1 arm64 [upgradable from: 0.3.0+rpt20240617-1]
libcurl3-gnutls/stable 7.88.1-10+deb12u7 arm64 [upgradable from: 7.88.1-10+deb12u6]
libcurl4/stable 7.88.1-10+deb12u7 arm64 [upgradable from: 7.88.1-10+deb12u6]
libexpat1/stable-security 2.5.0-1+deb12u1 arm64 [upgradable from: 2.5.0-1]
libpam-systemd/stable 252.30-1~deb12u2 arm64 [upgradable from: 252.26-1~deb12u2]
* libpipewire-0.3-0/stable-backports 1.2.4-1~bpo12+1 arm64 [upgradable from: 1.2.1-1~bpo12+1]
* libpipewire-0.3-common/stable-backports,stable-backports 1.2.4-1~bpo12+1 all [upgradable from: 1.2.1-1~bpo12+1]
* libpipewire-0.3-modules/stable-backports 1.2.4-1~bpo12+1 arm64 [upgradable from: 1.2.1-1~bpo12+1]
libpisp-common/stable,stable 1.0.7-1 all [upgradable from: 1.0.6-1]
libpisp1/stable 1.0.7-1 arm64 [upgradable from: 1.0.6-1]
* libspa-0.2-bluetooth/stable-backports 1.2.4-1~bpo12+1 arm64 [upgradable from: 1.2.1-1~bpo12+1]
* libspa-0.2-modules/stable-backports 1.2.4-1~bpo12+1 arm64 [upgradable from: 1.2.1-1~bpo12+1]
libssl3/stable 3.0.14-1~deb12u2+rpt1 arm64 [upgradable from: 3.0.13-1~deb12u1+rpt1]
libsystemd-shared/stable 252.30-1~deb12u2 arm64 [upgradable from: 252.26-1~deb12u2]
libsystemd0/stable 252.30-1~deb12u2 arm64 [upgradable from: 252.26-1~deb12u2]
libudev1/stable 252.30-1~deb12u2 arm64 [upgradable from: 252.26-1~deb12u2]
linux-headers-rpi-2712/stable 1:6.6.51-1+rpt3 arm64 [upgradable from: 1:6.6.31-1+rpt1]
linux-headers-rpi-v8/stable 1:6.6.51-1+rpt3 arm64 [upgradable from: 1:6.6.31-1+rpt1]
linux-image-rpi-2712/stable 1:6.6.51-1+rpt3 arm64 [upgradable from: 1:6.6.31-1+rpt1]
linux-image-rpi-v8/stable 1:6.6.51-1+rpt3 arm64 [upgradable from: 1:6.6.31-1+rpt1]
linux-libc-dev/stable,stable 1:6.6.51-1+rpt3 all [upgradable from: 1:6.6.31-1+rpt1]
locales/stable,stable 2.36-9+rpt2+deb12u8 all [upgradable from: 2.36-9+rpt2+deb12u7]
openssl/stable 3.0.14-1~deb12u2+rpt1 arm64 [upgradable from: 3.0.13-1~deb12u1+rpt1]
* pipewire-alsa/stable-backports 1.2.4-1~bpo12+1 arm64 [upgradable from: 1.2.1-1~bpo12+1]
* pipewire-audio-client-libraries/stable-backports,stable-backports 1.2.4-1~bpo12+1 all [upgradable from: 1.2.1-1~bpo12+1]
* pipewire-bin/stable-backports 1.2.4-1~bpo12+1 arm64 [upgradable from: 1.2.1-1~bpo12+1]
* pipewire-jack/stable-backports 1.2.4-1~bpo12+1 arm64 [upgradable from: 1.2.1-1~bpo12+1]
* pipewire-pulse/stable-backports 1.2.4-1~bpo12+1 arm64 [upgradable from: 1.2.1-1~bpo12+1]
* pipewire/stable-backports 1.2.4-1~bpo12+1 arm64 [upgradable from: 1.2.1-1~bpo12+1]
python3-gpiozero/stable,stable 2.0.1-0+rpt1 all [upgradable from: 2.0-1]
raspberrypi-sys-mods/stable 20240911 arm64 [upgradable from: 20240807]
raspi-firmware/stable,stable 1:1.20240924-1 all [upgradable from: 1:1.20240529-1]
raspi-utils-core/stable 20240903-1 arm64 [upgradable from: 20240402-4]
raspi-utils-dt/stable 20240903-1 arm64 [upgradable from: 20240402-4]
raspi-utils-eeprom/stable 20240903-1 arm64 [upgradable from: 20240402-4]
raspi-utils-otp/stable,stable 20240903-1 all [upgradable from: 20240402-4]
raspi-utils/stable,stable 20240903-1 all [upgradable from: 20240402-4]
raspinfo/stable,stable 20240903-1 all [upgradable from: 20240402-4]
rpi-eeprom/stable,stable 26.0-1 all [upgradable from: 24.0-1]
rpicam-apps-lite/stable 1.5.2-2 arm64 [upgradable from: 1.5.0-2]
systemd-sysv/stable 252.30-1~deb12u2 arm64 [upgradable from: 252.26-1~deb12u2]
systemd-timesyncd/stable 252.30-1~deb12u2 arm64 [upgradable from: 252.26-1~deb12u2]
systemd/stable 252.30-1~deb12u2 arm64 [upgradable from: 252.26-1~deb12u2]
udev/stable 252.30-1~deb12u2 arm64 [upgradable from: 252.26-1~deb12u2]
* wireplumber/stable-backports 0.5.6-1~bpo12+1 arm64 [upgradable from: 0.4.17-1~bpo12+1]

于是我upgrade对整个列表进行了检查;这似乎正常完成,但有些项目没有引起我的注意(检查过程中没有看屏幕upgrade),直到“轮子脱落”:

$ sudo apt -y full-upgrade
...

The following package was automatically installed and is no longer required:
  libwireplumber-0.4-0
Use 'sudo apt autoremove' to remove it.
The following NEW packages will be installed:
  libwireplumber-0.5-0 linux-headers-6.6.51+rpt-common-rpi linux-headers-6.6.51+rpt-rpi-2712 linux-headers-6.6.51+rpt-rpi-v8
  linux-image-6.6.51+rpt-rpi-2712 linux-image-6.6.51+rpt-rpi-v8 linux-kbuild-6.6.51+rpt
The following packages will be upgraded:
  base-files curl git git-man initramfs-tools initramfs-tools-core libc-bin libc-dev-bin libc-devtools libc-l10n libc6 libc6-dbg libc6-dev
  libcamera-ipa libcamera0.3 libcurl3-gnutls libcurl4 libexpat1 libpam-systemd libpipewire-0.3-0 libpipewire-0.3-common libpipewire-0.3-modules
  libpisp-common libpisp1 libspa-0.2-bluetooth libspa-0.2-modules libssl3 libsystemd-shared libsystemd0 libudev1 linux-headers-rpi-2712
  linux-headers-rpi-v8 linux-image-rpi-2712 linux-image-rpi-v8 linux-libc-dev locales openssl pipewire pipewire-alsa
  pipewire-audio-client-libraries pipewire-bin pipewire-jack pipewire-pulse python3-gpiozero raspberrypi-sys-mods raspi-firmware raspi-utils
  raspi-utils-core raspi-utils-dt raspi-utils-eeprom raspi-utils-otp raspinfo rpi-eeprom rpicam-apps-lite systemd systemd-sysv systemd-timesyncd
  udev wireplumber
59 upgraded, 7 newly installed, 0 to remove and 0 not upgraded.

...

apt-listchanges: Reading changelogs...
apt-listchanges: News
---------------------

wireplumber (0.5.1-1) experimental; urgency=medium

  WirePlumber 0.5 was released with a new configuration system.
  The new system is based on JSON instead of Lua which makes WirePlumber >= 0.5
  incompatible with Lua conf files written for WirePlumber 0.4.
  .
  If only the default configuration (e.g the configuration shipped with the
  Debian package) is used, then there is nothing to do.
  .
  If you use custom configuration files, you will have to manually update them
  by following the migration guide. No automatic migration of old configuration
  files is performed.
  .
  This guide is available at (after having installed "wireplumber-doc"):
    /usr/share/doc/wireplumber/html/daemon/configuration/migration.html
  or
    https://pipewire.pages.freedesktop.org/wireplumber/daemon/configuration/migration.html

 -- Dylan Aïssi <[email protected]>  Sun, 31 Mar 2024 14:44:46 +0200

...

$ sudo reboot
... 

4. 之后upgrade我发现“轮子脱落了”;pipewire根本不再工作;没有蓝牙声音!

为了确认我已经知道的事情,我检查了蓝牙状态systemctl

$ systemctl status bluetooth
● bluetooth.service - Bluetooth service
     Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; preset: enabled)
     Active: active (running) since Wed 2024-10-09 22:29:30 UTC; 1h 6min ago
       Docs: man:bluetoothd(8)
   Main PID: 507 (bluetoothd)
     Status: "Running"
      Tasks: 1 (limit: 404)
        CPU: 196ms
     CGroup: /system.slice/bluetooth.service
             └─507 /usr/libexec/bluetooth/bluetoothd

Oct 09 22:29:30 rpi2w bluetoothd[507]: Starting SDP server
Oct 09 22:29:30 rpi2w bluetoothd[507]: profiles/audio/vcp.c:vcp_init() D-Bus experimental not enabled
Oct 09 22:29:30 rpi2w bluetoothd[507]: src/plugin.c:plugin_init() Failed to init vcp plugin
Oct 09 22:29:30 rpi2w bluetoothd[507]: profiles/audio/mcp.c:mcp_init() D-Bus experimental not enabled
Oct 09 22:29:30 rpi2w bluetoothd[507]: src/plugin.c:plugin_init() Failed to init mcp plugin
Oct 09 22:29:30 rpi2w bluetoothd[507]: profiles/audio/bap.c:bap_init() D-Bus experimental not enabled
Oct 09 22:29:30 rpi2w bluetoothd[507]: src/plugin.c:plugin_init() Failed to init bap plugin
Oct 09 22:29:30 rpi2w bluetoothd[507]: Bluetooth management interface 1.22 initialized
Oct 09 22:29:31 rpi2w bluetoothd[507]: profiles/sap/server.c:sap_server_register() Sap driver initialization failed.
Oct 09 22:29:31 rpi2w bluetoothd[507]: sap-server: Operation not permitted (1)

$

bluetoothctl能够连接我的扬声器,但是没有声音。

5. 使用 2024 年 8 月 16 日创建的原始映像文件恢复系统

这“使我的系统恢复”到安装等之后的状态pipewire(当时运行良好!)。所以 - 此时我的系统又恢复了功能齐全;2024 年 10 月 9 日。

6. 开始逐步升级;2024 年 10 月 9 日

通过反复试验,我开始使用 进行“增量”升级sudo apt-get install --only-upgrade X Y Z etc。每次升级后,我都会检查蓝牙是否仍在工作。在我将未安装软件包的列表缩减为以下内容后,蓝牙仍然正常工作:

$ apt list --upgradable
Listing... Done

libpipewire-0.3-common/stable-backports,stable-backports 1.2.4-1~bpo12+1 all [upgradable from: 1.2.1-1~bpo12+1]
libpipewire-0.3-modules/stable-backports 1.2.4-1~bpo12+1 arm64 [upgradable from: 1.2.1-1~bpo12+1]
libspa-0.2-bluetooth/stable-backports 1.2.4-1~bpo12+1 arm64 [upgradable from: 1.2.1-1~bpo12+1]
libspa-0.2-modules/stable-backports 1.2.4-1~bpo12+1 arm64 [upgradable from: 1.2.1-1~bpo12+1]
pipewire-alsa/stable-backports 1.2.4-1~bpo12+1 arm64 [upgradable from: 1.2.1-1~bpo12+1]
pipewire-audio-client-libraries/stable-backports,stable-backports 1.2.4-1~bpo12+1 all [upgradable from: 1.2.1-1~bpo12+1]
pipewire-bin/stable-backports 1.2.4-1~bpo12+1 arm64 [upgradable from: 1.2.1-1~bpo12+1]
pipewire-jack/stable-backports 1.2.4-1~bpo12+1 arm64 [upgradable from: 1.2.1-1~bpo12+1]
pipewire-pulse/stable-backports 1.2.4-1~bpo12+1 arm64 [upgradable from: 1.2.1-1~bpo12+1]
pipewire/stable-backports 1.2.4-1~bpo12+1 arm64 [upgradable from: 1.2.1-1~bpo12+1]
wireplumber/stable-backports 0.5.6-1~bpo12+1 arm64 [upgradable from: 0.4.17-1~bpo12+1]

7.pipewire等人显然对蓝牙故障负有全部责任。我想这对很多人来说可能“不足为奇”,但我觉得我需要尽可能具体地确定问题的根源。

我的问题是:我怎么把事情搞砸了?我以前从未使用过backports,我以为当常规渠道“赶上”时,backports一切apt都会顺利合并/安装。显然,这里发生的事情并非如此。我需要做什么来解决这个问题?

debian
  • 1 个回答
  • 33 Views
Martin Hope
Seamus
Asked: 2024-06-03 12:56:30 +0800 CST

为什么这个文件夹在“sysfs”中重复?

  • 6

我有一个运行“书虫”版本操作系统的 Raspberry Pi;操作系统的 64 位版本(如果有什么区别的话)。我已经安装了 SHT3X 温度和湿度传感器之一,它显然工作正常。它通过 I2C 接口(我相信是通道 0)连接/dev/i2c-0。我可以从文件中读取温度和湿度sysfs;我相信传感器工作正常。

我发现其中有两个相同的文件夹,sysfs其中包含 SHT3X 设备的相同输出和控制文件:

文件夹 1:/sys/devices/platform/soc/3f205000.i2c/i2c-0/0-0044/hwmon/hwmon2

$ ls -l
total 0
lrwxrwxrwx 1 root root    0 Jun  2 21:55 device -> ../../../0-0044
-rw-r--r-- 1 root root 4096 Jun  2 21:55 heater_enable
-r--r--r-- 1 root root 4096 Jun  2 21:55 humidity1_alarm
-r--r--r-- 1 root root 4096 Jun  2 21:55 humidity1_input
-rw-r--r-- 1 root root 4096 Jun  2 21:55 humidity1_max
-rw-r--r-- 1 root root 4096 Jun  2 21:55 humidity1_max_hyst
-rw-r--r-- 1 root root 4096 Jun  2 21:55 humidity1_min
-rw-r--r-- 1 root root 4096 Jun  2 21:55 humidity1_min_hyst
-r--r--r-- 1 root root 4096 Jun  2 21:55 name
lrwxrwxrwx 1 root root    0 Jun  2 21:55 of_node -> ../../../../../../../../firmware/devicetree/base/soc/i2c@7e205000/sht3x@44
drwxr-xr-x 2 root root    0 Jun  2 21:55 power
-rw-r--r-- 1 root root 4096 Jun  2 21:55 repeatability
lrwxrwxrwx 1 root root    0 Jun  2 21:55 subsystem -> ../../../../../../../../class/hwmon
-r--r--r-- 1 root root 4096 Jun  2 21:55 temp1_alarm
-r--r--r-- 1 root root 4096 Jun  2 21:55 temp1_input
-rw-r--r-- 1 root root 4096 Jun  2 21:55 temp1_max
-rw-r--r-- 1 root root 4096 Jun  2 21:55 temp1_max_hyst
-rw-r--r-- 1 root root 4096 Jun  2 21:55 temp1_min
-rw-r--r-- 1 root root 4096 Jun  2 21:55 temp1_min_hyst
-rw-r--r-- 1 root root 4096 Jun  2 21:52 uevent
-rw-r--r-- 1 root root 4096 Jun  2 21:55 update_interval

文件夹2:/sys/class/hwmon/hwmon2

$ ls -l
total 0
lrwxrwxrwx 1 root root    0 Jun  2 21:55 device -> ../../../0-0044
-rw-r--r-- 1 root root 4096 Jun  2 21:55 heater_enable
-r--r--r-- 1 root root 4096 Jun  2 21:55 humidity1_alarm
-r--r--r-- 1 root root 4096 Jun  2 21:55 humidity1_input
-rw-r--r-- 1 root root 4096 Jun  2 21:55 humidity1_max
-rw-r--r-- 1 root root 4096 Jun  2 21:55 humidity1_max_hyst
-rw-r--r-- 1 root root 4096 Jun  2 21:55 humidity1_min
-rw-r--r-- 1 root root 4096 Jun  2 21:55 humidity1_min_hyst
-r--r--r-- 1 root root 4096 Jun  2 21:55 name
lrwxrwxrwx 1 root root    0 Jun  2 21:55 of_node -> ../../../../../../../../firmware/devicetree/base/soc/i2c@7e205000/sht3x@44
drwxr-xr-x 2 root root    0 Jun  2 21:55 power
-rw-r--r-- 1 root root 4096 Jun  2 21:55 repeatability
lrwxrwxrwx 1 root root    0 Jun  2 21:55 subsystem -> ../../../../../../../../class/hwmon
-r--r--r-- 1 root root 4096 Jun  2 21:55 temp1_alarm
-r--r--r-- 1 root root 4096 Jun  2 21:55 temp1_input
-rw-r--r-- 1 root root 4096 Jun  2 21:55 temp1_max
-rw-r--r-- 1 root root 4096 Jun  2 21:55 temp1_max_hyst
-rw-r--r-- 1 root root 4096 Jun  2 21:55 temp1_min
-rw-r--r-- 1 root root 4096 Jun  2 21:55 temp1_min_hyst
-rw-r--r-- 1 root root 4096 Jun  2 21:52 uevent
-rw-r--r-- 1 root root 4096 Jun  2 21:55 update_interval

还有更多;例如:

文件夹 3:/sys/devices/platform/soc/3f205000.i2c/i2c-0/0-0044/hwmon/hwmon2/subsystem/hwmon2

我意识到涉及符号链接,但是这些文件是否有真实/不可变的sysfs位置?我读过一些关于sysfs 1、2 的参考文献,但没有发现对这种明显重复的解释。有人可以解释一下明显的冗余,以及文件是否有不可变的位置吗?

sysfs
  • 1 个回答
  • 25 Views
Martin Hope
Seamus
Asked: 2024-04-09 16:14:02 +0800 CST

如何从 Debian 反向移植卸载软件包(不是重复的 Q)

  • 1

我知道这里有几个问题与我似乎在问的问题相同。我已经尝试过这些建议1和2,但它们在这种情况下不起作用。这是发生的事情:

pi@raspberrypi0w:~ $ sudo apt -t bullseye-backports install udev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  libudev1
The following packages will be upgraded:
  libudev1 udev
2 upgraded, 0 newly installed, 0 to remove and 35 not upgraded.
Need to get 1,654 kB of archives.
After this operation, 511 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://deb.debian.org/debian bullseye-backports/main armhf udev armhf 252.5-2~bpo11+1 [1,554 kB]
Get:2 http://deb.debian.org/debian bullseye-backports/main armhf libudev1 armhf 252.5-2~bpo11+1 [100 kB]
Fetched 1,654 kB in 1s (1,267 kB/s)
Reading changelogs... Done
(Reading database ... 43648 files and directories currently installed.)
Preparing to unpack .../udev_252.5-2~bpo11+1_armhf.deb ...
Unpacking udev (252.5-2~bpo11+1) over (247.3-7+rpi1+deb11u2) ...
Preparing to unpack .../libudev1_252.5-2~bpo11+1_armhf.deb ...
Unpacking libudev1:armhf (252.5-2~bpo11+1) over (247.3-7+rpi1+deb11u2) ...
Setting up libudev1:armhf (252.5-2~bpo11+1) ...
Setting up udev (252.5-2~bpo11+1) ...
Segmentation fault
Job for systemd-udevd.service failed because a fatal signal was delivered to the control process.
See "systemctl status systemd-udevd.service" and "journalctl -xe" for details.
invoke-rc.d: initscript udev, action "restart" failed.
● systemd-udevd.service - Rule-based Manager for Device Events and Files
     Loaded: loaded (/lib/systemd/system/systemd-udevd.service; static)
     Active: activating (start) since Tue 2024-04-09 07:36:27 UTC; 130ms ago
TriggeredBy: ● systemd-udevd-control.socket
             ● systemd-udevd-kernel.socket
       Docs: man:systemd-udevd.service(8)
             man:udev(7)
   Main PID: 8773 ((md-udevd))
      Tasks: 1
        CPU: 45ms
     CGroup: /system.slice/systemd-udevd.service
             └─8773 (md-udevd)

Apr 09 07:36:28 raspberrypi0w systemd[1]: Stopped Rule-based Manager for Device Events and Files.
Apr 09 07:36:28 raspberrypi0w systemd[1]: Starting Rule-based Manager for Device Events and Files...
Apr 09 07:36:28 raspberrypi0w systemd[1]: systemd-udevd.service: Main process exited, code=killed, status=11/SEGV
Apr 09 07:36:28 raspberrypi0w systemd[1]: systemd-udevd.service: Failed with result 'signal'.
Apr 09 07:36:28 raspberrypi0w systemd[1]: Failed to start Rule-based Manager for Device Events and Files.
Apr 09 07:36:28 raspberrypi0w systemd[1]: systemd-udevd.service: Scheduled restart job, restart counter is at 5.
Apr 09 07:36:28 raspberrypi0w systemd[1]: Stopped Rule-based Manager for Device Events and Files.
Apr 09 07:36:28 raspberrypi0w systemd[1]: systemd-udevd.service: Start request repeated too quickly.
Apr 09 07:36:28 raspberrypi0w systemd[1]: systemd-udevd.service: Failed with result 'signal'.
Apr 09 07:36:28 raspberrypi0w systemd[1]: Failed to start Rule-based Manager for Device Events and Files.
dpkg: error processing package udev (--configure):
 installed udev package post-installation script subprocess returned error exit status 1
Processing triggers for libc-bin (2.31-13+rpt2+rpi1+deb11u8) ...
Processing triggers for man-db (2.9.4-2) ...
Processing triggers for initramfs-tools (0.140) ...
Errors were encountered while processing:
 udev
E: Sub-process /usr/bin/dpkg returned an error code (1)

尝试的“恢复”并不是很有趣:

pi@raspberrypi0w:~ $ apt install ${udev}/bullseye
Illegal instruction

我尝试了其他一些“回归”:

pi@raspberrypi0w:~ $ sudo apt install udev
Illegal instruction
pi@raspberrypi0w:~ $ sudo apt-get install udev/stable
Illegal instruction
pi@raspberrypi0w:~ $ sudo apt-get install udev/old-stable
Illegal instruction

“分段错误”——听起来很严重:)。我不确定这是什么意思;即系统是否自动拒绝udev升级并自动恢复?——或者是我介入了?我等了几分钟并尝试了这个:

$ systemctl status systemd-udevd.service
● systemd-udevd.service - Rule-based Manager for Device Events and Files
     Loaded: loaded (/lib/systemd/system/systemd-udevd.service; static)
     Active: failed (Result: signal) since Tue 2024-04-09 07:36:28 UTC; 28min ago
TriggeredBy: ● systemd-udevd-control.socket
             ● systemd-udevd-kernel.socket
       Docs: man:systemd-udevd.service(8)
             man:udev(7)
    Process: 8776 ExecStart=/lib/systemd/systemd-udevd (code=killed, signal=SEGV)
   Main PID: 8776 (code=killed, signal=SEGV)
        CPU: 199ms

Apr 09 07:36:28 raspberrypi0w systemd[1]: systemd-udevd.service: Scheduled restart job, restart counter is at 5.
Apr 09 07:36:28 raspberrypi0w systemd[1]: Stopped Rule-based Manager for Device Events and Files.
Apr 09 07:36:28 raspberrypi0w systemd[1]: systemd-udevd.service: Start request repeated too quickly.
Apr 09 07:36:28 raspberrypi0w systemd[1]: systemd-udevd.service: Failed with result 'signal'.
Apr 09 07:36:28 raspberrypi0w systemd[1]: Failed to start Rule-based Manager for Device Events and Files.

我昨晚有一个很好的(图像)备份,所以如果我杀死了我的操作系统,我可以恢复。但是,如果可能的话,我更愿意在不求助于备份的情况下修复此问题。

我应该怎么办?

debian
  • 1 个回答
  • 67 Views
Martin Hope
Seamus
Asked: 2024-04-09 15:14:39 +0800 CST

Debian 向后移植:如何列出 bullseye-backports 的所有可用升级

  • 7

我没有成功地寻找一种方法来列出Debian 向后移植的所有可用升级(特别是bullseye-backports):

  • 我已经添加deb http://deb.debian.org/debian bullseye-backports main contrib non-free到/etc/apt/sources.list.

  • 我已经运行sudo apt update成功了

  • 我运行的sudo apt list --upgradeable bullseye-backports结果是“空”

  • 我已经跑了sudo apt list --upgradeable -t bullseye-backports;出现错误

  • 我已经跑了sudo apt -t bullseye-backports upgrade;我得到了要安装的新软件包的列表、要升级的现有软件包的列表,以及[Y/n]继续处理整个批次的选项。

有没有办法简单地列出可升级的软件包bullseye-backports?

debian
  • 1 个回答
  • 56 Views
Martin Hope
Seamus
Asked: 2024-03-19 08:17:16 +0800 CST

rsync:需要帮助解决“命名法”问题

  • 5

我已经使用了rsync一段时间了,一直表现都很好。然而,尝试将rsync我的 macOS(源、APFS 文件系统)与我的 Synology NAS(目标、btrfs 文件系统)一起使用似乎总是会带来我在rsync.

我的一些“挑战”与(特别是)文档中使用的术语rsync有关;IE man rsync。我希望对这个问题找到一些澄清;具体如下:

rsync是“单向”同步;( )man rsync描述如下:-i--itemize-changes
[output is cryptic string] that is 11 letters long. The general format is    
YXcstpoguax, where Y is replaced by the type of update being done ... 

A < means that a file is being transferred to the remote host (sent)  

A > means that a file is being transferred to the local host (received)

当使用以下rsync命令时:

# Version:
rsync --version
rsync  version 3.2.7  protocol version 31   

# The command (simplified)
rsync -rlAtgoDiv /Users/seamus/Desktop/ /Volumes/backups/Desktop

我得到以下输出:

>f..t....... BooksBlogsEtc/pix/Capucine02.jpg

这就是我失去情节的地方。上面>说"file being transferred to local host (received)",但从表面上看,它表示该文件正在从NAS 传输到我的 Mac上- 正在接收该文件。IOW,我已将该术语与and (在较小程度上)混为一谈。但这似乎并不是发生的情况 - 上例中的文件正在从源/Mac发送到目标/NAS。sourcesentlocal host

有人可以向我解释这些明显的差异吗?

rsync
  • 1 个回答
  • 32 Views
Martin Hope
Seamus
Asked: 2024-02-17 09:44:37 +0800 CST

为什么 grep 忽略前导“.”?

  • 1

我试图在下载的网页中找到一个字符串curl。我用来查找与正则表达式grep模式匹配的字符串。

以下是我试图找到的字符串:

./download/file.php?id=86753

该字符串是网页中这个较大字符串的一部分:

href="./download/file.php?id=86753"

我正在使用的咒语grep如下:

grep -Eo '\.\/download\/file\.php\?id=[0-9]+' dlfile.html

但这在 html 文件中找不到任何内容。但是,如果我进行grep如下修改,我会得到两 (2) 个匹配项。第一场比赛就是我需要的;第二个是无用的干扰,不得包含在内:

grep -Eo '\/download\/file\.php\?id=[0-9]+' dlfile.html
/download/file.php?id=86753
/download/file.php?id=62517

包含第二个(不需要的)匹配的字符串如下:

href="https://web.archive.org/web/20190824162104/https://www.somewhere.com/forums/download/file.php?id=62517&amp;sid=907ab04af81e19ad758c5bcf8ebdca32"

问题似乎是无法识别.字符串中的前导(点)。请注意,这是所需字符串和不需要的字符串之间的主要区别。

问:为什么这不起作用,我需要什么?


我的环境:Debian 衍生品(Raspberry Pi),“bullseye”版本

grep我正在使用哪个bash?

$ grep --version
grep (GNU grep) 3.6
...
$ bash --version
GNU bash, version 5.1.4(1)-release (arm-unknown-linux-gnueabihf)
grep
  • 4 个回答
  • 157 Views
Martin Hope
Seamus
Asked: 2024-01-16 16:04:29 +0800 CST

vim 可以在不退出的情况下关闭文件吗?

  • 8

我在 中打开了一个文件vim,并且我已经完成了编辑。有没有办法让我关闭文件(或缓冲区)以使vim屏幕空白?

vim
  • 1 个回答
  • 680 Views
Martin Hope
Seamus
Asked: 2024-01-08 15:26:39 +0800 CST

为“exec >>(tee -ia $OUT)”创建选项以跳过标准输出

  • 5

我正在尝试修改使用以下内容的脚本:

# first portion of script
# ...
exec > >(tee -ia $OUT)
# ...
# second portion of script 

我对这个脚本的问题是它会向stdout(我的终端)产生大量输出。脚本作者没有包含消除终端输出的选项。我想添加一个选项来删除stdout, 并仅在文件中获取输出$OUT。

这是我尝试过的:

TERM_OPT="OFF"

# first portion of script
# ...

if [ $TERM_OPT != "OFF" ]; then
     exec > >(tee -ia $OUT)
else {

# ...
# second portion of script 

} > $OUT
fi

这似乎有效,但我不确定在这种情况下是否使用大括号,因为 分组命令的 GNU 部分(似乎)声明列表后面需要一个分号。但添加或删除似乎没有什么区别。我想知道是否应该使用括号而不是花括号,但这会导致 中的所有内容都在子 shell 中执行。我对此并不是特别热衷,因为它是其他人的脚本,而且我不清楚subshel​​l 的含义(我没有尝试过)。{};;()()

我尝试的另一件事似乎是一个黑客,但我读到其他人使用它,它似乎也工作正常:

TERM_OPT="OFF"

# first portion of script
# ...

if [ $TERM_OPT != "OFF" ]; then
     exec > >(tee -ia $OUT)
else
     exec > >(tee -ia $OUT 1> /dev/null)
fi

# ...
# second portion of script 

我喜欢这个,因为它看起来更独立,但这并不是一个需要考虑的因素。

所以问题是: 执行此操作的正确方法是什么?我的意思是,在 后选择退出终端输出的正确方法是什么exec > >(tee -ia $OUT)?这些解决方案中的一种比另一种更可取——还是我需要做一些完全不同的事情?

bash
  • 2 个回答
  • 29 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve