godarch / darch

A tool for building and booting stateless and immutable images, bare metal.
https://godarch.com/
MIT License
832 stars 32 forks source link

Unresolvable hosts on stage #18

Closed burkostya closed 6 years ago

burkostya commented 6 years ago

I am using VirtualBox for playing with darch. And your https://github.com/pauldotknopf/darch-recipes/blob/master/machine-bootstrap for bootstraping.

Everything is fine until sudo darch stage upload pauldotknopf/darch-arch-base:latest. On this step pacman installs squashfs but it cannot resolve any host. So installing fails with error: error: failed retrieving file 'squashfs-tools....' from <any host> : Could not resolve host: <any host>.

Same happens if i try to build my own image. But in this case i can workaround it by adding echo "nameserver" > /etc/resolv.conf to the beggining of build script.

Guest os resolves any host without problem.

Can you help me?

pauldotknopf commented 6 years ago

When running arch normally with systemd, their are custom resolve services running that utilize the DHCP provided nameservers.

Since systemd/resolved isn't running in the container, these have to be manually specified.

This doesn't happen in docker, and I'm not sure why. They must be doing some special case for it. In any case, there is no special case for darch, except for the fact that we mount /etc/resolv.conf in the image for you. That way, you can provide these name servers.

Ideally, you shouldn't need network access to upload to the stage. In the future, I will try to use host tools to generate the squashfs image, instead of relying the image itself to download it and use it.

In the meantime, you have two options.

1) Provide a /etc/resolv.conf with nameservers on your host. 2) Add squashfs-tools into your images before hand. This would make the pacman -S squashfs-tools a no-op. I might consider just adding squashfs-tools into godarch/arch by default, since it is required to upload to the stage.

burkostya commented 6 years ago

Providing /etc/resolv.conf works for me. Thanks!

pauldotknopf commented 6 years ago

Hey, just letting you know.

I updated my recipes to use my precompiled images.

Items of interest:

https://github.com/pauldotknopf/darch-recipes/commit/9b706335368a19ef70c8e9f1e345ce0b74c68dec

https://github.com/pauldotknopf/github-release-sync

https://github.com/pauldotknopf/binary-repos/tree/arch-linux

This GREATLY reduced my build time of AUR packages. They not run as fast as pre-compiled packages in the official repo.