Serviio Keeping Drives From Sleeping [SOLVED]

Marvell Kirkwood based
Post Reply
Lonewolf54
Posts: 10
Joined: Thu Jan 04, 2018 4:14 pm

Serviio Keeping Drives From Sleeping [SOLVED]

Post by Lonewolf54 » Wed Jan 10, 2018 7:46 pm

I recently updated Serviio on my Zyxel NSA325V2 from version 1.52 to version 1.9. I now noticed that my drives will no longer sleep after the prescribed time and stay active as long as serviio process is running. The strange thing is that with version 1.52 of Serviio, I didn't have this problem. If I stop Serviio the unit sleeps after the prescribed time. I have all updating in Serviio shut off but the problem persists. Can anyone help me out on this?

It seems to do the same thing with Twonky but I normally keep Twonky disabled.

Here is what I am seeing with Serviio enabled.

Code: Select all

cat /proc/d_suspdtime
The results are:

Code: Select all

SuspendingTime = 10
Disk0: ACTIVE
Disk1: ACTIVE
The disks never go to INACTIVE so they never go to STANDBY

Code: Select all

root:~# lsof /mnt/HD_a2 | grep i-data
httpd     9415  nobody    5w   REG    9,0   138295 102368995 /i-data/0365a9f9/.system/zyxelFrameworkLog
httpd     9415  nobody   10w   REG    9,0   138295 102368995 /i-data/0365a9f9/.system/zyxelFrameworkLog
dservice 22638    root    2w   REG    9,0   749413 102368990 /i-data/0365a9f9/.system/storage.txt
dservice 22638    root   13u   REG    9,0     3072 102368992 /i-data/0365a9f9/.system/dservice.db
smbd     25902    root  cwd    DIR    9,0     4096 110231553 /i-data/0365a9f9/public
smbd     25903    root  cwd    DIR    9,0     4096  15859713 /i-data/0365a9f9/video
smbd     25904    root  cwd    DIR    9,0     4096  69206017 /i-data/0365a9f9/photo
smbd     25905    root  cwd    DIR    9,0     4096 184942593 /i-data/0365a9f9/music
smbd     25906    root  cwd    DIR    9,0     4096  45744129 /i-data/0365a9f9/admin
smbd     25907    root  cwd    DIR    9,0     4096 114691595 /i-data/0365a9f9/.system/autoshare_sata/Volume1
Can anyone help me out on this?
Last edited by Lonewolf54 on Sun Jan 14, 2018 9:33 pm, edited 1 time in total.
Doug

barmalej2
Posts: 2387
Joined: Sun Apr 29, 2012 5:24 pm

Re: Serviio Keeping Drives From Sleeping

Post by barmalej2 » Wed Jan 10, 2018 8:16 pm

I guess that dservice stands for firmware download service. Try to disable it temporary.
As for Serviio, it's hard to advise something without regular using of it. Does

Code: Select all

lsof /i-data | grep serviio
returns anything?
P.S. Take a look here:
http://forum.serviio.org/viewtopic.php?f=5&t=24044
On ffp serviio logs are located in /ffp/opt/serviio/log dir.
and here:
http://www.serviio.org/forum/viewtopic.php?f=5&t=23944
https://bitbucket.org/xnejp03/serviio/i ... ing-up-nas
Seems like a bug in Serviio, which is planned to be resolved in 1.9.1.
Or you can try to fix yourself line serviio developer recommended in post:
http://forum.serviio.org/viewtopic.php? ... 44#p115340
Stop serviio daemon service before editing and start it after.

Lonewolf54
Posts: 10
Joined: Thu Jan 04, 2018 4:14 pm

Re: Serviio Keeping Drives From Sleeping

Post by Lonewolf54 » Wed Jan 10, 2018 11:34 pm

barmalej2 wrote:I guess that dservice stands for firmware download service. Try to disable it temporary.
As for Serviio, it's hard to advise something without regular using of it. Does

Code: Select all

lsof /i-data | grep serviio
returns anything?
Running this code returns nothing which is what is expected, right?

Yes, the "dservice" is the firmware download service and shutting it down does not help.

I read all the posts you listed and added the "fix" but it did not help. Those issues seem to have the problem that their NAS boxes go to standby but keep coming out every hour or so. My issue is that the disks go "active" as soon as Serviio or Twonky are activated and then never go "not active". Well, I guess I should not say never, as I have caught a momentary "not active" but it only lasts a few seconds before going back to "active". The weird part is that Twonky does the same thing. Is there any other way to see what is causing the drives to stay "active" anytime a media server is enabled?
Doug

barmalej2
Posts: 2387
Joined: Sun Apr 29, 2012 5:24 pm

Re: Serviio Keeping Drives From Sleeping

Post by barmalej2 » Thu Jan 11, 2018 8:34 am

If you activated Twonky even once and disabled after, it can be a coolprit of current problem. Twonky on zyxel's has known issue to continue working (scanner? still running) even it is disabled. This is a short output of inotifywait utility on my NSA310:
/i-data/md0/.media/twonkymedia/db/ ACCESS 11.tms.dat
/i-data/md0/.media/twonkymedia/db/ ACCESS 11.tms.dat
/i-data/md0/.media/twonkymedia/db/ ACCESS 11.tms.dat
/i-data/md0/.media/twonkymedia/db/ ACCESS 11.tms.dat
/i-data/md0/.media/twonkymedia/db/ ACCESS 11.tms.dat
/i-data/md0/.media/twonkymedia/db/ ACCESS 11.tms.dat
/i-data/md0/.media/twonkymedia/db/ ACCESS 11.tms.dat
/i-data/md0/.media/twonkymedia/db/ ACCESS 11.tms.dat
/i-data/md0/.media/twonkymedia/db/ ACCESS 11.tms.dat
/i-data/md0/.media/twonkymedia/db/ ACCESS 11.tms.dat
/i-data/md0/.media/twonkymedia/db/ ACCESS 11.tms.dat
/i-data/md0/.media/twonkymedia/db/ ACCESS 11.tms.dat
/i-data/md0/.media/twonkymedia/db/ ACCESS 11.tms.dat
/i-data/md0/.media/twonkymedia/db/ ACCESS 11.tms.dat
/i-data/md0/.media/twonkymedia/db/ ACCESS 11.tms.dat
/i-data/md0/.media/twonkymedia/db/ ACCESS 11.tms.dat
/i-data/md0/.media/twonkymedia/db/ ACCESS 11.tms.dat
Mijzelf has cool Tweaks package (zypkg-zyxel package), which is available after MetaRepository install:
http://zyxel.nas-central.org/wiki/3rd_p ... Repository
http://zyxel.nas-central.org/wiki/3rd_p ... kgs#Tweaks
Particularly you should be interested in these tweaks:
http://zyxel.nas-central.org/wiki/3rd_p ... sk_monitor
http://zyxel.nas-central.org/wiki/3rd_p ... ed_daemons

There is a handy linux utility iotop, but unfortunately it will not run on zyxel's due to missing kernel configuration options enabled:
Could not run iotop as some of the requirements are not met:
- Linux >= 2.6.20 with
- I/O accounting support (CONFIG_TASKSTATS, CONFIG_TASK_DELAY_ACCT, CONFIG_TASK_IO_ACCOUNTING)
If you want to track, what files and directories are accessed on HDD, when you can use inotifywait utility for monitoring:

Code: Select all

slacker -a mz:inotify_tools
# Increase max_user_watches if you have a lot files and dirs on HDD

Code: Select all

echo 500000 > /proc/sys/fs/inotify/max_user_watches

Code: Select all

inotifywait -rmdo /root/monitorHDD.log --format '%T %e %w/%f' --timefmt '%Y.%m.%d %H:%M:%S' /i-data/md0
It takes time (up to several minutes) for inotifywait to set up watches on HDD recursively.
That can give some info as well, but it doesn't shows what is accessing and modifying files or directories.

To stop monitoring:

Code: Select all

pkill inotifywait

Lonewolf54
Posts: 10
Joined: Thu Jan 04, 2018 4:14 pm

Re: Serviio Keeping Drives From Sleeping

Post by Lonewolf54 » Thu Jan 11, 2018 2:44 pm

OK, I'll give it a shot. Today is busy but I'll check this out tomorrow and see what I find and report back. I have tried out Twonky a few times since it got updated in the latest firmware update I installed before updating Serviio. Perhaps this is what I will find but it seems strange that killing Serviio (with Twonky disabled as well) stops the activity. Thanks for your assistance!!
Doug

Lonewolf54
Posts: 10
Joined: Thu Jan 04, 2018 4:14 pm

Re: Serviio Keeping Drives From Sleeping

Post by Lonewolf54 » Fri Jan 12, 2018 5:59 pm

OK, here is what I think is keeping the disks running. The disk accesses noted in the log stop as soon as I stop Serviio and the disks go "not active".
  • ==== Fri Jan 12 12:43:05 EST 2018 ====
    kjournald2(1596): WRITE block 3905183064 on md0
    md0_raid1(1579): WRITE block 8 on sda2
    md0_raid1(1579): WRITE block 8 on sdb2
    kjournald2(1596): WRITE block 3905183072 on md0
    kjournald2(1596): WRITE block 3905183080 on md0
    md0_raid1(1579): WRITE block 8 on sda2
    md0_raid1(1579): WRITE block 8 on sdb2
    pdflush(170): WRITE block 3670018200 on md0
    md0_raid1(1579): WRITE block 8 on sda2
    md0_raid1(1579): WRITE block 8 on sdb2
    md0_raid1(1579): WRITE block 8 on sda2
    md0_raid1(1579): WRITE block 8 on sdb2
    java(13188): dirtied inode 114691904 (.userRootModFile.serviio) on md0
    kjournald2(1596): WRITE block 3905183088 on md0
    md0_raid1(1579): WRITE block 8 on sda2
    md0_raid1(1579): WRITE block 8 on sdb2
    kjournald2(1596): WRITE block 3905183096 on md0
    kjournald2(1596): WRITE block 3905183104 on md0
    md0_raid1(1579): WRITE block 8 on sda2
    md0_raid1(1579): WRITE block 8 on sdb2
    ==== Fri Jan 12 12:44:04 EST 2018 ====
    kjournald2(1596): WRITE block 3905183112 on md0
    md0_raid1(1579): WRITE block 8 on sda2
    md0_raid1(1579): WRITE block 8 on sdb2
    kjournald2(1596): WRITE block 3905183120 on md0
    kjournald2(1596): WRITE block 3905183128 on md0
    md0_raid1(1579): WRITE block 8 on sda2
    md0_raid1(1579): WRITE block 8 on sdb2
    pdflush(170): WRITE block 3670018200 on md0
    md0_raid1(1579): WRITE block 8 on sda2
    md0_raid1(1579): WRITE block 8 on sdb2
    md0_raid1(1579): WRITE block 8 on sda2
    md0_raid1(1579): WRITE block 8 on sdb2
    java(13188): dirtied inode 114691904 (.userRootModFile.serviio) on md0
    kjournald2(1596): WRITE block 3905183136 on md0
    md0_raid1(1579): WRITE block 8 on sda2
    md0_raid1(1579): WRITE block 8 on sdb2
    kjournald2(1596): WRITE block 3905183144 on md0
    kjournald2(1596): WRITE block 3905183152 on md0
    md0_raid1(1579): WRITE block 8 on sda2
    md0_raid1(1579): WRITE block 8 on sdb2
    Logging stopped : Fri Jan 12 12:44:46 EST 2018
Does that make any sense that Serviio is causing this?
Doug

barmalej2
Posts: 2387
Joined: Sun Apr 29, 2012 5:24 pm

Re: Serviio Keeping Drives From Sleeping

Post by barmalej2 » Fri Jan 12, 2018 8:51 pm

I think so. Not sure what else you wanted to find out. Imo, it should be more interesting to track, what files and folders Serviio is accesing on disk with inotify_wait.

Lonewolf54
Posts: 10
Joined: Thu Jan 04, 2018 4:14 pm

Re: Serviio Keeping Drives From Sleeping

Post by Lonewolf54 » Fri Jan 12, 2018 9:10 pm

Doing that now. I'll post results in a moment or two.
Doug

Lonewolf54
Posts: 10
Joined: Thu Jan 04, 2018 4:14 pm

Re: Serviio Keeping Drives From Sleeping

Post by Lonewolf54 » Sat Jan 13, 2018 7:40 pm

OK, I reran inotifywait again this time with all the options you suggested (I missed some the first time) and found something interesting. For some reason, Serviio is opening and closing files every 30 seconds it seems and I don't know why. Here is what it is doing with two 30 second examples listed.
018_01_13 19:23:31 OPEN,ISDIR /i-data/md0/.system/zy-pkgs/ffproot/ffp/opt/serviio//plugins
2018_01_13 19:23:31 OPEN,ISDIR /i-data/md0/.system/zy-pkgs/ffproot/ffp/opt/serviio/plugins//
2018_01_13 19:23:31 CLOSE_NOWRITE,CLOSE,ISDIR /i-data/md0/.system/zy-pkgs/ffproot/ffp/opt/serviio//plugins
2018_01_13 19:23:31 CLOSE_NOWRITE,CLOSE,ISDIR /i-data/md0/.system/zy-pkgs/ffproot/ffp/opt/serviio/plugins//
2018_01_13 19:23:41 OPEN,ISDIR /i-data/md0/.system/zy-pkgs/ffproot/ffp/opt/serviio//plugins
2018_01_13 19:23:41 OPEN,ISDIR /i-data/md0/.system/zy-pkgs/ffproot/ffp/opt/serviio/plugins//
2018_01_13 19:23:41 CLOSE_NOWRITE,CLOSE,ISDIR /i-data/md0/.system/zy-pkgs/ffproot/ffp/opt/serviio//plugins
2018_01_13 19:23:41 CLOSE_NOWRITE,CLOSE,ISDIR /i-data/md0/.system/zy-pkgs/ffproot/ffp/opt/serviio/plugins//
2018_01_13 19:23:51 OPEN,ISDIR /i-data/md0/.system/zy-pkgs/ffproot/ffp/opt/serviio//plugins
2018_01_13 19:23:51 OPEN,ISDIR /i-data/md0/.system/zy-pkgs/ffproot/ffp/opt/serviio/plugins//
2018_01_13 19:23:51 CLOSE_NOWRITE,CLOSE,ISDIR /i-data/md0/.system/zy-pkgs/ffproot/ffp/opt/serviio//plugins
2018_01_13 19:23:51 CLOSE_NOWRITE,CLOSE,ISDIR /i-data/md0/.system/zy-pkgs/ffproot/ffp/opt/serviio/plugins//
2018_01_13 19:23:55 OPEN /i-data/md0/.system/zy-pkgs/ffproot/ffp/opt/serviio/.java/.userPrefs//.user.lock.serviio
2018_01_13 19:23:55 ATTRIB /i-data/md0/.system/zy-pkgs/ffproot/ffp/opt/serviio/.java/.userPrefs//.userRootModFile.serviio
2018_01_13 19:23:55 CLOSE_WRITE,CLOSE /i-data/md0/.system/zy-pkgs/ffproot/ffp/opt/serviio/.java/.userPrefs//.user.lock.serviio
2018_01_13 19:24:01 OPEN,ISDIR /i-data/md0/.system/zy-pkgs/ffproot/ffp/opt/serviio//plugins
2018_01_13 19:24:01 OPEN,ISDIR /i-data/md0/.system/zy-pkgs/ffproot/ffp/opt/serviio/plugins//
2018_01_13 19:24:01 CLOSE_NOWRITE,CLOSE,ISDIR /i-data/md0/.system/zy-pkgs/ffproot/ffp/opt/serviio//plugins
2018_01_13 19:24:01 CLOSE_NOWRITE,CLOSE,ISDIR /i-data/md0/.system/zy-pkgs/ffproot/ffp/opt/serviio/plugins//
2018_01_13 19:24:11 OPEN,ISDIR /i-data/md0/.system/zy-pkgs/ffproot/ffp/opt/serviio//plugins
2018_01_13 19:24:11 OPEN,ISDIR /i-data/md0/.system/zy-pkgs/ffproot/ffp/opt/serviio/plugins//
2018_01_13 19:24:11 CLOSE_NOWRITE,CLOSE,ISDIR /i-data/md0/.system/zy-pkgs/ffproot/ffp/opt/serviio//plugins
2018_01_13 19:24:11 CLOSE_NOWRITE,CLOSE,ISDIR /i-data/md0/.system/zy-pkgs/ffproot/ffp/opt/serviio/plugins//
2018_01_13 19:24:21 OPEN,ISDIR /i-data/md0/.system/zy-pkgs/ffproot/ffp/opt/serviio//plugins
2018_01_13 19:24:21 OPEN,ISDIR /i-data/md0/.system/zy-pkgs/ffproot/ffp/opt/serviio/plugins//
2018_01_13 19:24:21 CLOSE_NOWRITE,CLOSE,ISDIR /i-data/md0/.system/zy-pkgs/ffproot/ffp/opt/serviio//plugins
2018_01_13 19:24:21 CLOSE_NOWRITE,CLOSE,ISDIR /i-data/md0/.system/zy-pkgs/ffproot/ffp/opt/serviio/plugins//
2018_01_13 19:24:25 OPEN /i-data/md0/.system/zy-pkgs/ffproot/ffp/opt/serviio/.java/.userPrefs//.user.lock.serviio
2018_01_13 19:24:25 ATTRIB /i-data/md0/.system/zy-pkgs/ffproot/ffp/opt/serviio/.java/.userPrefs//.userRootModFile.serviio
2018_01_13 19:24:25 CLOSE_WRITE,CLOSE /i-data/md0/.system/zy-pkgs/ffproot/ffp/opt/serviio/.java/.userPrefs//.user.lock.serviio
I have posted this in the Serviio forum but so far nothing from Zip. Any help here if possible would be appreciated.
Doug

barmalej2
Posts: 2387
Joined: Sun Apr 29, 2012 5:24 pm

Re: Serviio Keeping Drives From Sleeping

Post by barmalej2 » Sat Jan 13, 2018 9:35 pm

I found this log much more interesting, but it is too short. From mine point view:
stop all unnecessary ffp services including serviio, except sshd. Remove all serviio logs inside /ffp/opt/serviio/log dir and then start inotifywait service as described above. Start serviio service after several minutes. Then let run both services at least for 30 min., upload somewhere inotifywait logs for review and save serviio logs for Serviio developer.

normsland
Posts: 69
Joined: Sun Mar 31, 2013 10:07 am

Re: Serviio Keeping Drives From Sleeping

Post by normsland » Sun Jan 14, 2018 8:07 am

I've replied over on serviio.org but there's probably a couple of system properties Lonewolf54 can try.

Code: Select all

-Dplugins.check=false -Djava.util.prefs.syncInterval=86400
I've had them in my JAVA_OPTS for a few years and haven't caused me any issues. The only problem is that you need to restart serviio if you add or update a plugin but that isn't a frequent requirement (I am guessing).

barmalej2
Posts: 2387
Joined: Sun Apr 29, 2012 5:24 pm

Re: Serviio Keeping Drives From Sleeping

Post by barmalej2 » Sun Jan 14, 2018 6:44 pm

Good catch Normsland. Seems like you have found solution for Lonewolf54 and those, who have ffp installed on HDD (zypkg version). I wasn't able to reproduce issue, since my ffp is on USB stick. Related info as well:
https://stackoverflow.com/questions/173 ... ry-30-secs

I will add these two options to Serviio start script with next Serviio ffp package release.

Lonewolf54
Posts: 10
Joined: Thu Jan 04, 2018 4:14 pm

Re: Serviio Keeping Drives From Sleeping

Post by Lonewolf54 » Sun Jan 14, 2018 8:07 pm

OK, because this is for a Zyxel NSA325V2 with Barmalej2's start script, I made the changes suggested in /ffp/start/serviio.sh instead of the version located in /ffp/opt/serviio/bin/serviio.sh. And guess what? IT WORKED!!!!! :D Kudos and many thanks to Normsland and Barmalej2 (again ;) ) for your help diagnosing this issue and then solving the problem. Great!!!
Doug

Post Reply