From 863a486d81a67fe0f3dafe38ddb29655e018791d Mon Sep 17 00:00:00 2001 From: Alejandro Ojeda Date: Fri, 24 Oct 2014 03:18:14 +0200 Subject: [PATCH] devices: filter /dev/console out of the node list Fixed getDeviceNodes() so it won't add /dev/console to the device node list. This fixes an issue where containers wouldn't start if /dev/console is a pts (which is the case when running docker inside docker), because devpts inodes are special and cannot be created with mknod: attempting to open the result of doing so will return EIO. Since later libcontainer would attempt to open the file to mount --bind over it and fail because of the EIO error, the container wouldn't start if the /dev/console was a pts, which is the case inside a docker that was started from a pts. getDeviceNodes() already filters pts so this change is consistent with the current behavior. Signed-off-by: Alejandro Ojeda --- devices/devices.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/devices/devices.go b/devices/devices.go index 558f7f5f9..d9a2181bc 100644 --- a/devices/devices.go +++ b/devices/devices.go @@ -115,14 +115,19 @@ func getDeviceNodes(path string) ([]*Device, error) { } } - device, err := GetDevice(filepath.Join(path, f.Name()), "rwm") - if err != nil { - if err == ErrNotADeviceNode { - continue + switch f.Name() { + case "console": + continue + default: + device, err := GetDevice(filepath.Join(path, f.Name()), "rwm") + if err != nil { + if err == ErrNotADeviceNode { + continue + } + return nil, err } - return nil, err + out = append(out, device) } - out = append(out, device) } return out, nil