Incorrect battery handling in checkfs.sh

Bug #59080 reported by none
2
Affects Status Importance Assigned to Milestone
sysvinit (Ubuntu)
Confirmed
Low
Daniel Hahler

Bug Description

checkfs.sh sets PATH to be /sbin:/bin . When it attempts to check if we're on battery, it does "if which on_ac_power >/dev/null 2>&1".

On a standard Edgy system, on_ac_power is located in /usr/bin. Because of the PATH setting, the "which on_ac_power" will never find that command and the net effect is that checkfs.sh always acts as if we're running on AC.

One fix would be to also put /usr/bin in the path, but I'm not sure if that's the correct one.

This is with up-to-date Edgy, initscripts version 2.86.ds1-14.1ubuntu7.

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

Of course, if you have no /usr, this wouldn't work then either

Changed in sysvinit:
importance: Undecided → Low
status: Unconfirmed → Confirmed
Revision history for this message
none (ubuntu-bugs-nullinfinity-deactivatedaccount) wrote :

Under which conditions would you not have /usr ? If it's on NFS or something? At any rate, putting /usr/bin in the path may not be *the* correct fix but it'd solve this problem for most people. Laptops are unlikely to have important parts of the filesystem mounted remotely.

I also disagree somewhat with setting importance to "low". The reason I looked into this in the first place was a time when my battery was close to empty and I booted up to check for some important e-mail.

To my surprise the disks were fscked at boot, as far as I could tell with no way of interrupting the fsck. That time I did have enough battery to get to my e-mail, but it's an unpleasant surprise if you barely have enough battery to look up something important.

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

It's low because it's not a regression -- this has always been broken, we've just never noticed.

And in the grand scheme of things "wastes a bit of battery power" is of relatively low importance compared to "doesn't boot at all"

Revision history for this message
none (ubuntu-bugs-nullinfinity-deactivatedaccount) wrote :

Is there any chance this could be fixed in time for Feisty?

Revision history for this message
none (ubuntu-bugs-nullinfinity-deactivatedaccount) wrote :

Or maybe for Gutsy?

Revision history for this message
Daniel Hahler (blueyed) wrote :

Scott, adding /usr/bin to the path seems sane to me: if it's not mounted yet, it will only fail as before. It's not the correct fix, but the one for this bug IMHO.

btw:
$ which which
/usr/bin/which

If it's OK, I'll provide a debdiff to fix this in Gutsy, by adding /usr/bin to the end of $PATH.

Changed in sysvinit:
assignee: nobody → blueyed
status: Confirmed → In Progress
Revision history for this message
Daniel Hahler (blueyed) wrote :

See also bug #89752, where it says that e2fsck supports it by itself (by deferring the check), but there seems to be another problem - with both attempts.

Changed in sysvinit:
status: In Progress → Confirmed
Revision history for this message
Daniel Hahler (blueyed) wrote :

Sorry, for the confusion. I think $PATH is not the problem, because both "on_ac_power" and "which" get installed into different places:

$ dpkg -S on_ac_power
..
powermgmt-base: /usr/bin/on_ac_power
powermgmt-base: /sbin/on_ac_power

$ dpkg -S bin/which
debianutils: /bin/which
debianutils: /usr/bin/which

So the problem is likely to be the missing "modprobe ac", as suggested in bug 89752.

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.