Smartctl

udisks SMART / APM 停止工作?

  • May 8, 2017

我有一台裝有該死的西部數據硬碟的筆記型電腦。我使用 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.

儘管此時正在啟動 udisk:

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)應該重新應用 resume 上的設置,但在我的系統上似乎並非如此。我嘗試禁用我的腳本以防它破壞了某些東西,但是在從掛起恢復後,再次hdparm -B /dev/sda顯示128.

註銷並重新啟動解決了這兩個問題。SMART 和 APM 出現在 GNOME 磁碟中。重新啟用我的恢復腳本後,驅動器 APM 設置在從睡眠恢復後重新設置為 254。

重啟肯定會清除某些狀態,而重啟 udisk 不會清除這些狀態。

這發生了第二次,我在 udisks 停止工作的地方注意到了下面的 udev 錯誤。

執行sudo udevadm trigger /dev/sda允許 udev 重新掃描磁碟,並使 udisk 無需重新啟動即可再次工作。udevadm info /dev/sda在觸發器顯示它缺少 udisk 必須使用的屬性之前執行( diff)。

udev 事件正在超時,因為 udev 正在計算暫停所花費的時間。我已經送出了一個包含具體細節的錯誤。

一個 udev 事件在 sda 的掛起時觸發,因為我添加的重新啟動 udisk 的鉤子也在掛起時執行。它為設備設置 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/

引用自:https://unix.stackexchange.com/questions/347085