How to collect advanced Samba logs (for debugging)?
Applicable products
- NAS models running QTS / QuTS hero
Scenario
When SMB connection issues occur, such as the service working only briefly after a reboot, inability to connect to shared folders, or interrupted file transfers, capturing Samba debug logs can help you and QNAP technical support diagnose the root cause.
Common symptoms include:
- SMB service works only briefly after NAS reboot
- Windows or Mac cannot connect to NAS shared folders
- Connection is established but transfers are interrupted
- HTTP interface works but SMB is inaccessible
Details
Samba log file locations
Samba log file locations vary depending on the firmware version and operation mode.
QTS/QuTS hero 5.2.x and earlier versions
| Operation mode | Log file path |
|---|---|
| Standalone | /share/CACHEDEV1_DATA/.samba/var/log.winbindd*/share/CACHEDEV1_DATA/.samba/var/log.wb*/var/log/log.smbd.wspd*/var/log/log.smbd*/var/log/log.nmbd* |
| AD member | /share/CACHEDEV1_DATA/.samba/var/log.winbind*/share/CACHEDEV1_DATA/.samba/var/log.wb*/var/log/log.smbd.wspd*/var/log/log.smbd*/var/log/log.nmbd* |
| DC (domain controller) | /share/CACHEDEV1_DATA/.samba_target/var/log.samba*/share/CACHEDEV1_DATA/.samba_target/var/log.smbd*/share/CACHEDEV1_DATA/.samba_target/var/log.winbindd*/share/CACHEDEV1_DATA/.samba_target/var/log.wb*/share/CACHEDEV1_DATA/.samba_target/var/log.wspd* |
QTS/QuTS hero 5.3.x and later versions
| Operation mode | Log file path |
|---|---|
| Standalone | /var/log/smb_a/log.smbd*/var/log/smb_a/log.nmbd*/var/log/smb_a/log.winbindd*/var/log/smb_a/log.wb*/var/log/smb_a/log.smbd.wspd* |
| AD member | /var/log/smb_a/log.smbd*/var/log/smb_a/log.nmbd*/var/log/smb_a/log.winbindd*/var/log/smb_a/log.wb*/var/log/smb_a/log.smbd.wspd* |
| DC (domain controller) | /mnt/ext/opt/samba/var/log.smbd*/mnt/ext/opt/samba/var/log.winbindd*/mnt/ext/opt/samba/var/log.samba*/mnt/ext/opt/samba/var/log.wb*/mnt/ext/opt/samba/var/log.wspd* |
Procedure
For Advanced Users Only: This article involves SSH access and command-line operations. Incorrect modifications to system files may cause service disruptions or system instability. Proceed only if you are comfortable with these operations.
Step 1: Enable SSH
- Log in to QTS / QuTS hero with an administrator account.
- Go to Control Panel > Network & File Services > Telnet / SSH.
- Select Allow SSH connection.
- Set the port number (default: 22).
- Click Apply.
Step 2: Connect to the NAS using SSH
Use PuTTY (Windows) or Terminal (Mac/Linux) to connect:
ssh admin@<NAS_IP>Step 3: Increase the Samba log level (enable debug mode)
Run the following command to increase the log level to 10 (most detailed):
QTS/QuTS hero 5.2.x and earlier versions:
/usr/local/samba/bin/smbcontrol -s /etc/config/smb.conf smbd debug 10QTS/QuTS hero 5.3.x and later versions:
/usr/local/samba/bin/smbcontrol -s /etc/config.local/smb_a.conf smbd debug 10Tip: This is a dynamic adjustment that takes effect immediately without restarting the service.
Warning: Enabling debug logging for an extended period may generate a large volume of logs that can fill up the system partition. If you need to capture debug logs over a longer period, you can temporarily redirect debug logs to a data volume.
Optional: Change log storage location
If you need to output logs directly to a shared folder for easier collection, you can temporarily change the log storage path.
QTS/QuTS hero 5.2.x and earlier versions
Edit /etc/config/smb.sh and find the following line. Change the path after -l to a shared folder:
/sbin/daemon_mgr smbd start "${smbd_bin} -l /var/log -D -s $CONFIG"Change it to, for example:
/sbin/daemon_mgr smbd start "${smbd_bin} -l /share/Public -D -s $CONFIG"QTS/QuTS hero 5.3.x and later versions
Edit /etc/init.d/smb_a.sh and find the following global variable:
SMB_LOG_PATH="/var/log/smb_a"Change it to, for example:
SMB_LOG_PATH="/share/Public/smb_log"Warning: Back up the original file before modifying system scripts. These settings may be reset after a reboot.
Step 4: Reproduce the issue
Perform the operations that trigger the issue (for example, connecting to a NAS shared folder from Windows) so that the system can record the relevant logs.
Step 5: Collect log files
Based on your firmware version and operation mode, navigate to the corresponding path to collect log files.
Example (QTS/QuTS hero 5.3.x standalone mode):
# Copy logs to a shared folder
cp /var/log/smb_a/log.smbd* /share/Public/
cp /var/log/smb_a/log.nmbd* /share/Public/Download the log files from /share/Public/ via File Station or an SMB connection.
Step 6: Restore the log level (after troubleshooting)
Reset the log level to the default value (1):
QTS/QuTS hero 5.2.x and earlier versions:
/usr/local/samba/bin/smbcontrol -s /etc/config/smb.conf smbd debug 1QTS/QuTS hero 5.3.x and later versions:
/usr/local/samba/bin/smbcontrol -s /etc/config.local/smb_a.conf smbd debug 1Important notes
- Enabling a high log level (such as 10) generates a large volume of logs and may affect NAS performance. Use this setting only during troubleshooting.
- Always reset the log level to the default value after troubleshooting is complete.
- If you modified the log storage location, restore the original settings after troubleshooting is complete.
Technical support escalation checklist
When contacting QNAP technical support, prepare the following information and files:
- NAS model name
- Firmware version (QTS/QuTS hero version number)
- Samba log files (collected based on operation mode)
- Timestamp of when the issue occurred
- Client operating system version
- Network topology (for example, direct connection, switch, or router)
- Steps to reproduce the issue