Startup trouble in Docker

Hi!

I'm using this docker image to try to run OpenWRT in a container. The container can see and manage all the interfaces on my device, so it seems promising.

However, at first the image crashed on startup - I'm not really sure at what point. I set the CMD to "sleep 100000" which prevented the crash, but (predictably) some services don't seem to be correctly initialized.

However, if I try to run /sbin/init manually, I only get this output

Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level

Typing any of the numbers or f doesn't seem to do anything.

It is possible to run init this way? Can I do something else to help it along?

Thanks!

What do you mean by manually? Can you describe your manual steps?

The default entry is already defined as /sbin/init:
https://github.com/openwrt/docker/blob/master/Dockerfile.rootfs#L11

Are you only missing the param -it for a interactive tty session?

Hi,

If I try to run the container with the default CMD, it crashes on startup.

By running manually I mean removing the CMD from the docker image, starting the container and running /sbin/init from a shell.

I was hoping to get some more information about what goes wrong by running `/sbin/init' in a shell since the container is running on an embedded platform (Balena) and I wasn't sure I was getting all the logs.

I did some more experiments with the unmodified image, and got the following in the log

May 13 08:43:33 5ac84d3 mount_root: mounting /dev/root
May 13 08:43:33 5ac84d3 kernel[603]: mount_root: mounting /dev/root
May 13 08:43:33 5ac84d3 urandom-seed: Seed file not found (/etc/urandom.seed)
May 13 08:43:33 5ac84d3 kernel[603]: urandom-seed: Seed file not found (/etc/urandom.seed)
May 13 08:43:33 5ac84d3 procd: - early -
May 13 08:43:33 5ac84d3 procd: Failed to bind hotplug socket: Address in use
May 13 08:43:33 5ac84d3 kernel[603]: procd: - early -
May 13 08:43:33 5ac84d3 kernel[603]: procd: Failed to bind hotplug socket: Address in use
May 13 08:43:33 5ac84d3 balenad[685]: time="2020-05-13T08:43:33.376404672Z" level=info msg="shim reaped" id=212681f3d9b034b4e58637db19e34df9a757691b4006d042ed9cb81cf72ce339
May 13 08:43:33 5ac84d3 balenad[685]: time="2020-05-13T08:43:33.384486253Z" level=info msg="ignoring event" module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
May 13 08:43:33 5ac84d3 d79b4a673b5b[685]: [event]   Event: Service exit {"service":{"appId":1652955,"serviceId":526756,"serviceName":"openwrt","releaseId":1380490}}
May 13 08:43:33 5ac84d3 resin-supervisor[1440]: [event]   Event: Service exit {"service":{"appId":1652955,"serviceId":526756,"serviceName":"openwrt","releaseId":1380490}}
May 13 08:43:36 5ac84d3 balenad[685]: time="2020-05-13T08:43:36.670946108Z" level=info msg="shim balena-engine-containerd-shim started" address=/containerd-shim/moby/212681f3d9b034b4e58637db19e34df9a757691b4006d042ed9cb81cf72ce339/shim.sock debug=false pid=19882
May 13 08:43:37 5ac84d3 init: Console is alive
May 13 08:43:37 5ac84d3 kernel[603]: init: Console is alive
May 13 08:43:37 5ac84d3 init: - preinit -
May 13 08:43:37 5ac84d3 kernel[603]: init: - preinit -
May 13 08:43:37 5ac84d3 212681f3d9b0[685]: Press the [f] key and hit [enter] to enter failsafe mode
May 13 08:43:37 5ac84d3 212681f3d9b0[685]: Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
May 13 08:43:37 5ac84d3 d79b4a673b5b[685]: [event]   Event: Service restart {"service":{"appId":1652955,"serviceId":526756,"serviceName":"openwrt","releaseId":1380490}}
May 13 08:43:37 5ac84d3 resin-supervisor[1440]: [event]   Event: Service restart {"service":{"appId":1652955,"serviceId":526756,"serviceName":"openwrt","releaseId":1380490}}
May 13 08:43:40 5ac84d3 mount_root: mounting /dev/root
May 13 08:43:40 5ac84d3 kernel[603]: mount_root: mounting /dev/root
May 13 08:43:40 5ac84d3 urandom-seed: Seed file not found (/etc/urandom.seed)
May 13 08:43:40 5ac84d3 kernel[603]: urandom-seed: Seed file not found (/etc/urandom.seed)
May 13 08:43:40 5ac84d3 procd: - early -
May 13 08:43:40 5ac84d3 procd: Failed to bind hotplug socket: Address in use
May 13 08:43:40 5ac84d3 kernel[603]: procd: - early -
May 13 08:43:40 5ac84d3 kernel[603]: procd: Failed to bind hotplug socket: Address in use
May 13 08:43:40 5ac84d3 balenad[685]: time="2020-05-13T08:43:40.460968790Z" level=info msg="shim reaped" id=212681f3d9b034b4e58637db19e34df9a757691b4006d042ed9cb81cf72ce339
May 13 08:43:40 5ac84d3 balenad[685]: time="2020-05-13T08:43:40.469017362Z" level=info msg="ignoring event" module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
May 13 08:43:40 5ac84d3 d79b4a673b5b[685]: [event]   Event: Service exit {"service":{"appId":1652955,"serviceId":526756,"serviceName":"openwrt","releaseId":1380490}}
May 13 08:43:40 5ac84d3 resin-supervisor[1440]: [event]   Event: Service exit {"service":{"appId":1652955,"serviceId":526756,"serviceName":"openwrt","releaseId":1380490}}

I think this is a complete attempted startup of the container, but the problem is that I don't know what's coming from where. The lines containing "balena" or "resin" are definitely not from openwrt, but maybe someone more familiar can add some insight?

In particular, the line Failed to bind hotplug socket: Address in use looks suspecious - where can I find out more about that?