roleoroleo / sonoff-hack

Custom firmware for Sonoff GK-200MP2B camera
GNU General Public License v3.0
203 stars 48 forks source link

0.1.7 scp doesn't seem to be working #166

Closed gewinh closed 3 months ago

gewinh commented 7 months ago

Hi back after a long absence. I have had a number of Sonoff cameras running on 0.1.5 and integrated in to HA with great success for over 12 months( thanks for all the work)(this system has been frozen version wise for this period). Now in a moment of madness I have decided to update everything (pi5 ubuntu HA etc etc). One of the changes has been to try 0.1.7 most things I have tested on a new Sonoff Cam slim using the GK-200MP2-B_0.1.7 are working well, except scp. ssh is working, If I ssh to this camera running 0.1.5 and execute the scp command I get some stuff about usage, so the command is working. If I ssh to this camera running 0.1.7 and execute the scp command I get "command not found". Is this a path thing? I notice an issue raised for 0.1.6 to fix scp , is this the same issue for 0.1.7 if so how do I fix it. The one thing I didn't want to change, if possible, is my nightly server scp copying of previous days recording from each camera on the network. SO it would be great to get scp working

gewinh commented 7 months ago

Did some further investigation scp is in the 0.1.7 distribution. You can run it via /mnt/mmc/sonoff-hack/bin/scp.

Tried 2 temp fixes

A)Created a link to this by

  1. ssh to the camera 2.cd /usr/bin 3.ln -s /mnt/mmc/sonoff-hack/bin/scp scp works This doesn't survive a reboot

B)Looked at adding /mnt/mmc/sonoff-hack/bin to PATH existing Path looks like echo $PATH /usr/bin:/usr/sbin:/bin:/sbin:/gm/bin:/gm/tools:/tmp/sd/yi-hack/bin:/tmp/sd/yi-hack/sbin:/tmp/sd/yi-hack/usr/bin:/tmp/sd/yi-hack/usr/sbin PATH="$PATH:/mnt/mmc/sonoff-hack/bin" echo $PATH /usr/bin:/usr/sbin:/bin:/sbin:/gm/bin:/gm/tools:/tmp/sd/yi-hack/bin:/tmp/sd/yi-hack/sbin:/tmp/sd/yi-hack/usr/bin:/tmp/sd/yi-hack/usr/sbin:/mnt/mmc/sonoff-hack/bin scp works This change doesn't survive logout

Forgive my ignorance but I do not know how to make any of these changes permanent or how to update the distribution to include a fix. Any help?

gewinh commented 7 months ago

A bit more info. I see /mnt/mmc/sonoff-hack/scripts/system.sh called by boot.sh system.sh sets the path in export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/mnt/mmc/sonoff-hack/lib export PATH=$PATH:/mnt/mmc/sonoff-hack/bin:/mnt/mmc/sonoff-hack/sbin:/mnt/mmc/sonoff-hack/usr/bin:/mnt/mmc/sonoff-hack/usr/sbin but this path isn't there on boot, if it was run correctly and the path was set as above scp would work. I also noticed a problem with filezilla access giving sftp error. Again I would guess this is related to the path not being set correctly.

darkxst commented 7 months ago

I think the path on ssh login is set in Dropbear

https://github.com/roleoroleo/sonoff-hack/blob/master/src/dropbear/localoptions.h

darkxst commented 7 months ago

paths got messed up in this commit: https://github.com/roleoroleo/sonoff-hack/commit/9bd2e3d5a475891a4857b25588e7a01ebc4b547e#diff-0c5450329c3e310a6a4ffd3041cfb1f656d34cfcc18a7052ea0b9d44f2acf371

gewinh commented 7 months ago

Thanks. Yes I couldn't understand why all that yi-hack stuff was in the path when i'm running the sonoff-hack. It's beyond my skills to fix that. Hopefully someone will find the time to fix it.

darkxst commented 7 months ago

@gewinh you could do a local build off PR #167 to test changes. I dont currently have access to my sonoff cams.

gewinh commented 7 months ago

Thanks for doing this. Unfortunately I can get my head around how to do a local build. Install the toolchain? , vscode, development environment, dockers etc. etc. I think I will have to wait until the fix is incorporated into a release.

gewinh commented 7 months ago

This old brain works a bit slowly these days. Finally sorted all the dependencies, paths etc. and got he updated 0.1.7 built. Installed on a GK-200MP2-B camera and scp and filezilla are now working. The PATH now looks correct. Will test on the Sonoff 1080p slim cam and the HA integration later. Thanks for all your help.

gewinh commented 7 months ago

Tested on the Sonoff 1080p slim cam using firmware 0.1.7 all works fine, except for camera on/off as described in issue 0.1.7 camera on/off not working for some firmware

roleoroleo commented 7 months ago

Sorry for this regression. Below a binary with the fix posted by @darkxst: dropbearmulti.gz

github-actions[bot] commented 4 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.