disk/hdd-parking failed on non-hdd system and cause the system enters "degraded"

Bug #1910516 reported by jeremyszu
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Checkbox Provider - Base
Expired
Medium
Kent Lin
OEM Priority Project
Triaged
Critical
jeremyszu

Bug Description

Here are two problems.

1. disk/hdd-parking needs to check the system has HDD(s) as extra "requires:"
2. the hdapds should not be installed in non-HDD system OR the hdapds.service should be disabled if there is no HDD.

* plainbox-provider-certification-client installed hdapsd as Recommends by default.[1]
* hdapds will create a systemd service "hdapds.service" and if there is no hdd in the system then the system will enter "degraded" mode. [2]
* disk/hdd-parking use the command "command: hdd_parking.py" and it use
```
    try:
        hdapsd = Popen(
            ['/usr/sbin/hdapsd'], stdout=PIPE, stderr=PIPE,
            universal_newlines=True)
    except OSError as err:
```
without checking the hdd, it cause the test case failed[3].
* The DUT is only has nvme[4]

As least, the "disk/hdd-parking" needs to be executed only if the HDD presents.
I suggest to disable "hdapds.service" when there is no HDD in the system if the "plainbox-provider-certification-client" dependencies could not be checked in runtime.

[1]
$ apt show plainbox-provider-certification-client
Package: plainbox-provider-certification-client
...
Recommends: ..., hdapsd, ...

[2]
● hdapsd.service - hdapsd hard drive active protection system daemon
     Loaded: loaded (/lib/systemd/system/hdapsd.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Wed 2021-01-06 18:32:25 CST; 22h ago
       Docs: man:hdapsd(8)
    Process: 760 ExecStart=/usr/sbin/hdapsd (code=exited, status=1/FAILURE)
   Main PID: 760 (code=exited, status=1/FAILURE)

-- Logs begin at Wed 2020-12-30 20:24:13 CST, end at Thu 2021-01-07 17:35:58 CST. --
systemd[1]: Started hdapsd hard drive active protection system daemon.
hdapsd[760]: Wed Jan 6 18:32:25 2021: Could not detect any devices.
hdapsd[760]: Wed Jan 6 18:32:25 2021: Starting hdapsd
hdapsd[760]: Wed Jan 6 18:32:25 2021: WARNING: You did not supply any devices to protect, trying autodetection.
hdapsd[760]: Usage: hdapsd [OPTIONS]
hdapsd[760]: -c --cfgfile=<cfgfile> Load configuration from <cfgfile>.
hdapsd[760]: By default, configuration is read from /etc/hdapsd.conf
hdapsd[760]: -d --device=<device> <device> is likely to be hda or sda.
hdapsd[760]: Can be given multiple times
hdapsd[760]: to protect multiple devices.
hdapsd[760]: -f --force Force unloading heads, even if kernel thinks
hdapsd[760]: differently (on pre ATA7 drives).
hdapsd[760]: This only works when adding devices by hand (-d).
hdapsd[760]: -r --force-rotational Autodetect drives as rotational, even if
hdapsd[760]: kernel thinks they are not.
hdapsd[760]: -s --sensitivity=<sensitivity> How sensitive hdapsd should be to movements.
hdapsd[760]: Defaults to 15, higher value means less
hdapsd[760]: sensitive.
hdapsd[760]: -a --adaptive Adaptive threshold (automatic increase
hdapsd[760]: when the built-in keyboard/mouse are used).
hdapsd[760]: -v --verbose Get verbose statistics.
hdapsd[760]: -b --background Run the process in the background.
hdapsd[760]: -p --pidfile[=<pidfile>] Create a pid file when running
hdapsd[760]: in background.
hdapsd[760]: If <pidfile> is not specified,
hdapsd[760]: it's set to /var/run/hdapsd.pid.
hdapsd[760]: -t --dry-run Don't actually park the drive.
hdapsd[760]: -y --poll-sysfs Force use of sysfs interface to
hdapsd[760]: accelerometer.
hdapsd[760]: -H --hardware-logic Use the hardware fall detection logic instead of
hdapsd[760]: the software one (-s/--sensitivity and -a/--adaptive
hdapsd[760]: have no effect in this mode).
hdapsd[760]: -S --software-logic Use the software fall detection logic even if the
hdapsd[760]: hardware one is available.
hdapsd[760]: -L --no-leds Don't blink the LEDs.
hdapsd[760]: -l --syslog Log to syslog instead of stdout/stderr.
hdapsd[760]: -V --version Display version information and exit.
hdapsd[760]: -h --help Display this message and exit.
hdapsd[760]: You can send SIGUSR1 to deactivate hdapsd for 8 seconds.
hdapsd[760]: Send bugs, comments and suggestions to <email address hidden>
systemd[1]: hdapsd.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: hdapsd.service: Failed with result 'exit-code'.

[3]
$ cat com.canonical.certification__disk_hdd-parking.stdout
Starting HDD protection test - move the system around on all axis. No particular force should be required.
Tue Jan 5 01:52:02 2021: Starting hdapsd
Tue Jan 5 01:52:02 2021: WARNING: You did not supply any devices to protect, trying autodetection.
Usage: hdapsd [OPTIONS]

   -c --cfgfile=<cfgfile> Load configuration from <cfgfile>.
                                     By default, configuration is read from /etc/hdapsd.conf
   -d --device=<device> <device> is likely to be hda or sda.
                                     Can be given multiple times
                                     to protect multiple devices.
   -f --force Force unloading heads, even if kernel thinks
                                     differently (on pre ATA7 drives).
                                     This only works when adding devices by hand (-d).
   -r --force-rotational Autodetect drives as rotational, even if
                                     kernel thinks they are not.
   -s --sensitivity=<sensitivity> How sensitive hdapsd should be to movements.
                                     Defaults to 15, higher value means less
                                     sensitive.
   -a --adaptive Adaptive threshold (automatic increase
                                     when the built-in keyboard/mouse are used).
   -v --verbose Get verbose statistics.
   -b --background Run the process in the background.
   -p --pidfile[=<pidfile>] Create a pid file when running
                                     in background.
                                     If <pidfile> is not specified,
                                     it's set to /var/run/hdapsd.pid.
   -t --dry-run Don't actually park the drive.
   -y --poll-sysfs Force use of sysfs interface to
                                     accelerometer.
   -H --hardware-logic Use the hardware fall detection logic instead of
                                     the software one (-s/--sensitivity and -a/--adaptive
                                     have no effect in this mode).
   -S --software-logic Use the software fall detection logic even if the
                                     hardware one is available.
   -L --no-leds Don't blink the LEDs.
   -l --syslog Log to syslog instead of stdout/stderr.

   -V --version Display version information and exit.
   -h --help Display this message and exit.

You can send SIGUSR1 to deactivate hdapsd for 8 seconds.

Send bugs, comments and suggestions to <email address hidden>
[4]
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
...
nvme0n1 259:0 0 953.9G 0 disk
|-nvme0n1p1 259:1 0 512.1M 0 part /var/lib/snapd/hostfs/boot/efi
|-nvme0n1p2 259:2 0 4.3G 0 part
`-nvme0n1p3 259:3 0 949G 0 part /var/lib/snapd/hostfs

jeremyszu (os369510)
tags: added: oem-priority originate-from-1910194 stella
Changed in oem-priority:
assignee: nobody → jeremyszu (os369510)
status: New → Triaged
importance: Undecided → High
importance: High → Critical
jeremyszu (os369510)
tags: added: originate-from-1929666
Revision history for this message
jeremyszu (os369510) wrote :

Hi Pierre,

could you please help to take a look at this issue?

tags: added: originate-from-1977791
Revision history for this message
Pierre Equoy (pieq) wrote :

Thanks for filing this up! I had a similar issue in another project and I thought it originated in the image content... Turns out it's a problem with Checkbox!

Thanks for spending time to investigate this as well. I'll see what we can do about this.

Changed in plainbox-provider-checkbox:
status: New → Confirmed
importance: Undecided → Medium
Pierre Equoy (pieq)
Changed in plainbox-provider-checkbox:
assignee: nobody → Kent Lin (kent-jclin)
milestone: none → 0.66.0
Revision history for this message
Pierre Equoy (pieq) wrote :

@Kent, given that there is less and less devices using spinning hard drives, and that this job (disk/hdd-parking) is not a cert-blocker, we are thinking of retiring this job from the certification test plan[1] (and removing the needs for hdapsd to be packaged in our Debian release).

What do you think from a QA point of view?

[1] https://git.launchpad.net/plainbox-provider-checkbox/tree/units/disk/test-plan.pxu#n7

jeremyszu (os369510)
tags: removed: originate-from-1977791
Pierre Equoy (pieq)
Changed in plainbox-provider-checkbox:
milestone: 2.0.0 → 2.1.0
Revision history for this message
Maksim Beliaev (beliaev-maksim) wrote :

Bug was migrated to GitHub: https://github.com/canonical/checkbox/issues/125.
Bug is no more monitored here.

Changed in plainbox-provider-checkbox:
status: Confirmed → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.