web-dev-qa-db-ja.com

Sambaサービスは16.04 LTS(アップグレードではない)で開始されなくなりました

HI長時間リスナーの最初の呼び出し元。

約2か月前に、16.04 LTSデスクトップを実行しているシステムでSamba共有が起動を停止しました。再起動、パージ、再インストールの試みはすべて失敗しました。あなたが提供できる助けを事前に感謝します。

私の検索の最も一般的なリンクは、Ubuntuが16.04にアップグレードされた後に発生した同様の問題に対するものでしたが、これは私が一度も行ったことがないことに注意してください。同様に、smb.confからsecurity = shareおよびusername map = smbusersをコメントアウトすることを含むソリューションは、smb.confファイルになかったため、私の場合には適用されません。

以下に例を示します。

    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)

手動でSambaを起動しようとすると、サービスがマスクされていると言われます。

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

単純にマスクを解除しても役に立ちません。明らかにsmbd.serviceは開始されていません。

私はその頃ファイル許可をいじっていたのではないかと疑っていて、元の状態に戻すことはしませんでした。とにかく私の最高の推測。

ありとあらゆる提案を本当に感謝します。

追加するように編集:

Sudo systemctl restart samba-ad-dcは何も出力しなかったので、問題なく再起動したと思います。

systemctl status samba-ad-dc出力:

    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.

編集#2:

ユーザーが、sambaが機能しないことを警告しました。要求された出力:

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

編集#3-4:

testparmの出力(smb.confで作成されたマスクエラーを修正してマスクを作成しましたが、改善されていません):

    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

編集#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)

編集#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

編集#6:

N0rbert、今日私を助けてくれてありがとう。私はあなたの最後のリクエストをsshで苦労しましたが、リモート管理者が箱に入って動作しました。

    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

次:

    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)

次:

    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

再起動しても改善も変更もありませんでした。 /etc/samba/smb.confファイルを変更せずに提案どおりに変更しました。そして、共有フォルダーにアクセスする権限があります。

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

ここで本当に困っています。

編集#7:解決しました!!!

ユーザーjelmerは、/var/log/sambaのsambaログを確認するように私に頼みました。奇妙なことに、このフォルダ内の1つのファイルlog.が今月初めに最後に変更され、他のファイルは以前に変更されました。その1つのファイルはこれを示しました:

    [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

そのため、メッセージの指示に従ってmsg.sockの権限を0700に変更し、Sudo apt upgradeを実行したときにサービスが開始されました。成功。

スティックの奥深くまで送ってくれたjelnerに感謝します。また、今日のより多くの情報を要求してくれた時間と忍耐にN0rbertに感謝します。あなたの両方に称賛。

3

ここで、問題を解決するためのすべての手順を要約します。

  1. 最新のUbuntuでは、メインのSambaサービスはsamba-ad-dcであり、ユーザーはそれらを再起動してステータスを確認できます

    Sudo systemctl restart samba-ad-dc
    systemctl status samba-ad-dc
    
  2. すべてのSamba共有を表示できます

    smbclient -L localhost 
    
  3. 共有が表示されない場合は、/etc/samba/smb.confを確認できます

    testparm
    
  4. 実行できるAPTおよびdpkgアクションを再開するには

    Sudo apt-get install -f
    Sudo dpkg --configure -a
    
  5. これらのコマンドが失敗したことがわかっているので、すべての警告を強制してSambaパッケージをインストールしてから再開できます。

    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. この/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
    

    /media/4TB-Aにアクセスできることを確認してください(ls -ld /media/4TB-Aで確認してください)。

  7. jelmer/var/log/sambaのログに関するコメントは、次のことを示しています。

     [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
    

    したがって、問題は完全に修正されました

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