WSL icon indicating copy to clipboard operation
WSL copied to clipboard

docker installation fails E: Can not write log(Is /dev/pts mounted?)

Open uadev opened this issue 10 years ago • 50 comments

root@localhost:/mnt/c/apps/cmder# apt-get install docker
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  docker
0 upgraded, 1 newly installed, 0 to remove and 10 not upgraded.
Need to get 0 B/12.2 kB of archives.
After this operation, 65.5 kB of additional disk space will be used.
E: Can not write log (Is /dev/pts mounted?) - openpty (2: No such file or directory)
Selecting previously unselected package docker.
(Reading database ... 24948 files and directories currently installed.)
Preparing to unpack .../docker_1.5-1_amd64.deb ...
Unpacking docker (1.5-1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up docker (1.5-1) ...
root@localhost:/mnt/c/apps/cmder# docker
The program 'docker' is currently not installed. You can install it by typing:
apt-get install docker
root@localhost:/mnt/c/apps/cmder#

uadev avatar Apr 08 '16 22:04 uadev

Seems to be related to #80. I'm not convinced that the log error is causing docker to fail to install (but what do I know, I'm just some random guy on the Internet), but it nevertheless isn't working, just as you say.

mphaney avatar Apr 08 '16 23:04 mphaney

The logs error is known and is a red herring, sorry. Docker does not run on WSL at this time. it is something on our radar but not something we want to talk about quite yet. That said, if someone wants to play with Docker here's what they will see:

  1. Docker install instructions are here. Follow the instructions for Trusty 14.04 (LTS)
  2. Starting the Docker service gives the following error (you also see this error on the apt-get install docker-engine when it tries to start the service):

$ sudo service docker start initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: No such fi le or directory

  • Starting Docker: docker [ OK ]

While it says the Docker service is started, don't be fooled:

$ sudo docker run hello-world docker: Cannot connect to the Docker daemon. Is the docker daemon running on this host?. See 'docker run --help'.

russalex avatar Apr 09 '16 00:04 russalex

@russalex You've managed to run upstart somehow? Is there an instruction for this?

uadev avatar Apr 09 '16 09:04 uadev

@russalex it'd be interesting to see how you overcame upstart ...

mjoppich avatar Apr 11 '16 16:04 mjoppich

Hate to say it, but I did nothing special for upstart. Before running this test I uninstalled using lxrun /uninstall, then did my usual round of apt-get installs for update, upgrade, build-essential, git and ruby. After that I just followed the instructions on the webpage. What I believe you're seeing is an error that was a result of #143.

Running docker with the apt-get fixes on that thread it looks like:

russ@RUSSALEX-DESK:~$ sudo service docker start
 * Starting Docker: docker                                                         [ OK ]
russ@RUSSALEX-DESK:~$ sudo docker run hello-world
docker: Cannot connect to the Docker daemon. Is the docker daemon running on this host?.
See 'docker run --help'.

russalex avatar Apr 12 '16 23:04 russalex

Thanks for the heads up.

Even though the service seems to start at my end, something else must be broken, as not even

root@localhost:~# docker -D info ^Croot@localhost:~# docker --help ^Croot@localhost:~#

info or help are displayed. I guess this got to do with docker itself which requires Kernel 3.10+. Is there any chance we get a more recent kernel for WSL?

Coming from computer science, I really think the ability to run docker containers and any other linux tools could really boost bioinformatics, where there are also a lot of non-computer-affine people :)

mjoppich avatar Apr 13 '16 06:04 mjoppich

WSL isn't a Linux kernel, it's an emulation layer. Though good question what kernel ABI version is being targeted. Presumably things may need to be updated a bit when the Ubuntu version gets dist-upgraded from 14.04 to 16.04.

tkelman avatar Apr 13 '16 07:04 tkelman

Someone made the Docker work?

renatocassino avatar Apr 25 '16 17:04 renatocassino

The docker engine is not a supported scenario in the short term. I would suggest hitting our User Voice page and upvoting Docker if you're looking to run the docker engine.

The docker client however should be running in build 14342. I have been able to run the docker client and connect to a docker engine running in a VM.

russalex avatar May 16 '16 16:05 russalex

To help future work, here is my investigation. I installed latest docker-engine following instruction at: https://docs.docker.com/engine/installation/linux/ubuntulinux/

issues:

  • The doc specify a kernel version 3.10 minimum when lxss is 3.0.4+
  • when daemon is starting it fails with error:
FATA[0000] can't create unix socket /var/run/docker.sock: listen unix /var/run/docker.sock: setsockopt: invalid argument

The strace reveal invalid argument on setsockopt:

sudo strace docker daemon
...
setsockopt(4, SOL_SOCKET, SO_BROADCAST, [1], 4) = -1 EINVAL (Invalid argument)
close(4)
...

value 1 as Boolean flag seems fine for SO_BROADCAST when looking at man 7 socket

yarmand avatar May 29 '16 17:05 yarmand

@russalex - we can't upvote Docker on UserVoice.. it is locked :(

https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/suggestions/13250370-docker

davetropeano avatar Jul 21 '16 12:07 davetropeano

For what it's worth: A big piece of docker-engine actually lives inside the kernel itself. That's why it keeps requiring newer kernels. (The docker-engine process doesn't actually do a whole lot itself when running a container; its job is to tell the kernel what to do, the kernel does the real work.)

WSL is a clean-room kernel reimplementation. So it can't, for both technical and legal reasons, simply take the kernel components of Docker and "make it work". They would need to reverse-engineer years of ongoing kernel development and reimplement it. (Or take some other nontrivial approach.)

If I were a WSL dev (which I'm not), I would totally enjoy that project. But it would take me a huge amount of time, time that could be spent building many other big features.

aseering avatar Jul 21 '16 14:07 aseering

@aseering Great explanation. Without making any promises I can say that we know docker is an important and powerful too and definitely something we're looking into.

benhillis avatar Jul 21 '16 15:07 benhillis

I can confirm the issue from May posted by @yarmand is still the same as it is today.

$ docker -D info

Cannot connect to the Docker daemon. Is the docker daemon running on this host?
$ sudo docker daemon

can't create unix socket /var/run/docker.sock: listen unix /var/run/docker.sock: setsockopt: invalid argument
$ sudo strace docker daemon

...
setsockopt(4, SOL_SOCKET, SO_BROADCAST, [1], 4) = -1 EINVAL (Invalid argument)
close(4)                                = 0
...

krisbulman avatar Aug 03 '16 00:08 krisbulman

It seems like (1) supporting windows server containers in Windows 10 and (2) using Windows Docker from Windows Bash (already working) would be acceptable.

bbarker avatar Aug 11 '16 19:08 bbarker

@bbarker I do not understand the benefit you are describing. Being able to run docker client inside WSL in order to run a windows app as a container looks a bit overcomplicated to me. The point we try to make here is being able to run Linux containers without the need of a VM.

It also seems the first error we are blocking on here, is a better support for sockets into WSL, which will be a good thing to have anyway.

yarmand avatar Aug 11 '16 21:08 yarmand

@yarmand I agree for not needing a VM - this is why I said support windows server containers, which I believe does not require Hyper-V (source). As for being complicated, it really wasn't - I got it up and running in a matter of minutes. Of course, in my case, I was using Hyper-V as I'm on Windows 10.

I'm all for better Linux kernel emulation, just saying this might be an easier route. I'd like to have real containers on Windows 10 instead of using Hyper-V, though I realize that is an "upstream" concern.

Edit: that said, I'm not actually sure, since I haven't tested it, if you can run a Linux container on Windows server containers without hyper-v .... logic suggests no. In which case, full steam ahead on this issue! :+1:

Edit 2: Actually, you should be able to run a Windows container with WSL inside windows server containers - over-complicated, yes, I see your point, but it would be better than nothing. Might not be so bad if other distributions were supported in WSL, other than just Ubuntu - but I Haven't looked into this yet.

bbarker avatar Aug 11 '16 21:08 bbarker

@aseering Does docker use anything in the kernel other than cgroups, namespaces, chroot, and more socket options for AF_Unix? If those are all that are being used, doesn't docker support come practically for free from support for chroot and systemd? I took a look at some of how docker works, and it seems that unlike some of the other container solutions, it doesn't require specific kernel patches.

fpqc avatar Aug 27 '16 06:08 fpqc

@fpqc -- I don't know the full list offhand, but I know it also does a bunch of stuff with the kernel network layer. It creates virtual network devices (related to tap/tun devices, I think?, which as you've said are very low priority right now). It creates a virtual network bridge (same syscalls as brctl, as far as I know). It uses iptables for routing network traffic between containers.

WSL's socket implementation is in general not robust enough yet. Docker can run over TCP today; but even in that scenario, which is in theory supported, Docker puts a fair bit of stress on the socket, especially when building new containers (it has a client/server model so sends all filesystem data over the network) and there are still bugs/deadlocks in WSL's socket implementation ( #30 #575 ) that cause it to intermittently hang. And, of course, it prefers and defaults to AF_UNIX, which still needs more functionality as you mentioned.

It also does bind-mounts of both directories and files, I believe. Bind-mounts ought to be easy to implement, I think? But I don't think they work yet.

WSL would have to implement the requirements for at least one of the storage backends -- one of AUFS, OverlayFS, BtrFS's snapshotting capabilities, or the whole DeviceMapper subsystem plus loopback devices and mount support for ext4, etc. I think there is a backend that mostly works on just a regular filesystem, but I believe it's firmly labeled as not for production use / mostly just for debugging Docker -- Docker uses copy-on-write semantics extensively; emulating that is expensive and a pain to get right.

Also, there's "supports cgroups and namespaces" and then there's "supports cgroups and namespaces" :-) My understanding, which may be incorrect, is that systemd only really requires pretty basic support for both, at least to get it minimally working. Enumerating the available cgroups, setting some values, etc. Docker uses both cgroups and namespaces extensively; I would be surprised if it worked properly without relatively complete support for the network namespace; I don't know offhand about other namespaces. Docker uses cgroups to impose various restrictions on the processes within a container; I don't have a clear picture in my head of exactly how it uses cgroups, but my guess is that basic containers would mostly work with stubbed-out support there, but they would be somewhat flaky and wouldn't support a bunch of Docker's resource-limiting features without more complete support.

You're right that Docker doesn't require specific kernel patches. For perspective, though: In the US at least, Red Hat Enterprise Linux is the most popular enterprise Linux solution. And RHEL 6 (or its free counterpart CentOS 6) is the most common version in existing deployments. So there's a huge market pressure to support RHEL 6 -- lots of big companies would be willing to pay someone to make it work. Docker never supported RHEL 6.4 or older because its kernel simply lacked necessary functionality. They worked with Red Hat to backport some network-namespace-related stuff from newer kernels into the CentOS 6.5 and 6.6 kernels, but that effort proved to be buggy and insufficient so they have since dropped support for RHEL 6 entirely. (Though Red Hat will happily sell you Docker support and extra features on RHEL 7 :-) ) Docker doesn't require patches because they're working with, and extending, features that are baked into the core kernel. As I recall, networking was an issue at one point, as was capping physical memory (Linux has supported virtual-memory caps for a long time but I believe physical-memory caps are more recent). Other things too, I'm sure. These days, I think it's filesystem stuff; their OverlayFS doc hints a little bit about the kinds of new kernel functionality that they're using. WSL is keeping the Windows kernel team busy, but the Linux kernel team is busy too :-)

aseering avatar Aug 27 '16 17:08 aseering

@aseering I have to admit, I wouldn't be very surprised if MS decides to wait until something like Redstone 3 or Redstone 4, after Server 2016 and Windows containers come out, if only because container-mania, if it continues that long, will make it so MS's customers will demand the ability to run both Windows and Linux workloads on a single kernel without any further virtualization.

The difference between RHEL6/CentOS6 is that Windows Server 2016 will not be just LTS. RHEL6 and CentOS6 are using basically an LTS kernel forked from the mainline kernel all the way back in 2009, with only security updates backported, which means no cgroups whatsoever. That's like asking MS to backport Windows Containers back to Windows Server 2008R2. Docker doesn't support kernels that are older probably than cgroupsv2. If it supported cgroupsv1 (not sure how old Docker is), compatibility was dropped because cgroupsv1 was deemed unstable and was removed from the Kernel.

But yeah, the thing you said about the level of cgroups support necessary for docker, as well as docker taking over Linux's network configuration, means that Docker would be hard to support (based on my reading of its Kernel Option requirements listed on the Gentoo wiki). Thanks for your long and detailed answer though.

fpqc avatar Aug 27 '16 21:08 fpqc