It's my pty and I'll cry if I want to.

Setting up servers inside an etch chroot can lead to some interesting problems. The most recent problem for me happened when I tried to install the perl module IO::Tty. During the test I would keep getting the following error:
chrt:webdev2:~/.cpan/build/IO-Tty-1.07# make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-Iblib/lib" "-Iblib/arch" test.pl
1..4
Configuration: -DHAVE_DEV_PTMX -DHAVE_GETPT -DHAVE_GRANTPT -DHAVE_OPENPTY -DHAVE_PTSNAME -DHAVE_PTSNAME_
R -DHAVE_PTY_H -DHAVE_SIGACTION -DHAVE_SYS_STROPTS_H -DHAVE_TERMIOS_H -DHAVE_TERMIO_H -DHAVE_TTYNAME -DH
AVE_UNLOCKPT
Checking for appropriate ioctls: TIOCNOTTY TIOCSCTTY
Checking that returned fd's don't clash with stdin/out/err...
trying getpt()...
pty_allocate(nonfatal): getpt(): No such file or directory at /root/.cpan/build/IO-Tty-1.07/blib/lib/IO/
Pty.pm line 24.
trying openpty()...
pty_allocate(nonfatal): openpty(): No such file or directory at /root/.cpan/build/IO-Tty-1.07/blib/lib/I
O/Pty.pm line 24.
trying /dev/ptmx...
trying grantpt()...
IO::Tty::pty_allocate(nonfatal): grantpt(): No such file or directory at /root/.cpan/build/IO-Tty-1.07/b
lib/lib/IO/Pty.pm line 24.
trying unlockpt()...
trying ptsname_r()...
IO::Tty::open_slave(nonfatal): ptsname_r(): No such file or directory at /root/.cpan/build/IO-Tty-1.07/b
lib/lib/IO/Pty.pm line 24.
trying to open /dev/pts/3...
IO::Tty::open_slave(nonfatal): open(/dev/pts/3): No such file or directory at /root/.cpan/build/IO-Tty-1
.07/blib/lib/IO/Pty.pm line 24.
pty_allocate(nonfatal): open(/dev/ptmx): No such file or directory at /root/.cpan/build/IO-Tty-1.07/blib
/lib/IO/Pty.pm line 24.
trying BSD /dev/pty??...
Cannot open a pty at test.pl line 42
It turns out that this is due to the /dev directory not being configured correctly. The solution was not easy to find, so I shall post it here along with a link to the post that provided me with it, in the hopes that it will get bumped up the search listing. The answer, well there are two.
      	
      	cd /dev
      	./MAKEDEV pty
      	
      This creates a bunch of pty entries in /dev that can then be used when required.
      	mount -t devpts -o rw,gid=5,mode=620 none /dev/pts
      	
      This will mount /dev/pts and allow processes to create their own tty as needed.
I went for the 'MAKEDEV pty' option as I didn't want to mount /dev/pts everytime the machine was rebooted. So, there you have it. Now you wont cry when your pty isn't going the way you want it to.

Posted by neomorphic Thu, 21 Aug 2008 20:37:00 GMT


Debian locales

Have you ever come across this error:
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = "en_GB:en",
	LC_ALL = (unset),
	LANG = "en_GB.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
It turns out that this can be easily solved in a couple of steps (on debian).
  1. install the locales package:
    apt-get install locales
  2. reconfigure your locale:
    dpkg-reconfigure locales
No more nasty perl warnings.

Posted by neomorphic Sat, 15 Dec 2007 15:27:00 GMT



weewar.com corner