Hi I’m not sure if this was brought up somewhere before, it seems like something that would be affecting a lot of people but I couldn’t find much about it.
A couple of folks noticed an issue with DNS resolution from within the NextCloud snap on Ubuntu 18.04 Server and there was an issue open about it here. It was noticed that this can be worked around by installing resolvconf
package.
I wanted to see if I can avoid it and I did a bit of digging and found that this is because on the system I was on /etc/resolv.conf
was a symlink pointing to /lib/systemd/resolv.conf
and that file couldn’t be read from a confined snap. I.e.:
# snap run --shell nextcloud.occ
# cat /etc/resolv.conf
/etc/resolv.conf: No such file or directory
On the other hand if I changed the symlink to point to the file /run/systemd/resolve/stub-resolv.conf
dynamically generated by systemd-resolved things worked OK. This is a good-enough solution for me, as in my case I prefer the dynamically generated stub because it respects the search domain, but I thought it’d be better to report it in case others run into this.
I’m not sure where is the best place to do that. As mentioned in the comment both configurations are perfectly valid but it could be that the default confinement policy should allow reading from (/usr)?/lib/systemd/resolv.conf
but currently doesn’t? Not sure. Does anyone have ideas?
/cc @kyrofa