Le service dnsmasq ne fonctionne plus suite à la migration YunoHost de 4.4.x vers 11.0.9.1

Bonjour le service dnsmasq ne fonctionne plus suite à la migration YunoHost de 4.4.x vers 11.0.9.1 .
Quand je lance le diagnostic, j’ai une erreur sur la Connectivité Internet :

J’ai les informations suivantes sur le service :

journalctl

-- Journal begins at Sat 2022-08-13 02:55:49 CEST, ends at Sat 2022-08-13 16:21:54 CEST. --
août 13 10:44:00 systemd[1]: Stopping dnsmasq - A lightweight DHCP and caching DNS server...
août 13 10:44:01 dnsmasq[6663]: sortie sur réception du signal SIGTERM
août 13 10:44:01 systemd[1]: dnsmasq.service: Succeeded.
août 13 10:44:01 systemd[1]: Stopped dnsmasq - A lightweight DHCP and caching DNS server.
août 13 10:44:01 systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
août 13 10:44:01 dnsmasq[14796]: dnsmasq: vérification de syntaxe OK.
août 13 10:44:01 dnsmasq[14807]: demarré, version 2.80 (taille de cache 256)
août 13 10:44:01 dnsmasq[14807]: options à la compilation : IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth DNSSEC loop-detect inotify dumpfile
août 13 10:44:01 dnsmasq[14807]: Lecture de /etc/resolv.dnsmasq.conf
août 13 10:44:01 dnsmasq[14807]: utilise le serveur de nom 91.239.100.100#53
août 13 10:44:01 dnsmasq[14807]: utilise le serveur de nom 185.233.100.101#53
août 13 10:44:01 dnsmasq[14807]: utilise le serveur de nom 2a0c:e300::101#53
août 13 10:44:01 dnsmasq[14807]: utilise le serveur de nom 2001:910:800::40#53
août 13 10:44:01 dnsmasq[14807]: utilise le serveur de nom 195.160.173.53#53
août 13 10:44:01 dnsmasq[14807]: utilise le serveur de nom 89.233.43.71#53
août 13 10:44:01 dnsmasq[14807]: utilise le serveur de nom 2a0c:e300::100#53
août 13 10:44:01 dnsmasq[14807]: utilise le serveur de nom 2a00:5881:8100:1000::3#53
août 13 10:44:01 dnsmasq[14807]: utilise le serveur de nom 84.200.70.40#53
août 13 10:44:01 dnsmasq[14807]: utilise le serveur de nom 89.234.141.66#53
août 13 10:44:01 dnsmasq[14807]: utilise le serveur de nom 2001:1608:10:25::1c04:b12f#53
août 13 10:44:01 dnsmasq[14807]: utilise le serveur de nom 194.150.168.168#53
août 13 10:44:01 dnsmasq[14807]: utilise le serveur de nom 2001:1608:10:25::9249:d69b#53
août 13 10:44:01 dnsmasq[14807]: utilise le serveur de nom 80.67.169.12#53
août 13 10:44:01 dnsmasq[14807]: utilise le serveur de nom 2a01:3a0:53:53::#53
août 13 10:44:01 dnsmasq[14807]: utilise le serveur de nom 80.67.169.40#53
août 13 10:44:01 dnsmasq[14807]: utilise le serveur de nom 84.200.69.80#53
août 13 10:44:01 dnsmasq[14807]: utilise le serveur de nom 2001:910:800::12#53
août 13 10:44:01 dnsmasq[14807]: utilise le serveur de nom 2001:67c:28a4::#53
août 13 10:44:01 dnsmasq[14807]: utilise le serveur de nom 185.233.100.100#53
août 13 10:44:01 dnsmasq[14807]: lecture /etc/hosts - 9 adresses
août 13 10:44:01 systemd[1]: Started dnsmasq - A lightweight DHCP and caching DNS server.
août 13 11:32:00 systemd[1]: Stopping dnsmasq - A lightweight DHCP and caching DNS server...
août 13 11:32:00 dnsmasq[14807]: sortie sur réception du signal SIGTERM
août 13 11:32:00 systemd[1]: dnsmasq.service: Succeeded.
août 13 11:32:00 systemd[1]: Stopped dnsmasq - A lightweight DHCP and caching DNS server.
août 13 11:32:00 systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
août 13 11:32:00 dnsmasq[22271]: Usage: /etc/init.d/dnsmasq {start|stop|restart|force-reload|dump-stats|status}
août 13 11:32:00 systemd[1]: dnsmasq.service: Control process exited, code=exited, status=3/NOTIMPLEMENTED
août 13 11:32:00 systemd[1]: dnsmasq.service: Failed with result 'exit-code'.
août 13 11:32:00 systemd[1]: Failed to start dnsmasq - A lightweight DHCP and caching DNS server.
août 13 11:39:17 systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
août 13 11:39:17 dnsmasq[1828]: Usage: /etc/init.d/dnsmasq {start|stop|restart|force-reload|dump-stats|status}
août 13 11:39:17 systemd[1]: dnsmasq.service: Control process exited, code=exited, status=3/NOTIMPLEMENTED
août 13 11:39:17 systemd[1]: dnsmasq.service: Failed with result 'exit-code'.
août 13 11:39:17 systemd[1]: Failed to start dnsmasq - A lightweight DHCP and caching DNS server.
août 13 11:51:04 systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
août 13 11:51:04 dnsmasq[5624]: Usage: /etc/init.d/dnsmasq {start|stop|restart|force-reload|dump-stats|status}
août 13 11:51:04 systemd[1]: dnsmasq.service: Control process exited, code=exited, status=3/NOTIMPLEMENTED
août 13 11:51:04 systemd[1]: dnsmasq.service: Failed with result 'exit-code'.
août 13 11:51:04 systemd[1]: Failed to start dnsmasq - A lightweight DHCP and caching DNS server.

Je ne sais pas quelles informations rajouter, je vous remercie d’avance pour votre aide :slight_smile:

Je ne sais pas quoi tester pour vérifier le bon fonctionnement. Avez-vous des commandes pour le faire ?

Merci d’avance pour votre aide

Eduardo

Can you share the output of cat /lib/systemd/system/dnsmasq.service | grep Exec

edit: and dpkg --list | grep dnsmasq

edit2 : also could it be that you have (or had in the past) some apps installed among : vpnclient, hotspot, pihole, adguard ?

Bonjour Aleks, j’ai ce résultat en lançant la commande :

cat /lib/systemd/system/dnsmasq.service | grep Exec
ExecStartPre=/etc/init.d/dnsmasq checkconfig
ExecStart=/etc/init.d/dnsmasq systemd-exec
ExecStartPost=/etc/init.d/dnsmasq systemd-start-resolvconf
ExecStop=/etc/init.d/dnsmasq systemd-stop-resolvconf
ExecReload=/bin/kill -HUP $MAINPID

Je n’ai pas ces applications suivantes sur mon Yuno : vpnclient, hotspot, pihole et adguard

Mes applications : Jirafeau, Librespeed, MediaWiki, Nextcloud, Piwigo, Rainloop, Tiny Tiny RSS, Wetty et Wordpress.

Est-ce que tu peux partager la sortie de dpkg --list | grep dnsmasq ?

Aussi tu peux tenter les commandes suivantes :

root@example:/ynh-dev# /etc/init.d/dnsmasq checkconfig
root@example:/ynh-dev# /etc/init.d/dnsmasq  systemd-exec

dnsmasq: failed to create listening socket for port 53: Address already in use

(qui est le résultat attendu … mais j’imagine que chez toi ça va mettre “Usage: /etc/init.d/dnsmasq […]” sur l’une des commandes

Voilà le résultat de la commande dpkg --list | grep dnsmasq :

dpkg --list | grep dnsmasq
ii  dnsmasq                               2.85-1                                                                   all          Small caching DNS proxy and DHCP/TFTP server
ii  dnsmasq-base                          2.85-1                                                                   amd64        Small caching DNS proxy and DHCP/TFTP server

Pour les deux autres commandes :

admin@lesinfos:~$ /etc/init.d/dnsmasq checkconfig
Usage: /etc/init.d/dnsmasq {start|stop|restart|force-reload|dump-stats|status}
admin@lesinfos:~$

et la deuxième :

admin@lesinfos:~$ /etc/init.d/dnsmasq  systemd-exec

dnsmasq: impossible de créer une socket d'écoute pour port 53 : Permission non accordée
admin@lesinfos:~$

Blockquote

Mokay I’m not sure why it wouldnt recognize checkconfig … despite the fact that you’re running a normal up to date version

Naively running apt install dnsmasq --reinstall may fix the issue …

Maybe yunohost tools regen-conf dnsmasq after this

admin@lesinfos:~$ sudo apt install dnsmasq --reinstall
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances... Fait
Lecture des informations d'état... Fait
Les paquets suivants ont été installés automatiquement et ne sont plus nécessaires :
  bind9-utils bind9utils dnsutils libreadline7 php-gettext python3-ply python3-publicsuffix
Veuillez utiliser « sudo apt autoremove » pour les supprimer.
0 mis à jour, 0 nouvellement installés, 1 réinstallés, 0 à enlever et 0 non mis à jour.
Il est nécessaire de prendre 32,0 ko dans les archives.
Après cette opération, 0 o d'espace disque supplémentaires seront utilisés.
Réception de :1 http://ftp.debian.org/debian bullseye/main amd64 dnsmasq all 2.85-1 [32,0 kB]
32,0 ko réceptionnés en 0s (1 154 ko/s)
(Lecture de la base de données... 76350 fichiers et répertoires déjà installés.)
Préparation du dépaquetage de .../dnsmasq_2.85-1_all.deb ...
Dépaquetage de dnsmasq (2.85-1) sur (2.85-1) ...
Paramétrage de dnsmasq (2.85-1) ...
Job for dnsmasq.service failed because the control process exited with error code.
See "systemctl status dnsmasq.service" and "journalctl -xe" for details.
invoke-rc.d: initscript dnsmasq, action "restart" failed.
● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
     Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Sat 2022-08-13 17:32:23 CEST; 10ms ago
    Process: 22481 ExecStartPre=/etc/init.d/dnsmasq checkconfig (code=exited, status=3)

août 13 17:32:23 lesinfos.top systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
août 13 17:32:23 lesinfos.top dnsmasq[22481]: Usage: /etc/init.d/dnsmasq {start|stop|restart|force-reload|dump-stats|status}
août 13 17:32:23 lesinfos.top systemd[1]: dnsmasq.service: Control process exited, code=exited, status=3/NOTIMPLEMENTED
août 13 17:32:23 lesinfos.top systemd[1]: dnsmasq.service: Failed with result 'exit-code'.
août 13 17:32:23 lesinfos.top systemd[1]: Failed to start dnsmasq - A lightweight DHCP and caching DNS server.
admin@lesinfos:~$

J’ai du rajouter un sudo à la commande car j’avais un message d’erreur :

admin@lesinfos:~$ apt install dnsmasq --reinstall
E: Impossible d'ouvrir le fichier verrou /var/lib/dpkg/lock-frontend - open (13: Permission non accordée)
E: Impossible d'obtenir le verrou de dpkg (/var/lib/dpkg/lock-frontend). Avez-vous les droits du superutilisateur ?
admin@lesinfos:~$

J’avais oublié de rajouter le résultat de la dernière commande :

admin@lesinfos:~$ sudo  yunohost tools regen-conf dnsmasq
Succès ! La configuration a été mise à jour pour 'dnsmasq'
Attention : Job for dnsmasq.service failed because the control process exited with error code.
Attention : See "systemctl status dnsmasq.service" and "journalctl -xe" for details.
Erreur : Échec de l'exécution du script : /usr/share/yunohost/hooks/conf_regen/43-dnsmasq
dnsmasq:
  applied:
    /etc/resolv.dnsmasq.conf:
      status: updated
  pending:
admin@lesinfos:~$

Mouarf bon bah c’est encore plus incompréhensible …

Est-ce que tu peux partager le retour de cat /etc/init.d/dnsmasq ? Ça va être une sacrée tartine, c’est cool si tu peux la copier sur paste.yunohost.org et partager le lien plutot que de direct copier le tout ici

Toutes mes excuses mais j’ai des soucis avec pastebin pour récupérer le lien :frowning:

admin@lesinfos:~$ cat /etc/init.d/dnsmasq
#!/bin/sh
### BEGIN INIT INFO
# Provides:       dnsmasq
# Required-Start: $network $remote_fs $syslog
# Required-Stop:  $network $remote_fs $syslog
# Default-Start:  2 3 4 5
# Default-Stop:   0 1 6
# Description:    DHCP and DNS server
### END INIT INFO

set +e   # Don't exit on error status

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/dnsmasq
NAME=dnsmasq
DESC="DNS forwarder and DHCP server"

# Most configuration options in /etc/default/dnsmasq are deprecated
# but still honoured.
ENABLED=1
if [ -r /etc/default/$NAME ]; then
        . /etc/default/$NAME
fi

# Get the system locale, so that messages are in the correct language, and the
# charset for IDN is correct
if [ -r /etc/default/locale ]; then
        . /etc/default/locale
        export LANG
fi

# /etc/dnsmasq.d/README is a non-conffile installed by the dnsmasq package.
# Should the dnsmasq package be removed, the following test ensures that
# the daemon is no longer started, even if the dnsmasq-base package is
# still in place.
test -e /etc/dnsmasq.d/README || exit 0

test -x $DAEMON || exit 0

# Provide skeleton LSB log functions for backports which don't have LSB functions.
if [ -f /lib/lsb/init-functions ]; then
         . /lib/lsb/init-functions
else
         log_warning_msg () {
            echo "${@}."
         }

         log_success_msg () {
            echo "${@}."
         }

         log_daemon_msg () {
            echo -n "${1}: $2"
         }

         log_end_msg () {
            if [ $1 -eq 0 ]; then
              echo "."
            elif [ $1 -eq 255 ]; then
              /bin/echo -e " (warning)."
            else
              /bin/echo -e " failed!"
            fi
         }
fi

# RESOLV_CONF:
# If the resolvconf package is installed then use the resolv conf file
# that it provides as the default.  Otherwise use /etc/resolv.conf as
# the default.
#
# If IGNORE_RESOLVCONF is set in /etc/default/dnsmasq or an explicit
# filename is set there then this inhibits the use of the resolvconf-provided
# information.
#
# Note that if the resolvconf package is installed it is not possible to
# override it just by configuration in /etc/dnsmasq.conf, it is necessary
# to set IGNORE_RESOLVCONF=yes in /etc/default/dnsmasq.

if [ ! "$RESOLV_CONF" ] &&
   [ "$IGNORE_RESOLVCONF" != "yes" ] &&
   [ -x /sbin/resolvconf ]
then
        RESOLV_CONF=/var/run/dnsmasq/resolv.conf
fi

for INTERFACE in $DNSMASQ_INTERFACE; do
        DNSMASQ_INTERFACES="$DNSMASQ_INTERFACES -i $INTERFACE"
done

for INTERFACE in $DNSMASQ_EXCEPT; do
        DNSMASQ_INTERFACES="$DNSMASQ_INTERFACES -I $INTERFACE"
done

if [ ! "$DNSMASQ_USER" ]; then
   DNSMASQ_USER="dnsmasq"
fi

# This tells dnsmasq to ignore DNS requests that don't come from a local network.
# It's automatically ignored if  --interface --except-interface, --listen-address
# or --auth-server exist in the configuration, so for most installations, it will
# have no effect, but for otherwise-unconfigured installations, it stops dnsmasq
# from being vulnerable to DNS-reflection attacks.

DNSMASQ_OPTS="$DNSMASQ_OPTS --local-service"

# If the dns-root-data package is installed, then the trust anchors will be
# available in $ROOT_DS, in BIND zone-file format. Reformat as dnsmasq
# --trust-anchor options.

ROOT_DS="/usr/share/dns/root.ds"

if [ -f $ROOT_DS ]; then
   DNSMASQ_OPTS="$DNSMASQ_OPTS `sed -e s/"^.*DS[\t ]"/--trust-anchor=.,/ -e s/" "/,/g $ROOT_DS | tr '\n' ' '`"
fi

start()
{
        # Return
        #   0 if daemon has been started
        #   1 if daemon was already running
        #   2 if daemon could not be started

        # /var/run may be volatile, so we need to ensure that
        # /var/run/dnsmasq exists here as well as in postinst
        if [ ! -d /var/run/dnsmasq ]; then
           mkdir /var/run/dnsmasq || return 2
           chown dnsmasq:nogroup /var/run/dnsmasq || return 2
        fi

        start-stop-daemon --start --quiet --pidfile /var/run/dnsmasq/$NAME.pid --exec $DAEMON --test > /dev/null || return 1
        start-stop-daemon --start --quiet --pidfile /var/run/dnsmasq/$NAME.pid --exec $DAEMON -- \
                -x /var/run/dnsmasq/$NAME.pid \
                ${MAILHOSTNAME:+ -m $MAILHOSTNAME} \
                ${MAILTARGET:+ -t $MAILTARGET} \
                ${DNSMASQ_USER:+ -u $DNSMASQ_USER} \
                ${DNSMASQ_INTERFACES:+ $DNSMASQ_INTERFACES} \
                ${DHCP_LEASE:+ -l $DHCP_LEASE} \
                ${DOMAIN_SUFFIX:+ -s $DOMAIN_SUFFIX} \
                ${RESOLV_CONF:+ -r $RESOLV_CONF} \
                ${CACHESIZE:+ -c $CACHESIZE} \
                ${CONFIG_DIR:+ -7 $CONFIG_DIR} \
                ${DNSMASQ_OPTS:+ $DNSMASQ_OPTS} \
                || return 2
}

start_resolvconf()
{
# If interface "lo" is explicitly disabled in /etc/default/dnsmasq
# Then dnsmasq won't be providing local DNS, so don't add it to
# the resolvconf server set.
        for interface in $DNSMASQ_EXCEPT
        do
                [ $interface = lo ] && return
        done

        if [ -x /sbin/resolvconf ] ; then
                echo "nameserver 127.0.0.1" | /sbin/resolvconf -a lo.$NAME
        fi
        return 0
}

stop()
{
        # Return
        #   0 if daemon has been stopped
        #   1 if daemon was already stopped
        #   2 if daemon could not be stopped
        #   other if a failure occurred
        start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile /var/run/dnsmasq/$NAME.pid --name $NAME
}

stop_resolvconf()
{
        if [ -x /sbin/resolvconf ] ; then
                /sbin/resolvconf -d lo.$NAME
        fi
        return 0
}

status()
{
        # Return
        #   0 if daemon is running
        #   1 if daemon is dead and pid file exists
        #   3 if daemon is not running
        #   4 if daemon status is unknown
        start-stop-daemon --start --quiet --pidfile /var/run/dnsmasq/$NAME.pid --exec $DAEMON --test > /dev/null
        case "$?" in
                0) [ -e "/var/run/dnsmasq/$NAME.pid" ] && return 1 ; return 3 ;;
                1) return 0 ;;
                *) return 4 ;;
        esac
}

case "$1" in
  start)
        test "$ENABLED" != "0" || exit 0
        log_daemon_msg "Starting $DESC" "$NAME"
        start
        case "$?" in
                0)
                        log_end_msg 0
                        start_resolvconf
                        exit 0
                        ;;
                1)
                        log_success_msg "(already running)"
                        exit 0
                        ;;
                *)
                        log_end_msg 1
                        exit 1
                        ;;
        esac
        ;;
  stop)
        stop_resolvconf
        if [ "$ENABLED" != "0" ]; then
             log_daemon_msg "Stopping $DESC" "$NAME"
        fi
        stop
        RETVAL="$?"
        if [ "$ENABLED" = "0" ]; then
            case "$RETVAL" in
               0) log_daemon_msg "Stopping $DESC" "$NAME"; log_end_msg 0 ;;
            esac
            exit 0
        fi
        case "$RETVAL" in
                0) log_end_msg 0 ; exit 0 ;;
                1) log_warning_msg "(not running)" ; exit 0 ;;
                *) log_end_msg 1; exit 1 ;;
        esac
        ;;
  restart|force-reload)
        test "$ENABLED" != "0" || exit 1
        $DAEMON --test ${CONFIG_DIR:+ -7 $CONFIG_DIR} ${DNSMASQ_OPTS:+ $DNSMASQ_OPTS} >/dev/null 2>&1
        if [ $? -ne 0 ]; then
            NAME="configuration syntax check"
            RETVAL="2"
        else
            stop_resolvconf
            stop
            RETVAL="$?"
        fi
        log_daemon_msg "Restarting $DESC" "$NAME"
        case "$RETVAL" in
                0|1)
                        sleep 2
                        start
                        case "$?" in
                                0)
                                        log_end_msg 0
                                        start_resolvconf
                                        exit 0
                                        ;;
                                *)
                                        log_end_msg 1
                                        exit 1
                                        ;;
                        esac
                        ;;
                *)
                        log_end_msg 1
                        exit 1
                        ;;
        esac
        ;;
  status)
        log_daemon_msg "Checking $DESC" "$NAME"
        status
        case "$?" in
                0) log_success_msg "(running)" ; exit 0 ;;
                1) log_success_msg "(dead, pid file exists)" ; exit 1 ;;
                3) log_success_msg "(not running)" ; exit 3 ;;
                *) log_success_msg "(unknown)" ; exit 4 ;;
        esac
        ;;
  dump-stats)
        kill -s USR1 `cat /var/run/dnsmasq/$NAME.pid`
        ;;
  systemd-start-resolvconf)
        start_resolvconf
        ;;
  systemd-stop-resolvconf)
        stop_resolvconf
        ;;
  systemd-exec)
# /var/run may be volatile, so we need to ensure that
        # /var/run/dnsmasq exists here as well as in postinst
        if [ ! -d /var/run/dnsmasq ]; then
           mkdir /var/run/dnsmasq || return 2
           chown dnsmasq:nogroup /var/run/dnsmasq || return 2
        fi
        exec $DAEMON -x /var/run/dnsmasq/$NAME.pid \
            ${MAILHOSTNAME:+ -m $MAILHOSTNAME} \
            ${MAILTARGET:+ -t $MAILTARGET} \
            ${DNSMASQ_USER:+ -u $DNSMASQ_USER} \
            ${DNSMASQ_INTERFACES:+ $DNSMASQ_INTERFACES} \
            ${DHCP_LEASE:+ -l $DHCP_LEASE} \
            ${DOMAIN_SUFFIX:+ -s $DOMAIN_SUFFIX} \
            ${RESOLV_CONF:+ -r $RESOLV_CONF} \
            ${CACHESIZE:+ -c $CACHESIZE} \
            ${CONFIG_DIR:+ -7 $CONFIG_DIR} \
            ${DNSMASQ_OPTS:+ $DNSMASQ_OPTS}
        ;;
  *)
        echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload|dump-stats|status}" >&2
        exit 3
        ;;
esac

exit 0

admin@lesinfos:~$

Le lien pastebin : https://pastebin.com/KPGwMZUv

J’ai refait le copier/coller de la commande dans pastebin qui n’était pas bon.

Zblerg I don’t understand why that file doesnt contain the code for checkconfig … And what’s even more “table-throwing” is that we just did an apt reinstall of the package …

(The thing is that you’re apparently not the only person encountering the issue so it’s kinda important to try to understand and find an automatizable fix …)

Maybe let’s try to mv /etc/init.d/dnsmasq /etc/init.d/dnsmasq.bkp and reattempt the apt install dnsmasq --reinstall which should recreate the /etc/init.d/dnsmasq with an actual fresh version

Then let’s try to validate by re-running /etc/init.d/dnsmasq checkconfig that it does work now (ie. it should display nothing, no ‘Usage: blah’)

J’ai lancé la première commande et vérifié :

admin@lesinfos:~$ sudo mv /etc/init.d/dnsmasq /etc/init.d/dnsmasq.bkp
admin@lesinfos:~$ ls -al /etc/init.d/dnsmasq.bkp
-rwxr-xr-x 1 root root 8292  5 juil.  2018 /etc/init.d/dnsmasq.bkp
admin@lesinfos:~$

La deuxième commande :

admin@lesinfos:~$ sudo apt install dnsmasq --reinstall
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances... Fait
Lecture des informations d'état... Fait
Les paquets suivants ont été installés automatiquement et ne sont plus nécessaires :
  bind9-utils bind9utils dnsutils libreadline7 php-gettext python3-ply python3-publicsuffix
Veuillez utiliser « sudo apt autoremove » pour les supprimer.
0 mis à jour, 0 nouvellement installés, 1 réinstallés, 0 à enlever et 0 non mis à jour.
Il est nécessaire de prendre 32,0 ko dans les archives.
Après cette opération, 0 o d'espace disque supplémentaires seront utilisés.
Réception de :1 http://ftp.debian.org/debian bullseye/main amd64 dnsmasq all 2.85-1 [32,0 kB]
32,0 ko réceptionnés en 0s (1 278 ko/s)
(Lecture de la base de données... 76350 fichiers et répertoires déjà installés.)
Préparation du dépaquetage de .../dnsmasq_2.85-1_all.deb ...
Dépaquetage de dnsmasq (2.85-1) sur (2.85-1) ...
Paramétrage de dnsmasq (2.85-1) ...
admin@lesinfos:~$

Enfin la validation, il ne trouve pas la commande :

admin@lesinfos:~$ sudo /etc/init.d/dnsmasq checkconfig
sudo: /etc/init.d/dnsmasq : commande introuvable
admin@lesinfos:~$

Il n’y a pas besoin de sudo dans ce cas précis, c’est compliqué d’expliquer pourquoi et d’expliquer pourquoi il affiche ce message d’erreur, mais c’est “normal”, il faut juste le faire sans le sudo …

J’ai refait la commande mais pas mieux, j’au fait un ls sur dns* ensuite :

admin@lesinfos:~$ /etc/init.d/dnsmasq checkconfig
-bash: /etc/init.d/dnsmasq: Aucun fichier ou dossier de ce type
admin@lesinfos:~$ ls -al /etc/init.d/dns*
-rwxr-xr-x 1 root root 8292  5 juil.  2018 /etc/init.d/dnsmasq.bkp
-rwxr-xr-x 1 root root 9672  3 avril  2021 /etc/init.d/dnsmasq.dpkg-dist
admin@lesinfos:~$

Ah I see -_-

Well let’s try cp /etc/init.d/dnsmasq.dpkg-dist /etc/init.d/dnsmasq then …

J’ai lancé la commande, rien en sortie (comme prévu ?) :

admin@lesinfos:~$ admin@lesinfos:~$ sudo cp /etc/init.d/dnsmasq.dpkg-dist /etc/init.d/dnsmasq
admin@lesinfos:~$ /etc/init.d/dnsmasq checkconfig
admin@lesinfos:~$

Yep du coup on peut tenter de systemctl restart dnsmasq puis systemctl status dnsmasq pour confirmer que ça tourne

J’ai fait :

admin@lesinfos:~$ sudo systemctl restart
Too few arguments.
admin@lesinfos:~$ sudo systemctl restart dnsmasq
Job for dnsmasq.service failed because the control process exited with error code.
See "systemctl status dnsmasq.service" and "journalctl -xe" for details.
admin@lesinfos:~$ sudo systemctl status dnsmasq.service
● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
     Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Sat 2022-08-13 18:50:12 CEST; 1min 7s ago
    Process: 27317 ExecStartPre=/etc/init.d/dnsmasq checkconfig (code=exited, status=0/SUCCESS)
    Process: 27324 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=2)

août 13 18:50:12 lesinfos.top systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
août 13 18:50:12 lesinfos.top dnsmasq[27324]: dnsmasq: impossible de créer une socket d'écoute pour port 53 : Adresse déjà utilisée
août 13 18:50:12 lesinfos.top dnsmasq[27324]: impossible de créer une socket d'écoute pour port 53 : Adresse déjà utilisée
août 13 18:50:12 lesinfos.top dnsmasq[27324]: IMPOSSIBLE de démarrer
août 13 18:50:12 lesinfos.top systemd[1]: dnsmasq.service: Control process exited, code=exited, status=2/INVALIDARGUMENT
août 13 18:50:12 lesinfos.top systemd[1]: dnsmasq.service: Failed with result 'exit-code'.
août 13 18:50:12 lesinfos.top systemd[1]: Failed to start dnsmasq - A lightweight DHCP and caching DNS server.
admin@lesinfos:~$ journalctl -xe
Hint: You are currently not seeing messages from other users and the system.
      Users in groups 'adm', 'systemd-journal' can see all messages.
      Pass -q to turn off this notice.
août 13 17:22:41 lesinfos.top dnsmasq[22238]: impossible de créer une socket d'écoute pour port 53 : Permission non accordée
août 13 17:22:41 lesinfos.top dnsmasq[22238]: IMPOSSIBLE de démarrer
août 13 17:23:57 lesinfos.top dnsmasq[22260]: impossible de créer une socket d'écoute pour port 53 : Permission non accordée
août 13 17:23:57 lesinfos.top dnsmasq[22260]: IMPOSSIBLE de démarrer
août 13 17:24:10 lesinfos.top dnsmasq[22269]: impossible de créer une socket d'écoute pour port 53 : Permission non accordée
août 13 17:24:10 lesinfos.top dnsmasq[22269]: IMPOSSIBLE de démarrer
août 13 17:32:20 lesinfos.top sudo[22384]:    admin : TTY=pts/0 ; PWD=/home/admin ; USER=root ; COMMAND=/usr/bin/apt install dnsmasq --reinstall
août 13 17:32:20 lesinfos.top sudo[22384]: pam_unix(sudo:session): session opened for user root(uid=0) by admin(uid=1007)
août 13 17:32:23 lesinfos.top sudo[22384]: pam_unix(sudo:session): session closed for user root
août 13 17:37:29 lesinfos.top sudo[22553]:    admin : TTY=pts/0 ; PWD=/home/admin ; USER=root ; COMMAND=/usr/bin/yunohost tools regen-conf dnsmasq
août 13 17:37:29 lesinfos.top sudo[22553]: pam_unix(sudo:session): session opened for user root(uid=0) by admin(uid=1007)
août 13 17:37:33 lesinfos.top sudo[22553]: pam_unix(sudo:session): session closed for user root
août 13 17:44:52 lesinfos.top sudo[23724]:    admin : TTY=pts/0 ; PWD=/home/admin ; USER=root ; COMMAND=/usr/bin/yunohost service restart dnsmasq
août 13 17:44:52 lesinfos.top sudo[23724]: pam_unix(sudo:session): session opened for user root(uid=0) by admin(uid=1007)
août 13 17:44:53 lesinfos.top sudo[23724]: pam_unix(sudo:session): session closed for user root
août 13 17:56:07 lesinfos.top sshd[16546]: Close session: user admin from 91.166.232.186 port 43057 id 0
août 13 17:56:07 lesinfos.top sshd[16546]: Connection closed by 91.166.232.186 port 43057
août 13 17:56:07 lesinfos.top sshd[16546]: Transferred: sent 1069440, received 76024 bytes
août 13 17:56:07 lesinfos.top sshd[16546]: Closing connection to 91.166.232.186 port 43057
août 13 17:58:21 lesinfos.top sshd[24266]: Starting session: shell on pts/0 for admin from 91.166.232.186 port 46790 id 0
août 13 17:58:45 lesinfos.top sshd[24266]: Close session: user admin from 91.166.232.186 port 46790 id 0
août 13 17:58:45 lesinfos.top sshd[24266]: Connection closed by 91.166.232.186 port 46790
août 13 17:58:45 lesinfos.top sshd[24266]: Transferred: sent 18864, received 20568 bytes
août 13 17:58:45 lesinfos.top sshd[24266]: Closing connection to 91.166.232.186 port 46790
août 13 17:59:16 lesinfos.top sshd[24290]: Starting session: shell on pts/0 for admin from 91.166.232.186 port 46263 id 0
août 13 18:09:50 lesinfos.top sshd[24290]: Close session: user admin from 91.166.232.186 port 46263 id 0
août 13 18:09:50 lesinfos.top sshd[24290]: Connection closed by 91.166.232.186 port 46263
août 13 18:09:50 lesinfos.top sshd[24290]: Transferred: sent 59952, received 21608 bytes
août 13 18:09:50 lesinfos.top sshd[24290]: Closing connection to 91.166.232.186 port 46263
août 13 18:10:32 lesinfos.top sshd[24646]: Starting session: shell on pts/0 for admin from 91.166.232.186 port 36180 id 0
août 13 18:28:45 lesinfos.top sudo[25720]:    admin : TTY=pts/0 ; PWD=/home/admin ; USER=root ; COMMAND=/bin/mv /etc/init.d/dnsmasq /etc/init.d/dnsmasq.bkp
août 13 18:28:45 lesinfos.top sudo[25720]: pam_unix(sudo:session): session opened for user root(uid=0) by admin(uid=1007)
août 13 18:28:45 lesinfos.top sudo[25720]: pam_unix(sudo:session): session closed for user root
août 13 18:30:57 lesinfos.top sudo[25754]:    admin : TTY=pts/0 ; PWD=/home/admin ; USER=root ; COMMAND=/usr/bin/apt install dnsmasq --reinstall
août 13 18:30:57 lesinfos.top sudo[25754]: pam_unix(sudo:session): session opened for user root(uid=0) by admin(uid=1007)
août 13 18:30:59 lesinfos.top sudo[25754]: pam_unix(sudo:session): session closed for user root
août 13 18:45:47 lesinfos.top sudo[26884]:    admin : TTY=pts/0 ; PWD=/home/admin ; USER=root ; COMMAND=/bin/cp /etc/init.d/dnsmasq.dpkg-dist /etc/init.d/dnsmasq
août 13 18:45:47 lesinfos.top sudo[26884]: pam_unix(sudo:session): session opened for user root(uid=0) by admin(uid=1007)
août 13 18:45:47 lesinfos.top sudo[26884]: pam_unix(sudo:session): session closed for user root
août 13 18:49:54 lesinfos.top sudo[27232]:    admin : TTY=pts/0 ; PWD=/home/admin ; USER=root ; COMMAND=/bin/systemctl restart
août 13 18:49:54 lesinfos.top sudo[27232]: pam_unix(sudo:session): session opened for user root(uid=0) by admin(uid=1007)
août 13 18:49:54 lesinfos.top sudo[27232]: pam_unix(sudo:session): session closed for user root
août 13 18:50:12 lesinfos.top sudo[27314]:    admin : TTY=pts/0 ; PWD=/home/admin ; USER=root ; COMMAND=/bin/systemctl restart dnsmasq
août 13 18:50:12 lesinfos.top sudo[27314]: pam_unix(sudo:session): session opened for user root(uid=0) by admin(uid=1007)
août 13 18:50:12 lesinfos.top sudo[27314]: pam_unix(sudo:session): session closed for user root
août 13 18:51:19 lesinfos.top sudo[27333]:    admin : TTY=pts/0 ; PWD=/home/admin ; USER=root ; COMMAND=/bin/systemctl status dnsmasq.service
août 13 18:51:19 lesinfos.top sudo[27333]: pam_unix(sudo:session): session opened for user root(uid=0) by admin(uid=1007)
août 13 18:51:19 lesinfos.top sudo[27333]: pam_unix(sudo:session): session closed for user root
lines 23-70/70 (END)

Hmf then maybe we started a dnsmasq daemon inadvertendly … Let’s pkill -9 dnsmasq and retry to restart the service