Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running unik daemon on Windows: Error: Input/output error during read on /dev/loop0\nError: Operation not permitted during write on /dev/loop0 #169

Open
hsluoyz opened this issue Jun 26, 2018 · 0 comments

Comments

@hsluoyz
Copy link
Contributor

hsluoyz commented Jun 26, 2018

C:\Users\luo>unik daemon --debug
time="2018-06-25T00:16:30+08:00" level=info msg="daemon started" config={{[] [] [] [{my-vbox VirtualBox Host-Only Ethernet Adapter host_only}] [] [] [] [] []} 0.0.0}
time="2018-06-25T00:16:30+08:00" level=info msg="using container versions" versions=map[boot-creator:d0665c8793b16c51 compilers-rump-c-hw:1954dce79e407724 qemu-util:6f5922561bbb86e3 compilers-osv-java:14f2183e5cb49482 compilers-osv-dynamic:59ba07ca2f12ecaa compilers-mirage-ocaml-ukvm:2c35c23771682e9a compilers-rump-base-xen:f841298dae4340f7 compilers-rump-nodejs-hw-no-stub:baebfe68f3283190 compilers-rump-c-xen:65c2c7316ad6fc77 compilers-mirage-ocaml-xen:0cd46f5253c6ca8a compilers-includeos-cpp-hw:694e22e023dbbbc8 compilers-rump-python3-hw-no-stub:81a494acc94d7827 compilers-rump-python3-xen:1496a60a071e79e1 compilers-rump-base-hw:8cd85d4a7ee1009b compilers-rump-go-hw:d1bfbc13602e306d compilers-rump-python3-hw:22bc5378af6e099d compilers-includeos-cpp-common:8de1311f7b1365d9 compilers-rump-base-common:2eb72d1b386ce2a4 compilers-rump-nodejs-hw:b5029ddcc8731a25 vsphere-client:a9538c7c242acbef image-creator:fa560ac11cecae33 compilers-rump-nodejs-xen:2fbc447253ba19b8 compilers-rump-java-hw:e8c77dc577b288d9 compilers-rump-java-xen:43365940a0dd610c rump-debugger-qemu:0a841d0bf71287e6 compilers-rump-go-xen:fe3335e71ed20510]
...

time="2018-06-26T16:07:14+08:00" level=debug msg="time=\"2018-06-26T08:07:16Z\" level=debug msg=\"total size 10 after adding file vol\" "
time="2018-06-26T16:07:14+08:00" level=debug msg="time=\"2018-06-26T08:07:16Z\" level=debug msg=\"total size 10 after adding file Godeps\" "
time="2018-06-26T16:07:14+08:00" level=debug msg="time=\"2018-06-26T08:07:16Z\" level=debug msg=\"total size 10 after adding file Godeps.json\" "
time="2018-06-26T16:07:14+08:00" level=debug msg="time=\"2018-06-26T08:07:16Z\" level=debug msg=\"total size 10 after adding file boot-creator-result.img.689419057\" "
time="2018-06-26T16:07:14+08:00" level=debug msg="time=\"2018-06-26T08:07:16Z\" level=debug msg=\"total size 10 after adding file bootstrap_ec2.go\" "
time="2018-06-26T16:07:14+08:00" level=debug msg="time=\"2018-06-26T08:07:16Z\" level=debug msg=\"total size 10 after adding file bootstrap_gcloud.go\" "
time="2018-06-26T16:07:14+08:00" level=debug msg="time=\"2018-06-26T08:07:16Z\" level=debug msg=\"total size 10 after adding file bootstrap_nostub.go\" "
time="2018-06-26T16:07:14+08:00" level=debug msg="time=\"2018-06-26T08:07:16Z\" level=debug msg=\"total size 10 after adding file bootstrap_udp.go\" "
time="2018-06-26T16:07:14+08:00" level=debug msg="time=\"2018-06-26T08:07:16Z\" level=debug msg=\"total size 10 after adding file main.go\" "
time="2018-06-26T16:07:14+08:00" level=debug msg="time=\"2018-06-26T08:07:16Z\" level=debug msg=\"total size 20 after adding file program\" "
time="2018-06-26T16:07:14+08:00" level=debug msg="time=\"2018-06-26T08:07:16Z\" level=debug msg=\"total size 47 after adding file program.bin\" "
time="2018-06-26T16:07:15+08:00" level=debug msg="time=\"2018-06-26T08:07:17Z\" level=debug msg=\"created sparse file\" imgFile=\"/opt/vol/boot.image.6c2e66c1-42ac-4ffb-86d8-3883b0d2b7ea\" size=61MiB "
time="2018-06-26T16:07:15+08:00" level=debug msg="time=\"2018-06-26T08:07:17Z\" level=debug msg=\"attaching sparse file\" imgFile=\"/opt/vol/boot.image.6c2e66c1-42ac-4ffb-86d8-3883b0d2b7ea\" "
time="2018-06-26T16:07:15+08:00" level=debug msg="time=\"2018-06-26T08:07:17Z\" level=debug msg=\"running losetup -f\" cmd=losetup device=\"/opt/vol/boot.image.6c2e66c1-42ac-4ffb-86d8-3883b0d2b7ea\" "
time="2018-06-26T16:07:15+08:00" level=debug msg="time=\"2018-06-26T08:07:17Z\" level=debug msg=\"device mapping to 'hda'\" "
time="2018-06-26T16:07:15+08:00" level=debug msg="time=\"2018-06-26T08:07:17Z\" level=debug msg=partitioning "
time="2018-06-26T16:07:15+08:00" level=debug msg="time=\"2018-06-26T08:07:17Z\" level=debug msg=\"running parted\" args=[mklabel msdos] device=\"/dev/loop0\" "
time="2018-06-26T16:07:15+08:00" level=debug msg="time=\"2018-06-26T08:07:17Z\" level=error msg=\"parted failed\" args=[--script --machine /dev/loop0 mklabel msdos] err=\"exit status 1\" out=\"Error: Input/output error during read on /dev/loop0\\nError: Input/output error during read on /dev/loop0\\nError: Operation not permitted during write on /dev/loop0\\n\" "
time="2018-06-26T16:07:15+08:00" level=debug msg="time=\"2018-06-26T08:07:17Z\" level=debug msg=\"running losetup\" args=[-d /dev/loop0] cmd=losetup "
time="2018-06-26T16:07:15+08:00" level=debug msg="time=\"2018-06-26T08:07:17Z\" level=fatal msg=\"exit status 1\" "
time="2018-06-26T16:07:15+08:00" level=error msg="running daemon failed: [cmd/daemon.go:86] daemon failed to initialize: {[daemon/daemon.go:107] initializing virtualbox provider: {[virtualbox/virtualbox_provider.go:49] deploying virtualbox instance listener: {[virtualbox/deploy_instance_listener.go:39] compiling instance listener source to unikernel: {[rump/rump-go.go:55] creating boot volume from kernel binary: {exit status 1}}}}}"
C:\Users\luo>

In order to clearly show the error, I extracted the faulting Docker command that unik invoked:

Microsoft Windows [Version 10.0.17134.112]
(c) 2018 Microsoft Corporation. All rights reserved.

C:\Users\luo>docker run --rm --privileged -v /dev/:/dev/ -v /c/Users/luo/AppData/Local/Temp/bootable-image-directory.593233002:/opt/vol/ --name=c17ee6e8-83a5-45f0-8769-ba44ae8acb93 projectunik/boot-creator:d0665c8793b16c51 -d /opt/vol/ -p program.bin -a {"rc":[{"bin":"program","argv":["-prefix","unik_virtualbox","-enablePersistence"]}],"net":{"if":"vio"}} -o boot-creator-result.img.375002817 -part=true
time="2018-06-26T14:14:21Z" level=debug msg="calling CreateBootImageWithSize" args="{rc:[{bin:program,argv:[-prefix,unik_virtualbox,-enablePersistence]}],net:{if:vio}}" imgFile="/opt/vol/boot.image.d07710ad-d6d2-4d2a-b182-769237e8d067" kernelFile="/opt/vol/program.bin" usePartitionTables=true
time="2018-06-26T14:14:21Z" level=debug msg="total size 10 after adding file vol"
time="2018-06-26T14:14:21Z" level=debug msg="total size 10 after adding file Godeps"
time="2018-06-26T14:14:21Z" level=debug msg="total size 10 after adding file Godeps.json"
time="2018-06-26T14:14:21Z" level=debug msg="total size 10 after adding file boot-creator-result.img.375002817"
time="2018-06-26T14:14:21Z" level=debug msg="total size 573 after adding file boot.image.5842ae65-7d6a-4a25-9454-e410ac012533"
time="2018-06-26T14:14:21Z" level=debug msg="total size 634 after adding file boot.image.a209c265-8313-49c0-bfe7-8c54e5a8056f"
time="2018-06-26T14:14:21Z" level=debug msg="total size 902 after adding file boot.image.c9a8495e-782a-4976-9542-d46d6bb9a273"
time="2018-06-26T14:14:21Z" level=debug msg="total size 1030 after adding file boot.image.dd5039c0-35d5-4956-8763-aa9bd557ee03"
time="2018-06-26T14:14:21Z" level=debug msg="total size 1030 after adding file bootstrap_ec2.go"
time="2018-06-26T14:14:21Z" level=debug msg="total size 1030 after adding file bootstrap_gcloud.go"
time="2018-06-26T14:14:21Z" level=debug msg="total size 1030 after adding file bootstrap_nostub.go"
time="2018-06-26T14:14:21Z" level=debug msg="total size 1030 after adding file bootstrap_udp.go"
time="2018-06-26T14:14:21Z" level=debug msg="total size 1030 after adding file main.go"
time="2018-06-26T14:14:21Z" level=debug msg="total size 1040 after adding file program"
time="2018-06-26T14:14:21Z" level=debug msg="total size 1067 after adding file program.bin"
time="2018-06-26T14:14:29Z" level=debug msg="created sparse file" imgFile="/opt/vol/boot.image.d07710ad-d6d2-4d2a-b182-769237e8d067" size=1183MiB
time="2018-06-26T14:14:29Z" level=debug msg="attaching sparse file" imgFile="/opt/vol/boot.image.d07710ad-d6d2-4d2a-b182-769237e8d067"
time="2018-06-26T14:14:29Z" level=debug msg="running losetup -f" cmd=losetup device="/opt/vol/boot.image.d07710ad-d6d2-4d2a-b182-769237e8d067"
time="2018-06-26T14:14:29Z" level=debug msg="device mapping to 'hda'"
time="2018-06-26T14:14:29Z" level=debug msg=partitioning
time="2018-06-26T14:14:29Z" level=debug msg="running parted" args=[mklabel msdos] device="/dev/loop0"
time="2018-06-26T14:14:29Z" level=error msg="parted failed" args=[--script --machine /dev/loop0 mklabel msdos] err="exit status 1" out="Error: Input/output error during read on /dev/loop0\nError: Input/output error during read on /dev/loop0\nError: Operation not permitted during write on /dev/loop0\n"
time="2018-06-26T14:14:29Z" level=debug msg="running losetup" args=[-d /dev/loop0] cmd=losetup
time="2018-06-26T14:14:29Z" level=fatal msg="exit status 1"

C:\Users\luo>

Simply speaking, it seems that the parted --script --machine /dev/loop0 mklabel msdos command causes error in the container:

Error: Input/output error during read on /dev/loop0
Error: Operation not permitted during write on /dev/loop0

The faulty code is: (the code is running inside the container)

func runParted(device string, args ...string) ([]byte, error) {
log.WithFields(log.Fields{"device": device, "args": args}).Debug("running parted")
args = append([]string{"--script", "--machine", device}, args...)
out, err := exec.Command("parted", args...).CombinedOutput()
if err != nil {
log.WithFields(log.Fields{"args": args, "err": err, "out": string(out)}).Error("parted failed")
}
return out, err
}

Is there any advice on how to fix it? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant