Difference between revisions of "Container enter failed"

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search
(alternative solution for the problem)
 
(24 intermediate revisions by 14 users not shown)
Line 1: Line 1:
'''Problem''': container created succesfully and started.
+
== Symptoms ==
But when trying to do
+
 
 
<pre>
 
<pre>
vzctl enter 101
+
error: open pty: No such file or directory
</pre>
 
you get
 
<pre>
 
container enter failed(?)
 
 
</pre>
 
</pre>
  
Using strace, you see:
+
== Solutions ==
 +
 
 +
=== Using strace ===
 +
 
 +
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 17:
 
</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 exec 101 mknod --mode=666 /dev/ptmx c 5 2
 +
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
  
Another solution:
+
=== Older Slackware ===
  
enter the VE  manually creating the LEGACY_PTYS devices
+
Check that /dev/pts is mounted under the container as a devpts filesystem:
  
<pre>
+
vzctl exec VEID mount
vzctl exec 101 /sbin/MAKEDEV tty
 
vzctl exec 101 /sbin/MAKEDEV pty
 
vzctl enter 101
 
</pre>
 
  
To save the changes create a file  to force udev making LEGACY_PTYS:
+
If it is not, try this immediate fix:
  
<pre>
+
vzctl exec VEID mount /dev/pts
cat > /etc/udev/makedev.d/51-udev.nodes
 
# These device have to be created manually
 
tty0
 
tty1
 
tty2
 
tty3
 
tty4
 
tty5
 
tty6
 
tty7
 
tty8
 
tty9
 
ttyp0
 
ttyp1
 
ttyp2
 
ttyp3
 
ttyp4
 
ttyp5
 
ttyp6
 
ptyp0
 
ptyp1
 
ptyp2
 
ptyp3
 
ptyp4
 
ptyp5
 
  
</pre>
+
You should now be able to enter the VPS. You will need to fix /etc/rc.d/rc.S and/or /etc/fstab to ensure that /dev/pts is mounted in the boot process.
  
  

Latest revision as of 19:30, 30 September 2014

Symptoms[edit]

error: open pty: No such file or directory

Solutions[edit]

Using strace[edit]

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[edit]

Temporary fix[edit]

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 exec 101 mknod --mode=666 /dev/ptmx c 5 2
vzctl enter 101

Permanent fix with udev[edit]

  • 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[edit]

  • 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[edit]

  • 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

Older Slackware[edit]

Check that /dev/pts is mounted under the container as a devpts filesystem:

vzctl exec VEID mount

If it is not, try this immediate fix:

vzctl exec VEID mount /dev/pts

You should now be able to enter the VPS. You will need to fix /etc/rc.d/rc.S and/or /etc/fstab to ensure that /dev/pts is mounted in the boot process.


See also[edit]