roleoroleo / yi-hack-MStar

Custom firmware for Yi 1080p camera based on MStar platform
GNU General Public License v3.0
841 stars 111 forks source link

Yi Dome 1080P on v.0.4.8 and v0.4.9 Reboot Loop #472

Closed idanny76 closed 3 months ago

idanny76 commented 1 year ago

I have had two problems and I am not sure if its just happening with two cameras. Where I have done a reboot from the web interface and then it gets stuck on a reboot loop. The only way I have been able to fix it is to delete the recording and leave the flash files only.

idanny76 commented 1 year ago

I'm starting to think there's something wrong with the home partition. What about the free space?

/home/yi-hack # df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                 1920      1876        44  98% /
tmpfs                    30412      1872     28540   6% /dev
/dev/block/mtdblock3     12480     11312      1168  91% /home
/dev/block/mtdblock3     12480     11312      1168  91% /home/app/cloudAPI
tmpfs                    32768       268     32500   1% /tmp

The Sd card is a 32gb and I its right now 29gb filled.

idanny76 commented 1 year ago

I'm starting to think there's something wrong with the home partition. What about the free space?

/home/yi-hack # df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                 1920      1876        44  98% /
tmpfs                    30412      1872     28540   6% /dev
/dev/block/mtdblock3     12480     11312      1168  91% /home
/dev/block/mtdblock3     12480     11312      1168  91% /home/app/cloudAPI
tmpfs                    32768       268     32500   1% /tmp
/home/yi-hack # df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                 1920      1876        44  98% /
tmpfs                    30428      1872     28556   6% /dev
/dev/block/mtdblock3     12480     11324      1156  91% /home
/dev/block/mtdblock3     12480     11324      1156  91% /home/app/cloudAPI
tmpfs                    32768        96     32672   0% /tmp

Thats without the sd card, because I removed it to get the camera to boot. I did not want to format the sd card, since I want to see what in the sd card is causing the bootloop.

roleoroleo commented 1 year ago

I don't know if the problem is related but the available space in /dev/root is too small. It's not ok. Give it a temporary try: remove some file that you don't use. For example: /home/yi-hack/usr/libexec/sftp-server or /home/yi-hack/bin/onvif_srvd

idanny76 commented 1 year ago

I don't know if the problem is related but the available space in /dev/root is too small. It's not ok. Give it a temporary try: remove some file that you don't use. For example: /home/yi-hack/usr/libexec/sftp-server or /home/yi-hack/bin/onvif_srvd

This might help. I have two identical cameras and both are on the same firmware. One does not have the bootloop issue and the other does. I have them both here.

This is the one working:

/home/yi-hack # df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                 1920      1876        44  98% /
tmpfs                    30428      1872     28556   6% /dev
/dev/block/mtdblock3     12480     11352      1128  91% /home
/dev/block/mtdblock3     12480     11352      1128  91% /home/app/cloudAPI
tmpfs                    32768       204     32564   1% /tmp
/dev/block/mmcblk0p1  31150560  30743424    407136  99% /tmp/sd

Not working:

/home/yi-hack # df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                 1920      1876        44  98% /
tmpfs                    30428      1872     28556   6% /dev
/dev/block/mtdblock3     12480     11324      1156  91% /home
/dev/block/mtdblock3     12480     11324      1156  91% /home/app/cloudAPI
tmpfs                    32768        96     32672   0% /tmp
idanny76 commented 1 year ago

/home/yi-hack/usr/libexec/sftp-server

deleted /home/yi-hack/usr/libexec/sftp-server, put in the sd card and is in bootloop. Without the SD card it works perfect. If I format the SD card it works also, but if I reboot at a later time... maybe after sd card is almost full then bootloop happens. I just deleted the sd card on another camera with the bootloop and then rebooted after recording for some time and it boots fine.

idanny76 commented 1 year ago

The other one that was having the bootloop that I fixed by deleting everything from the SD Card is now at 27% usage and its rebooting fine. I guess once sd card gets past a certain percentage it does the bootloop? But the other same camera with the SD usage at 99% reboots ok with the same firmware.

idanny76 commented 1 year ago

Update..... Good lead here to where the issue is. Instead of deleting the record folder to fix the problem.... I made some space on the SD card about 7GB free by deleting some of the videos recorded in the record folder and it bootloop again. Then I deleted more of the video files in the record folder to at least 50% free and then camera stopped bootloop. It does have to do with the amount of space available that it is causing the camera to go into bootloop.

idanny76 commented 1 year ago

What I will try now is adding a large file to the SD card and reboot to see if it goes into a bootloop.

roleoroleo commented 1 year ago

Did you set this option? immagine

roleoroleo commented 1 year ago

Please run this command:

/home/yi-hack # cat /var/spool/cron/crontabs/root
* * * * * /home/yi-hack/script/thumb.sh cron
0 * * * * sleep 20; /home/yi-hack/script/clean_records.sh 30
roleoroleo commented 1 year ago

Another try please: try to kill the watchdog wd_rtsp.sh (or disable it from system.sh) and check if the cam remains on.

idanny76 commented 1 year ago

Did you set this option? immagine

I have the same camera with same firmware working fine with 99% full sd card and it reboots fine. I just filled up the memory card on the faulty one with 10gb free space and it did reboot. Filling it more now to see if I can cause it to bootloop, because right now is booting fine. I want to be doing the bootloop again to try those changes and then insert sd card.

idanny76 commented 1 year ago

Yep. filled up the camera with 3gb free space and it started doing the bootloop.

idanny76 commented 1 year ago

Another try please: try to kill the watchdog wd_rtsp.sh (or disable it from system.sh) and check if the cam remains on.

Whats the putty command to kill the watchdog wd_rtsp.sh or how to disable it on the system.sh?

idanny76 commented 1 year ago

Getting this error: /home/yi-hack # cat /var/spool/cron/crontabs/root cat: can't open '/var/spool/cron/crontabs/root': No such file or directory

The command is "cat" without the directory

idanny76 commented 1 year ago

Another try please: try to kill the watchdog wd_rtsp.sh (or disable it from system.sh) and check if the cam remains on.

I did killall wd_rtsp.sh without the sd card, because it stays in a bootloop. Once I did the command the camera stayed on.

idanny76 commented 1 year ago

Did you set this option? immagine

I am sure this will solve the bootloop, but it doesn't seems to be a problem with the other cameras on the same firmware with 99% storage filled.

idanny76 commented 1 year ago

Please run this command:

/home/yi-hack # cat /var/spool/cron/crontabs/root
* * * * * /home/yi-hack/script/thumb.sh cron
0 * * * * sleep 20; /home/yi-hack/script/clean_records.sh 30

I am explaining it the best I know how. If you need clarification let me know. I ran the command in the configuration web interface where it says Expert Crontab and the camera booted with only 12% space left in the memory card. What I did notice is that the root file that was missing on /var/spool/cron/crontabs/root now appears. Why would the root file be missing and now appears? The root file in cronstabs is missing in all the other cameras. Here is a screenshot of the Crontab. I did paste this command on the box provided but only the bottom two lines remained after I rebooted.

If I delete the code below from the Crontab web interface in the configuration tab and reboot..... the bootloop happens. If I add the code back insert the sd card with only 12% space available the bootloop stops. That code fixed the bootloop no matter how full the ad card is.

cat /var/spool/cron/crontabs/root
* * * * * /home/yi-hack/script/thumb.sh cron

Code:

cat /var/spool/cron/crontabs/root
* * * * * /home/yi-hack/script/thumb.sh cron
0 * * * * sleep 20; /home/yi-hack/script/clean_records.sh 30

The remaining code

cat /var/spool/cron/crontabs/root
* * * * * /home/yi-hack/script/thumb.sh cron

Screenshot 2023-03-24 at 13-21-16 Sala - configurations

idanny76 commented 1 year ago

Crazy.... No bootloop issues if I keep that code in the Crontab inside the configurations interfance regardless of the space available in the SD Card. Plus now the root file appears in the /var/spool/cron/crontabs/ directory. Does that tell you what the issue is? I am not at all fluent in Linux and I really don't know what the thumb.sh does or what the root file inside cronstabs is for either.

I just had it powered off and just connected it and its doing the bootloop. I guess the command code gets erased?

idanny76 commented 1 year ago

I changed the SD card free space to 30%. That should keep prevent the sd card getting to its max storage and solve the bootloop problem.

roleoroleo commented 1 year ago

Whats the putty command to kill the watchdog wd_rtsp.sh or how to disable it on the system.sh?

You should use vi editor to change the file system.sh. vi /home/yi-hack/script/system.sh Find the line where wd_rtsp.sh is started and add a # at the start of the line. vi is not simple if you don't use it. Press 'i' to go in editing mode and 'esc' to come back in command mode.

roleoroleo commented 1 year ago

I ran the command in the configuration web interface where it says Expert Crontab

No, run this command in a putty session. Don't add it to the "crontab" section.

Crazy.... No bootloop issues if I keep that code in the Crontab inside the configurations interfance regardless of the space available in the SD Card. Plus now the root file appears in the /var/spool/cron/crontabs/ directory. Does that tell you what the issue is? I am not at all fluent in Linux and I really don't know what the thumb.sh does or what the root file inside cronstabs is for either.

This is really crazy. I don't know how this procedure can stop the bootloop.

I changed the SD card free space to 30%. That should keep prevent the sd card getting to its max storage and solve the bootloop problem.

Yes, but I would like to fix this issue.

idanny76 commented 1 year ago

Whats the putty command to kill the watchdog wd_rtsp.sh or how to disable it on the system.sh?

You should use vi editor to change the file system.sh. vi /home/yi-hack/script/system.sh Find the line where wd_rtsp.sh is started and add a # at the start of the line. vi is not simple if you don't use it. Press 'i' to go in editing mode and 'esc' to come back in command mode.

I can edit the system.sh easily by editing the file with notepad++ and re-uploading it through FTP.

idanny76 commented 1 year ago

I know how to duplicate it and is by filling the card up 90% or more. Once the card reached close to max capacity it causes the camera to bootloop during reboot. I'll duplicate it again and run the command in Putty. Do you want me to try the system.sh edit and if it doesn't work, then try the Putty commands? or is it one long command?

I tried the putty commands first, but it was just stuck and nothing happened. When I am in Putty and login, I am in the /home/yi-hack #. Then I would type 3 seperate commands...Correct? Command 1: cat /var/spool/cron/crontabs/root Command 2: /home/yi-hack/script/thumb.sh cron Command 3: 0 * sleep 20; /home/yi-hack/script/clean_records.sh 30

idanny76 commented 1 year ago

Man, when I think I figured something out something else weird happens. I have the sd card with only 7% sapce left. But now the camera does a weird reboot where it doesn't spin all the way back and does like two short and pauses quickly before each turn and then boots back up ok. I haven't done the system.sh or the putty commands..... I just filled up the card to get the bootloop situation happening to see if the steps would fix it. But now is just a weird reboot situation.

Video of weird reboot: https://www.youtube.com/watch?v=vTJx1CzXN9M

idanny76 commented 1 year ago

Just tried flashing 0.4.6 to see if it would do a normal reboot and its still doing a really short reboot. Anyway to re-flash all partitions and restart fresh? I don't think switching firmware version really restores partitions. I just did a reset yi settings to default and still same issue with a abnormal super quick reboot. Even with the memory almost completely full......is no longer doing the bootloop. I am not sure why the abnormal reboot, but the bootloop is not happening with the sd card almost full.

roleoroleo commented 1 year ago

I can edit the system.sh easily by editing the file with notepad++ and re-uploading it through FTP.

Ok, you can edit the file as you prefer.

Then I would type 3 seperate commands...Correct?

No, only the 1st command. 2nd and 3rd lines are my output, as an example.

I don't think switching firmware version really restores partitions

Yes, when you change the fw version, sys and home partitions are reflashed.

This short reboot is weird. If you want to try to restore the original partitions, I can send them to you. It would be interesting to understand if the problem disappears. But before to try to restore the factory fw, please try to edit the file system.sh and comment wd_rtsp.

idanny76 commented 1 year ago

It is still having issues with reboot even with editing the file system.sh and comment wd_rtsp. I tried the command on putty and I got this error:

/home/yi-hack # cat /var/spool/cron/crontabs/root
cat: can't open '/var/spool/cron/crontabs/root': No such file or directory

The only way I was able to get the root file to appear in the crontab folder was by running it on the web internface. I did try flashing 0.4.7 and is doing the weird reboot. I think something is wrong with at least this camera. I would have to test is on another camera to make sure the weird reboot is just with this camera. Send me the factory fw to see if that fixes the weird reboot issue. Going to test another camera that also has the bootloop issue, but doesn't have the weird reboot problem.

idanny76 commented 1 year ago

I tried the other camera that doesn't have the weird reboot issue, but has the same bootloop problem. It is doing the bootloop with the sd filled card. I did commented out the wd_rtsp and the bootloop is still happening. Then I did the putty command and got the same result. I have to cameras for testing that have bootloop issues. One has a weird reboot cycle and the other doesn't. Both still have the bootloop after commenting out the wd_rtsp and both got the no file in directory in putty.

/home/yi-hack # cat /var/spool/cron/crontabs/root
cat: can't open '/var/spool/cron/crontabs/root': No such file or directory
roleoroleo commented 1 year ago

Ok, try the original fw: h201c.tar.gz

idanny76 commented 1 year ago

Ok, try the original fw: h201c.tar.gz

Flashed both cameras. The one with the weird reboot is still doing the weird reboot, but it works fine. I then flashed the 0.4.9 on both and filled the sd card in the one without the weird reboot, till there was less than 2gb of storage left or 7% available. When completely powered down and then powered up.... it boots once, reboots and then goes online. Then I went into the web interface and rebooted camera and it reboots fine. So it seems to be working fine. It boots twice from no power and when I select reboot, it reboots once and then goes online like it is supposed to. So to me it seems to be fixed. It doesn't go into this long bootloop cycle.

idanny76 commented 1 year ago

Just swapped the filled sd card to the one with the weird boot and was able to get the same results. Boots twice during power up from no power and boots only once from reboot in the web interface. Seems flashing factory firmware then flashing 0.4.9 fixed the many bootloop cycles before it went online. Might not do it to the other ones, since I have to get ladders to reach some of them. I might just do the erase when it reaches 30% storage left. I usually don't need to go to many days back for videos.

roleoroleo commented 1 year ago

Ok. Try them for a few days and let me know.

idanny76 commented 1 year ago

Ok. Try them for a few days and let me know.

Just decided to do a test reboot and the camera did the reboot loop again. Something with the space available on the SD card causes the problem. How the SD card affects the camera.... I don't know, because is not like the other Yi hack where part of the firmware is in the SD card.

The other confusion is that it doesn't happen in the other cameras. I am going to conclude that it's a camera issue and not firmware..... Because it doesn't happen to all the cameras.

roleoroleo commented 1 year ago

I don't know if this is the case but lately the h201c model is causing me a lot of problems.

idanny76 commented 1 year ago

I don't know if this is the case but lately the h201c model is causing me a lot of problems.

But in the other hand the issues with the cameras go away with the 0.4.7 firmware. Issues only occured with the 0.4.8 and 0.4.9. What solution is would be best? Change the SD card storage to 30% left on the 0.4.9 or switch back to the 0.4.7 firmware which still works great without the improvements from the newer version. I really didn't see any noticeable improvement from 0.4.7 to 0.4.9.

idanny76 commented 1 year ago

Main noticeable difference from 0.4.7 to 0.4.9 is the Snapshot for recorded video and Force low resolution snapshot, but the weird thing is that it doesn't cause problems on the other same cameras with the same firmware. I am just going to keep the cameras with the issue on 0.4.7 and the ones working fine on the 0.4.9.

roleoroleo commented 1 year ago

But in the other hand the issues with the cameras go away with the 0.4.7 firmware. Issues only occured with the 0.4.8 and 0.4.9.

This is the weird thing i can't figure out.

idanny76 commented 1 year ago

I tried the FTP upload feature for all the 8 cameras. I created an FTP Server and setup all 8 cameras to upload to the server. For some reason I thought having a 1Gig upload and download would be able to handle it without slowing down the 2.4Ghz connection too much. But the 2.4Ghz connection was almost unusable to the other devices using it. I did not think it would be using so much bandwidth, but it does. Not a good feature to use, if you have many devices in the home using the 2.4Ghz, unless you have one or two cameras.

github-actions[bot] commented 5 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.