Bug 711125

Summary: zypper in chrooted environment: "Cannot read input: bad stream or EOF."
Product: [openSUSE] openSUSE 11.4 Reporter: Andreas Nordal <andreas_nordal_4>
Component: YaST2Assignee: E-mail List <zypp-maintainers>
Status: RESOLVED INVALID QA Contact: Jiri Srain <jsrain>
Severity: Normal    
Priority: P5 - None CC: abergmann
Version: Final   
Target Milestone: ---   
Hardware: i686   
OS: openSUSE 11.4   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Andreas Nordal 2011-08-08 22:01:13 UTC
User-Agent:       Mozilla/5.0 (compatible; Konqueror/4.6; Linux) KHTML/4.6.5 (like Gecko) SUSE

When installing programs (e.g. zypper install nano), zypper normally asks the user to confirm the changes, and waits for the answer. When in a chrooted environment, zypper fails to wait and complains (see Actual Results).

As zypper suggests, «--non-interactive» will omit the question. With this workaround, zypper works flawlessly, at the loss of interactivity.

Reproducible: Always

Steps to Reproduce:
1. zypper --root=/suse install zypper
2. chroot /suse
3. zypper install nano
Actual Results:  
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following NEW package is going to be installed:
  nano 

1 new package to install.
Overall download size: 193.0 KiB. After the operation, additional 550.0 KiB will be used.
Continue? [y/n/?] (y): Cannot read input: bad stream or EOF.
If you run zypper without a terminal, use '--non-interactive' global
option to make zypper use default answers to prompts.

Expected Results:  
Zypper should read standard in.

I was using bash as shell. There seemed to be nothing wrong with standard in, as I was able to use vim and a proof-of-concept shellscript that successfully read from standard in.
Comment 1 Andreas Nordal 2011-08-14 13:55:41 UTC
The problem disappears if "mount --bind /dev /suse/dev" is executed before "chroot /suse".

IMHO, since mount-binding /dev is a good idea anyway, an acceptible fix would be to just inform about this (unintuitive) dependency of the /dev pseudo filesystem in the error message. Example: "Did you remember to mount the /dev filesystem?"
Comment 2 Alexander Bergmann 2012-01-26 09:27:19 UTC
I've ran into this problem with an OpenVZ virtualized guest system. After upgrading from openSUSE 11.4 to 12.1 I've got the same error message.

"Cannot read input: bad stream or EOF."

The problem was a the missing "/dev/tty" device. Instead of an character device I found an empty regular file.

# ls -l /dev/tty
-rw-r--r-- 1 root root    0 Jan 26 11:03 /dev/tty

So I removed that file and created the right character device again.

# rm /dev/tty
# mknod /dev/tty c 5 0
# ls -l /dev/tty
crw-r--r-- 1 root root 5, 0 Jan 26 12:16 /dev/tty

Happy days! Everything is back to normal.


PS: I'm not hundred percent convinced that this is reproducible.
Comment 3 Michael Andres 2013-09-30 15:34:08 UTC
no zypp issue