New install, smbd sits at 20-25% CPU all the time

Having had to reinstall Rockstor today, I have run into a new problem I havent seen before.

The SMBD process (Samba) is constantly using 20-25% of my CPU.

This is not due to file accesses or anything like that, the system is completely idle, but the CPU is pretty busy.
I have never seen this behaviour in any of my earlier installs.

Anybody have an idea as to what could be the cause?

The problem persist across reboots. Switching of Samba in Rockstor fixes the problem, but its not a usable solution :slight_smile:

Otherwise the system seems fine, I can access files both through SMBD and NFS.

Edit:

I just tried deleting my Samba shares. Even with no shares active, SMBD is still consuming ~20% CPU.

Trying to bump this.

Does anybody have an idea?

Its a completely new install. Imported pools and shares, and setup Samba and NFS, and smbd is constantly using about 20% CPU, while the system is basically sitting idle.

The system otherwise works fine.

There must be a fix for this…

I have this problem as well. It has persisted throughout releases. SMBD just hogs 20-40% CPU at all times. Even idle.

I thought it had to do with the kswapd kernel thread locking up and spewing errors into dmesg. But once I turned off kswapd entirely and no longer use swap at all, my kswapd lockups ceased.

But the SMBD CPU usage continued.

I have samba and it’s not taking any CPU. Almost idle.
So do not think it’s a general issue.
Think more information is needed like your smb.conf and digging around in the logs if you find smb reporting any issues.

Hi @KarstenV,
on “Rockstor land” samba is my best friend and my coolest enemy too, so let’s have fun!

Can you provide you /etc/samba/smb.conf?
Can you describe your samba use? (ex. having rsync over cifs mounts? having tons of I/O via samba shares? etc etc)
Finally, can you provide some samba logs from /var/log/ ?

Mirko

I will try to do my best.

Understand that this is a basic Rockstor install, and that I have only added the same shares I have had in all my other installs. Nothing is speicial, only CPU usage is high.

I dont run rsync (hardly know what it is), and my share access is mostly one file at a time, as Samba is mostly used for media access (playing movies and music).
The server is in no way under pressure, there are (at most) 3 clients accesing it, and 90+% of the time its sitting more or less idle (even then SMBD uses 20+% CPU).

smb.conf:

[global]
workgroup = SAMBA
security = user

passdb backend = tdbsam

printing = cups
printcap name = cups
load printers = yes
cups options = raw

[homes]
comment = Home Directories
valid users = %S, %D%w%S
browseable = No
read only = No
inherit acls = Yes

[printers]
comment = All Printers
path = /var/tmp
printable = Yes
create mask = 0600
browseable = No

[print$]
comment = Printer Drivers
path = /var/lib/samba/drivers
write list = root
create mask = 0664
directory mask = 0775
####BEGIN: Rockstor SAMBA CONFIG####
[Media]
root preexec = "/opt/rockstor/bin/mnt-share Media"
root preexec close = yes
comment = Media
path = /mnt2/Media
browseable = yes
read only = no
guest ok = no
admin users = Karsten
[Musik]
root preexec = "/opt/rockstor/bin/mnt-share Musik"
root preexec close = yes
comment = Musik
path = /mnt2/Musik
browseable = yes
read only = no
guest ok = no
admin users = Karsten
[Data]
root preexec = "/opt/rockstor/bin/mnt-share Data"
root preexec close = yes
comment = Data
path = /mnt2/Data
browseable = yes
read only = no
guest ok = no
admin users = Karsten
####END: Rockstor SAMBA CONFIG####

In the /var/log/ direcory there are two files log.nmdb and log.smdb, both are 0 bytes. in /var/log/old/ the same files are present.

log.nmdb:

[2017/04/19 19:16:16.907668, 0] …/lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon ‘nmbd’ finished starting up and ready to serve connections
[2017/04/19 19:16:39.688080, 0] …/lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon ‘nmbd’ finished starting up and ready to serve connections
[2017/04/19 19:16:56.656707, 0] …/lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon ‘nmbd’ finished starting up and ready to serve connections
[2017/04/19 19:17:10.659745, 0] …/lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon ‘nmbd’ finished starting up and ready to serve connections
[2017/04/19 19:17:33.539434, 0] …/source3/nmbd/nmbd_become_lmb.c:397(become_local_master_stage2)


Samba name server ROCKSTORNAS is now a local master browser for workgroup SAMBA on subnet 172.26.1.8


[2017/04/19 19:20:56.949393, 0] …/lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon ‘nmbd’ finished starting up and ready to serve connections
[2017/04/19 19:21:19.975835, 0] …/source3/nmbd/nmbd_become_lmb.c:397(become_local_master_stage2)


Samba name server ROCKSTORNAS is now a local master browser for workgroup SAMBA on subnet 172.26.1.8


[2017/04/19 20:40:56.678346, 0] …/source3/nmbd/nmbd.c:58(terminate)
Got SIGTERM: going down…
[2017/04/19 20:44:50.013581, 0] …/lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon ‘nmbd’ finished starting up and ready to serve connections
[2017/04/19 20:45:13.043692, 0] …/source3/nmbd/nmbd_become_lmb.c:397(become_local_master_stage2)


Samba name server ROCKSTORNAS is now a local master browser for workgroup SAMBA on subnet 172.26.1.8


[2017/04/19 20:50:33.663858, 0] …/source3/nmbd/nmbd.c:58(terminate)
Got SIGTERM: going down…
[2017/04/19 20:52:27.392100, 0] …/lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon ‘nmbd’ finished starting up and ready to serve connections
[2017/04/19 20:52:50.417623, 0] …/source3/nmbd/nmbd_become_lmb.c:397(become_local_master_stage2)


Samba name server ROCKSTORNAS is now a local master browser for workgroup SAMBA on subnet 172.26.1.8


[2017/04/19 20:56:47.941314, 0] …/lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon ‘nmbd’ finished starting up and ready to serve connections
[2017/04/19 20:57:19.491217, 0] …/source3/nmbd/nmbd_become_lmb.c:397(become_local_master_stage2)


Samba name server ROCKSTORNAS is now a local master browser for workgroup SAMBA on subnet 172.26.1.8


[2017/04/19 21:13:20.234854, 0] …/source3/nmbd/nmbd.c:58(terminate)
Got SIGTERM: going down…
[2017/04/19 21:13:20.271147, 0] …/lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon ‘nmbd’ finished starting up and ready to serve connections
[2017/04/19 21:13:25.812924, 0] …/source3/nmbd/nmbd.c:58(terminate)
Got SIGTERM: going down…
[2017/04/19 21:13:25.845531, 0] …/lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon ‘nmbd’ finished starting up and ready to serve connections
[2017/04/19 21:13:31.714336, 0] …/lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon ‘nmbd’ finished starting up and ready to serve connections
[2017/04/19 21:13:54.761315, 0] …/source3/nmbd/nmbd_become_lmb.c:397(become_local_master_stage2)


Samba name server ROCKSTORNAS is now a local master browser for workgroup SAMBA on subnet 172.26.1.8


[2017/04/19 21:15:23.916721, 0] …/source3/nmbd/nmbd.c:58(terminate)
Got SIGTERM: going down…
[2017/04/19 21:15:23.963061, 0] …/lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon ‘nmbd’ finished starting up and ready to serve connections
[2017/04/19 21:15:46.279558, 0] …/lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon ‘nmbd’ finished starting up and ready to serve connections
[2017/04/19 21:16:08.012713, 0] …/source3/nmbd/nmbd.c:58(terminate)
[2017/04/19 21:16:08.048185, 0] …/lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon ‘nmbd’ finished starting up and ready to serve connections
[2017/04/19 21:16:31.073613, 0] …/source3/nmbd/nmbd_become_lmb.c:397(become_local_master_stage2)


Samba name server ROCKSTORNAS is now a local master browser for workgroup SAMBA on subnet 172.26.1.8


[2017/04/19 21:16:35.856960, 0] …/lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon ‘nmbd’ finished starting up and ready to serve connections
[2017/04/19 21:16:58.884466, 0] …/source3/nmbd/nmbd_become_lmb.c:397(become_local_master_stage2)


Samba name server ROCKSTORNAS is now a local master browser for workgroup SAMBA on subnet 172.26.1.8


[2017/04/19 21:40:30.446289, 0] …/lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon ‘nmbd’ finished starting up and ready to serve connections
[2017/04/19 21:40:53.508927, 0] …/source3/nmbd/nmbd_become_lmb.c:397(become_local_master_stage2)


Samba name server ROCKSTORNAS is now a local master browser for workgroup SAMBA on subnet 172.26.1.8


log.smbd

[2017/04/19 19:16:19.956956, 0] …/lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon ‘smbd’ finished starting up and ready to serve connections
[2017/04/19 19:16:39.641907, 0] …/lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon ‘smbd’ finished starting up and ready to serve connections
[2017/04/19 19:16:56.593636, 0] …/lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon ‘smbd’ finished starting up and ready to serve connections
[2017/04/19 19:17:10.612596, 0] …/lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon ‘smbd’ finished starting up and ready to serve connections
[2017/04/19 19:22:11.175039, 0] …/lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon ‘smbd’ finished starting up and ready to serve connections
[2017/04/19 20:46:05.960179, 0] …/lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon ‘smbd’ finished starting up and ready to serve connections
[2017/04/19 20:52:27.477652, 0] …/lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon ‘smbd’ finished starting up and ready to serve connections
[2017/04/19 20:58:03.250786, 0] …/lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon ‘smbd’ finished starting up and ready to serve connections
[2017/04/19 20:58:48.103682, 0] …/lib/util/pidfile.c:104(pidfile_create)
ERROR: smbd is already running. File /run/smbd.pid exists and process id 12694 is running.
[2017/04/19 21:04:05.015679, 0] …/lib/util/pidfile.c:104(pidfile_create)
ERROR: smbd is already running. File /run/smbd.pid exists and process id 12694 is running.
[2017/04/19 21:04:32.252632, 0] …/lib/util/pidfile.c:104(pidfile_create)
ERROR: smbd is already running. File /run/smbd.pid exists and process id 12694 is running.
[2017/04/19 21:13:20.207560, 0] …/lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon ‘smbd’ finished starting up and ready to serve connections
[2017/04/19 21:13:25.784650, 0] …/lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon ‘smbd’ finished starting up and ready to serve connections
[2017/04/19 21:13:31.656110, 0] …/lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon ‘smbd’ finished starting up and ready to serve connections
[2017/04/19 21:15:23.888530, 0] …/lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon ‘smbd’ finished starting up and ready to serve connections
[2017/04/19 21:15:46.224535, 0] …/lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon ‘smbd’ finished starting up and ready to serve connections
[2017/04/19 21:16:07.985664, 0] …/lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon ‘smbd’ finished starting up and ready to serve connections
[2017/04/19 21:16:35.802267, 0] …/lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon ‘smbd’ finished starting up and ready to serve connections
[2017/04/19 21:41:51.553647, 0] …/lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon ‘smbd’ finished starting up and ready to serve connections

This is all the data I’ve got. Hope you can learn something from it :slight_smile:

I actually just noticed something.

Screenshot:

In all my screenshots, taken at different times, the process “cleanupd” is also using some CPU, sitting at second place. Could this be the sinner / culprit?

What does cleanupd actually do?

Hi @KarstenV,
first thing I noticed is your smbd service often going up/down (those lines with smbd daemon)
First thing you can do is to add local master = no on samba global conf (from Rockstor WebUI -> wrench next to samba service) : this will avoid samba trying to become current workgroup master

Next checks:
smbstatus from CLI to check connections
add log level = 10 to samba global to grab further infos/logs (please remember to delete it after tests so we avoid tons of logs!)

Mirko

OK, have added local master = no

At the same time made workgroup name match my windows machines.

Stopped/started samba and checked that the shares are accessible and they were.

Ran smbstatus:


Samba version 4.4.4
PID Username Group Machine Protocol Version Encryption Signing

15550 Karsten Karsten 172.26.1.3 (ipv4:172.26.1.3:3461) SMB3_11 - partial(AES-128-CMAC)

Service pid Machine Connected at Encryption Signing

Data 15550 172.26.1.3 Sat Apr 29 10:46:20 AM 2017 CEST - -
Musik 15550 172.26.1.3 Sat Apr 29 10:46:19 AM 2017 CEST - -
Media 15550 172.26.1.3 Sat Apr 29 10:46:18 AM 2017 CEST - -

Locked files:
Pid Uid DenyMode Access R/W Oplock SharePath Name Time

15550 0 DENY_ALL 0x100080 RDONLY NONE /mnt2/Media . Sat Apr 29 10:46:23 2017
15550 0 DENY_NONE 0x100081 RDONLY NONE /mnt2/Data . Sat Apr 29 10:46:20 2017
15550 0 DENY_NONE 0x100081 RDONLY NONE /mnt2/Data . Sat Apr 29 10:46:24 2017
15550 0 DENY_NONE 0x80 RDONLY NONE /mnt2/Musik . Sat Apr 29 10:46:19 2017


I think you can even follow me checking the accesability to the shares.

SMBD is still sitting at 21% CPU usage.

Have now added the log level you requested.

smb.conf now looks like this:


[global]
map to guest = Bad User
cups options = raw
log file = /var/log/samba/log.%m
printcap name = /dev/null
load printers = no

####BEGIN: Rockstor SAMBA GLOBAL CUSTOM####
local master = no
log level = 10
workgroup = MSHOME
####END: Rockstor SAMBA GLOBAL CUSTOM####

####BEGIN: Rockstor SAMBA CONFIG####
[Media]
root preexec = “/opt/rockstor/bin/mnt-share Media”
root preexec close = yes
comment = Media
path = /mnt2/Media
browseable = yes
read only = no
guest ok = no
admin users = Karsten
[Musik]
root preexec = “/opt/rockstor/bin/mnt-share Musik”
root preexec close = yes
comment = Musik
path = /mnt2/Musik
browseable = yes
read only = no
guest ok = no
admin users = Karsten
[Data]
root preexec = “/opt/rockstor/bin/mnt-share Data”
root preexec close = yes
comment = Data
path = /mnt2/Data
browseable = yes
read only = no
guest ok = no
admin users = Karsten
####END: Rockstor SAMBA CONFIG####


The system is now rebooting, to make certain all changes are applied (dont know if its enough to simply stop/start the service).

Its up again and settled in, SMBD is stil on top of the world :slight_smile:

OK, I think I may have found a/the reason.

While messing with the Rockstor server, I had to power down an Lubuntu machine I have running (basically an old laptop that is running Logitech Media server for my Squeezebox).
As soon as this one was powered down, smbd returned to taking no CPU time.

Bringing back up the Lubuntu machine did not see the CPU time increase again. Could this other machine have been doing something to poke samba on the Rockstor machine?

As it sits right now everything is fine.

Short answer is yes
Long answer is: if that media server had connection to Rockstor via samba yes

Suggestion for sharing data: serving documents/images with a “normal use” samba is ok, having media streaming avoid samba and go with nfs!

Mirko

OK.

It had something to do with that computer, the SMBD usage is completely gone, even when playing music through the Squeezebox.

The way its set up is that Logitech Media Server (LMS) has access to the music directory, which it scans for new media once a week. It then stores the music in a SQLite database, and images in a cache directory. And then off course when I play a song, it accesses the relevant mp3/flac file and streams it to my Squeezebox.
I dont think it puts that much strain upon samba.

But what could have happened is that my Rocktor server choose to crash during a media scan from LMS, and this has made the Logitech Media server misbehave, even though Rockstor was back up and running.

This is all guesswork, but something I will have to keep an eye out for in the future.