[TriLUG] e2fsck under cron gets retcode=8 operational error

Joseph Mack NA3T jmack at wm7d.net
Wed Sep 19 10:27:17 EDT 2012


On Wed, 19 Sep 2012, Igor Partola wrote:

> Joe, it seems to me that in your case this would actually 
> cause you more grief. Basically, fsck would run fine every 
> time there is no error (probably 99% of all times) and 
> fail 1% of the time when a tty was required to confirm the 
> fix and there was none. When you noticed this you'd run 
> fsck by hand and fix the problem, wondering why it failed.

In the 1% of cases, I would know exactly why it failed. The 
error message in the logs would say that it couldn't fix the 
problem without a tty. That's acceptable as a best effort to 
me.

I need this machine to operate for a decade without human 
intervention. The expected problems are

o the thumbdrive fails. This can't be fixed by code, but 
the problem will appear in the logs.

o someone pulls the thumbdrive out while the machine is 
running and later reinserts it. I hope (but don't know yet) 
that having a journalling fs, fsck before every mounting, 
fsck -f every hour, and only having the drive mounted while 
it's being read or written will handle this.

If everything goes well, fsck will not fail in the life of 
the machine and there will never be a fsck entry in the 
logs. If there is a fsck entry, then human intervention will 
be required.

> It would take significantly longer to to figure out that 
> there is a systematic problem in the first place.

I don't know of systematic problems that I should plan for, 
that I haven't handled.

> As is, e2fsck fails right away, so you know there is a
> problem right away.

In my case there never was a problem. I already know I don't 
have a tty. What I want done doesn't need one.

> The way I see it, there are two reasonable solutions to 
> this problem:
>
> 1. Fix e2fsck to have good error codes.

acceptable if you mean documentation of the error codes. eg 
"optional error" should list the possible error conditions 
"eg no tty".

There are problems with fixing the error codes. Currently I 
expect error code 8 (operational error) covers all the 
unhandled error conditions. There could be any number of 
conditions in there. At present there are only 8 possible 
exit codes (each a bit in a char) rather than 256. I expect 
to handle all the conditions likely buried in error code 8, 
that the current error code scheme will have to be changed, 
breaking all current scripts. A design where you can only 
use 8 of the 256 code might have been acceptable back in the 
days when everything was written in assembler, but not after 
C came along.

> 2. Fix the man page for e2fsck, showing how to run it 
> through cron, or similar. If #1 is not an option, perhaps 
> this would be the simplest fix.

yes. I expect Ted would accept this.

Joe

-- 
Joseph Mack NA3T EME(B,D), FM05lw North Carolina
jmack (at) wm7d (dot) net - azimuthal equidistant map
generator at http://www.wm7d.net/azproj.shtml
Homepage http://www.austintek.com/ It's GNU/Linux!



More information about the TriLUG mailing list