iximiuz/docker-to-linux

Error with extlinux

xavigonzalvo opened this issue · 8 comments

Observing the following issue when building the container:

#6 0.611 E: Package 'extlinux' has no installation candidate

Hi Xavi! What is your system setup and what distr have you tried building? I just tried all currently supported options (debian, ubuntu, and alpine) and they worked well for me.

From my host machine:

$ uname -a
Linux bpf-debian11-5-10 5.10.0-6-amd64 #1 SMP Debian 5.10.28-1 (2021-04-09) x86_64 GNU/Linux

$ docker version
Client: Docker Engine - Community
 Version:           20.10.6
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        370c289
 Built:             Fri Apr  9 22:46:58 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.6
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       8728dd2
  Built:            Fri Apr  9 22:45:08 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.4
  GitCommit:        05f951a3781f4f2c1911b05e61c160e9c30eaa8e
 runc:
  Version:          1.0.0-rc93
  GitCommit:        12644e614e25b05da6fd08a38ffa0cfe1903fdec
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

I'm working on a M1 Macbook air but I've used docker for a while with no issues.

$ uname -a
Darwin Javiers-Air 20.1.0 Darwin Kernel Version 20.1.0: Sat Oct 31 00:07:10 PDT 2020; root:xnu-7195.50.7~2/RELEASE_ARM64_T8101 arm64
$ docker version
 Client: Docker Engine - Community
 Cloud integration: 1.0.12
 Version:           20.10.5
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        55c4c88
 Built:             Tue Mar  2 20:13:00 2021
 OS/Arch:           darwin/amd64 (rosetta)
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.5
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       363e9a8
  Built:            Tue Mar  2 20:16:48 2021
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.4.4
  GitCommit:        05f951a3781f4f2c1911b05e61c160e9c30eaa8e
 runc:
  Version:          1.0.0-rc93
  GitCommit:        12644e614e25b05da6fd08a38ffa0cfe1903fdec
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

I think it's a matter of the architecture taken for the debian container. In case of M1 it'll take aarch64. It works if Dockerfile explicitly specifies amd64.

FROM amd64/debian:stretch

Good point! When I was creating this project, M1 wasn't really a thing. Also, I should probably have stated it explicitly in the README file, but I never tried running this directly on macOS. Not sure if it'll work. A quick check on my old-ish MBP returns losetup: command not found from the Makefile. Normally, I just run it from a VirtualBox machine instead. However, in the case of M1, that's unlikely an option... Probably adding ARM support will require some extra work.

Yes, as you say, the losetup is missing in Mac Os. However, not sure why the loopback needs to be passed to the container but I can confirm that I produced the final image and it starts a system in qemu.

Changes:

  • Dockerfile explicitly states amd69/ubuntu or amd64/debian.
  • losetup runs in the Makefile (i.e., container) and not in the host. I'm not an expert so I don't know why it's better to run losetup in the host and not in the container but it produces the final linux.img.

The final image runs on qemu. A couple of issues, I don't know if that's related to my changes:

  • Read only filesystem.
  • Network is not working.

I merged a bunch of changes addressing your findings. Now it works on both Linux and macOS for me. But I cannot check the M1 chip.

Regarding the read-only fs and missing networking - these are known limitations. It shouldn't be too hard to make both things work, however, I'm out of capacity at the moment.

That's great! I can confirm that everything works fine.

This is really cool stuff you have here.

Yay! Thanks for validating!