/dev/pty always gone [message #26055] |
Tue, 15 January 2008 00:46 |
Thomasd
Messages: 39 Registered: December 2007
|
Member |
|
|
I have a couple VMs that cause always the same problem:
when I try to enter them, I get a dev/pty or dev/pts missing
so, I do vzctl exec <vmid> MAKEDEV /dev/pty
I can enter fine
I stop the VM, restart it...
same problem
How can I make the entries in /dev/ persistant?
|
|
|
|
Re: /dev/pty always gone [message #26121 is a reply to message #26060] |
Tue, 15 January 2008 19:22 |
Thomasd
Messages: 39 Registered: December 2007
|
Member |
|
|
This is my kernel version
#uname -r
2.6.18-53.el5.028stab051.1
Devpts is mounted:
# mount
simfs on / type simfs (rw)
/proc on /proc type proc (rw)
/sys on /sys type sysfs (rw)
none on /dev type tmpfs (rw)
none on /dev/pts type devpts (rw)
Is it usually different entries failing:
ptmx and ptyp0 being the most common; sometimes both, sometimes only one.
this is the dev folder of a VM
# ls -l /dev
total 4
lrwxrwxrwx 1 root root 13 Jan 14 19:58 MAKEDEV -> /sbin/MAKEDEV
lrwxrwxrwx 1 root root 4 Jan 14 19:58 X0R -> null
crw------- 1 root root 5, 1 Jan 14 19:58 console
lrwxrwxrwx 1 root root 11 Jan 14 19:58 core -> /proc/kcore
lrwxrwxrwx 1 root root 13 Jan 14 19:58 fd -> /proc/self/fd
prw------- 1 root root 0 Jan 14 19:58 initctl
srw-rw-rw- 1 root root 0 Jan 14 19:58 log
brw-r----- 1 root disk 7, 0 Jan 14 19:58 loop0
brw-r----- 1 root disk 7, 1 Jan 14 19:58 loop1
brw-r----- 1 root disk 7, 2 Jan 14 19:58 loop2
brw-r----- 1 root disk 7, 3 Jan 14 19:58 loop3
brw-r----- 1 root disk 7, 4 Jan 14 19:58 loop4
brw-r----- 1 root disk 7, 5 Jan 14 19:58 loop5
brw-r----- 1 root disk 7, 6 Jan 14 19:58 loop6
brw-r----- 1 root disk 7, 7 Jan 14 19:58 loop7
drwxr-xr-x 2 root root 40 Jan 14 19:58 mapper
drwxr-xr-x 2 root root 60 Jan 14 19:58 net
crw-rw-rw- 1 root root 1, 3 Jan 14 19:58 null
crw-rw---- 1 root lp 99, 0 Jan 14 19:58 parport0
crw-rw---- 1 root lp 99, 1 Jan 14 19:58 parport1
crw-rw---- 1 root lp 99, 2 Jan 14 19:58 parport2
crw-rw---- 1 root lp 99, 3 Jan 14 19:58 parport3
crw------- 1 root root 108, 0 Jan 14 19:58 ppp
crw-rw-rw- 1 root root 5, 2 Jan 15 14:21 ptmx
drwxr-xr-x 2 root root 0 Jan 14 19:58 pts
crw-rw-rw- 1 root tty 2, 0 Jan 14 20:00 ptyp0
drwxr-xr-x 2 root root 40 Jan 14 19:58 shm
lrwxrwxrwx 1 root root 15 Jan 14 19:58 stderr -> /proc/self/fd/2
lrwxrwxrwx 1 root root 15 Jan 14 19:58 stdin -> /proc/self/fd/0
lrwxrwxrwx 1 root root 15 Jan 14 19:58 stdout -> /proc/self/fd/1
crw-rw-rw- 1 root root 5, 0 Jan 14 19:58 tty
-rw-r--r-- 1 root root 512 Jan 14 19:58 urandom
crw-rw-rw- 1 root root 1, 5 Jan 14 19:58 zero
also, it happens on all my VMs, not just one
|
|
|
|
|
|
Re: /dev/pty always gone [message #26188 is a reply to message #26055] |
Wed, 16 January 2008 18:39 |
Thomasd
Messages: 39 Registered: December 2007
|
Member |
|
|
there you go:
# rpm -qf /lib/udev/devices/
udev-095-14.9.el5
and
]# cat /sbin/start_udev
#!/bin/sh
#
# start_udev
#
# script to initialize /dev by using udev.
#
# Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>
#
# Released under the GPL v2 only.
#
# This needs to be run at the earliest possible point in the boot
# process.
#
# Based on the udev init.d script
#
# Thanks go out to the Gentoo developers for proving
# that this is possible to do.
#
# Yes, it's very verbose, feel free to turn off all of the echo calls,
# they were there to make me feel better that everything was working
# properly during development...
#
# don't use udev if sysfs is not mounted.
sysfs_dir=/sys
export TZ=/etc/localtime
[ -d $sysfs_dir/class ] || exit 1
[ -r /proc/mounts ] || exit 1
[ -x /sbin/udevd ] || exit 1
[ -f /etc/udev/udev.conf ] && . /etc/udev/udev.conf
udev_root=${udev_root-/dev}
. /etc/init.d/functions
prog=udev
bin=/sbin/udev
udevd=/sbin/udevd
MAKEDEV="/sbin/MAKEDEV"
xargs_simple () {
if [ "$1" = "-n" ]; then
shift
MAXNR="$1"
shift
else
MAXNR=100
fi
NR=$MAXNR
ARGS=""
[ -z "$1" ] && set echo
while read line; do
if [ $NR -gt 0 ]; then
ARGS="$ARGS $line"
NR=$[$NR - 1]
else
"$@" $ARGS
NR=$MAXNR
ARGS="$line"
fi
done
if [ -n "$ARGS" ]; then
"$@" $ARGS
fi
}
make_extra_nodes () {
ln -snf /proc/self/fd $udev_root/fd
ln -snf /proc/self/fd/0 $udev_root/stdin
ln -snf /proc/self/fd/1 $udev_root/stdout
ln -snf /proc/self/fd/2 $udev_root/stderr
ln -snf /proc/kcore $udev_root/core
[ -d $udev_root/pts ] || mkdir -m 0755 $udev_root/pts
[ -d $udev_root/shm ] || mkdir -m 0755 $udev_root/shm
[ -a /dev/MAKEDEV ] || ln -s $MAKEDEV /dev/MAKEDEV;
if [ -x $MAKEDEV ]; then
for i in /etc/udev/makedev.d/*.nodes; do
if [ -f "$i" ]; then
cat "$i" | sed -e 's,#.*,,g' | \
xargs_simple -n 100 $MAKEDEV -x
fi
done
fi
for devdir in /etc/udev/devices /lib/udev/devices; do
[ -d "$devdir" ] || continue
pushd $devdir &> "$udev_root/null"
set *
if [ "$1" != "*" ]; then
cp -ar "$@" $udev_root/
pushd "$udev_root" &> "$udev_root/null"
[ -x /sbin/restorecon ] && /sbin/restorecon "$@"
popd &> "$udev_root/null"
fi
popd &> "$udev_root/null"
done
}
kill_udevd() {
if [ -x /sbin/pidof ]; then
pid=`/sbin/pidof -x udevd`
[ -n "$pid" ] && kill $pid
fi
}
wait_for_queue() {
local timeout=${1:-0}
local ret=0
if [ $timeout -gt 0 ]; then
/sbin/udevsettle --timeout=$timeout
else
/sbin/udevsettle
fi
ret=$?
if [ $ret -ne 0 ]; then
echo -n "Wait timeout. Will continue in the background."
fi
return $ret;
}
export ACTION=add
prog=udev
ret=0
STRING=$"Starting $prog: "
# propagate $udev_root from /sys
echo -n "$STRING"
# mount the tmpfs on ${udev_root%/}, if not already done
LANG=C awk "\$2 == \"${udev_root%/}\" && \$3 == \"tmpfs\" { exit 1 }" /proc/mounts && {
if LANG=C fgrep -q "none ${udev_root%/}/pts " /proc/mounts; then
PTSDIR=$(mktemp -d)
mount --move $udev_root/pts "$PTSDIR"
fi
if LANG=C fgrep -q "none ${udev_root%/}/shm " /proc/mounts; then
SHMDIR=$(mktemp -d)
mount --move $udev_root/shm "$SHMDIR"
fi
mount -n -o mode=0755 -t tmpfs none "$udev_root"
mkdir -m 0755 $udev_root/pts
mkdir -m 0755 $udev_root/shm
if [ -n "$PTSDIR" ]; then
mount --move "$PTSDIR" $udev_root/pts
rmdir "$PTSDIR"
fi
if [ -n "$SHMDIR" ]; then
mount --move "$SHMDIR" $udev_root/shm
rmdir "$SHMDIR"
fi
ret=$[$ret + $?]
}
# returns OK if $1 contains $2
strstr() {
[ "${1#*$2*}" = "$1" ] && return 1
return 0
}
getval() {
what=$1
shift
for arg; do
if strstr "$arg" "$what="; then
val=${arg#${what}=*}
echo $val
return 0
fi
done
return 1
}
make_extra_nodes
cmdline=$(cat /proc/cmdline)
kill_udevd > "$udev_root/null" 2>&1
if [ -f "/sys/class/tty/console/uevent" ]; then
# trigger the sorted events
echo -e '\000\000\000\000' > /proc/sys/kernel/hotplug
if strstr "$cmdline" modprobedebug; then
touch /dev/.modprobe_debug
else
rm -f /dev/.modprobe_debug
fi
/sbin/udevd -d
ret=$[$ret + $?]
if strstr "$cmdline" udevdebug; then
/sbin/udevcontrol log_priority=debug
fi
/sbin/udevtrigger
ret=$[$ret + $?]
wait_for_queue $(getval udevtimeout $cmdline)
ret=$[$ret + $?]
else
echo -n " kernel too old for this udev version "
/sbin/udevd -d
ret=10
fi
ret=$[$ret + $?]
[ $ret -eq 0 ] && success $"$STRING" || failure $"$STRING"
echo
exit 0
so, here's what I found:
if I install from one of the CentOS 5 template (either full or minimal, same problem), it will work properly. I can restart the VM many times without problem.
When I run vzyum <vm> update it will trigger the problem and the pty will be missing each time I restart the VM.
Not sure if it matters but I have dag added to my yum repositories:
[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el5/en/i386/dag
gpgcheck=1
enabled=1
|
|
|
|
|
|
|
|
|
|
Re: /dev/pty always gone [SOLUTION] [message #26559 is a reply to message #26544] |
Mon, 28 January 2008 16:22 |
maratrus
Messages: 1495 Registered: August 2007 Location: Moscow
|
Senior Member |
|
|
Hi,
undoubtedly this is a decision.
But I would like to add a few words about this issue:
IMHO, it is not very correctly to place additional entries to 50-udev.nodes and this is the reason: in our case the udev package was not installed at first moment. So the problem was appeared when it was be installed during the update and we should be very careful because we want to save our settings. I recommend to create additional file, for example /etc/udev/makedev.d/vz-udev.nodes and
place there necessary devices. So if udev will be installed our devices will be added automatically.
|
|
|