smartmontools init scripts fails on 'status' action

Bug #491324 reported by Jarl
24
This bug affects 4 people
Affects Status Importance Assigned to Milestone
smartmontools (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: smartmontools

ubuntu Karmic koala 9.10

I have smartmontools enabled and it is running, however the status action of the init script fails.

$ ps -lef | grep smartd
5 S root 1592 1 0 80 0 - 3017 hrtime Nov27 ? 00:00:00 /usr/sbin/smartd --pidfile /var/run/smartd.pid
0 S jarl 16487 15853 0 80 0 - 1836 pipe_w 12:11 pts/0 00:00:00 grep smartd
$ sudo invoke-rc.d smartmontools status
 * could not access PID file for
invoke-rc.d: initscript smartmontools, action "status" failed.

It sems like there is a name missing at the end of the generated text "could not access PID file for", I don't know if this is related to the actual incorrect behaviour f the status action.

Jarl

Tags: smartd

Related branches

Revision history for this message
Steven Danna (ssd7) wrote :

The problem is in /etc/init.d/smartmontools. The following lines:

  status)
        status_of_proc -p $SMARTDPID $SMARTD smartd && exit 0 || exit $?
        ;;

These should read as follows:

  status)
        status_of_proc -p $PIDFILE $SMARTD smartd && exit 0 || exit $?
        ;;

I would create the debdiff myself but I have very little time at the moment.

Changed in smartmontools (Ubuntu):
status: New → Confirmed
Revision history for this message
Steven Danna (ssd7) wrote :

Correction, it should read:

  status)
        status_of_proc -p $PIDFILE $DAEMON smartd && exit 0 || exit $?
        ;;

or

  status)
        status_of_proc $DAEMON smartd && exit 0 || exit $?
        ;;

But even with that change it doesn't seem to be working right for me. If this bug is still around in a few days I will look at the init script more closely than I can right now and try to fix it.

Revision history for this message
Steven Danna (ssd7) wrote :

Sorry to spam the bug tracker. Either of the changes in comment #2 should solve this problem. The reason they weren't working for me was only because of how my local system is configured.

Revision history for this message
Hontvári József Levente (hontvari) wrote :

On 10.04 the info line is changed, but not in the good direction, now it contains not only one but two undefined variables:
status_of_proc -p $SMARTDPID $SMARTD smartd && exit 0 || exit $?
The fixed line proposed by Steven Danna does work:
status_of_proc $DAEMON smartd && exit 0 || exit $?

I would also add, that the smartd daemon does not start automatically on system start after installation of the package. Even if I try to start manually using
sudo service smartmontools start
it does not actually start and it does not display any message. I had to edit
/etc/default/smartmontools
and uncomment the
#start_smartd=yes
line.

Revision history for this message
Steven Danna (ssd7) wrote :

I've fixed this bug in this branch:

https://code.launchpad.net/~ssd7/ubuntu/maverick/smartmontools/smartmontools-fix-491324

I followed the directions I found at https://wiki.ubuntu.com/Bugs/HowToFix and have proposed the branch for merging. I only fixed the issue with the status message and not the fact that one needs to uncomment #start_smartd=yes in /etc/default/smartmontools even when starting it manually after boot, despite the fact that the comment in that file only indicates that the #smart_smartd line is for system startup.

Alternatively, this could be converted to an upstart script. I'd be happy to do the conversion if that is the preferred solution.

Revision history for this message
Jarl (jarl-dk) wrote : Re: [Bug 491324] Re: smartmontools init scripts fails on 'status' action

Hontvári József Levente writes:

> I would also add, that the smartd daemon does not start automatically on system start after installation of the package. Even if I try to start manually using
> sudo service smartmontools start
> it does not actually start and it does not display any message. I had to edit
> /etc/default/smartmontools
> and uncomment the
> #start_smartd=yes
> line.

There are two other bugs concerning this issue:
bug #103681, and bug #391576:
https://bugs.launchpad.net/ubuntu/+source/smartmontools/+bug/103681
https://bugs.launchpad.net/ubuntu/+source/ubuntu-meta/+bug/391576

Jarl

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package smartmontools - 5.38-3ubuntu4

---------------
smartmontools (5.38-3ubuntu4) maverick; urgency=low

  * debian/smartmontools.init: Fix status message (LP: #491324)
 -- Steven Danna <sdanna7@u.washington.edu> Wed, 16 Jun 2010 04:33:06 -0700

Changed in smartmontools (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Daniel Smedegaard Buus (danielbuus) wrote :

Not sure what exactly was fixed, but "/etc/init.d/smartmontools start" doesn't seem to work in Maverick, either. Either it fails silently, or explicitly with a [fail] appendix. "service smartmontools start" works as expected, though.

The daemon is still not set to start on boot, as pointed out by #4 https://bugs.launchpad.net/ubuntu/+source/smartmontools/+bug/491324/comments/4

Also, the example scripts provided are buggy, though that is hardly a package maintainer issue (wall commands erroneously use the message as an argument although wall expects its input through STDIN, and the emailer tries to capture output from smartctl by feeding it the full $SMARTD_DEVICE environment variable, which includes the drive type in square brackets, e.g. "/dev/sdn [SAT]", which obviously fails. It's easily converted to something useful by for example

SMARTD_DEVICE_CLEAN=`echo "$SMARTD_DEVICE" | sed 's/ .\+$//'`

but still kinda sucks that the example scripts don't work :)

Revision history for this message
Steven Danna (ssd7) wrote :

Perhaps these issues should be posted as separate bugs. As far as I can
tell, the init script's 'status' action does work, which is the focus of
this bug.

I agree that the other issues that you mentioned should be addressed--just
not in this report.

Revision history for this message
Christian Franke (christian-franke) wrote :
Revision history for this message
Joshua Timberman (jtimberman) wrote :

The smartmontools (5.38-3ubuntu4) package is not available in Lucid, and the startup script there still has this problem.

% cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.04
DISTRIB_CODENAME=lucid
DISTRIB_DESCRIPTION="Ubuntu 10.04.3 LTS"

% sudo apt-get update
...

% echo $?
0

% apt-cache policy smartmontools
smartmontools:
  Installed: 5.38-3ubuntu3
  Candidate: 5.38-3ubuntu3
  Version table:
 *** 5.38-3ubuntu3 0
        500 http://us.archive.ubuntu.com/ubuntu/ lucid/main Packages
        100 /var/lib/dpkg/status

% grep SMARTD /etc/init.d/smartmontools
 status_of_proc -p $SMARTDPID $SMARTD smartd && exit 0 || exit $?

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.