Don't attempt to create devices in lx-brand containers

Bug #1679727 reported by Christopher Horrell on 2017-04-04
32
This bug affects 6 people
Affects Status Importance Assigned to Milestone
makedev (Ubuntu)
Medium
Unassigned

Bug Description

This is a similar issue to https://bugs.launchpad.net/ubuntu/+source/makedev/+bug/1675163

In a Joyent lx-brand container environment an upgrade of the makedev package fails at the post-installation script:

# apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up makedev (2.3.1-93ubuntu2~ubuntu14.04.1) ...
mknod: ‘mem-’: Operation not permitted
makedev mem c 1 1 root kmem 0640: failed
mknod: ‘kmem-’: Operation not permitted
makedev kmem c 1 2 root kmem 0640: failed
mknod: ‘null-’: Operation not permitted
makedev null c 1 3 root root 0666: failed
mknod: ‘port-’: Operation not permitted
makedev port c 1 4 root kmem 0640: failed
mknod: ‘zero-’: Operation not permitted
makedev zero c 1 5 root root 0666: failed
mknod: ‘full-’: Operation not permitted
makedev full c 1 7 root root 0666: failed
mknod: ‘random-’: Operation not permitted
makedev random c 1 8 root root 0666: failed
mknod: ‘urandom-’: Operation not permitted
makedev urandom c 1 9 root root 0666: failed
mknod: ‘tty-’: Operation not permitted
makedev tty c 5 0 root tty 0666: failed
mknod: ‘ram0-’: Operation not permitted
makedev ram0 b 1 0 root disk 0660: failed
mknod: ‘ram1-’: Operation not permitted
makedev ram1 b 1 1 root disk 0660: failed
mknod: ‘ram2-’: Operation not permitted
makedev ram2 b 1 2 root disk 0660: failed
mknod: ‘ram3-’: Operation not permitted
makedev ram3 b 1 3 root disk 0660: failed
mknod: ‘ram4-’: Operation not permitted
makedev ram4 b 1 4 root disk 0660: failed
mknod: ‘ram5-’: Operation not permitted
makedev ram5 b 1 5 root disk 0660: failed
mknod: ‘ram6-’: Operation not permitted
makedev ram6 b 1 6 root disk 0660: failed
mknod: ‘ram7-’: Operation not permitted
makedev ram7 b 1 7 root disk 0660: failed
mknod: ‘ram8-’: Operation not permitted
makedev ram8 b 1 8 root disk 0660: failed
mknod: ‘ram9-’: Operation not permitted
makedev ram9 b 1 9 root disk 0660: failed
mknod: ‘ram10-’: Operation not permitted
makedev ram10 b 1 10 root disk 0660: failed
mknod: ‘ram11-’: Operation not permitted
makedev ram11 b 1 11 root disk 0660: failed
mknod: ‘ram12-’: Operation not permitted
makedev ram12 b 1 12 root disk 0660: failed
mknod: ‘ram13-’: Operation not permitted
makedev ram13 b 1 13 root disk 0660: failed
mknod: ‘ram14-’: Operation not permitted
makedev ram14 b 1 14 root disk 0660: failed
mknod: ‘ram15-’: Operation not permitted
makedev ram15 b 1 15 root disk 0660: failed
mknod: ‘ram16-’: Operation not permitted
makedev ram16 b 1 16 root disk 0660: failed
mknod: ‘loop0-’: Operation not permitted
makedev loop0 b 7 0 root disk 0660: failed
mknod: ‘loop1-’: Operation not permitted
makedev loop1 b 7 1 root disk 0660: failed
mknod: ‘loop2-’: Operation not permitted
makedev loop2 b 7 2 root disk 0660: failed
mknod: ‘loop3-’: Operation not permitted
makedev loop3 b 7 3 root disk 0660: failed
mknod: ‘loop4-’: Operation not permitted
makedev loop4 b 7 4 root disk 0660: failed
mknod: ‘loop5-’: Operation not permitted
makedev loop5 b 7 5 root disk 0660: failed
mknod: ‘loop6-’: Operation not permitted
makedev loop6 b 7 6 root disk 0660: failed
mknod: ‘loop7-’: Operation not permitted
makedev loop7 b 7 7 root disk 0660: failed
mknod: ‘tty0-’: Operation not permitted
makedev tty0 c 4 0 root tty 0600: failed
mknod: ‘console-’: Operation not permitted
makedev console c 5 1 root tty 0600: failed
ln: failed to create symbolic link ‘fd/fd’: Function not implemented
ln: failed to create symbolic link ‘stdin’: File exists
ln: failed to create symbolic link ‘stdout’: File exists
ln: failed to create symbolic link ‘stderr’: File exists
/sbin/MAKEDEV: don't know how to make device "tty0"
dpkg: error processing package makedev (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 makedev
E: Sub-process /usr/bin/dpkg returned an error code (1)

The workaround is similar to 1675163 except in this case the post-installation script should check for "container=zone" in '/proc/1/environ':

if grep -q container=zone /proc/1/environ
then
    echo "lx-brand container detected."
    exit 0
fi

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in makedev (Ubuntu):
status: New → Confirmed
tags: added: trusty
Changed in makedev (Ubuntu):
importance: Undecided → Medium

Same issue in machined containers.

I published fixed package: https://yadi.sk/d/_vXq0WdR3HgbTJ

I replaced LXC detection with following condition:

# don't stomp on container users
if [ "$(systemd-detect-virt -c)" != "none" ]
then
    echo "Container detected, aborting."
    exit 0
fi

But I don't know if this good solution. Anyone from Canonical can check this?

Joyent lx-brand user here with Ubuntu 14.04 image. Any guidance on how to work around this please?

Check comment #4

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers