Subject: gzip and dpkg problem

From: Paul Schoenly <[email-masked]>
Date: Tue, 4 Jun 1996 12:35:30 -0500 (CDT)

Hi,

   I've been using debian (0.93R6) a while now at home and in my first
office, and never had any problems, till trying to install debian on a
computer at my second office. After installing the base system and running
dselect for the first time with no problems, I keep getting error messages
when using dpkg (+- dselect) or dftp when installing subsequent packages.
The errors are: 

$ dpkg --install package_x.deb
   .
   .
   .
   gzip:stdout: Broken pipe
   dpkg-deb: subprocess gzip -dc returned error exit status 1
   dpkg: error processing package_x.deb (--install)
    subprocess dpkg-deb --control returned error exit status 2
   Errors were encountered... (and so on)

I've tried the following:
 reinstalling gzip from scratch (tar not deb)
 reinstalling dpkg (tar and deb and recompiling source)
 reinstalling the whole os
 dpkg-deb --fsys-tarfile xxx.deb > xxx.tar and dpkg-deb -e xxx.deb to
   get the package contents and control files installed and processed
   (this *will* work but it's a hassle)

The computer in question is:
 IBM Personal Computer 750-P90
 hda1=540MB Conner HD, hdb=ATAPI cdrom, hdc=Maxtor 72004A 2Gig HD
 24 meg RAM
 +floppy, tape, cyclom 8 port, etc.

I've read the Debian installation manual, gone to www.debian.org, searched
the mailing list archives, etc. but haven't found very much.  If it's a
problem because it's an IBM, I'm having the computer replaced in a week or
two. This is the fourth or fifth time this had happened, and I'm getting
kinda frustrated. Any suggestions? Am I missing something really obvious? 

Thanks in advance,
Paul Schoenly
Auburn University

---

From: llucius <[email-masked]>
Date: Tue, 4 Jun 1996 20:57:45 -0500 (CDT)

>    Errors were encountered... (and so on)
I've recently started asking about this too.  I figured that it was only
my setup (I'm running Linux/68k), but other people have also said that
there is problems with similar setups to yours.  

Unfortunately, I have gotten an answer as yet.  (So I modified the source
to ignore 'broken pipe" errors and it works like a charm.  B-))

If ya get a solution, please let me know 'cause mine isn't really
acceptable.  B-)

L.Lucius

__ Y_ a_ m_ b_ o_ | The leanest, meanest, fightinest sweet tater on Earth!
   oo o  oo o  o  | 
    o       o   o | [email-masked]
 o oo    o     o  | 
-- -- -- -- -- -- | http://www.millcomm.com/~llucius       (maybe one day)

---

From: Alexander Goldstein <[email-masked]>
Date: Wed, 5 Jun 1996 11:54:50 -0500 (CDT)

> there is problems with similar setups to yours.  

I also often have the same problem sometimes (with some packages).  It
only happens when su-ing to root.  To bypass it, I just login directly as
root on a VC.  I have 1.1 system and it happened with all versions of dpkg
including as far way back as .96R6.

---

From: Ian Jackson <[email-masked]>
Date: Thu, 6 Jun 96 02:42 BST

Paul Schoenly writes ("gzip and dpkg problem"):
...
> $ dpkg --install package_x.deb
...
>    Errors were encountered... (and so on)

This means that SIGPIPE was set to SIG_IGN when dpkg started.  For
reasons too complicated to explain here this means that dpkg can't do
proper error trapping (it always gets an error indication, and can't
tell whether it's really an error).

This is a bug in one of:
  Your inetd, telnetd, rlogind, if you're logging in over the
    network (some versions of the Debian netbase and/or netstd
    packages had this problem).
  Your shell (I know of no shells that cause this problem).
  The getty you're using.
    (Some versions of getty_ps are known to have this problem.)
  The login you're using (I know of no problem here).
  Any program which started one of the above, or which is in
    the calling chain for dpkg.

...
>    (this *will* work but it's a hassle)

This *won't* work - it won't properly install the packages.

In case you're truly desperate, I've attached a Perl script which
resets SIGPIPE to SIG_DFL and then runs the command you supply as
arguments.  Use it like `nohup' or `time'.  I call it `resetsigpipe'
(and I need it because my serial terminal is on getty_ps, which has
the bug).

Please do tell us what the problem is if you find out.  Telling us
which ways of logging in cause the problem and which don't will help
us a lot :-).  If you don't want to bother trying to install packages
(and it sometimes works even if the bug is present), try:
  cat /dev/zero | true
If the bug isn't present this produces just `Broken pipe' (assuming
you're using bash as your shell).  If the bug is present it will
produce `cat: write error: Broken pipe'.

Alexander Goldstein writes ("Re: gzip and dpkg problem"):
...
> including as far way back as .96R6.

Huh ?  `su' does this ?  I don't believe it ...

... no, `su' doesn't.  Perhaps you have `sudo' or something else in
the calling chain.

Please try to identify what it is that's causing the problem, so that
we can fix it and/or tell others to avoid it :-).

Thanks,
Ian.

Here's resetsigpipe, a Perl one-liner:

#!/usr/bin/perl
$SIG{"PIPE"}="DFL"; exec @ARGV; die "resetsigpipe: $ARGV[0]: $!\n";

---

From: llucius <[email-masked]>
Date: Thu, 6 Jun 1996 00:24:18 -0500 (CDT)

>     (Some versions of getty_ps are known to have this problem.)

You hit on the head for me anyway.  I thought I was using agetty, but I
was using an older version of getty_ps (2.0.7g) and after replacing
with agetty, "cat /dev/null | true" runs like a charm.

Is getty_ps no longer debianized?  I've noticed that there is a 2.0.7i
available.  Which is better anyway?  (I suppose that's up to the user...)

Anyway, THANKS a heap.

Leland Lucius

---

From: [email-masked] (Miquel van Smoorenburg)
Date: Thu, 6 Jun 1996 10:14:37 +0200 (MET DST)

In article <[email-masked]>,
>tell whether it's really an error).

Can't you just set signal(SIGPIPE, SIG_DFL) first thing in the
main() function of dpkg? And if not, could you tell me why not
(sounds interesting ;))

Mike.
--
+ Miquel van Smoorenburg   + Cistron Internet Services +  Living is a     |
| [email-masked] (SP6) | Independent Dutch ISP     |   horizontal     |
+ [email-masked]   + http://www.cistron.nl/    +      fall        +

---

From: Alexander Goldstein <[email-masked]>
Date: Thu, 6 Jun 1996 13:14:18 -0500 (CDT)

>     packages had this problem).

I get that problem when locally su-ing in an xsession

>   Your shell (I know of no shells that cause this problem).
I am using tcsh in my user account but when su and root's shell is bash.

>     (Some versions of getty_ps are known to have this problem.)

	It's an X session, no getty should be involve

>     the calling chain for dpkg.

tcsh -> rxvt/xterm -> su -> bash -> dpkg

so I guess it would either be tcsh or rxvt/xterm.

[stuff removed]

> ... no, `su' doesn't.  Perhaps you have `sudo' or something else in

no, no sudo, but there is either rxvt or xterm and tcsh

> we can fix it and/or tell others to avoid it :-).
I will try to test it better when I get home.

---

From: llucius <[email-masked]>
Date: Thu, 6 Jun 1996 20:39:35 -0500 (CDT)

On Thu, 6 Jun 1996, Ian Jackson wrote:

> us a lot :-).
Well, I just checked and even the latest(?) version, 2.0.7i, of getty_ps
sets the SIGPIPE signal to SIG_IGN.  So it likes like we need to just stay
away from getty_ps altogether (at least on ttys where pipes will be used).

Leland Lucius

---

From: Paul Schoenly <[email-masked]>
Date: Thu, 6 Jun 1996 16:56:38 -0500 (CDT)

Hi,
   OK, haven't done much yet, but here's what I've done to check the 
getty/gzip/dpkg problem. 

>     packages had this problem).

   I've never tried to use dpkg this way.

>   Your shell (I know of no shells that cause this problem).

   I'm using bash, so if it's bash I'm really screwed... but it's not 
(keep reading)

>     (Some versions of getty_ps are known to have this problem.)

   This looks like the problem! OK, I can't try this on the computer I 
mentioned in my first message, cause I had to have it running so I 
plopped slackware on it-will put debian back on tonight. So instead, on 
my other debian comp, here's what I did:

 my /etc/inittab
1:2345:respawn:/sbin/agetty 9600 tty1
2:23:respawn:/sbin/agetty 9600 tty2
3:23:respawn:/sbin/getty_ps tty3 9600 linux
4:23:respawn:/sbin/getty_ps tty4 9600 linux
5:23:respawn:/sbin/getty_ps tty5 9600 linux

So using both, here's what happened:
cat /dev/zero | true
 on tty1 and tty2 : got "Broken pipe" error msg
 on tty3+ : got "cat: write error: Broken pipe" error msg

using dpkg to install samba-1.9.14.deb (this was the package I was trying 
to install on the other computer that prompted my 1st message)
 on tty1 and tty2 : did ok
 on tty3+ : got same error message about gzip -dc

so this looks like fairly conclusive evidence for me.

>   The login you're using (I know of no problem here).

Can't help there. Except for the getty differences, I'm just using bash 
on a tty, no su, no telnet, nothing special.

>     the calling chain for dpkg.

Can't help again.

OK, there was also a message about this problem happening in an xterm/rxvt
I tried using tcsh as root in an xterm and did get errors, but that was
due to my tcsh configuration errors rather than the one that gives you the
gzip -dc error message. So I can't really say whether this would be the
same type problem as mine. I'm very ignorant about all the inner workings
of terminals, getty's, etc., so I did try launching X from both agetty and
getty_ps, but that didn't seem to matter either. 

Well, from my end, the getty issue seems to be where the problem was 
coming from. Thanks for everyone's help! That problem was really bugging 
me. If anyone has any other tests they'd like for me to run, just let me 
know and I'd be happy to help.

-Paul Schoenly
Auburn University
[email-masked]

---

From: Alexander Goldstein <[email-masked]>
Date: Sun, 9 Jun 1996 22:59:40 -0500 (CDT)

> tell whether it's really an error).

[ much stuff deleted ] 
> produce `cat: write error: Broken pipe'.

ok, I am pretty sure I can blame this on xsm.  Whenever I try this
test in rxvt start by xsm or in rxvt started from that original rxvt,
it fails, if I start rxvt from a window manager (fvwm2) which is
itself started by xsm, the test does not fail.  Strange.  I guess fvwm resets
that handler correctly.

---

From: llucius <[email-masked]>
Date: Sun, 9 Jun 1996 21:02:41 -0500 (CDT)

On Mon, 10 Jun 1996, Ian Jackson wrote:

> 
> It should be a simple fix to getty_ps; if anyone packages it for
> Debian this will be an easy thing to do at the same time.
> 
Yep, it looks REAL simple.  It there isn't a current maintainer, I'll
package it up.

L.Lucius

---

From: Ian Jackson <[email-masked]>
Date: Mon, 10 Jun 96 02:01 BST

> main() function of dpkg? And if not, could you tell me why not

Yes, I *could* do that.  However, if I did I would simply be covering
up a problem which ought to be a problem for many programs other than
dpkg but which isn't solely because of sloppy programming.

If I add any code to dpkg with respect to this it'll be a check which
makes it bomb out with an informative message.  See, for example, my
approach to trying to run dpkg with a bad PATH.

Ian.

---

From: Ian Jackson <[email-masked]>
Date: Mon, 10 Jun 96 01:12 BST

Ian.