Technical article 125767

cpio: I am unable to open /dev/tty for writing

OpenServer 5.0.5OpenServer 5.0.6OpenServer 5.0.7

Written · Last revised

Problem

When running a cpio backup using cron, I see the following error message;

"cpio: can't open /dev/tty for writing"
Why does this happen?

Cause

Some programs issue messages to stdout via the /dev/tty device.

/dev/tty is a special file that is always the controlling terminal, even when standard input and standard output have been redirected.

Solution

A common program that writes to /dev/tty is cpio: if it needs another volume (tape or floppy is full), it writes to /dev/tty asking you to give it the name of another device it can write on. Therefore, cpio scripts put into background / cron can generate this kind of message.

If you want to see the actual message (and you are using OSR5+) try adding the "-P0,1" flag to cpio;

e.g.  find . -print | tee /etc/backup.list | cpio -oBc
-P0,1 $TAPEDEV

If you are getting this at the command line, the permissions on /dev or /dev/tty itself may be wrong.

From the Xinuos technical article database, record 125767. Reproduced with permission. The original is at www.sco.com/ta/125767, which is reachable but blocked from search engines.

Next step

Need this fixed rather than explained?

Tell us the release, what the system runs and what it is doing. We will reply by email with what we would do next.

  • You deal with the people who do the work
  • No obligation, and no upgrade required before we will help
  • We tell you plainly if something is not worth doing

Send an enquiry

We reply by email. If a server is down, say so in the first line. You can also write to help@scoexpert.com.