Amanda-Users

Re: /dev/null caused backups to fail

2004-06-07 10:19:31
Subject: Re: /dev/null caused backups to fail
From: Paul Bijnens <paul.bijnens AT xplanation DOT com>
To: pll+amanda AT permabit DOT com
Date: Mon, 07 Jun 2004 16:15:47 +0200
pll+amanda AT permabit DOT com wrote:

All file systems on one of my backup clients failed over the weekend. The dump summary thinks the system was offline, but it wasn't, and the amadad debug log had this in it:

amandad: time 0.016: amandahosts security check passed
amandad: time 0.016: running service "/usr/lib/amanda/sendsize"
sendsize: error [spawn /usr/lib/amanda/runtar: dup2 in: Bad file descriptor]
...
After digging through all this, I tried seeing what amcheck revealed (which I should have done first It stated:

 ERROR: jpt: [can not read/write /dev/null: Permission denied]

Evidently, from what I can tell, /dev/null's permissions were changed sometime on Friday (16:42 to be precise) after my cron-driven amcheck runs.

Is there any way to have amanda mention in the summary report that the reason a backup failed was because /dev/null was not writeable?

Besides the fact that a LOT of programs will fail mysteriously when
/dev/null has been tampered with, here is a patch for sendsize.c .

ps. Ever replaced /dev/null with a plain file by accident?  :-)

PPS. patch not tested to verify it it really detects the problem  :-)

--
Paul Bijnens, Xplanation                            Tel  +32 16 397.511
Technologielaan 21 bus 2, B-3001 Leuven, BELGIUM    Fax  +32 16 397.512
http://www.xplanation.com/          email:  Paul.Bijnens AT xplanation DOT com
***********************************************************************
* I think I've got the hang of it now:  exit, ^D, ^C, ^\, ^Z, ^Q, F6, *
* quit,  ZZ, :q, :q!,  M-Z, ^X^C,  logoff, logout, close, bye,  /bye, *
* stop, end, F3, ~., ^]c, +++ ATH, disconnect, halt,  abort,  hangup, *
* PF4, F20, ^X^X, :D::D, KJOB, F14-f-e, F8-e,  kill -1 $$,  shutdown, *
* kill -9 1,  Alt-F4,  Ctrl-Alt-Del,  AltGr-NumLock,  Stop-A,  ...    *
* ...  "Are you sure?"  ...   YES   ...   Phew ...   I'm out          *
***********************************************************************

--- sendsize.c_ORIG     2004-06-07 16:08:12.000000000 +0200
+++ sendsize.c  2004-06-07 16:07:04.000000000 +0200
@@ -797,6 +797,9 @@
     rundump_cmd = stralloc(cmd);
 
     stdoutfd = nullfd = open("/dev/null", O_RDWR);
+    if (nullfd < 0) {
+       error("%s: open /dev/null returned: %s", cmd, strerror(errno));
+    }
     pipefd[0] = pipefd[1] = killctl[0] = killctl[1] = -1;
     pipe(pipefd);
 
<Prev in Thread] Current Thread [Next in Thread>