Difference between revisions of "Container enter failed"

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search
(Better formatting)
Line 1: Line 1:
'''Problem''': container created succesfully and started.
+
== Problem ==
But when trying to do
+
 
<pre>
+
When you issue the following command you get an error:
vzctl enter 101  
+
[root@server ~]# vzctl enter 101
</pre>
+
enter into CT 101 failed
you get
+
Unable to open pty: No such file or directory
<pre>
+
 
container enter failed(?)
+
== Solutions ==
</pre>
+
 
 +
=== Using strace ===
  
Using strace, you see:
+
You can use [http://linux.die.net/man/1/strace strace] to analyse the command further:
 
<pre>
 
<pre>
# strace -ff vzctl enter
+
# strace -ff vzctl enter 101
 
....
 
....
 
fstat64(...st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0)...) fail
 
fstat64(...st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0)...) fail
Line 17: Line 18:
 
</pre>
 
</pre>
  
'''Solution''':
 
 
Recompile the kernel with the following option:
 
Recompile the kernel with the following option:
<pre>
+
CONFIG_LEGACY_PTYS=y
CONFIG_LEGACY_PTYS=y
+
 
</pre>
+
=== LEGACY_PTYS ===
 +
 
 +
==== Temporary fix ====
 +
''Note: This is a temporary fix so you can enter the VE.''
 +
 
 +
* Create the LEGACY_PTYS devices:
 +
 
 +
vzctl exec 101 /sbin/MAKEDEV tty
 +
vzctl exec 101 /sbin/MAKEDEV pty
 +
vzctl enter 101
 +
 
 +
==== Permanent fix with udev ====
 +
* For a permanent fix with udev, you will need to force udev to make LEGACY_PTYS:
  
'''Other solutions''':
+
cat > /etc/udev/makedev.d/51-udev.nodes
 +
# These device have to be created manually
 +
tty0
 +
tty1
 +
tty2
 +
tty3
 +
....
 +
ttyp0
 +
ttyp1
 +
ttyp2
 +
ttyp3
 +
....
 +
ptyp0
 +
ptyp1
 +
ptyp2
 +
ptyp3
 +
....
  
1) enter the VE  manually creating the LEGACY_PTYS devices
+
==== Permanent fix without udev ====
 +
* Alternatively, you can disable udev:
  
<pre>
+
Edit the ''/etc/rc.d/rc.sysinit'' file and comment out the ''/sbin/start_udev'' line
vzctl exec  101 /sbin/MAKEDEV tty
 
vzctl exec 101 /sbin/MAKEDEV pty
 
vzctl enter 101
 
</pre>
 
  
2A) If you want udev in VE,  save the changes forcing udev to make LEGACY_PTYS:
+
Or you can run the following command:
  
<pre>
+
sed -i 's|/sbin/start_udev|#/sbin/start_udev|g' /etc/rc.d/rc.sysinit
cat > /etc/udev/makedev.d/51-udev.nodes
 
# These device have to be created manually
 
tty0
 
tty1
 
tty2
 
tty3
 
....
 
ttyp0
 
ttyp1
 
ttyp2
 
ttyp3
 
....
 
ptyp0
 
ptyp1
 
ptyp2
 
ptyp3
 
....
 
</pre>
 
  
 +
''Warning'' Updates to the package which owns this file may revert your changes.
  
2B) If you think is better disable udev in VE, comment out in the VE the line:
+
''Note'' This was tested with CentOS VE.
<pre>
 
/sbin/start_udev
 
</pre>
 
in
 
<pre>
 
/etc/rc.d/rc.sysinit
 
</pre>
 
  
.. <b>however</b> updates to the package which owns this file may revert your changes, so you must take steps to guard against this.
+
=== Debian only ===
  
Restart the VE and make the devices with MAKEDEV:
+
* Enter the VE manually
<pre>
+
  CTID=101
vzctl exec 101 /sbin/MAKEDEV tty
+
vzctl exec $CTID "mount -t devpts devpts /dev/pts"
vzctl exec 101 /sbin/MAKEDEV pty
+
vzctl enter $CTID
vzctl enter 101
 
</pre>
 
  
3) Debian : enter the VE manually (the 1 && 2 solutions did'nt work on my VE debian-5.0)
+
* Remove udev using apt
<pre>
+
  CTID=101
CTID=101
+
vzctl exec $CTID apt-get remove udev
vzctl exec $CTID "mount -t devpts devpts /dev/pts"
+
vzctl restart $CTID
vzctl enter $CTID
 
</pre>
 
  
4) Debian : Simply remove udev using apt
 
<pre>
 
CTID=101
 
vzctl exec $CTID apt-get remove udev
 
vzctl restart $CTID
 
</pre>
 
 
== See also ==
 
== See also ==
  

Revision as of 00:00, 10 December 2010

Problem

When you issue the following command you get an error:

[root@server ~]# vzctl enter 101
enter into CT 101 failed
Unable to open pty: No such file or directory

Solutions

Using strace

You can use strace to analyse the command further:

# strace -ff vzctl enter 101
....
fstat64(...st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0)...) fail
....

Recompile the kernel with the following option:

CONFIG_LEGACY_PTYS=y

LEGACY_PTYS

Temporary fix

Note: This is a temporary fix so you can enter the VE.

  • Create the LEGACY_PTYS devices:
vzctl exec 101 /sbin/MAKEDEV tty
vzctl exec 101 /sbin/MAKEDEV pty
vzctl enter 101

Permanent fix with udev

  • For a permanent fix with udev, you will need to force udev to make LEGACY_PTYS:
cat > /etc/udev/makedev.d/51-udev.nodes
# These device have to be created manually
tty0
tty1
tty2
tty3
....
ttyp0
ttyp1
ttyp2
ttyp3
....
ptyp0
ptyp1
ptyp2
ptyp3
....

Permanent fix without udev

  • Alternatively, you can disable udev:

Edit the /etc/rc.d/rc.sysinit file and comment out the /sbin/start_udev line

Or you can run the following command:

sed -i 's|/sbin/start_udev|#/sbin/start_udev|g' /etc/rc.d/rc.sysinit

Warning Updates to the package which owns this file may revert your changes.

Note This was tested with CentOS VE.

Debian only

  • Enter the VE manually
CTID=101
vzctl exec $CTID "mount -t devpts devpts /dev/pts" 
vzctl enter $CTID
  • Remove udev using apt
CTID=101
vzctl exec $CTID apt-get remove udev
vzctl restart $CTID

See also