Assorted (but probably connected) problems with Omnia

Hello forums

I’d be grateful for your help.
Attached to the omnia (2GB model) are two 3TB WD Red HDDs (BTRFS raid 1). Starting from a clean install, I followed the instructions in the documentation to get samba running. Other than samba, there’s mpd (with usb soundcard) and transmission running.
I usually don’t touch the system unless something is broken, so I didn’t make any big changes to the configuration.

I have several problems with this setup, and I’m sure they are somehow related:
First problem:
The permissions in the samba share aren’t working properly. The NAS section of /etc/samba/smb.conf has

valid users = wush1
read only = no
guest ok = no

On my computer, I mount it at boot with cifs. The user is setup correctly on the box and in samba (according to the instructions), and in the beginning it works, but after a while, I lose write permissions, or the NAS simply becomes unreachable and I’d have to restart the smb process on the box. Even with file and directory mask set to 777, I don’t get write permission.

Second problem:
When I add torrents to transmission, the box often crashes (particularly with large files). Also, even without downloading anything, on the overview page in luci, I have only a few % memory left.
Often, luci and foris are not reachable or crash when I’m logged in.

Third problem:
The mpd running on the box cannot refresh its database (160GB music collection): It will only show a few entries and not continue. I have to run mpd on my computer, point it at the music collection, refresh the database (which takes a long time) and copy the file to the box. Also, I cannot get beets to import new music to the box due to write permission problems.

I hope you can help me out with these problems. Please let me know if you need any logs or configuration files.

Just guessing here, it sounds like memory problems.
Try vmstat etc to see memory pressure. Does the oom-killer do something?

Is the oom-killer automatically activated or does it have to be configured? When should it trigger? I just rebooted the router and played some music from the NAS with mpd running on the router, which did not take a lot of memory (top shows that mpd takes 4% VSZ, which is by far the largest number of any processes). I don’t believe mpd to be the culprit.
Next, I played movie files from the NAS via samba, using mpv on my computer. This made the free memory shown on the luci overview page go down very quickly (a percent every few seconds).
The overview page shows 33% free memory at the moment.
In /var/log/messages:

root@turris:~# grep -i kill /var/log/messages*
root@turris:~# (Does not show anything.)

Then:

root@turris:~# free -lm
total used free shared buffers cached
Mem: 2070768 1378840 691928 2668 2448 1182396
-/+ buffers/cache: 193996 1876772
Swap: 0 0 0

And:

root@turris:~# egrep ‘High|Low’ /proc/meminfo
HighTotal: 1310720 kB
HighFree: 440700 kB
LowTotal: 760048 kB
LowFree: 251560 kB

Could something be wrong with the samba configuration (or is mpv acting silly?)

[details=The auto-generated smb.conf:]> [global]

netbios name = nas
display charset = UTF-8
interfaces = 127.0.0.1/8 lo 192.168.1.1/24 br-lan
server string = OpenWrt
unix charset = UTF-8
workgroup = WORKGROUP
browseable = yes
deadtime = 30
domain master = yes
encrypt passwords = true
enable core files = no
guest account = nobody
guest ok = no
invalid users = root
local master = yes
load printers = no
map to guest = Bad User
max protocol = SMB2
min receivefile size = 16384
null passwords = yes
obey pam restrictions = yes
os level = 20
passdb backend = smbpasswd
preferred master = yes
printable = no
read only = no
security = user
smb encrypt = disabled
smb passwd file = /etc/samba/smbpasswd
socket options = TCP_NODELAY IPTOS_LOWDELAY
syslog = 2
use sendfile = yes
writeable = yes

[nas]
path = /mnt/nas
valid users = users on the system
read only = no
guest ok = no
create mask = 777
directory mask = 777[/details]

And finally, vmstat shows:

root@turris:~# vmstat
procs -----------memory---------- —swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 0 692348 2448 1191020 0 0 0 0 91 323 1 0 99 0 0

Still guessing, yes, it can be samba. So you could go to the samba channels and mailing lists, but if you ask there, their first response will be to try samba 4.6. Samba 3.6 is old. You could try a lxc guest, run samba in there, and see if the same problems persist? That’s how I run samba, and I don’t have these problems.