Problem with resolv.conf after a cloud-init yunohost install

What type of hardware are you using: Virtual machine
What YunoHost version are you running: 12.1.17.1
How are you able to access your server: The webadmin
SSH
Are you in a special context or did you perform specific tweaking on your YunoHost instance ?: Use a image cloud-init build, have try edit netplan configs

Describe your issue

I have deployed a server with a image from a cloud-init, the image maintened here :

the installation was all right, thanks a lot for this image…

I have a warning in the diagnosis with the resolv.conf . First I have discover the file /etc/netplan/50-cloud-init.yaml was possible to edit so I do some change on it. When trying with netplan apply a warning about permissions, so I do chmod 600 /etc/netplan/50-cloud-init.yaml and change some syntax because the warnings said for exemple gateway4 is deprecated, replace by routes

After searching I arrive with this config

# This file is generated from information provided by the datasource.  Changes
# to it will not persist across an instance reboot.  To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    version: 2
    ethernets:
        eth0:
           addresses:
             - XXX.XX.XX.XX/24
           nameservers:
             search: 
             - domain.tld
             addresses: 
             - 127.0.0.1
           routes:
             - to: default
               via: XXX.XX.XX.X
           match:
                macaddress: xx:xx:xx:xx:xx:xx
           set-name: eth0

then netplan try… and apply config

This change the file /run/systemd/network/10-netplan-eth0.network

[Match]
PermanentMACAddress=xx:xx:xx:xx:xx:xx
Name=eth0

[Network]
LinkLocalAddressing=ipv6
Address=XXX.XX.XX.XX/24
DNS=127.0.0.1
Domains=domain.tld

[Route]
Destination=0.0.0.0/0
Gateway=XXX.XX.XX.X

In fact I don’t have IPv6 in this server

Other issue I can’t do a symbolic link for /etc/resolv.conf because there is no folder /etc/resolvconf/run/resolv.conf

ls -l /etc/resolvconf/
total 16
-rw-r--r-- 1 root root  878 Jan  5  2022 interface-order
drwxr-xr-x 2 root root 4096 Sep  5 20:19 resolv.conf.d
drwxr-xr-x 2 root root 4096 Sep  5 20:19 update.d
drwxr-xr-x 2 root root 4096 Aug 13 15:52 update-libc.d

Well I can’t get a /etc/resolv.conf with nameserver 127.0.0.1 and don’t know why I do not have a file /etc/resolvconf/run/resolv.conf

Share relevant logs or error messages

cat /etc/resolv.conf 
nameserver 89.234.141.66
nameserver 185.233.100.100
nameserver 2a0c:e300::101
nameserver 2001:910:800::40

yunohost diagnosis show --issues --human-readable
=================================
Internet connectivity (ip)
=================================

[WARNING] DNS resolution seems to be working, but it looks like you're using a custom /etc/resolv.conf.
  - The file /etc/resolv.conf should be a symlink to /etc/resolvconf/run/resolv.conf itself pointing to 127.0.0.1 (dnsmasq). If you want to manually configure DNS resolvers, please edit /etc/resolv.dnsmasq.conf.

Ok, I found my mistake !! the file exist in /var/run/resolvconf/resolv.conf

cat /var/run/resolvconf/resolv.conf 
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "resolvectl status" to see details about the actual nameservers.

nameserver 127.0.0.1

So I can do

rm /etc/resolv.conf
ln -sf /var/run/resolvconf/resolv.conf /etc/resolv.conf

Thanks for this:

1 Like

I remember having lived with this warning the first year I discovered yunohost. I was saying, “if it works, don’t touch it, you may break it :grin:”. That was on a laptop.
Anyway, you can just create that folder and try delete /etc/resolv.conf (or move it) then symlink to /etc/resolvconf/run/resolv.conf

Thanks, here is just because was on other path /var/run/resolvconf/resolv.conf, don’t know why…

1 Like

Hhh, mine is elsewhere

ls /etc/resolv.conf -lha
lrwxrwxrwx 1 root root 29 May 10 16:05 /etc/resolv.conf -> ../run/resolvconf/resolv.conf