web-dev-qa-db-fra.com

Le service Samba ne démarre plus à 16.04 LTS (pas une mise à niveau)

HI auditeur de longue date premier appelant.

J'ai un système fonctionnant sous 16.04 LTS Desktop avec un partage Samba qui a cessé de démarrer il y a environ deux mois. Mes tentatives de redémarrage, de purge, de réinstallation ont toutes échoué. Merci d'avance pour toute aide que vous pouvez offrir.

Veuillez noter que le lien le plus courant pour mes recherches concerne un problème similaire qui s'est présenté après la mise à niveau d'Ubuntu à 16.04, ce que je n'ai jamais fait. De plus, les solutions qui impliquaient de commenter security = share et username map = smbusers de smb.conf ne s'appliquent pas dans mon cas, car elles ne figuraient jamais dans mon fichier smb.conf.

Voici un exemple:

    user@ubuntu:~$ Sudo apt upgrade
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Calculating upgrade... Done
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    1 not fully installed or removed.
    After this operation, 0 B of additional disk space will be used.
    Do you want to continue? [Y/n] y
    Setting up samba (2:4.3.11+dfsg-0ubuntu0.16.04.12) ...
    Job for smbd.service failed because the control process exited with error code. 
    See "systemctl status smbd.service" and "journalctl -xe" for details.
    invoke-rc.d: initscript smbd, action "start" failed.
    ● smbd.service - LSB: start Samba SMB/CIFS daemon (smbd)
    Loaded: loaded (/etc/init.d/smbd; bad; vendor preset: enabled)
    Active: failed (Result: exit-code) since Sun 2018-01-28 12:49:10 EST; 7ms ago
    Docs: man:systemd-sysv-generator(8)
    Process: 6851 ExecStart=/etc/init.d/smbd start (code=exited, status=1/FAILURE)

    Jan 28 12:48:39 ubuntu systemd[1]: Starting LSB: start Samba SMB/CIFS daemon (.....
    Jan 28 12:49:10 ubuntu smbd[6851]:  * Starting SMB/CIFS daemon smbd
    Jan 28 12:49:10 ubuntu smbd[6851]:    ...fail!
    Jan 28 12:49:10 ubuntu systemd[1]: smbd.service: Control process exited, code=...=1
    Jan 28 12:49:10 ubuntu systemd[1]: Failed to start LSB: start Samba SMB/CIFS d...).
    Jan 28 12:49:10 ubuntu systemd[1]: smbd.service: Unit entered failed state.
    Jan 28 12:49:10 ubuntu systemd[1]: smbd.service: Failed with result 'exit-code'.
    Hint: Some lines were ellipsized, use -l to show in full.
    dpkg: error processing package samba (--configure):
     subprocess installed post-installation script returned error exit status 1
    Processing triggers for libc-bin (2.23-0ubuntu10) ...
    Errors were encountered while processing:
     samba
    E: Sub-process /usr/bin/dpkg returned an error code (1)

Si j'essaie de démarrer manuellement samba, on me dit que le service est masqué:

    user@ubuntu:~$ Sudo systemctl restart samba 
    Failed to restart samba.service: Unit samba.service is masked.

Simplement démasquer n'aide pas. Clairement, smbd.service ne démarre pas.

Je soupçonne que je détournais avec des autorisations de fichiers à cette époque et que je n'avais pas rétabli les choses à leur état d'origine. Mon meilleur deviner quand même.

Vraiment apprécier toutes les suggestions.

Édité pour ajouter:

Sudo systemctl restart samba-ad-dc n'a donné aucune sortie, donc je suppose que redémarré sans problème.

systemctl status samba-ad-dc output:

    user@ubuntu://$ systemctl status samba-ad-dc
    ● samba-ad-dc.service - LSB: start Samba daemons for the AD DC
       Loaded: loaded (/etc/init.d/samba-ad-dc; bad; vendor preset: enabled)
       Active: active (exited) since Sun 2018-01-28 14:25:40 EST; 16s ago
         Docs: man:systemd-sysv-generator(8)
      Process: 4949 ExecStop=/etc/init.d/samba-ad-dc stop (code=exited, status=0/SUCCE
      Process: 4962 ExecStart=/etc/init.d/samba-ad-dc start (code=exited, status=0/SUC

    Jan 28 14:25:40 SVR systemd[1]: Starting LSB: start Samba daemons for the AD DC...
    Jan 28 14:25:40 SVR systemd[1]: Started LSB: start Samba daemons for the AD DC.

EDIT # 2:

Un utilisateur m'a averti que Samba ne fonctionnait pas. La sortie demandée:

    user@ubuntu://$ smbclient -L localhost
    WARNING: The "syslog" option is deprecated
    Enter user’s password: 
    Connection to localhost failed (Error NT_STATUS_CONNECTION_REFUSED)

EDIT # 3-4:

sortie testparm (j'ai corrigé l'erreur de masque créé dans smb.conf pour créer un masque et aucune amélioration):

    user@ubuntu://$ testparm
    Load smb config files from /etc/samba/smb.conf
    rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
    WARNING: The "syslog" option is deprecated
    Processing section "[printers]"
    Processing section "[print$]"
    Processing section "[share]"
    Loaded services file OK.
    Server role: ROLE_STANDALONE

    Press enter to see a dump of your service definitions

    # Global parameters
    [global]
        server string = %h server (Samba, Ubuntu)
        server role = standalone server
        obey pam restrictions = Yes
        pam password change = Yes
        passwd program = /usr/bin/passwd %u
        passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
        unix password sync = Yes
        syslog = 0
        log file = /var/log/samba/log.%m
        max log size = 10000
        dns proxy = No
        panic action = /usr/share/samba/panic-action %d
        idmap config * : backend = tdb
        read only = No
    [printers]
        comment = All Printers
        path = /var/spool/samba
        read only = Yes
        create mask = 0700
        printable = Yes
        browseable = No
    [print$]
        comment = Printer Drivers
        path = /var/lib/samba/printers
        read only = Yes
    [share]
        comment = Ubuntu File Server Share
        path = /media/4TB-A
        create mask = 0755
        guest ok = Yes

EDIT # 5a:

    user@ubuntu://$ Sudo apt-get install -f
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    1 not fully installed or removed.
    After this operation, 0 B of additional disk space will be used.
    Setting up samba (2:4.3.11+dfsg-0ubuntu0.16.04.12) ...
    Job for smbd.service failed because the control process exited with error code. See "systemctl status smbd.service" and "journalctl -xe" for details.
    invoke-rc.d: initscript smbd, action "start" failed.
    ● smbd.service - LSB: start Samba SMB/CIFS daemon (smbd)
       Loaded: loaded (/etc/init.d/smbd; bad; vendor preset: enabled)
       Active: failed (Result: exit-code) since Sun 2018-01-28 15:21:41 EST; 7ms ago
         Docs: man:systemd-sysv-generator(8)
      Process: 5967 ExecStart=/etc/init.d/smbd start (code=exited, status=1/FAILURE)

    Jan 28 15:21:41 SVR systemd[1]: Starting LSB: start Samba SMB/CIFS daemon (smbd)...
    Jan 28 15:21:41 SVR smbd[5967]:  * Starting SMB/CIFS daemon smbd
    Jan 28 15:21:41 SVR smbd[5967]:    ...fail!
    Jan 28 15:21:41 SVR systemd[1]: smbd.service: Control process exited, code=exited...s=1
    Jan 28 15:21:41 SVR systemd[1]: Failed to start LSB: start Samba SMB/CIFS daemon ...d).
    Jan 28 15:21:41 SVR systemd[1]: smbd.service: Unit entered failed state.
    Jan 28 15:21:41 SVR systemd[1]: smbd.service: Failed with result 'exit-code'.
    Hint: Some lines were ellipsized, use -l to show in full.
    dpkg: error processing package samba (--configure):
     subprocess installed post-installation script returned error exit status 1
    Processing triggers for libc-bin (2.23-0ubuntu10) ...
    Errors were encountered while processing:
     samba
    E: Sub-process /usr/bin/dpkg returned an error code (1)

EDIT # 5b:

    user@ubuntu://$ Sudo dpkg --configure -a
    Setting up samba (2:4.3.11+dfsg-0ubuntu0.16.04.12) ...
    Job for smbd.service failed because the control process exited with error code. See "systemctl status smbd.service" and "journalctl -xe" for details.
    invoke-rc.d: initscript smbd, action "start" failed.
    ● smbd.service - LSB: start Samba SMB/CIFS daemon (smbd)
       Loaded: loaded (/etc/init.d/smbd; bad; vendor preset: enabled)
       Active: failed (Result: exit-code) since Sun 2018-01-28 15:22:32 EST; 7ms ago
         Docs: man:systemd-sysv-generator(8)
      Process: 6091 ExecStart=/etc/init.d/smbd start (code=exited, status=1/FAILURE)

    Jan 28 15:22:31 SVR systemd[1]: Starting LSB: start Samba SMB/CIFS daemon (smbd)...
    Jan 28 15:22:31 SVR smbd[6091]:  * Starting SMB/CIFS daemon smbd
    Jan 28 15:22:32 SVR smbd[6091]:    ...fail!
    Jan 28 15:22:32 SVR systemd[1]: smbd.service: Control process exited, code=exited...s=1
    Jan 28 15:22:32 SVR systemd[1]: Failed to start LSB: start Samba SMB/CIFS daemon ...d).
    Jan 28 15:22:32 SVR systemd[1]: smbd.service: Unit entered failed state.
    Jan 28 15:22:32 SVR systemd[1]: smbd.service: Failed with result 'exit-code'.
    Hint: Some lines were ellipsized, use -l to show in full.
    dpkg: error processing package samba (--configure):
     subprocess installed post-installation script returned error exit status 1
    Processing triggers for libc-bin (2.23-0ubuntu10) ...
    Errors were encountered while processing:
     samba

EDIT # 6:

J'apprécie vraiment votre temps aujourd'hui pour m'aider, N0rbert. Je me suis débattu avec votre dernière requête sur ssh mais avec une administration à distance dans la boîte et je l’ai fait fonctionner.

    user@ubuntu:/var/cache/apt/archives$ Sudo dpkg -i --force-all /var/cache/apt/archives/samba_2%3a4.3.11+dfsg-0ubuntu0.16.04.12_AMD64.deb
    (Reading database ... 309686 files and directories currently installed.)
    Preparing to unpack .../samba_2%3a4.3.11+dfsg-0ubuntu0.16.04.12_AMD64.deb ...
    Unpacking samba (2:4.3.11+dfsg-0ubuntu0.16.04.12) over (2:4.3.11+dfsg-0ubuntu0.16.04.12) ...
    Setting up samba (2:4.3.11+dfsg-0ubuntu0.16.04.12) ...
    Job for smbd.service failed because the control process exited with error code. See "systemctl status smbd.service" and "journalctl -xe" for details.
    invoke-rc.d: initscript smbd, action "start" failed.
    ● smbd.service - LSB: start Samba SMB/CIFS daemon (smbd)
       Loaded: loaded (/etc/init.d/smbd; bad; vendor preset: enabled)
       Active: failed (Result: exit-code) since Sun 2018-01-28 16:48:22 EST; 6ms ago
         Docs: man:systemd-sysv-generator(8)
      Process: 7175 ExecStart=/etc/init.d/smbd start (code=exited, status=1/FAILURE)

    Jan 28 16:48:22 SVR systemd[1]: Starting LSB: start Samba SMB/CIFS daemon (.....
    Jan 28 16:48:22 SVR smbd[7175]:  * Starting SMB/CIFS daemon smbd
    Jan 28 16:48:22 SVR smbd[7175]:    ...fail!
    Jan 28 16:48:22 SVR systemd[1]: smbd.service: Control process exited, code=...=1
    Jan 28 16:48:22 SVR systemd[1]: Failed to start LSB: start Samba SMB/CIFS d...).
    Jan 28 16:48:22 SVR systemd[1]: smbd.service: Unit entered failed state.
    Jan 28 16:48:22 SVR systemd[1]: smbd.service: Failed with result 'exit-code'.
    Hint: Some lines were ellipsized, use -l to show in full.
    dpkg: error processing package samba (--install):
     subprocess installed post-installation script returned error exit status 1
    Processing triggers for libc-bin (2.23-0ubuntu10) ...
    Processing triggers for ufw (0.35-0ubuntu2) ...
    Rules updated for profile 'OpenSSH'
    Rules updated for profile 'Samba'
    Firewall reloaded
    Processing triggers for ureadahead (0.100.0-19) ...
    ureadahead will be reprofiled on next reboot
    Processing triggers for systemd (229-4ubuntu21) ...
    Processing triggers for man-db (2.7.5-1) ...
    Errors were encountered while processing:
     samba

Prochain:

    user@ubuntu:/var/cache/apt/archives$ Sudo apt-get install -f
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    1 not fully installed or removed.
    After this operation, 0 B of additional disk space will be used.
    Setting up samba (2:4.3.11+dfsg-0ubuntu0.16.04.12) ...
    Job for smbd.service failed because the control process exited with error code. See "systemctl status smbd.service" and "journalctl -xe" for details.
    invoke-rc.d: initscript smbd, action "start" failed.
    ● smbd.service - LSB: start Samba SMB/CIFS daemon (smbd)
       Loaded: loaded (/etc/init.d/smbd; bad; vendor preset: enabled)
       Active: failed (Result: exit-code) since Sun 2018-01-28 16:51:44 EST; 5ms ago
         Docs: man:systemd-sysv-generator(8)
      Process: 8065 ExecStart=/etc/init.d/smbd start (code=exited, status=1/FAILURE)

    Jan 28 16:51:44 SVR systemd[1]: Starting LSB: start Samba SMB/CIFS daemon (smbd)...
    Jan 28 16:51:44 SVR smbd[8065]:  * Starting SMB/CIFS daemon smbd
    Jan 28 16:51:44 SVR smbd[8065]:    ...fail!
    Jan 28 16:51:44 SVR systemd[1]: smbd.service: Control process exited, code=exited...s=1
    Jan 28 16:51:44 SVR systemd[1]: Failed to start LSB: start Samba SMB/CIFS daemon ...d).
    Jan 28 16:51:44 SVR systemd[1]: smbd.service: Unit entered failed state.
    Jan 28 16:51:44 SVR systemd[1]: smbd.service: Failed with result 'exit-code'.
    Hint: Some lines were ellipsized, use -l to show in full.
    dpkg: error processing package samba (--configure):
     subprocess installed post-installation script returned error exit status 1
    Processing triggers for libc-bin (2.23-0ubuntu10) ...
    Errors were encountered while processing:
     samba
    E: Sub-process /usr/bin/dpkg returned an error code (1)

Prochain:

    user@ubuntu:/var/cache/apt/archives$ Sudo dpkg --configure -a
    Setting up samba (2:4.3.11+dfsg-0ubuntu0.16.04.12) ...
    Job for smbd.service failed because the control process exited with error code. See "systemctl status smbd.service" and "journalctl -xe" for details.
    invoke-rc.d: initscript smbd, action "start" failed.
    ● smbd.service - LSB: start Samba SMB/CIFS daemon (smbd)
       Loaded: loaded (/etc/init.d/smbd; bad; vendor preset: enabled)
       Active: failed (Result: exit-code) since Sun 2018-01-28 16:52:41 EST; 6ms ago
         Docs: man:systemd-sysv-generator(8)
      Process: 8194 ExecStart=/etc/init.d/smbd start (code=exited, status=1/FAILURE)

    Jan 28 16:52:41 SVR systemd[1]: Starting LSB: start Samba SMB/CIFS daemon (smbd)...
    Jan 28 16:52:41 SVR smbd[8194]:  * Starting SMB/CIFS daemon smbd
    Jan 28 16:52:41 SVR smbd[8194]:    ...fail!
    Jan 28 16:52:41 SVR systemd[1]: smbd.service: Control process exited, code=exited...s=1
    Jan 28 16:52:41 SVR systemd[1]: Failed to start LSB: start Samba SMB/CIFS daemon ...d).
    Jan 28 16:52:41 SVR systemd[1]: smbd.service: Unit entered failed state.
    Jan 28 16:52:41 SVR systemd[1]: smbd.service: Failed with result 'exit-code'.
    Hint: Some lines were ellipsized, use -l to show in full.
    dpkg: error processing package samba (--configure):
     subprocess installed post-installation script returned error exit status 1
    Processing triggers for libc-bin (2.23-0ubuntu10) ...
    Errors were encountered while processing:
     samba

J'ai redémarré et n'ai trouvé aucune amélioration ni changement. J'ai changé le fichier /etc/samba/smb.conf comme suggéré, sans changement. Et j'ai la permission d'accéder au dossier partagé.

    user@ubuntu:~$ ls -ld /media/4TB-A
    drwxrwxr-x 1 user user 262144 Dec 31  1969 /media/4TB-A

Je suis vraiment désemparé ici.

EDIT # 7: RESOLU !!!

L'utilisateur jelmer m'a demandé de vérifier les journaux de samba dans /var/log/samba. Curieusement, un fichier, log. dans ce dossier a été modifié pour la dernière fois au début de ce mois, tandis que les autres ont été modifiés plus tôt. Ce fichier indiquait ceci:

    [2018/01/05 23:33:51.639673,  0] ../lib/util/util.c:285(directory_create_or_exist_strict)
     invalid permissions on directory '/var/lib/samba/private/msg.sock': has 0704 should be 0700

J'ai donc modifié les autorisations de msg.sock en 0700 en fonction du message et le service a démarré lorsque j'ai exécuté Sudo apt upgrade. Succès.

Merci à jelner de m'envoyer plus profondément dans les bâtons, et plus particulièrement à N0rbert pour le temps et la patience dont il a fait preuve aujourd'hui pour demander plus d'informations, ce qui m'a beaucoup appris sur la samba et les services fournis sur mon système. Bravo à vous deux.

3
White Belt Ubuntu

Ici, je vais résumer toutes les étapes pour résoudre le problème:

  1. Sur Ubuntu moderne, le service principal de Samba est samba-ad-dc, l’utilisateur peut le redémarrer et vérifier son statut avec

    Sudo systemctl restart samba-ad-dc
    systemctl status samba-ad-dc
    
  2. On peut montrer tous les partages Samba avec

    smbclient -L localhost 
    
  3. Si aucun partage n'est affiché, vous pouvez vérifier /etc/samba/smb.conf avec

    testparm
    
  4. Pour reprendre les actions APT et dpkg, vous pouvez exécuter

    Sudo apt-get install -f
    Sudo dpkg --configure -a
    
  5. Comme nous savons que ces commandes ont échoué, nous pouvons donc installer le paquet Samba en forçant tous les avertissements, puis reprendre à nouveau:

    Sudo dpkg -i --force-all /var/cache/apt/archives/samba_2%3a4.3.11+dfsg-0ubuntu0.16.04‌​.12_AMD64.deb
    Sudo apt-get install -f
    Sudo dpkg --configure -a
    
  6. Si rien d’autre n’a aidé à essayer d’utiliser ce /etc/samba/smb.conf:

    # Global parameters
    [global]
        server string = %h server (Samba, Ubuntu)
        server role = standalone server
        map to guest = Bad User
        obey pam restrictions = Yes
        pam password change = Yes
        passwd program = /usr/bin/passwd %u
        passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
        unix password sync = Yes
        syslog = 0
        log file = /var/log/samba/log.%m
        max log size = 1000
        dns proxy = No
        usershare allow guests = Yes
        panic action = /usr/share/samba/panic-action %d
        idmap config * : backend = tdb
    
    
    [printers]
        comment = All Printers
        path = /var/spool/samba
        create mask = 0700
        printable = Yes
        browseable = No
    
    
    [print$]
        comment = Printer Drivers
        path = /var/lib/samba/printers
    
    
    [share]
        comment = Ubuntu File Server Share
        path = /media/4TB-A
        create mask = 0755
        guest ok = Yes
    

    et assurez-vous que vous pouvez accéder à /media/4TB-A (vérifiez-le avec ls -ld /media/4TB-A).

  7. Le commentaire de jelmer à propos des journaux dans /var/log/samba se présente comme suit:

     [2018/01/05 23:33:51.639673,  0] ../lib/util/util.c:285(directory_create_or_exist_strict)
     invalid permissions on directory '/var/lib/samba/private/msg.sock': has 0704 should be 0700
    

    Donc, le problème a été complètement résolu par

     Sudo chmod 0700 /var/lib/samba/private/msg.sock
     Sudo apt-get upgrade
    
1
N0rbert