easyVDR Kopie des easyVDR-Forums zum Nachschlagen
[SOLVED/PATCHED] NUC6i5SYK do not shutdown correctly, sometimes it reboots

easyVDR - >VARforumsname - >[SOLVED/PATCHED] NUC6i5SYK do not shutdown correctly, sometimes it reboots

jb  28.Nov.2016 14:58:43
Hi.

I open a new thread with the same problem I had in NUC6 since the version alpha2 of easyvdr 3.

The problem is that when I press the shutdown button in the remote, the NUC seems to be shutting down, but it reboots. When the first (sometimes the second) reboot is done, I press again the shutdown button in the remote and the NUC, then, shuts down correctly.

I thought that it was a kernel or BIOS problem, but I have the stable version of easyvdr 3, and the kernel is updated an so is the BIOS (I will check this week again, because there are updates every a short period of time).

If I can upload some info that can be useful to know which the problem is, I will be pleased to post it. Intel people seems not to be willingly enough in their forum.

Regards.
Javier B.
VDR 1: Intel NUC6i5SYK || SSD 128Gb M.2 2242 ADATA PREMIER || External HD: W.D. Elements 5 Tb || RAM: 4 Gb KINGSTON HYPERX IMPACT ? DDR4  || Remote compatible Microsoft Media Center || 3 tuners pctv nanoStick || [url=http://www.easy-vdr.de/index.php]easyVdr 3.0  
VDR 2: Xtreamer Ultra || HD 2 Tb || RAM: 4 Gb || Remote compatible Microsoft Media Center || 3 tuners pctv nanoStick || [url=http://www.vdr-portal.de/board16-video-disk-recorder/board99-distributionen/board96-yavdr/]yaVdr 0.6 
VDR 3: Siemens Gigaset M740 AV + HD Western Digital "My Book Essential-2, 1Tb" (6 partitions ext2) || [url=http://vdr-m7x0.foroactivo.com.es]VDR-NG-EM 0.6 Pro - Rev 844
SurfaceCleanerZ  28.Nov.2016 17:57:57
Hi, 
I think your remote is not working correct. 

Sometimes it seems to use keyboard buttons, and Power seems to use reboot (as strg+alt+entf). 
You can disable this via lirc. Conf or remote. Conf
Test-VDR1: HP rp5700 Fertigsystem, Core2Duo E6400, 2GB RAM, Mygica t230 Stick als Tuner, nvidia Slim-GT218 512MB PCIe x1     -   v3.5-64
VDR2 in Rente
VDR3 in Rente
VDR4: MSI G31M2 v2, Intel E5200, 6" t6963c gLCD, 2GB, WD Red 4TB, 2x TT3200, ASUS GT730-SL-2GD3-BRK, mod. Digitainergeh.       -   v3.5-64
VDR5: GIGABYTE GA-G31M-S2L, Intel E5200, GT630 passiv, 2GB, 3TB, 6"  t6963c gLCD, mod. Digitainergeh.          -   v3.5-64
VDR6: MSI MS-7236, Intel E2140, GT630 passiv, 2GB, WD Green 2TB, 6" t6963c gLCD, 2x TT3200    -    v2.5-64
[url=http://tinyurl.com/ycx4qsv]Hilfe gefällig? Dann brauchen wir ein easyInfo aus easyPortal!
Bleifuss2  28.Nov.2016 21:42:57
Hello Javier


This is the command for shutdown your vdr:

sudo init 0


works it?
Produktiv-VDR:
Board GA H77-DS3H, Intel Intel(R) Core(TM) i5-3470, Cine S2 DVB, WD 3TB Green, WDC WD20EARS-00J  2TB, Geforce 750Ti oder Intel HD
Easyvdr 3.0
jb  28.Nov.2016 23:54:07
[quote='SurfaceCleanerZ' pid='173134' dateline='1480352277']
I think your remote is not working correct. 
Sometimes it seems to use keyboard buttons, and Power seems to use reboot (as strg+alt+entf). 


Hi, I do not think that it was the problem, because if I connect by ssh and run the command:
sudo shutdown -h now

The first time the NUC reboots, and if I connect again and run again the command, the NUC shuts down. Just in the same way that pressing power buton in the remote.

Regards.
Javier B.
VDR 1: Intel NUC6i5SYK || SSD 128Gb M.2 2242 ADATA PREMIER || External HD: W.D. Elements 5 Tb || RAM: 4 Gb KINGSTON HYPERX IMPACT ? DDR4  || Remote compatible Microsoft Media Center || 3 tuners pctv nanoStick || [url=http://www.easy-vdr.de/index.php]easyVdr 3.0  
VDR 2: Xtreamer Ultra || HD 2 Tb || RAM: 4 Gb || Remote compatible Microsoft Media Center || 3 tuners pctv nanoStick || [url=http://www.vdr-portal.de/board16-video-disk-recorder/board99-distributionen/board96-yavdr/]yaVdr 0.6 
VDR 3: Siemens Gigaset M740 AV + HD Western Digital "My Book Essential-2, 1Tb" (6 partitions ext2) || [url=http://vdr-m7x0.foroactivo.com.es]VDR-NG-EM 0.6 Pro - Rev 844
jb  28.Nov.2016 23:57:01
[quote='Bleifuss2' pid='173138' dateline='1480365777']
This is the command for shutdown your vdr:
sudo init 0
works it?

Hi Bleifuss2.

It happens the same than when I press power buton in the remote, and equal if I run "sudo shutdown -h now". The first time it reboots, the second or the third time I repeat the command in the command line is when the NUC shuts down.

Regards.
Javier B.
VDR 1: Intel NUC6i5SYK || SSD 128Gb M.2 2242 ADATA PREMIER || External HD: W.D. Elements 5 Tb || RAM: 4 Gb KINGSTON HYPERX IMPACT ? DDR4  || Remote compatible Microsoft Media Center || 3 tuners pctv nanoStick || [url=http://www.easy-vdr.de/index.php]easyVdr 3.0  
VDR 2: Xtreamer Ultra || HD 2 Tb || RAM: 4 Gb || Remote compatible Microsoft Media Center || 3 tuners pctv nanoStick || [url=http://www.vdr-portal.de/board16-video-disk-recorder/board99-distributionen/board96-yavdr/]yaVdr 0.6 
VDR 3: Siemens Gigaset M740 AV + HD Western Digital "My Book Essential-2, 1Tb" (6 partitions ext2) || [url=http://vdr-m7x0.foroactivo.com.es]VDR-NG-EM 0.6 Pro - Rev 844
Bleifuss2  29.Nov.2016 07:54:42
Hi Javier

It's not a Linux Bug:
[url=https://communities.intel.com/thread/102244?start=15&tstart=0]
[url=https://communities.intel.com/thread/102244?start=15&tstart=0]https://communities.intel.com/thread/102244?start=15&tstart=0


Regards
Bleifuss
Produktiv-VDR:
Board GA H77-DS3H, Intel Intel(R) Core(TM) i5-3470, Cine S2 DVB, WD 3TB Green, WDC WD20EARS-00J  2TB, Geforce 750Ti oder Intel HD
Easyvdr 3.0
jb  29.Nov.2016 09:35:27
[quote='Bleifuss2' pid='173144' dateline='1480402482']
It's not a Linux Bug:
[url=https://communities.intel.com/thread/102244?start=15&tstart=0]
[url=https://communities.intel.com/thread/102244?start=15&tstart=0]https://communities.intel.com/thread/102244?start=15&tstart=0

Hi.

Thanks, then it seems the NUC6 under certain circumstances do not shut down properly, and it seems to be an intel unsolved/undetected problem.

I have another NUC6 at home with ubuntu 16.04 and Windows 10, but it works fine. This problem has never happened on it. So, may be it not affect to all the NUC6 computers.

Then may be I need another solution. I think that a solution can be a script that check during boot if a shutdown has been tried, if the boot is made after a shutdown process the script should force to do another shutdown (checking recordings or scheduled tasks) till the NUC shuts down definitely.

The problem is that I do not know how to implement it.

The idea is:

1) (script 1)When the shutdown button is pressed (in case of recordings, when the button is pressed and the recordings are finished), make a new file named: "shutdownButtonPressed", in "/home/easyvdr/".
2)  (script 2)When the computer starts, check if the file "shutdownButtonPressed" is newer that 15 minutes. In that case, force a shutdown again (checking recordings or secheduled tasks)==> Simulating the power buton action.

Then, when the NUC reboots after a shutdown it will detect a recent version of the  "shutdownButtonPressed" file and it will shutdown again a second, or even a third time if needed, till the complete shutdown.

What do you think. It is possible to work? Can someone help me to implement the scripts?

Regards.
Javier B.
VDR 1: Intel NUC6i5SYK || SSD 128Gb M.2 2242 ADATA PREMIER || External HD: W.D. Elements 5 Tb || RAM: 4 Gb KINGSTON HYPERX IMPACT ? DDR4  || Remote compatible Microsoft Media Center || 3 tuners pctv nanoStick || [url=http://www.easy-vdr.de/index.php]easyVdr 3.0  
VDR 2: Xtreamer Ultra || HD 2 Tb || RAM: 4 Gb || Remote compatible Microsoft Media Center || 3 tuners pctv nanoStick || [url=http://www.vdr-portal.de/board16-video-disk-recorder/board99-distributionen/board96-yavdr/]yaVdr 0.6 
VDR 3: Siemens Gigaset M740 AV + HD Western Digital "My Book Essential-2, 1Tb" (6 partitions ext2) || [url=http://vdr-m7x0.foroactivo.com.es]VDR-NG-EM 0.6 Pro - Rev 844
Bleifuss2  29.Nov.2016 12:23:58
Try first a simple workaround:

60s after vdr is running, simulate press power button.
The vdr osd shows a waring , you can break power off with any remote key.
If a recording is activ the osd shows a message that vdr can't suhtdown now.


Adding this code after your remote fix modprobe ....

sleep 60 # Change the time as you like it
svdrpsend HITK Power >/dev/null 2>&1


Regards

Bleifuss
Produktiv-VDR:
Board GA H77-DS3H, Intel Intel(R) Core(TM) i5-3470, Cine S2 DVB, WD 3TB Green, WDC WD20EARS-00J  2TB, Geforce 750Ti oder Intel HD
Easyvdr 3.0
jb  29.Nov.2016 14:14:55
Hi Bleifuss2.

It seems to work, but I have to test it after a sheduled recording, and I should improve the checking of the age of the checking file.

I created this file:
/usr/share/vdr/shutdown-hooks/95_createShutdownFile.sh
with this content:
#!/bin/bash
FILESHUTDOWNBUTTONPRESSED=/home/easyvdr/shutdownControl/shutdownButtonPressed;
rm $FILESHUTDOWNBUTTONPRESSED
touch $FILESHUTDOWNBUTTONPRESSED
exit 0


and I have created also this file:
/home/easyvdr/checkIfShutdownIsRequested.sh
with this content:
PATHFILESHUTDOWNBUTTONPRESSED=/home/easyvdr/shutdownControl/
if test "`find $PATHFILESHUTDOWNBUTTONPRESSED -mmin +5`" ; then
echo "File is older than 5 minutes"
else
echo "File is newer than 5 minutes"
sleep 15 # Change the time as you like it
svdrpsend HITK Power >/dev/null 2>&1
fi
exit 0
and I added in:

/etc/rc.local
this line:
sh /home/easyvdr/checkIfShutdownIsRequested.sh

As I said, it seems to work and if NUC reboots it is able to shutdown again... and again till it remains shuted down.

But I do not like the second script to check if the file "shutdownButtonPressed" (it is the only one file inside its folder) is newer or older than 5 minutes.

May be some of you can give a better idea to check it.

Regards.
Javier B.
VDR 1: Intel NUC6i5SYK || SSD 128Gb M.2 2242 ADATA PREMIER || External HD: W.D. Elements 5 Tb || RAM: 4 Gb KINGSTON HYPERX IMPACT ? DDR4  || Remote compatible Microsoft Media Center || 3 tuners pctv nanoStick || [url=http://www.easy-vdr.de/index.php]easyVdr 3.0  
VDR 2: Xtreamer Ultra || HD 2 Tb || RAM: 4 Gb || Remote compatible Microsoft Media Center || 3 tuners pctv nanoStick || [url=http://www.vdr-portal.de/board16-video-disk-recorder/board99-distributionen/board96-yavdr/]yaVdr 0.6 
VDR 3: Siemens Gigaset M740 AV + HD Western Digital "My Book Essential-2, 1Tb" (6 partitions ext2) || [url=http://vdr-m7x0.foroactivo.com.es]VDR-NG-EM 0.6 Pro - Rev 844
Bleifuss2  29.Nov.2016 15:19:48
Hi Javier

A pretty solution.

a usefull file for verify:


/var/log/easyvdr/easyvdr-runtime.csv


Regards
Bleifuss
Produktiv-VDR:
Board GA H77-DS3H, Intel Intel(R) Core(TM) i5-3470, Cine S2 DVB, WD 3TB Green, WDC WD20EARS-00J  2TB, Geforce 750Ti oder Intel HD
Easyvdr 3.0
mango  29.Nov.2016 15:32:11
Hi Javier,

...starts your VDR via remote control?

Regards
Wolfgang
[spoiler="My VDR Stuff"]DVB-S/S2: Silverstone LC17 mit 8,4" TFT Display, ASUS P5KPL SE, E6300, 2GB, NT-Fanlees, System SSD 40GB, Media 2TB, GT630, DVD-LG, SkyStar S2, Nova-T, FB X10 Medion-Scroll, "Arch-Linux - VDR 2.3.8"
Test-VDR: ASRock ALiveNF6G, AMD X2 3800+ (35W),4GB, GT 630 - nvidia-384, SSD 64GB, SkyStar S2, Cinergy T RC USB, easyVDR 3.5(Kernel-4.4.0) - VDR-2.3.8 - KODI-18.0 - FB X10 Medion-Scroll
Client: Evo N600c, Puppy-Slacko 6.3 - VDR-2.2.0 - FB X10 Medion_OR25V
Spielwiese: RPI2 als Client mit LibreELEC-9.80-Milhouse(Kodi-19.0) - MLD-5.4 VDR2VDR
jb  29.Nov.2016 16:59:42
[quote='mango' pid='173164' dateline='1480429931']
...starts your VDR via remote control?

Hi.

Yes NUC6 starts from the remote.

Regards
Javier Bradineras.
VDR 1: Intel NUC6i5SYK || SSD 128Gb M.2 2242 ADATA PREMIER || External HD: W.D. Elements 5 Tb || RAM: 4 Gb KINGSTON HYPERX IMPACT ? DDR4  || Remote compatible Microsoft Media Center || 3 tuners pctv nanoStick || [url=http://www.easy-vdr.de/index.php]easyVdr 3.0  
VDR 2: Xtreamer Ultra || HD 2 Tb || RAM: 4 Gb || Remote compatible Microsoft Media Center || 3 tuners pctv nanoStick || [url=http://www.vdr-portal.de/board16-video-disk-recorder/board99-distributionen/board96-yavdr/]yaVdr 0.6 
VDR 3: Siemens Gigaset M740 AV + HD Western Digital "My Book Essential-2, 1Tb" (6 partitions ext2) || [url=http://vdr-m7x0.foroactivo.com.es]VDR-NG-EM 0.6 Pro - Rev 844
SurfaceCleanerZ  29.Nov.2016 17:04:37
Hi, 
Does it also behave like this, when you start it via a Timer. And/or via Powerkey?

MfG Stefan
Test-VDR1: HP rp5700 Fertigsystem, Core2Duo E6400, 2GB RAM, Mygica t230 Stick als Tuner, nvidia Slim-GT218 512MB PCIe x1     -   v3.5-64
VDR2 in Rente
VDR3 in Rente
VDR4: MSI G31M2 v2, Intel E5200, 6" t6963c gLCD, 2GB, WD Red 4TB, 2x TT3200, ASUS GT730-SL-2GD3-BRK, mod. Digitainergeh.       -   v3.5-64
VDR5: GIGABYTE GA-G31M-S2L, Intel E5200, GT630 passiv, 2GB, 3TB, 6"  t6963c gLCD, mod. Digitainergeh.          -   v3.5-64
VDR6: MSI MS-7236, Intel E2140, GT630 passiv, 2GB, WD Green 2TB, 6" t6963c gLCD, 2x TT3200    -    v2.5-64
[url=http://tinyurl.com/ycx4qsv]Hilfe gefällig? Dann brauchen wir ein easyInfo aus easyPortal!
jb  29.Nov.2016 18:17:44
[quote='SurfaceCleanerZ' pid='173169' dateline='1480435477']
Does it also behave like this, when you start it via a Timer. And/or via Powerkey?

Hi.

I think so, but I have not tested it.

Do you need me to test something about it?

Regards
Javier B.
VDR 1: Intel NUC6i5SYK || SSD 128Gb M.2 2242 ADATA PREMIER || External HD: W.D. Elements 5 Tb || RAM: 4 Gb KINGSTON HYPERX IMPACT ? DDR4  || Remote compatible Microsoft Media Center || 3 tuners pctv nanoStick || [url=http://www.easy-vdr.de/index.php]easyVdr 3.0  
VDR 2: Xtreamer Ultra || HD 2 Tb || RAM: 4 Gb || Remote compatible Microsoft Media Center || 3 tuners pctv nanoStick || [url=http://www.vdr-portal.de/board16-video-disk-recorder/board99-distributionen/board96-yavdr/]yaVdr 0.6 
VDR 3: Siemens Gigaset M740 AV + HD Western Digital "My Book Essential-2, 1Tb" (6 partitions ext2) || [url=http://vdr-m7x0.foroactivo.com.es]VDR-NG-EM 0.6 Pro - Rev 844
mango  29.Nov.2016 20:13:53
Hi Javier,

Yes NUC6 starts from the remote.
over Lirc?

Regards
Wolfgang
[spoiler="My VDR Stuff"]DVB-S/S2: Silverstone LC17 mit 8,4" TFT Display, ASUS P5KPL SE, E6300, 2GB, NT-Fanlees, System SSD 40GB, Media 2TB, GT630, DVD-LG, SkyStar S2, Nova-T, FB X10 Medion-Scroll, "Arch-Linux - VDR 2.3.8"
Test-VDR: ASRock ALiveNF6G, AMD X2 3800+ (35W),4GB, GT 630 - nvidia-384, SSD 64GB, SkyStar S2, Cinergy T RC USB, easyVDR 3.5(Kernel-4.4.0) - VDR-2.3.8 - KODI-18.0 - FB X10 Medion-Scroll
Client: Evo N600c, Puppy-Slacko 6.3 - VDR-2.2.0 - FB X10 Medion_OR25V
Spielwiese: RPI2 als Client mit LibreELEC-9.80-Milhouse(Kodi-19.0) - MLD-5.4 VDR2VDR
jb  29.Nov.2016 21:45:15
[quote='mango' pid='173176' dateline='1480446833']
[quote='jb' pid='173167' dateline='1480435182']
Yes NUC6 starts from the remote.

over Lirc?

Hi.

No, I gess it is by mean the BIOS. The computer is shutted down completely but infrared port is able to start the computer by itself.

Regards
Javier B.
VDR 1: Intel NUC6i5SYK || SSD 128Gb M.2 2242 ADATA PREMIER || External HD: W.D. Elements 5 Tb || RAM: 4 Gb KINGSTON HYPERX IMPACT ? DDR4  || Remote compatible Microsoft Media Center || 3 tuners pctv nanoStick || [url=http://www.easy-vdr.de/index.php]easyVdr 3.0  
VDR 2: Xtreamer Ultra || HD 2 Tb || RAM: 4 Gb || Remote compatible Microsoft Media Center || 3 tuners pctv nanoStick || [url=http://www.vdr-portal.de/board16-video-disk-recorder/board99-distributionen/board96-yavdr/]yaVdr 0.6 
VDR 3: Siemens Gigaset M740 AV + HD Western Digital "My Book Essential-2, 1Tb" (6 partitions ext2) || [url=http://vdr-m7x0.foroactivo.com.es]VDR-NG-EM 0.6 Pro - Rev 844
jb  30.Nov.2016 11:31:32
Hi.

As the scripts work even after a recording and they end shutting down the NUC, I can mark as solved the thread. Thanks a lot for your help.

Anyway, if you can propose some improvement in the checking of the age of the test file (5 minutes old is the limit) I will try it, because I don not like my solution and I think it should be improved.

Regards.
Javier B.
VDR 1: Intel NUC6i5SYK || SSD 128Gb M.2 2242 ADATA PREMIER || External HD: W.D. Elements 5 Tb || RAM: 4 Gb KINGSTON HYPERX IMPACT ? DDR4  || Remote compatible Microsoft Media Center || 3 tuners pctv nanoStick || [url=http://www.easy-vdr.de/index.php]easyVdr 3.0  
VDR 2: Xtreamer Ultra || HD 2 Tb || RAM: 4 Gb || Remote compatible Microsoft Media Center || 3 tuners pctv nanoStick || [url=http://www.vdr-portal.de/board16-video-disk-recorder/board99-distributionen/board96-yavdr/]yaVdr 0.6 
VDR 3: Siemens Gigaset M740 AV + HD Western Digital "My Book Essential-2, 1Tb" (6 partitions ext2) || [url=http://vdr-m7x0.foroactivo.com.es]VDR-NG-EM 0.6 Pro - Rev 844
jb  08.Dec.2016 10:23:13
Hi.

I want to share the new version of the scripts, I think those are smarter than the elder.

This script:
/usr/share/vdr/shutdown-hooks/95_createShutdownFile.sh
has this content:
#!/bin/bash

#File should be added to /usr/share/vdr/shutdown-hooks/

# Path of the folder to control shutdown
DIRECTORY="/home/easyvdr/shutdownControl/"
# Path of the file made to shutdown computer several times if needed
FILESHUTDOWNBUTTONPRESSED="/home/easyvdr/shutdownControl/shutdownButtonPressed"

if [ ! -d "$DIRECTORY" ]; then
#Folder is made if needed
mkdir $DIRECTORY
fi

#Make shutdown request file
rm $FILESHUTDOWNBUTTONPRESSED
touch $FILESHUTDOWNBUTTONPRESSED

exit 0

###End of the Script

and this script:
checkIfShutdownIsRequested.sh
has inside:
#!/bin/bash

# Path of the file made when power button is pressed in order to shutdown computer
FILESHUTDOWNBUTTONPRESSED=/home/easyvdr/shutdownControl/shutdownButtonPressed

DATE_FILE=$(stat -c %y "$FILESHUTDOWNBUTTONPRESSED")
DATE_FILE_UTC=$(date -d "$DATE_FILE" +%s)

NOW=$(date +%s)
TIME_DIFF=$(($NOW - $DATE_FILE_UTC))

#Check if the file is older or newer than 5 minutes (300 seconds)
if [ $TIME_DIFF -lt 300 ]; then
echo "File is newer than 5 minutes"
sleep 15 # Change the time as you like it
svdrpsend HITK Power >/dev/null 2>&1
else
echo "File is older than 5 minutes"
fi

exit 0
###End of the Script

Regards
Javier B.
VDR 1: Intel NUC6i5SYK || SSD 128Gb M.2 2242 ADATA PREMIER || External HD: W.D. Elements 5 Tb || RAM: 4 Gb KINGSTON HYPERX IMPACT ? DDR4  || Remote compatible Microsoft Media Center || 3 tuners pctv nanoStick || [url=http://www.easy-vdr.de/index.php]easyVdr 3.0  
VDR 2: Xtreamer Ultra || HD 2 Tb || RAM: 4 Gb || Remote compatible Microsoft Media Center || 3 tuners pctv nanoStick || [url=http://www.vdr-portal.de/board16-video-disk-recorder/board99-distributionen/board96-yavdr/]yaVdr 0.6 
VDR 3: Siemens Gigaset M740 AV + HD Western Digital "My Book Essential-2, 1Tb" (6 partitions ext2) || [url=http://vdr-m7x0.foroactivo.com.es]VDR-NG-EM 0.6 Pro - Rev 844