Couldn't mount the binfmt_misc filesystem


mount: permission denied
update-binfmts: warning: Couldn't mount the binfmt_misc filesystem on /proc/sys/fs/binfmt_misc.

docker gcc upgrade error
https://qiita.com/kaizen_nagoya/items/d2d424318b711aef4af5

Cコンパイラ3種をdockerで
https://qiita.com/kaizen_nagoya/items/77184cf005490d7579e6

binfmt_misc problems in ubuntu18.04 under docker
https://stackoverflow.com/questions/54951262/binfmt-misc-problems-in-ubuntu18-04-under-docker

Ignore those warnings because it doesn't make sense to register binfmt on the host while the image is being built.

Support for unprivileged docker daemon #104
https://github.com/rust-embedded/cross/issues/104

In principle we can set up the binfmt_misc stuff outside docker then we wouldn't need that privileged docker call but I never got around to implement that. Setting binfmt_misc outside docker would still require root privilege though.

binfmt_misc filesystem
https://en.wikipedia.org/wiki/Binfmt_misc

linux-cheat/binfmt-misc-filesystem.md
https://github.com/cirosantilli/linux-cheat/blob/master/binfmt-misc-filesystem.md

QEMUのユーザーモードをDockerコンテナ上で使う
https://qiita.com/FGtatsuro/items/c5dd8fdb028fe8948c2e

--privilegedをつけて起動

$ docker run -it  --privileged kaizenjapan/cc2 /bin/bash 

clang導入。

# apt install clang
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  binfmt-support clang-3.8 libclang-common-3.8-dev libclang1-3.8 libgc1c2 libjsoncpp1 libllvm3.8
  libobjc-6-dev libobjc4 libpipeline1 llvm-3.8 llvm-3.8-dev llvm-3.8-runtime
Suggested packages:
  gnustep gnustep-devel clang-3.8-doc llvm-3.8-doc
The following NEW packages will be installed:
  binfmt-support clang clang-3.8 libclang-common-3.8-dev libclang1-3.8 libgc1c2 libjsoncpp1 libllvm3.8
  libobjc-6-dev libobjc4 libpipeline1 llvm-3.8 llvm-3.8-dev llvm-3.8-runtime
0 upgraded, 14 newly installed, 0 to remove and 0 not upgraded.
Need to get 58.0 MB of archives.
After this operation, 293 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://deb.debian.org/debian stretch/main amd64 libpipeline1 amd64 1.4.1-2 [27.6 kB]
Get:2 http://deb.debian.org/debian stretch/main amd64 libgc1c2 amd64 1:7.4.2-8 [208 kB]
Get:3 http://deb.debian.org/debian stretch/main amd64 binfmt-support amd64 2.1.6-2 [59.5 kB]
Get:4 http://deb.debian.org/debian stretch/main amd64 libllvm3.8 amd64 1:3.8.1-24 [10.4 MB]
Get:5 http://deb.debian.org/debian stretch/main amd64 libclang1-3.8 amd64 1:3.8.1-24 [4190 kB]
Get:6 http://deb.debian.org/debian stretch/main amd64 libobjc4 amd64 6.3.0-18+deb9u1 [49.5 kB]
Get:7 http://deb.debian.org/debian stretch/main amd64 libobjc-6-dev amd64 6.3.0-18+deb9u1 [196 kB]
Get:8 http://deb.debian.org/debian stretch/main amd64 libclang-common-3.8-dev amd64 1:3.8.1-24 [2198 kB]
Get:9 http://deb.debian.org/debian stretch/main amd64 clang-3.8 amd64 1:3.8.1-24 [22.8 MB]
Get:10 http://deb.debian.org/debian stretch/main amd64 clang amd64 1:3.8-36 [5810 B]                     
Get:11 http://deb.debian.org/debian stretch/main amd64 llvm-3.8-runtime amd64 1:3.8.1-24 [87.9 kB]       
Get:12 http://deb.debian.org/debian stretch/main amd64 llvm-3.8 amd64 1:3.8.1-24 [1548 kB]               
Get:13 http://deb.debian.org/debian stretch/main amd64 libjsoncpp1 amd64 1.7.4-3 [75.6 kB]               
Get:14 http://deb.debian.org/debian stretch/main amd64 llvm-3.8-dev amd64 1:3.8.1-24 [16.1 MB]           
Fetched 58.0 MB in 9s (6259 kB/s)                                                                        
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libpipeline1:amd64.
(Reading database ... 38749 files and directories currently installed.)
Preparing to unpack .../00-libpipeline1_1.4.1-2_amd64.deb ...
Unpacking libpipeline1:amd64 (1.4.1-2) ...
Selecting previously unselected package libgc1c2:amd64.
Preparing to unpack .../01-libgc1c2_1%3a7.4.2-8_amd64.deb ...
Unpacking libgc1c2:amd64 (1:7.4.2-8) ...
Selecting previously unselected package binfmt-support.
Preparing to unpack .../02-binfmt-support_2.1.6-2_amd64.deb ...
Unpacking binfmt-support (2.1.6-2) ...
Selecting previously unselected package libllvm3.8:amd64.
Preparing to unpack .../03-libllvm3.8_1%3a3.8.1-24_amd64.deb ...
Unpacking libllvm3.8:amd64 (1:3.8.1-24) ...
Selecting previously unselected package libclang1-3.8:amd64.
Preparing to unpack .../04-libclang1-3.8_1%3a3.8.1-24_amd64.deb ...
Unpacking libclang1-3.8:amd64 (1:3.8.1-24) ...
Selecting previously unselected package libobjc4:amd64.
Preparing to unpack .../05-libobjc4_6.3.0-18+deb9u1_amd64.deb ...
Unpacking libobjc4:amd64 (6.3.0-18+deb9u1) ...
Selecting previously unselected package libobjc-6-dev:amd64.
Preparing to unpack .../06-libobjc-6-dev_6.3.0-18+deb9u1_amd64.deb ...
Unpacking libobjc-6-dev:amd64 (6.3.0-18+deb9u1) ...
Selecting previously unselected package libclang-common-3.8-dev.
Preparing to unpack .../07-libclang-common-3.8-dev_1%3a3.8.1-24_amd64.deb ...
Unpacking libclang-common-3.8-dev (1:3.8.1-24) ...
Selecting previously unselected package clang-3.8.
Preparing to unpack .../08-clang-3.8_1%3a3.8.1-24_amd64.deb ...
Unpacking clang-3.8 (1:3.8.1-24) ...
Selecting previously unselected package clang.
Preparing to unpack .../09-clang_1%3a3.8-36_amd64.deb ...
Unpacking clang (1:3.8-36) ...
Selecting previously unselected package llvm-3.8-runtime.
Preparing to unpack .../10-llvm-3.8-runtime_1%3a3.8.1-24_amd64.deb ...
Unpacking llvm-3.8-runtime (1:3.8.1-24) ...
Selecting previously unselected package llvm-3.8.
Preparing to unpack .../11-llvm-3.8_1%3a3.8.1-24_amd64.deb ...
Unpacking llvm-3.8 (1:3.8.1-24) ...
Selecting previously unselected package libjsoncpp1:amd64.
Preparing to unpack .../12-libjsoncpp1_1.7.4-3_amd64.deb ...
Unpacking libjsoncpp1:amd64 (1.7.4-3) ...
Selecting previously unselected package llvm-3.8-dev.
Preparing to unpack .../13-llvm-3.8-dev_1%3a3.8.1-24_amd64.deb ...
Unpacking llvm-3.8-dev (1:3.8.1-24) ...
Setting up libllvm3.8:amd64 (1:3.8.1-24) ...
Setting up libclang-common-3.8-dev (1:3.8.1-24) ...
Setting up libclang1-3.8:amd64 (1:3.8.1-24) ...
Setting up libgc1c2:amd64 (1:7.4.2-8) ...
Setting up libpipeline1:amd64 (1.4.1-2) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...
Setting up libjsoncpp1:amd64 (1.7.4-3) ...
Setting up binfmt-support (2.1.6-2) ...
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of start.
Setting up libobjc4:amd64 (6.3.0-18+deb9u1) ...
Setting up libobjc-6-dev:amd64 (6.3.0-18+deb9u1) ...
Setting up llvm-3.8-runtime (1:3.8.1-24) ...
Setting up llvm-3.8 (1:3.8.1-24) ...
Setting up llvm-3.8-dev (1:3.8.1-24) ...
Setting up clang-3.8 (1:3.8.1-24) ...
Setting up clang (1:3.8-36) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...

文書履歴(document history)

ver. 0.01 初稿 20190504 夕
ver. 0.02 URL追記 20190504 夜


http://b.hatena.ne.jp/guide/bbutton