記錄一次服務出錯排錯的過程,不少新手出了點錯不百度直接巴拉巴拉的問,通常老手根據經驗能夠給出一點建議,可是因爲個體環境的差別並不適用,反而埋怨起來。這種真的無F**K可說,因此要培養本身的排錯能力是很重要的,這裏簡單的拋磚引玉的舉出個流程出來但願有所幫助。問問題以前善用各大搜索引擎以及博客論壇的搜索功能!windows
# systemctl status smb.service -l â— smb.service - Samba SMB Daemon Loaded: loaded (/usr/lib/systemd/system/smb.service; disabled; vendor preset: disabled) Active: failed (Result: exit-code) since Wed 2016-05-18 16:20:07 CST; 1min 8s ago Process: 3572 ExecStart=/usr/sbin/smbd $SMBDOPTIONS (code=exited, status=127) Main PID: 3572 (code=exited, status=127) May 18 16:20:07 localhost.localdomain systemd[1]: Starting Samba SMB Daemon... May 18 16:20:07 localhost.localdomain smbd[3572]: /usr/sbin/smbd: relocation error: /lib64/libsamba-credentials.so.0: symbol GSS_KRB5_CRED_NO_CI_FLAGS_X, version gssapi_krb5_2_MIT not defined in file libgssapi_krb5.so.2 with link time reference May 18 16:20:07 localhost.localdomain systemd[1]: smb.service: Main process exited, code=exited, status=127/n/a May 18 16:20:07 localhost.localdomain systemd[1]: Failed to start Samba SMB Daemon. May 18 16:20:07 localhost.localdomain systemd[1]: smb.service: Unit entered failed state. May 18 16:20:07 localhost.localdomain systemd[1]: smb.service: Failed with result 'exit-code'.
//從網絡上找的相似出錯,源錯誤日誌忘記保存api
#systemctl start smb 出錯網絡
第一步:samba能夠用testparm命令來測試smb.conf配置檔的合法性dom
[root@longlong Templates]# testparm Load smb config files from /etc/samba/smb.conf rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384) Processing section "[homes]" Processing section "[printers]" Processing section "[print$]" Loaded services file OK. Server role: ROLE_STANDALONE Press enter to see a dump of your service definitions # Global parameters [global] workgroup = SAMBA printcap name = cups security = USER idmap config * : backend = tdb cups options = raw [homes] comment = Home Directories browseable = No inherit acls = Yes read only = No valid users = %S %D%w%S [printers] comment = All Printers path = /var/tmp browseable = No printable = Yes create mask = 0600 [print$] comment = Printer Drivers path = /var/lib/samba/drivers create mask = 0664 directory mask = 0775 write list = root
能夠看到配置文件沒有錯誤,排除此錯誤!~
第二步:使用自帶命令 輸出samba日誌 測試
[root@longlong Templates]# smbd -F -S smbd: relocation error: /usr/lib64/samba/libgse-samba4.so: symbol krb5_get_init_creds_opt_set_pac_request, version krb5_3_MIT not defined in file libkrb5.so.3 with link time reference
找出錯誤緣由lib庫出錯搜索引擎
解決 yum -y install krb5-devel.x86_64 krb5-libs.x86_64
錯誤緣由:進一步分析,查看yum源 發現是公網阿里雲源,安裝了新版本,系統庫文件支持仍是老版本因此運行出錯阿里雲
security=share在新版中已經被廢棄了 因此最後貼個4以上samba新版本spa
samba-4.6.2-8.el7.x86_64日誌
創建匿名用戶Linux和windows共享目錄的配置文件:code
[global]
workgroup = SAMBA
security = user
passdb backend = tdbsam
printing = cups
printcap name = cups
load printers = yes
cups options = raw
map to guest = Bad User