Subject: No resolv.conf file in alpine-virt / how to enter DNS servers?

From: Joe Duarte <[email-masked]>
Date: Fri, 8 May 2020 03:24:48 -0700

Hi all,

There is no /etc/resolv.conf in the alpine-virt image. How do I enter DNS
servers in virt?

Here are the errors I'm getting when I try apk update or upgrade:
https://imgur.com/a/0jC4DZx

These are common errors, and I think they're DNS related.

Thanks,

Joe

---

From: Natanael Copa <[email-masked]>
Date: Fri, 8 May 2020 13:21:21 +0200

On Fri, 8 May 2020 03:24:48 -0700

> These are common errors, and I think they're DNS related.

You need to configure network first. To do so, run: setup-alpine

-nc

---

From: Joe Duarte <[email-masked]>
Date: Fri, 8 May 2020 05:20:31 -0700

I did that, twice. So what I've done is choose:

eth0
DHCP
no manual config
Mirror #1 (http://dl-cdn.alpinelinux.org)
chrony
dropbear for SSH
sda
sys

Is there something that should be different in the above?

Thanks,

JD

---

From: Joe Duarte <[email-masked]>
Date: Fri, 8 May 2020 05:36:23 -0700

I forgot to mention a couple of things:

1. I'm in Hyper-V. Not sure if that matters.
2. I'm not seeing etc/resolv.conf in Alpine Standard edition either. So
it's not just virt.

I'm not sure what I'm doing wrong re: my setup-alpine choices. This is the
latest release 3.11.6.

One other thing I noticed is that, by default, there's nothing in
etc/apk/repositories except for /media/sda1/apks/. There's no mirror or
repo, even though I choose #1 during setup-alpine. So initially when I try
apk update or upgrade, nothing happens – it doesn't download anything. I
have to manually enter http://dl-cdn.alpinelinux.org/alpine/ in
etc/apk/repositories. Then after saving that I try apk update again and get
the error message I linked in my first email, the "temporary error" and so
forth. That one is supposed to be DNS related, but there's no resolv.conf
file, so I don't know what's going on.

Should I just create resolv.conf? What goes in it besides the DNS IP
address? (I'll probably use Cloudflare's 1.1.1.1)

These errors usually get a lot of discussion on the Glider Labs repos:
https://github.com/gliderlabs/docker-alpine/issues/386

Thanks,

JD

---

From: "N. N." <[email-masked]>
Date: Fri, 8 May 2020 16:11:37 +0200 (CEST)

I see DHCP discover and lease messages during boot, and resolv.conf then contains the local DNS.
Maybe check you DHCP server or lan/bridge/filters.

-Al

---

From: Joe Duarte <[email-masked]>
Date: Sat, 9 May 2020 13:23:46 -0700

There might be a bug. I changed one thing during setup-alpine – the mirror
choice – and both resolv.conf and apk/repositories are setup properly.

Condition 1: If I choose the default mirror of 1, I get no resolv.conf file
and no repos in apk/repositories. This is http://dl-cdn.alpinelinux.org. I
don't know if it matters whether I just press Enter to choose the default,
or literally type 1 – I haven't tested that.

Condition 2: If I choose to find the fastest mirror and let it process, I
end up with a resolv.conf (with a working nameserver), and apk/repositories
(with the mirror it chose).

Condition 3: If I choose mirror 43 manually, same result as Condition 2 –
everything is fine. (I chose 43 because that was the result of letting it
find the fastest mirror: http://sjc.edge.kernel.org/alpine/)

I tested on two different PCs, using Hyper-V in all cases (Windows 10 Pro).
I don't know much about DHCP server settings, or lan/bridge/filters. Are
they things that Hyper-V would manage? In all cases I created the VMs with
the Quick Create utility in Hyper-V. I didn't do any manual config of the
VMs or their network interfaces.

I tested both Standard and Virt. I also tested Fedora 32 Server, and it
works like a charm every time, with the same setup procedure, Hyper-V Quick
Create, etc., so there doesn't seem to be anything wrong with the network
interfaces.

One other thing I noticed is that there are never any upgrades available to
any of the default packages. I don't know if Upgrade isn't working, or if
all the packages just happen to be up to date. The Update step seems to
work, downloads an APKINDEX.tar.gz file, but Upgrade does nothing. If I run
Upgrade on a new install of Ubuntu or Fedora, there will be *tons* of
packages getting updated, but maybe Alpine's default set is already up to
date? apk add works.

Cheers,

Joe