2008/12/20

WMU-6500FS - xterm 237



GUI dependencies: [X.Org]

Build result

[binary] [file list]

Installation

box# cd /mnt/C
box# ./filopack.sh --download xterm-237
Configuration file .filopack/.config file found and used
Retrieving package index... (Connecting to http://filodej.ic.cz)
Downloading package xterm-237 from http://filodej.ic.cz ...
connected!

Length: 502 [text/plain]
connected!

Length: 177,869 [application/x-tar]
box# ./filopack.sh --install xterm-237
Configuration file .filopack/.config file found and used
Retrieving package index... (Connecting to http://filodej.ic.cz)
Sure to unpack xterm-237 locally at /mnt/C (y/n)?y
sys/X11/share/pixmaps/xterm-color_32x32.xpm
sys/X11/share/pixmaps/xterm-color_48x48.xpm
sys/X11/share/pixmaps/xterm_32x32.xpm
sys/X11/share/pixmaps/xterm_48x48.xpm
sys/X11/man/man1/xterm.1
sys/X11/man/man1/resize.1
sys/X11/man/man1/uxterm.1
sys/X11/man/man1/koi8rxterm.1
sys/X11/lib/X11/app-defaults/XTerm
sys/X11/lib/X11/app-defaults/XTerm-color
sys/X11/lib/X11/app-defaults/UXTerm
sys/X11/lib/X11/app-defaults/KOI8RXTerm
sys/X11/bin/xterm
sys/X11/bin/resize
sys/X11/bin/uxterm
sys/X11/bin/koi8rxterm
box# xterm

Make sure you have the environment variables set properly (you can make it permanent e.g. by editing the /mnt/C/sys/etc/profile; for details see the X Configuration post):

PATH variable can possibly contain the /mnt/C/sys/X11/bin/ path:
box# export PATH=$PATH:/mnt/C/sys/X11/bin/
LD_LIBRARY_PATH must (among others) contain the /mnt/C/sys/X11/lib path:
box# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/mnt/C/sys/X11/lib/
DISPLAY environment variable properly set to a display of a machine running xserver:
box# export DISPLAY=<machine>:<display-number>
... or in case you are using putty, X11 forwarding enabled:

Build procedure

First we have to initialize the package timestamp.
dev# cd /mnt/C
dev# ./filopack.sh --init xterm-237 
Configuration file .filopack/.config file found and used
Timestamp written to file .filopack/xterm-237.ts
Now we can download and extract the source.
dev# cd /usr/local/src
dev# wget ftp://invisible-island.net/xterm/xterm-237.tgz
...
Length: 860,424 (unauthoritative)

100%[==========================================================>] 860,424       14.59K/s    ETA 00:00

14:18:14 (17.14 KB/s) - `xterm-237.tgz' saved [860424]

dev# tar xzvf xterm-237.tgz 
...
dev# cd xterm-237
We configure the build in order to have access to XOrg header files and libraries:
dev#  ./configure --x-includes=/mnt/C/sys/X11/include/ --x-libraries=/mnt/C/sys/X11/lib/ --prefix=/mnt/C/sys/X11
...
... and make and install the source:
dev# make
...
dev# make install
...
We can test the installation:
dev# /mnt/C/sys/X11/bin/xterm
Warning: This program is an suid-root program or is being run by the root user.
The full text of the error or warning message cannot be safely formatted
in this environment. You may get a more descriptive message by running the
program as a non-root user or by removing the suid bit on the executable.
/mnt/C/sys/X11/bin/xterm Xt error: Can't open display: %s
/mnt/C/sys/X11/bin/xterm:  DISPLAY is not set
Oops, I forgot to set the display variable on the mirror machine. Let's do it now (note that the IP address 192.168.2.1 is specific to my network configuration):
dev# export DISPLAY=192.168.2.1:0
dev# /mnt/C/sys/X11/bin/xterm
xterm: Error 18, errno 2: No such file or directory
Reason: spawn: open() failed on ptsname
It seems there is still some error. Let's investigate it with strace:
dev# strace -f /mnt/C/sys/X11/bin/xterm 2> strace.txt

<Ctrl-C>

dev# tail -n 120 strace.txt
[pid  8119] close(8 <unfinished ...>
[pid  8120] <... setsid resumed> )      = 8120
[pid  8119] <... close resumed> )       = 0
[pid  8120] setpgid(0, 0 <unfinished ...>
[pid  8119] close(5 <unfinished ...>
[pid  8120] <... setpgid resumed> )     = -1 EPERM (Operation not permitted)
[pid  8119] <... close resumed> )       = 0
[pid  8120] ioctl(4, TIOCSPTLCK <unfinished ...>
[pid  8119] read(7,  <unfinished ...>
[pid  8120] <... ioctl resumed> , [0])  = 0
[pid  8120] ioctl(4, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
[pid  8120] ioctl(4, TIOCGPTN, [2])     = 0
[pid  8120] open("/dev/pts/2", O_RDWR)  = -1 ENOENT (No such file or directory)
[pid  8120] write(2, "xterm", 5xterm)        = 5
[pid  8120] write(2, ": Error ", 8: Error )     = 8
[pid  8120] write(2, "18", 218)           = 2
[pid  8120] write(2, ", errno ", 8, errno )     = 8
[pid  8120] write(2, "2", 12)            = 1
[pid  8120] write(2, ": ", 2: )           = 2
[pid  8120] write(2, "No such file or directory", 25No such file or directory) = 25
[pid  8120] write(2, "\n", 1
)           = 1
[pid  8120] write(2, "Reason: ", 8Reason: )     = 8
[pid  8120] write(2, "spawn: open() failed on ptsname", 31spawn: open() failed on ptsname) = 31
[pid  8120] write(2, "\n", 1
)           = 1
[pid  8120] ioctl(4, TCFLSH, 0x1)       = 0
[pid  8120] chown("/dev/pts/2", 0, 0)   = -1 ENOENT (No such file or directory)
[pid  8120] chmod("/dev/pts/2", 0666)   = -1 ENOENT (No such file or directory)
[pid  8120] close(4)                    = 0
[pid  8120] munmap(0xb7c10000, 33608)   = 0
[pid  8120] munmap(0xb7c0b000, 17560)   = 0
[pid  8120] _exit(18)                   = ?
Process 8120 detached
<... read resumed> "", 1048)            = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
...
xterm is unable to open the pseudo terminal device, it should be OK when deployed to the box (there is no full device mapping on my mirror system; it is just chroot-ed to some sub-directory of hosting system).

Let's create the package:
dev# ./filopack.sh --pack xterm-237
Configuration file .filopack/.config file found and used
-rw-r--r-- root/root      1381 2008-12-20 14:27:33 sys/X11/share/pixmaps/xterm-color_32x32.xpm
-rw-r--r-- root/root      2710 2008-12-20 14:27:33 sys/X11/share/pixmaps/xterm-color_48x48.xpm
-rw-r--r-- root/root      2110 2008-12-20 14:27:33 sys/X11/share/pixmaps/xterm_32x32.xpm
-rw-r--r-- root/root      2586 2008-12-20 14:27:33 sys/X11/share/pixmaps/xterm_48x48.xpm
-rw-r--r-- root/root    174641 2008-12-20 14:27:32 sys/X11/man/man1/xterm.1
-rw-r--r-- root/root      2678 2008-12-20 14:27:33 sys/X11/man/man1/resize.1
-rw-r--r-- root/root      2967 2008-12-20 14:27:33 sys/X11/man/man1/uxterm.1
-rw-r--r-- root/root      3188 2008-12-20 14:27:33 sys/X11/man/man1/koi8rxterm.1
-rw-r--r-- root/root      6853 2008-12-20 14:27:33 sys/X11/lib/X11/app-defaults/XTerm
-rw-r--r-- root/root      4324 2008-12-20 14:27:33 sys/X11/lib/X11/app-defaults/XTerm-color
-rw-r--r-- root/root      2109 2008-12-20 14:27:33 sys/X11/lib/X11/app-defaults/UXTerm
-rw-r--r-- root/root       747 2008-12-20 14:27:33 sys/X11/lib/X11/app-defaults/KOI8RXTerm
-rwxr-xr-x root/root    334759 2008-12-20 14:27:32 sys/X11/bin/xterm
-rwxr-xr-x root/root     11157 2008-12-20 14:27:32 sys/X11/bin/resize
-rwxr-xr-x root/root      2088 2008-12-20 14:27:32 sys/X11/bin/uxterm
-rwxr-xr-x root/root      2163 2008-12-20 14:27:32 sys/X11/bin/koi8rxterm
... and deploy the package to the box:
dev# ./filopack.sh --upload xterm-237
Configuration file .filopack/.config file found and used
Sure to upload xterm-237 to root@storage:/mnt/C (y/n)?y
root@storage's password:
root@storage's password:
Now on the box, we can install it:
box# [root@storage C]# ./filopack.sh --install xterm-237
Configuration file .filopack/.config file found and used
Retrieving package index... (Connecting to http://filodej.ic.cz)
Module xterm-237 not found in package list - use 'tar.bz2' extension
Sure to unpack xterm-237 locally at /mnt/C (y/n)?y
sys/X11/share/pixmaps/xterm-color_32x32.xpm
sys/X11/share/pixmaps/xterm-color_48x48.xpm
sys/X11/share/pixmaps/xterm_32x32.xpm
sys/X11/share/pixmaps/xterm_48x48.xpm
sys/X11/man/man1/xterm.1
sys/X11/man/man1/resize.1
sys/X11/man/man1/uxterm.1
sys/X11/man/man1/koi8rxterm.1
sys/X11/lib/X11/app-defaults/XTerm
sys/X11/lib/X11/app-defaults/XTerm-color
sys/X11/lib/X11/app-defaults/UXTerm
sys/X11/lib/X11/app-defaults/KOI8RXTerm
sys/X11/bin/xterm
sys/X11/bin/resize
sys/X11/bin/uxterm
sys/X11/bin/koi8rxterm
And test the installation:
box# xterm
Cannot chown /dev/ttyp4 to 0,0: Read-only file system
Cannot chmod /dev/ttyp4 to 620 currently 666: Read-only file system
Cannot chown /dev/ttyp4 to 0,0: Read-only file system
The problem here is that xterm is trying to change the rights for the terminal device it is using (/dev/ttyp4 in this case) in order to prevent a read access of an unauthorized person (octal value 620 means that only root can read and write the terminal and users from the same group can just write). However, since the file system is read-only the chmod operation does not succeed and so the terminal device stays readable for everyone.
I was dealing with the same issue during the dropbear build.

Anyway, in case you are using the box on a trusted network with no one "sniffing around" and have it properly secured from the outside world then the warning should not mean any harm. Maybe it could be solved by a change in configuration (or by a slight change in source code), but I am not going to solve it now.

4 comments:

Anonymous said...

Hello,

I've done exactly what you've guided. Download-ok, Install-ok. When start the testing following error appeared:
/mnt/C/sys/X11/bin/xterm: can't load library 'libXft.so.2'

What's missing?

filodej said...

Hello,
I assume you have the XOrg dependency installed.

Then the problem is probably in LD_LIBRARY_PATH. I have updated the environment setup accordingly, or you can look directly at the X configuration post.

Regards,
Filodej

Bernd said...

Hello Filodej's,

thanks for that helpful Blog!

I had the same error like Anonymous.

I tried the exports of the paths and everyting.

Now I get the message:


/mnt/C/sys/X11/bin/xterm Xt error: Can't open display: %s
/mnt/C/sys/X11/bin/xterm: DISPLAY is not set

The hint with:

C:\Program Files\XMing\Xming.exe :0 -clipboard -multiwindow -ac

doesn't work :-(

What can I do?

Thank you so mutch.

Bernd.

filodej said...

Hi,
make sure you set up the DISPLAY environment variable as described in the post:

box# export DISPLAY=192.168.2.1:0
box# echo $DISPLAY
192.168.2.1:0

You have to substitute IP 192.168.2.1 and display number 0 to values specific to your network and X11 forwarding configuration.

Regards,
Filodej