You are not logged in.

#1 2013-11-27 22:38:14

dbe
Member
Registered: 2013-11-23
Posts: 2

[SOLVED] Runit runsv creating corrupted files inside qemu

I have created an ext2 filesystem on a file:

$ file sandbox.img
sandbox.img: Linux rev 1.0 ext2 filesystem data, UUID=1f385e0e-2c05-4c58-b2c8-1ca5b770a3bb (large files)

Inside it is a statically linked busybox, an init file which mounts /proc and / and runs runsvdir, and a single runit service, 'sh':

$ sudo mount sandbox.img mount -o loop
$ tree mount
mount
├── bin
│   ├── ash -> busybox
│   ├── busybox
│   ├── cp -> busybox
│   ├── ls -> busybox
│   ├── mount -> busybox
│   ├── mv -> busybox
│   ├── rm -> busybox
│   ├── runsv -> busybox
│   ├── runsvdir -> busybox
│   ├── sh -> busybox
│   └── sv -> busybox
├── lost+found [error opening dir]
├── proc
├── sbin
│   ├── init
│   └── svlogd -> ../bin/busybox
└── service
    └── sh
        ├── run
        └── supervise

The kernel config is pasted here.

Upon starting qemu, I get an error 'runsv: sh: fatal: cannot start ./run: Exec format error'. The file in question only contains the line '/bin/sh'.
When I then inspect the filesystem, this is what I see:

> ls mount/service/sh/supervise/ -la
/bin/ls: cannot access mount/service/sh/supervise/status: Input/output error
/bin/ls: cannot access mount/service/sh/supervise/pid: Input/output error
/bin/ls: cannot access mount/service/sh/supervise/stat: Input/output error
total 8
drwxr-xr-x 2 dbe  dbe  4096 nov 27 23:22 ./
drwxr-xr-x 3 dbe  dbe  4096 nov 27 01:15 ../
prw------- 1 root root    0 nov 27 23:22 control|
-rw------- 1 root root    0 nov 27 23:22 lock
prw------- 1 root root    0 nov 27 23:22 ok|
-????????? ? ?    ?       ?            ? pid
-????????? ? ?    ?       ?            ? stat
-????????? ? ?    ?       ?            ? status

Any ideas why this might happen?

Last edited by dbe (2013-11-29 23:13:42)

Offline

#2 2013-11-29 23:12:51

dbe
Member
Registered: 2013-11-23
Posts: 2

Re: [SOLVED] Runit runsv creating corrupted files inside qemu

The issue has been resolved. Here is what I did;

1. I changed file system from ext2 to ext3
2. I altered 'run' to avoid 'Exec format error'.

#!/bin/sh

/bin/sh

3. Wrote a handler for shutdown signals to avoid improper shutdowns.

Offline

Board footer

Powered by FluxBB