O serviço Samba não será iniciado em 16.04 LTS (não é uma atualização)

2

HI ouvinte de longa data pela primeira vez.

Eu tenho um sistema rodando 16.04 LTS Desktop com um compartilhamento Samba que parou de ser iniciado, cerca de dois meses atrás. Minhas tentativas de reiniciar, limpar, reinstalar todas falharam. Agradecemos antecipadamente por qualquer ajuda que você pode oferecer.

Por favor, note que o link mais comum para as minhas buscas tem sido um problema similar apresentado depois que o Ubuntu foi atualizado para o 16.04, o que eu nunca fiz. Além disso, as soluções que envolvem comentar security = share e username map = smbusers do smb.conf não se aplicam no meu caso, uma vez que elas nunca estiveram no meu arquivo smb.conf .

Aqui está um exemplo:

    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)

Se eu tentar iniciar manualmente o samba, sou informado de que o serviço está mascarado:

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

O simples desmascaramento não ajuda. Claramente, smbd.service não está sendo iniciado.

Eu suspeito que eu estava mexendo com permissões de arquivo por volta dessa época e não coloquei as coisas de volta ao seu estado original. Meu melhor palpite de qualquer maneira.

Aprecie realmente todas e quaisquer sugestões.

EDITADO PARA ADICIONAR:

sudo systemctl restart samba-ad-dc não deu saída, então presumo que reinicie sem problemas.

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:

Um usuário me alertou para o samba não funcionar. A saída solicitada:

    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:

saída testparm (eu corrigi o erro de máscara criado no smb.conf para criar máscara e não melhorar):

    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:

Eu realmente aprecio o seu tempo hoje me ajudando, N0rbert. Eu lutei com a sua última requisição por ssh, mas o admin foi removido remotamente e consegui que funcionasse.

    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

Próximo:

    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)

Próximo:

    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

Eu reiniciei e não encontrei melhorias nem alterações. Eu mudei o arquivo /etc/samba/smb.conf como sugerido sem alteração. E eu tenho permissão para acessar a pasta compartilhada.

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

Estou realmente perdido aqui.

EDIT # 7: RESOLVIDO !!!

O usuário jelmer me pediu para verificar os logs do samba em /var/log/samba . Curiosamente, um arquivo, log. nesta pasta foi modificado pela última vez no início deste mês, com os outros alterados anteriormente. Aquele arquivo indicava isso:

    [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

Então, alterei as permissões de msg.sock para 0700 conforme a mensagem foi direcionada e o serviço foi iniciado quando eu executei sudo apt upgrade . Sucesso.

Agradeço ao enguia por me mandar mais fundo, e aos agradecimentos especiais a N0rbert pelo tempo e paciência de hoje, solicitando mais informações, o que me ensinou muito mais sobre samba e serviços no meu sistema. Parabéns a vocês dois.

    
por White Belt Ubuntu 28.01.2018 / 20:19

1 resposta

0

Aqui, resumirei todas as etapas para corrigir o problema:

  1. No Ubuntu moderno, o serviço principal do Samba é samba-ad-dc , o usuário pode reiniciá-lo e verificar seu status com

    sudo systemctl restart samba-ad-dc
    systemctl status samba-ad-dc
    
  2. Pode-se mostrar todos os compartilhamentos do Samba com

    smbclient -L localhost 
    
  3. Se nenhum compartilhamento for exibido, pode-se verificar /etc/samba/smb.conf com

    testparm
    
  4. Para retomar as ações do APT e do dpkg, pode-se executar

    sudo apt-get install -f
    sudo dpkg --configure -a
    
  5. Como sabemos que esses comandos falharam, podemos instalar o pacote Samba forçando todos os avisos e, em seguida, retomar novamente:

    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. Se nada mais ajudasse a tentar usar este /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
    

    e verifique se você pode acessar /media/4TB-A (verifique com ls -ld /media/4TB-A ).

  7. O comentário do

    jelmer sobre os logs em /var/log/samba mostrou o seguinte:

     [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
    

    Então o problema foi completamente corrigido por

     sudo chmod 0700 /var/lib/samba/private/msg.sock
     sudo apt-get upgrade
    
por N0rbert 28.01.2018 / 21:41