for-mac icon indicating copy to clipboard operation
for-mac copied to clipboard

osxfs: character device file support

Open Red54 opened this issue 10 years ago • 13 comments

$ docker run -it red54/debian su -
root@70b08ee999bd:~# mknod test c 1 1
root@70b08ee999bd:~# ls -al test
crw-r--r-- 1 root root 1, 1 Aug 16 02:40 test
root@70b08ee999bd:~# 


$ echo -n This file system is case->tmp; echo -n in>>TMP; echo sensitive>>tmp; cat tmp
This file system is case-insensitive
$ docker run -it -v $(PWD)/test:/root red54/debian su -
root@15e1bd2de076:~# mknod test c 1 1
mknod: 'test': Function not implemented
root@15e1bd2de076:~# ls -al test
ls: cannot access test: No such file or directory
root@15e1bd2de076:~# 


$ echo -n This file system is case->tmp; echo -n in>>TMP; echo sensitive>>tmp; cat tmp
This file system is case-sensitive
$ docker run -it -v $(PWD)/test:/root red54/debian su -
root@5245cb220f95:~# mknod test c 1 1
mknod: 'test': Function not implemented
root@5245cb220f95:~# ls -al test
ls: cannot access test: No such file or directory
root@5245cb220f95:~# 

Red54 avatar Aug 16 '16 02:08 Red54

This is a documented limitation of the shared file system. See https://docs.docker.com/docker-for-mac/osxfs/#file-types which does not list block or character device files as supported file types. What behavior do you expect from this character device? What is your use case?

It is possible that supporting separate, unconnected character device files is relatively straightforward but supporting shared character (or block) devices will take significantly more work. I've opened a work ticket for this feature. Thank you, again, for your excellent report!

dsheets avatar Aug 16 '16 10:08 dsheets

Thank you for your explanation.

My use case is to build the firmware of a kind of WiSoc, some filesystem nodes should be created in the building directory, and be packaged as a part of the romfs.

I hope I can use this feature in the near future.

Red54 avatar Aug 16 '16 12:08 Red54

That sounds like a neat application! Just to be sure I understand your use correctly:

To build the FS image for your firmware, you need to create a root file system structure in the build directory which is a subdirectory of your shared code directory. This file system structure does not need to be functionally shared but it is necessary to have nodes of the appropriate types available for the image builder to consume. Because of this, you only require a shared character device directory entry and do not require OS X and Linux to share the underlying device. Is that right?

dsheets avatar Aug 16 '16 12:08 dsheets

That’s exactly right, you must be an old stager!

Red54 avatar Aug 16 '16 13:08 Red54

I'd like to chime in and say that fixing this would simplify my packaging as well.

$ pbuilder-dist xenial amd64 create --updates-only
/usr/sbin/debootstrap
mknod: '/var/cache/pbuilder/build/88/./test-dev-null': Function not implemented

CamJN avatar Jan 04 '17 21:01 CamJN

Upvote +1

I too am trying to use docker for packaging linuces (plural of linux - latin purist)

P: Running debootstrap...
mknod: /data/chroot/test-dev-null: Function not implemented
E: Cannot install into target '/data/chroot' mounted with noexec or nodev

Can we get more people on board?

mtlott avatar Apr 28 '17 14:04 mtlott

Most definitely another +1!

JHartman5 avatar Aug 25 '17 22:08 JHartman5

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale comment. Stale issues will be closed after an additional 30d of inactivity.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle stale

docker-robott avatar Mar 27 '18 10:03 docker-robott

/remove-lifecycle stale

CamJN avatar Mar 27 '18 10:03 CamJN

Thanks everyone for the report.

I investigated this a bit more, and while we could call mknod in the fileserver it would unfortunately fail on the Mac with EPERM, since the fileserver on the Mac runs as the user running Docker and not as root. Running the fileserver as non-root is important because it ensures that Docker cannot accidentally read sensitive paths like the macOS equivalent of /etc/shadow.

So I'd like to find the best available workaround to handle this particular problem. Could the build and packaging step be run as part of a docker build? This would upload the local files as part of the "build context" and it will be possible to run mknod since it's all running on Linux. The output can be extracted from the resulting image by a docker run command, perhaps something like

docker build -t test .
docker run test cat /package_name > package_name

What do you think?

djs55 avatar Mar 28 '18 14:03 djs55

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale comment. Stale issues will be closed after an additional 30d of inactivity.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle stale

docker-robott avatar Jul 30 '18 19:07 docker-robott

My use case can be read about here: https://github.com/phusion/passenger_apt_automation/#the-build-script

edit: wrong link, sorry

CamJN avatar Jul 30 '18 20:07 CamJN

Closed issues are locked after 30 days of inactivity. This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle locked

docker-robott avatar Jun 18 '20 03:06 docker-robott