我有一台笔记本电脑,配备了该死的西部数据硬盘。我已经使用 SMART 来查看加载/卸载周期 ( smartctl -a|grep Load
)。它们增长得太快,接近 300,000 的生命周期限制。
我使用 GNOME Disks 将硬盘驱动器 APM 更改为 254,它们停止增加。这本身并不是一个解决方案:我还必须创建/usr/lib/systemd/system-sleep/harddrive.sh
一个解决方案systemctl restart udisks2
- 当此驱动器设置丢失时,处理从挂起的恢复。
但几个月后,我注意到驱动器再次发出咔哒声,并且加载/卸载确实在增加。什么地方出了错?
我还去查看了 GNOME Disks。我再也找不到 SMART 数据,也找不到驱动器 APM 设置!发生了什么?!
我在 SELinux 故障排除程序中没有 SELinux 警报。
$ rpm -q gnome-disk-utility
gnome-disk-utility-3.22.1-1.fc25.x86_64
$ rpm -q --whatprovides /usr/libexec/udisks2/udisksd
storaged-2.6.2-2.fc25.x86_64
$ systemctl status udisks2
● udisks2.service - Disk Manager
Loaded: loaded (/usr/lib/systemd/system/udisks2.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2017-02-23 14:10:47 GMT; 3min 55s ago
Docs: man:udisks(8)
Main PID: 6416 (udisksd)
Tasks: 5 (limit: 4915)
CGroup: /system.slice/udisks2.service
└─6416 /usr/libexec/udisks2/udisksd --no-debug
Feb 23 14:10:47 alan-laptop systemd[1]: Starting Disk Manager...
Feb 23 14:10:47 alan-laptop udisksd[6416]: udisks daemon version 2.6.2 starting
Feb 23 14:10:47 alan-laptop udisksd[6416]: Acquired the name org.freedesktop.UDisks2 on the system message bus
Feb 23 14:10:47 alan-laptop systemd[1]: Started Disk Manager.
$ journalctl -b |grep udisks.*sda
Feb 21 09:05:42 alan-laptop udisksd[870]: Applying configuration from /etc/udisks2/WDC-WD5000LPLX-75ZNTT0-WX71A958AN1Y.conf to /dev/sda
Feb 21 09:05:42 alan-laptop udisksd[870]: Set APM level to 254 on /dev/sda [WDC-WD5000LPLX-75ZNTT0-WX71A958AN1Y]
Feb 21 10:20:56 alan-laptop udisksd[3449]: Applying configuration from /etc/udisks2/WDC-WD5000LPLX-75ZNTT0-WX71A958AN1Y.conf to /dev/sda
Feb 21 10:20:56 alan-laptop udisksd[3449]: Set APM level to 254 on /dev/sda [WDC-WD5000LPLX-75ZNTT0-WX71A958AN1Y]
...
Feb 23 10:07:16 alan-laptop udisksd[15542]: Applying configuration from /etc/udisks2/WDC-WD5000LPLX-75ZNTT0-WX71A958AN1Y.conf to /dev/sda
Feb 23 10:07:17 alan-laptop udisksd[15542]: Set APM level to 254 on /dev/sda [WDC-WD5000LPLX-75ZNTT0-WX71A958AN1Y]
Feb 23 12:31:36 alan-laptop udisksd[4243]: Applying configuration from /etc/udisks2/WDC-WD5000LPLX-75ZNTT0-WX71A958AN1Y.conf to /dev/sda
Feb 23 12:31:36 alan-laptop udisksd[4243]: Set APM level to 254 on /dev/sda [WDC-WD5000LPLX-75ZNTT0-WX71A958AN1Y]
$ date
Thu 23 Feb 14:25:05 GMT 2017
我针对挂起问题的特定解决方法目前无效。此时恢复时配置未应用:
Feb 23 13:02:55 alan-laptop systemd-sleep[4238]: System resumed.
尽管此时启动了 udisks,但仍然出现这种情况:
Feb 23 13:02:55 alan-laptop udisksd[4357]: udisks daemon version 2.6.2 starting
Feb 23 13:02:55 alan-laptop udisksd[4357]: Acquired the name org.freedesktop.UDisks2 on the system message bus
某些版本的 storaged (udisks) 是应该重新应用简历上的设置,但在我的系统上似乎并非如此。我尝试禁用我的脚本,以防它破坏某些内容,但再次从挂起恢复后,hdparm -B /dev/sda
显示128
.
答案1
注销并重新启动解决了这两个问题。 SMART 和 APM 出现在 GNOME 磁盘中。重新启用我的恢复脚本后,驱动器 APM 设置在从睡眠状态恢复后重新设置为 254。
肯定有一些状态是通过重新启动而清除的,而重新启动 udisk 并没有清除这些状态。
这种情况第二次发生,我注意到下面的 udev 错误在 udisks 停止工作的地方。
运行sudo udevadm trigger /dev/sda
允许 udev 重新扫描磁盘,并使 udisk 再次工作而无需重新启动。udevadm info /dev/sda
在触发器显示它缺少 udisks 必须使用的属性之前运行(差异)。
udev 事件超时,因为 udev 正在计算挂起的时间。我已经提交了一份漏洞以及具体细节。
udev 事件在 sda 挂起时触发,因为我添加的用于重新启动 udisks 的钩子也在挂起时运行。它设置设备的 APM 值,这需要打开它(然后关闭它)。每当块设备关闭时都会生成 Udev 更改事件,以便在运行 fdisk 或 mke2fs 等实用程序后重新扫描块设备。
Feb 23 08:21:05 alan-laptop kernel: Restarting tasks ...
Feb 23 08:21:05 alan-laptop kernel: usb 2-1: USB disconnect, device number 42
Feb 23 08:21:05 alan-laptop kernel: pci_bus 0000:01: Allocating resources
Feb 23 08:21:05 alan-laptop kernel: pci_bus 0000:02: Allocating resources
Feb 23 08:21:05 alan-laptop kernel: pci_bus 0000:03: Allocating resources
Feb 23 08:21:05 alan-laptop kernel: pci_bus 0000:01: Allocating resources
Feb 23 08:21:05 alan-laptop kernel: pci_bus 0000:02: Allocating resources
Feb 23 08:21:05 alan-laptop kernel: pci_bus 0000:03: Allocating resources
Feb 23 08:21:05 alan-laptop kernel: pci_bus 0000:01: Allocating resources
Feb 23 08:21:05 alan-laptop kernel: pci_bus 0000:02: Allocating resources
Feb 23 08:21:05 alan-laptop kernel: pci_bus 0000:03: Allocating resources
Feb 23 08:21:05 alan-laptop kernel: done.
Feb 23 08:21:05 alan-laptop systemd[1]: Time has been changed
Feb 23 08:21:05 alan-laptop audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=mlocate-upda
tedb comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Feb 23 08:21:05 alan-laptop bluetoothd[865]: Endpoint unregistered: sender=:1.177 path=/MediaEndpoint/A2DPSource
Feb 23 08:21:05 alan-laptop org.gnome.Shell.desktop[1173]: Window manager warning: Failed to set power save mode for output eDP-1: Permission denied
Feb 23 08:21:05 alan-laptop systemd-logind[876]: Lid opened.
Feb 23 08:21:05 alan-laptop bluetoothd[865]: Endpoint unregistered: sender=:1.177 path=/MediaEndpoint/A2DPSink
Feb 23 08:21:05 alan-laptop systemd[1096]: Time has been changed
Feb 23 08:21:05 alan-laptop bluetoothd[865]: Endpoint unregistered: sender=:1.46 path=/MediaEndpoint/A2DPSource
Feb 23 08:21:05 alan-laptop systemd-udevd[634]: seq 5075 '/devices/pci0000:00/0000:00:1f.2/ata2/host1/target1:0:0/1:0:0:0/block/sda/sda5' killed
Feb 23 08:21:05 alan-laptop bluetoothd[865]: Endpoint unregistered: sender=:1.46 path=/MediaEndpoint/A2DPSink
Feb 23 08:21:05 alan-laptop systemd-udevd[634]: seq 5073 '/devices/pci0000:00/0000:00:1f.2/ata2/host1/target1:0:0/1:0:0:0/block/sda/sda3' is taking a
long time
Feb 23 08:21:05 alan-laptop dbus-daemon[866]: [system] Rejected send message, 1 matched rules; type="error", sender=":1.177" (uid=1000 pid=6695 comm="
/usr/bin/pulseaudio --start --log-target=syslog " label="unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023") interface="(unset)" member="(unset)"
error name="org.bluez.MediaEndpoint1.Error.NotImplemented" requested_reply="0" destination=":1.1" (uid=0 pid=865 comm="/usr/libexec/bluetooth/bluetoot
hd " label="system_u:system_r:bluetooth_t:s0")
Feb 23 08:21:05 alan-laptop systemd-udevd[634]: seq 5072 '/devices/pci0000:00/0000:00:1f.2/ata2/host1/target1:0:0/1:0:0:0/block/sda/sda2' is taking a
long time
Feb 23 08:21:05 alan-laptop dbus-daemon[866]: [system] Rejected send message, 1 matched rules; type="error", sender=":1.177" (uid=1000 pid=6695 comm="/usr/bin/pulseaudio --start --log-target=syslog " label="unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023") interface="(unset)" member="(unset)" error name="org.bluez.MediaEndpoint1.Error.NotImplemented" requested_reply="0" destination=":1.1" (uid=0 pid=865 comm="/usr/libexec/bluetooth/bluetoot
hd " label="system_u:system_r:bluetooth_t:s0")
Feb 23 08:21:05 alan-laptop systemd-udevd[634]: seq 5074 '/devices/pci0000:00/0000:00:1f.2/ata2/host1/target1:0:0/1:0:0:0/block/sda/sda4' killed
Feb 23 08:21:05 alan-laptop dbus-daemon[866]: [system] Rejected send message, 1 matched rules; type="error", sender=":1.177" (uid=1000 pid=6695 comm="/usr/bin/pulseaudio --start --log-target=syslog " label="unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023") interface="(unset)" member="(unset)" error name="org.bluez.MediaEndpoint1.Error.NotImplemented" requested_reply="0" destination=":1.1" (uid=0 pid=865 comm="/usr/libexec/bluetooth/bluetoothd " label="system_u:system_r:bluetooth_t:s0")
Feb 23 08:21:05 alan-laptop systemd-udevd[634]: seq 5073 '/devices/pci0000:00/0000:00:1f.2/ata2/host1/target1:0:0/1:0:0:0/block/sda/sda3' killed
Feb 23 08:21:05 alan-laptop dbus-daemon[866]: [system] Rejected send message, 1 matched rules; type="error", sender=":1.177" (uid=1000 pid=6695 comm="/usr/bin/pulseaudio --start --log-target=syslog " label="unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023") interface="(unset)" member="(unset)" error name="org.bluez.MediaEndpoint1.Error.NotImplemented" requested_reply="0" destination=":1.1" (uid=0 pid=865 comm="/usr/libexec/bluetooth/bluetoothd " label="system_u:system_r:bluetooth_t:s0")
Feb 23 08:21:05 alan-laptop systemd-udevd[634]: seq 5072 '/devices/pci0000:00/0000:00:1f.2/ata2/host1/target1:0:0/1:0:0:0/block/sda/sda2' killed
Feb 23 08:21:05 alan-laptop dbus-daemon[866]: [system] Rejected send message, 1 matched rules; type="error", sender=":1.46" (uid=1001 pid=1704 comm="/usr/bin/pulseaudio --start --log-target=syslog " label="unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023") interface="(unset)" member="(unset)" error name="org.bluez.MediaEndpoint1.Error.NotImplemented" requested_reply="0" destination=":1.1" (uid=0 pid=865 comm="/usr/libexec/bluetooth/bluetoothd " label="system_u:system_r:bluetooth_t:s0")
Feb 23 08:21:05 alan-laptop systemd-udevd[634]: seq 5074 '/devices/pci0000:00/0000:00:1f.2/ata2/host1/target1:0:0/1:0:0:0/block/sda/sda4' is taking a long time
Feb 23 08:21:05 alan-laptop dbus-daemon[866]: [system] Rejected send message, 1 matched rules; type="error", sender=":1.46" (uid=1001 pid=1704 comm="/usr/bin/pulseaudio --start --log-target=syslog " label="unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023") interface="(unset)" member="(unset)" error name="org.bluez.MediaEndpoint1.Error.NotImplemented" requested_reply="0" destination=":1.1" (uid=0 pid=865 comm="/usr/libexec/bluetooth/bluetoothd " label="system_u:system_r:bluetooth_t:s0")
Feb 23 08:21:05 alan-laptop systemd-udevd[634]: seq 5075 '/devices/pci0000:00/0000:00:1f.2/ata2/host1/target1:0:0/1:0:0:0/block/sda/sda5' is taking a long time
Feb 23 08:21:05 alan-laptop dbus-daemon[866]: [system] Rejected send message, 1 matched rules; type="error", sender=":1.46" (uid=1001 pid=1704 comm="/usr/bin/pulseaudio --start --log-target=syslog " label="unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023") interface="(unset)" member="(unset)" error name="org.bluez.MediaEndpoint1.Error.NotImplemented" requested_reply="0" destination=":1.1" (uid=0 pid=865 comm="/usr/libexec/bluetooth/bluetoothd " label="system_u:system_r:bluetooth_t:s0")
Feb 23 08:21:05 alan-laptop systemd[1560]: Time has been changed
May 01 14:53:27 alan-laptop systemd[1]: Starting Suspend...
May 01 14:53:24 alan-laptop wpa_supplicant[1103]: wlp2s0: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD
May 01 14:53:27 alan-laptop systemd[1]: Stopping Disk Manager...
May 01 14:53:24 alan-laptop wpa_supplicant[1103]: wlp2s0: CTRL-EVENT-REGDOM-CHANGE init=USER type=COUNTRY alpha2=GB
May 01 14:53:27 alan-laptop systemd[1]: Stopped Disk Manager.
May 01 14:53:24 alan-laptop chronyd[937]: Source 85.199.214.100 offline
May 01 14:53:27 alan-laptop systemd[1]: Starting Disk Manager...
May 01 14:53:24 alan-laptop chronyd[937]: Source 85.199.214.98 offline
May 01 14:53:28 alan-laptop systemd[1]: Started Disk Manager.
May 01 14:53:24 alan-laptop chronyd[937]: Source 193.150.34.2 offline
May 01 14:53:28 alan-laptop systemd-sleep[31584]: Suspending system...
May 01 14:53:24 alan-laptop chronyd[937]: Source 85.199.214.101 offline
May 01 15:19:01 alan-laptop systemd[1]: Time has been changed
May 01 14:53:24 alan-laptop chronyd[937]: Can't synchronise: no selectable sources
May 01 15:19:01 alan-laptop systemd-logind[877]: Lid opened.
May 01 14:53:25 alan-laptop wpa_supplicant[1103]: nl80211: deinit ifname=p2p-dev-wlp2s0 disabled_11b_rates=0
May 01 15:19:01 alan-laptop systemd-udevd[639]: seq 5485 '/devices/pci0000:00/0000:00:1f.2/ata2/host1/target1:0:0/1:0:0:0/block/sda' killed
May 01 14:53:26 alan-laptop wpa_supplicant[1103]: nl80211: deinit ifname=wlp2s0 disabled_11b_rates=0
May 01 15:19:01 alan-laptop systemd[1578]: Time has been changed
May 01 14:53:27 alan-laptop udisksd[31589]: udisks daemon version 2.6.2 starting
May 01 15:19:01 alan-laptop systemd-udevd[639]: seq 5485 '/devices/pci0000:00/0000:00:1f.2/ata2/host1/target1:0:0/1:0:0:0/block/sda' is taking a long
May 01 14:53:28 alan-laptop udisksd[31589]: Applying configuration from /etc/udisks2/WDC-WD5000LPLX-75ZNTT0-WX71A958AN1Y.conf to /dev/sda
May 01 15:19:01 alan-laptop systemd[7053]: Time has been changed
May 01 14:53:28 alan-laptop udisksd[31589]: Set APM level to 254 on /dev/sda [WDC-WD5000LPLX-75ZNTT0-WX71A958AN1Y]
May 01 15:19:01 alan-laptop systemd-udevd[639]: worker [31598] terminated by signal 9 (Killed)
May 01 14:53:28 alan-laptop udisksd[31589]: Acquired the name org.freedesktop.UDisks2 on the system message bus
May 01 15:19:01 alan-laptop systemd-udevd[639]: worker [31598] failed while handling '/devices/pci0000:00/0000:00:1f.2/ata2/host1/target1:0:0/1:0:0:0/