ppamidimarri / TeslaDashcamWeb

Uses a Raspberry Pi Zero W as the USB drive for a Tesla Dashcam and provides access to the videos over a website
41 stars 6 forks source link

The Script Section Below Does not work #4

Closed barjohn closed 5 years ago

barjohn commented 5 years ago

Load website scripts

mkdir /home/pi/dash Set up some permissions: chown -R pi:www-data /home/pi/dash chown -R pi:www-data /var/www/html cd /home/pi/dash Download the scripts with git clone https://github.com/ppamidimarri/TeslaDashcamWeb Move the website scripts with cp -r /home/pi/dash/TeslaDashcamWeb/html/ /var/www/ Move python scripts with mv /home/pi/dash/TeslaDashcamWeb/connect /home/pi/dash More permissions: chmod +x /home/pi/dash/* On your computer browser, navigate to the LAN IP of your Pi, you should see the Tesla Dashcam welcome page

After completing this script I only get a blank web page. The two chown instructions both produce an "Operation not permitted" error unless run under sudo. This did work before you fixed the TYPOS but now it doesn't.

For rclone should I get the rclone from their web site or use the one from GitHub cymryan uses?

Thank you for any help. How do you access a local IP from your Tesla as you describe?

ppamidimarri commented 5 years ago

@barjohn Sorry for the delay in responding.

You are right, those chown statements need sudo. I used rclone in the way cimyran set it up, but it should not matter. The key is to verify that your rclone configuration is good. You can test it with rclone ls, etc.

It's been a few weeks, so do you have this running, or are you still trying to figure it out?

barjohn commented 5 years ago

I have a pi that will operate as a USB and present semi functioning web pages; however, if I try and upload the files to google drive or try and do a preview of a file I get a “forbiden” (misspelled as shown) message. At first I thought maybe the files were locked to a user other than pi and that was the issue. I looked at permissions and tried changing ownership but nothing seems to work from the bowser. I I take the pi and plug it into my iMac and go directly to the drives that appear and click on the files recorded from the Tesla they will open and run. However, even though I moved the drives to the trash to unmount them when I bring the pi back up the drives no longer appear. I can make them appear and disappear by issuing "sudo modprobe -r g_mass_storage” or "sudo modprobe g_mass_storage” but sometimes I get the message that I didn’t properly close the file even though I did. Any clue on what I have wrong?

Thanks,

John

On Apr 22, 2019, at 7:55 AM, ppamidimarri notifications@github.com wrote:

@barjohn https://github.com/barjohn Sorry for the delay in responding.

You are right, those chown statements need sudo. I used rclone in the way cimyran set it up, but it should not matter. The key is to verify that your rclone configuration is good. You can test it with rclone ls, etc.

It's been a few weeks, so do you have this running, or are you still trying to figure it out?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ppamidimarri/TeslaDashcamWeb/issues/4#issuecomment-485440694, or mute the thread https://github.com/notifications/unsubscribe-auth/ALOESM6A6QZNZA6GFH3LRSLPRXGVRANCNFSM4HDY6MDA.

ppamidimarri commented 5 years ago

@barjohn I suspect your user www-data is not a valid sudoer... can you check your /etc/sudoers.d/020_www-data-nopasswd file? Try sudo cat /etc/sudoers.d/020_www-data-nopasswd and see if it shows this:

www-data ALL=(ALL) NOPASSWD: ALL

If you get anything else, this is the reason for your problem. The solution would be to add that file. That's one of the things I changed when I fixed typos.

barjohn commented 5 years ago

I thought of that too but here are the results of just running it.

John

On Apr 22, 2019, at 8:25 PM, ppamidimarri notifications@github.com wrote:

@barjohn https://github.com/barjohn I suspect your user www-data is not a valid sudoer... can you check your /etc/sudoers.d/020_www-data-nopasswd file? Try sudo cat /etc/sudoers.d/020_www-data-nopasswd and see if it shows this:

www-data ALL=(ALL) NOPASSWD: ALL If you get anything else, this is the reason for your problem. The solution would be to add that file. That's one of the things I changed when I fixed typos.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ppamidimarri/TeslaDashcamWeb/issues/4#issuecomment-485629233, or mute the thread https://github.com/notifications/unsubscribe-auth/ALOESM7L44VPEFGWVB7S5EDPRZ6SJANCNFSM4HDY6MDA.

ppamidimarri commented 5 years ago

@barjohn Not sure what happened, but I can't see the result. Another thing you can check is sudo visudo... if the sudoer settings are not good, it will give you an error.

barjohn commented 5 years ago

Were you not able to see the screen shot I attached in my email? Here is a screen shot from issuing the sudo visduo command. Let me know if you can’t see it. I am also copy & pasting the text below”

#

This file MUST be edited with the 'visudo' command as root.

#

Please consider adding local content in /etc/sudoers.d/ instead of

directly modifying this file.

#

See the man page for details on how to write a sudoers file.

# Defaults env_reset Defaults mail_badpass Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

Host alias specification

User alias specification

Cmnd alias specification

User privilege specification

root ALL=(ALL:ALL) ALL

Allow members of group sudo to execute any command

%sudo ALL=(ALL:ALL) ALL

See sudoers(5) for more information on "#include" directives:

includedir /etc/sudoers.d

John

On Apr 23, 2019, at 7:29 AM, ppamidimarri notifications@github.com wrote:

@barjohn https://github.com/barjohn Not sure what happened, but I can't see the result. Another thing you can check is sudo visudo... if the sudoer settings are not good, it will give you an error.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ppamidimarri/TeslaDashcamWeb/issues/4#issuecomment-485827342, or mute the thread https://github.com/notifications/unsubscribe-auth/ALOESMZPQGCG5JVDIBHCSZLPR4ML7ANCNFSM4HDY6MDA.

barjohn commented 5 years ago

In case you couldn’t see yesterday’s, here it is:

Last login: Tue Apr 9 22:22:49 on ttys000 Johns-Imac:~ johngriffith$ ssh pi@teslausb.local pi@teslausb.local's password: Linux teslausb 4.14.98+ #1200 Tue Feb 12 20:11:02 GMT 2019 armv6l

The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Wed Apr 10 06:23:07 2019 from 192.168.86.82

SSH is enabled and the default password for the 'pi' user has not been changed. This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.

pi@teslausb:~ $ sudo modprobe g_mass_storage pi@teslausb:~ $ sudo modprobe -r g_mass_storage pi@teslausb:~ $ sudo modprobe -r g_mass_storage pi@teslausb:~ $ sudo modprobe -r g_mass_storage pi@teslausb:~ $ sudo modprobe g_mass_storage pi@teslausb:~ $ sudo cat /etc/sudoers.d/020_www-data-nopasswd www-data ALL=(ALL) NOPASSWD: ALL pi@teslausb:~ $ sudo visudo visudo: /etc/sudoers.tmp unchanged pi@teslausb:~ $ sudo cat /etc/sudoers.d/020_www-data-nopasswd www-data ALL=(ALL) NOPASSWD: ALL pi@teslausb:~ $

John

On Apr 23, 2019, at 7:29 AM, ppamidimarri notifications@github.com wrote:

@barjohn https://github.com/barjohn Not sure what happened, but I can't see the result. Another thing you can check is sudo visudo... if the sudoer settings are not good, it will give you an error.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ppamidimarri/TeslaDashcamWeb/issues/4#issuecomment-485827342, or mute the thread https://github.com/notifications/unsubscribe-auth/ALOESMZPQGCG5JVDIBHCSZLPR4ML7ANCNFSM4HDY6MDA.

ppamidimarri commented 5 years ago

@barjohn Github is not showing me screenshots in this page, but I can now see what happened with your screen dump. It looks like my updated instructions to create the file through "echo ... > " doesn't take proper effect. To confirm this, can you please see the output of groups www-data and see if "sudo" is in the result?

If it is not, can you try doing this to fix it? sudo visudo

Scroll down to the bottom of the file and enter this text to the file and save it:

www-data ALL=(ALL) NOPASSWD: ALL

Again run groups www-data and now you should see "sudo" as one of the items listed. Then restart the Pi and the website should work.

barjohn commented 5 years ago

Below is commands I have issued.

I added the line requested vis sudo visudo and saved it to the file: /etc/sudoers.tmp However, after the reboot it still did not work and the command groups www-data did not show sudo.

pi@teslausb:~ $ sudo modprobe g_mass_storage pi@teslausb:~ $ sudo modprobe -r g_mass_storage pi@teslausb:~ $ sudo modprobe -r g_mass_storage pi@teslausb:~ $ sudo modprobe -r g_mass_storage pi@teslausb:~ $ sudo modprobe g_mass_storage pi@teslausb:~ $ sudo cat /etc/sudoers.d/020_www-data-nopasswd www-data ALL=(ALL) NOPASSWD: ALL pi@teslausb:~ $ sudo visudo visudo: /etc/sudoers.tmp unchanged pi@teslausb:~ $ sudo cat /etc/sudoers.d/020_www-data-nopasswd www-data ALL=(ALL) NOPASSWD: ALL pi@teslausb:~ $ groups pi adm dialout cdrom sudo audio video plugdev games users input netdev gpio i2c spi pi@teslausb:~ $ groups www-data www-data : www-data pi@teslausb:~ $ sudo visudo pi@teslausb:~ $ sudo reboot Connection to teslausb.local closed by remote host. Connection to teslausb.local closed. Johns-Imac:~ johngriffith$ ssh pi@teslausb.local pi@teslausb.local's password: Linux teslausb 4.14.98+ #1200 Tue Feb 12 20:11:02 GMT 2019 armv6l

The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Mon Apr 22 16:18:49 2019 from fe80::10fb:a80c:9131:e4fb%wlan0

SSH is enabled and the default password for the 'pi' user has not been changed. This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.

pi@teslausb:~ $ sudo modprobe g_mass_storage pi@teslausb:~ $ group -bash: group: command not found pi@teslausb:~ $ groups pi adm dialout cdrom sudo audio video plugdev games users input netdev gpio i2c spi pi@teslausb:~ $ groups www-data www-data : www-data pi@teslausb:~ $

Result of sudo visudo command and insertion of line:

#

This file MUST be edited with the 'visudo' command as root.

#

Please consider adding local content in /etc/sudoers.d/ instead of

directly modifying this file.

#

See the man page for details on how to write a sudoers file.

# Defaults env_reset Defaults mail_badpass Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

Host alias specification

User alias specification

Cmnd alias specification

User privilege specification

root ALL=(ALL:ALL) ALL

Allow members of group sudo to execute any command

%sudo ALL=(ALL:ALL) ALL

See sudoers(5) for more information on "#include" directives:

includedir /etc/sudoers.d

www-data ALL=(ALL) NOPASSWD: ALL

                                                                                   [ Read 28 lines ]

^G Get Help ^O Write Out ^W Where Is ^K Cut Text ^J Justify ^C Cur Pos ^Y Prev Page M-\ First Line M-W WhereIs Next ^^ Mark Text M-} Indent Text ^X Exit ^R Read File ^\ Replace ^U Uncut Text ^T To Spell ^_ Go To Line ^V Next Page M-/ Last Line M-] To Bracket M-^ Copy Text M-{ Unindent Text

On Apr 23, 2019, at 11:11 AM, ppamidimarri notifications@github.com wrote:

@barjohn https://github.com/barjohn Github is not showing me screenshots in this page, but I can now see what happened with your screen dump. It looks like my updated instructions to create the file through "echo ... > " doesn't take proper effect. To confirm this, can you please see the output of groups www-data and see if "sudo" is in the result?

If it is not, can you try doing this to fix it? sudo visudo

Scroll down to the bottom of the file and enter this text to the file and save it:

www-data ALL=(ALL) NOPASSWD: ALL Again run groups www-data and now you should see "sudo" as one of the items listed. Then restart the Pi and the website should work.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ppamidimarri/TeslaDashcamWeb/issues/4#issuecomment-485914764, or mute the thread https://github.com/notifications/unsubscribe-auth/ALOESM2R5EZ7FO7QVL7VLLTPR5GMXANCNFSM4HDY6MDA.

ppamidimarri commented 5 years ago

@barjohn After you insert the line, press Ctrl-O, then Enter, to save your changes. Then Ctrl-X to exit. If your changes are successful, then try groups www-data and this time you should see sudo in the list in addition to www-data.

Edit: BTW, do change the password of your pi account as soon as possible. It is not a good idea to leave it as 'raspberry'.

barjohn commented 5 years ago

This is what I see when I enter sudo visudo: GNU nano 2.7.4 File: /etc/sudoers.tmp

#

This file MUST be edited with the 'visudo' command as root.

#

Please consider adding local content in /etc/sudoers.d/ instead of

directly modifying this file.

#

See the man page for details on how to write a sudoers file.

# Defaults env_reset Defaults mail_badpass Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

Host alias specification

User alias specification

Cmnd alias specification

User privilege specification

root ALL=(ALL:ALL) ALL

Allow members of group sudo to execute any command

%sudo ALL=(ALL:ALL) ALL

See sudoers(5) for more information on "#include" directives:

includedir /etc/sudoers.d

www-data ALL=(ALL) NOPASSWD: ALL

^G Get Help ^O Write Out ^W Where Is ^K Cut Text ^J Justify ^C Cur Pos ^Y Prev Page M-\ First Line M-W WhereIs Next ^^ Mark Text M-} Indent Text ^X Exit ^R Read File ^\ Replace ^U Uncut Text ^T To Spell ^_ Go To Line ^V Next Page M-/ Last Line M-] To Bracket M-^ Copy Text M-{ Unindent Text

I have added the line. I do a Ctrl O, enter, and Ctrl X

Then I issue groups www-data and here is what I get:

pi@teslausb:~ $ sudo visudo pi@teslausb:~ $ groups www-data www-data : www-data pi@teslausb:~ $

Sudo is not there. Is it missing the includedir (should I romove the # commenting the line out?

Should www-data line be preceded by Defaults?

Why isn’t it working?

John

On Apr 23, 2019, at 12:37 PM, ppamidimarri notifications@github.com wrote:

@barjohn https://github.com/barjohn After you insert the line, press Ctrl-O, then Enter, to save your changes. Then Ctrl-X to exit. If your changes are successful, then try groups www-data and this time you should see sudo in the list in addition to www-data.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ppamidimarri/TeslaDashcamWeb/issues/4#issuecomment-485944706, or mute the thread https://github.com/notifications/unsubscribe-auth/ALOESM5QLYVJ2YLJLILBJCLPR5QQHANCNFSM4HDY6MDA.

ppamidimarri commented 5 years ago

@barjohn According to this document, we can either edit the sudoers file, use visudo, or simply add the group sudo using usermod command.

So please try this: sudo usermod www-data -a -G sudo

After that if you do groups www-data it should show "sudo" in the result. Once that happens, www-data has sudo privileges, but it will be asked to enter its password when doing so. The entry you already made using sudo visudo saying NOPASSWD gets around that, so you will be good to go at that point.

barjohn commented 5 years ago

That did add sudo to the group but after a reboot it still did not work.

See below: Johns-Imac:~ johngriffith$ ssh pi@teslausb.local pi@teslausb.local's password: Linux teslausb 4.14.98+ #1200 Tue Feb 12 20:11:02 GMT 2019 armv6l

The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Tue Apr 23 19:42:41 2019 from fe80::10fb:a80c:9131:e4fb%wlan0

SSH is enabled and the default password for the 'pi' user has not been changed. This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.

pi@teslausb:~ $ groups www-data www-data : www-data sudo pi@teslausb:~ $

Attached is screen shot from browser.

On Apr 23, 2019, at 3:38 PM, ppamidimarri notifications@github.com wrote:

@barjohn https://github.com/barjohn According to this document https://www.raspberrypi.org/documentation/linux/usage/root.md, we can either edit the sudoers file, use visudo, or simply add the group sudo using usermod command.

So please try this: sudo usermod www-data -a -G sudo

After that if you do groups www-data it should show "sudo" in the result. Once that happens, www-data has sudo privileges, but it will be asked to enter its password when doing so. The entry you already made using sudo visudo saying NOPASSWD gets around that, so you will be good to go at that point.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ppamidimarri/TeslaDashcamWeb/issues/4#issuecomment-486000283, or mute the thread https://github.com/notifications/unsubscribe-auth/ALOESM433TNJ7V4DCN72MS3PR6FXZANCNFSM4HDY6MDA.

ppamidimarri commented 5 years ago

@barjohn Can you please upload the screenshot to imgur and post the link here? Github isn't showing me any screenshots.

barjohn commented 5 years ago

Here is a link: Screen shot of problem with Web access on Raspberry USB https://imgur.com/gallery/F8V4OVA

John

On Apr 23, 2019, at 3:59 PM, ppamidimarri notifications@github.com wrote:

@barjohn https://github.com/barjohn Can you please upload the screenshot to imgur and post the link here? Github isn't showing me any screenshots.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ppamidimarri/TeslaDashcamWeb/issues/4#issuecomment-486004705, or mute the thread https://github.com/notifications/unsubscribe-auth/ALOESM4UDEFUJZUKL7LRCETPR6IGRANCNFSM4HDY6MDA.

ppamidimarri commented 5 years ago

@barjohn That is weird. Let's check ls /etc/sudoers.d. If you still have a file called /etc/sudoers.d/020_www-data-nopasswd, delete it with sudo rm /etc/sudoers.d/020_www-data-nopasswd, because you now have www-data sudo NOPASSWD setting in the main sudoer configuration. Again restart the Pi and check if the preview works.

Another question: when you tried to save the sudo visudo file with Ctrl-O and Enter, did it give you any error messages?

ppamidimarri commented 5 years ago

@barjohn One more question. Are your recent changes, are you still have to manually do modprobe commands, or are you able to use the website buttons to do it? I am beginning to wonder if the "forbiden" message you are getting is related to sudo permissions at all.

barjohn commented 5 years ago

The answer is yes. There is no button to mount or unmount and once I leave the main page I cannot get back to it. It does let me do a reboot and then it shows the main page After the reboot the drives do not appear and after I click on prepare video list it brings up the page that says Disconnecting Drive from the Car…Done Mounting the drive on the Pi…Done.

Show video list shows the folders and opening them shows the files but the drives don’t show on the computer unless I do a modprobe.

Go back to main page does not take me back to the main page but instead it is a page that shows I am connected to the wifi network and the drive is mounted on the pi.

On Apr 23, 2019, at 5:25 PM, ppamidimarri notifications@github.com wrote:

@barjohn https://github.com/barjohn One more question. Are your recent changes, are you still have to manually do modprobe commands, or are you able to use the website buttons to do it? I am beginning to wonder if the "forbiden" message you are getting is related to sudo permissions at all.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ppamidimarri/TeslaDashcamWeb/issues/4#issuecomment-486021512, or mute the thread https://github.com/notifications/unsubscribe-auth/ALOESM4PEHHQPI6YAQ4AYTDPR6SGFANCNFSM4HDY6MDA.

barjohn commented 5 years ago

I tried this too. Same results. No I did not get any error when I did the save.

On Apr 23, 2019, at 4:45 PM, ppamidimarri notifications@github.com wrote:

@barjohn https://github.com/barjohn That is weird. Let's check ls /etc/sudoers.d. If you still have a file called /etc/sudoers.d/020_www-data-nopasswd, delete it with sudo rm /etc/sudoers.d/020_www-data-nopasswd, because you now have www-data sudo NOPASSWD setting in the main sudoer configuration. Again restart the Pi and check if the preview works.

Another question: when you tried to save the sudo visudo file with Ctrl-O and Enter, did it give you any error messages?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ppamidimarri/TeslaDashcamWeb/issues/4#issuecomment-486014031, or mute the thread https://github.com/notifications/unsubscribe-auth/ALOESM6ICIBPRQGLCNXTMV3PR6NSJANCNFSM4HDY6MDA.

ppamidimarri commented 5 years ago

It does let me do a reboot and then it shows the main page

So if you click the Reboot button on the web site, the Pi is rebooting. This would not work if your www-data user did not have sudo privileges. So that is not the issue.

After the reboot the drives do not appear

When you say "the drives do not appear," do you mean the drive is mounted to the car and you see the dashcam icon in the car's display, so they don't show up on the Pi? Or are you testing this by connecting the Pi over USB to your computer, and you don't see the drives mount to your computer on reboot?

One quick thing that occurs to me to check is which Micro-USB port on the Pi you are using. Are you using the one on the end, or the one next to it, closer to the middle?

barjohn commented 5 years ago

I am testing after removing it from my car and plugging it in to my iMac via the USB port (the one next to the power only one at the end). That is why I expect to see the drives show up and I can make them show up by manually issuing the modprobe command.

Why the pi thinks the contents of the drive is forbidden but I can open the drive on the iMac and run the videos just like it was a USB stick. Other commands also produce the fobiden message such as telling it to upload a file. However, I have just found that if I click on “prepare video list” and the drives were showing, it unmounts the drives but the iMac thinks the disks were not ejected properly and I get that error message. If I click on “Switch to Recording Mode” the drives reappear without my using terminal. I also discovered that reboot unmounts the drives (not properly ejected) but does not do a reboot. Shutdown does not do a shutdown either.

I hope this will help you figure out what it could be. Thanks for your help

On Apr 23, 2019, at 8:11 PM, ppamidimarri notifications@github.com wrote:

It does let me do a reboot and then it shows the main page

So if you click the Reboot button on the web site, the Pi is rebooting. This would not work if your www-data user did not have sudo privileges. So that is not the issue.

After the reboot the drives do not appear

When you say "the drives do not appear," do you mean the drive is mounted to the car and you see the dashcam icon in the car's display, so they don't show up on the Pi? Or are you testing this by connecting the Pi over USB to your computer, and you don't see the drives mount to your computer on reboot?

One quick thing that occurs to me to check is which Micro-USB port on the Pi you are using. Are you using the one on the end, or the one next to it, closer to the middle?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ppamidimarri/TeslaDashcamWeb/issues/4#issuecomment-486050582, or mute the thread https://github.com/notifications/unsubscribe-auth/ALOESM4RBRTYPAMXUGSLWATPR7FVJANCNFSM4HDY6MDA.

ppamidimarri commented 5 years ago

However, I have just found that if I click on “prepare video list” and the drives were showing, it unmounts the drives but the iMac thinks the disks were not ejected properly and I get that error message.

So that part is working as intended. "Preparing the video list" requires unmounting the drives from the laptop so we can access the files safely on the Pi. Behind the scenes, it runs sudo modprobe -r g_mass_storage and sudo mount /mnt/cam. Both are working, which means your www-data user has sudo privileges.

I also discovered that reboot unmounts the drives (not properly ejected) but does not do a reboot. Shutdown does not do a shutdown either.

I looked in the code and found the reason... I had commented out the code that actually does the reboot/shutdown! I will fix that.

The problem you are experiencing is clearly unrelated to sudo privileges. Please check that your PHP sessions are correctly getting saved: ls -la /tmp/php/sessions and verifying that your file /etc/php/7.0/fpm/php.ini has this line exactly like this:

session.save_path = “/tmp/php/sessions”

If this looks OK, please check the permissions of the files in your cam folder, like this: ls -la /mnt/cam/TeslaCam and ls -la /var/www/html/TeslaCam. The user should be pi / www-data and permissions should be "-rw-r--r--" for the video files. If they are not, we will need to troubleshoot why.

barjohn commented 5 years ago

A lot of strange results:

The /tmp/php/sessions file does not exist. The php.ini file has the session.save_path = ‘/tmp/php/sessions”. The /mnt/cam/TeslaCam produces a fiels doesn’t exist and the last one shows wrong group ownership. Here is copy of session (not sure which is easiest to read):

This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.

pi@teslausb:~ $ ls -la /tmp/php/sessions ls: cannot access '/tmp/php/sessions': No such file or directory pi@teslausb:~ $ sudo ls -la /tmp/php/sessions ls: cannot access '/tmp/php/sessions': No such file or directory pi@teslausb:~ $ nano /etc/php/7.0/fpm/php.ini pi@teslausb:~ $ ls /tmp rc.local.log rclone.conf systemd-private-8abe56483a974729b61528eaee28b72d-systemd-timesyncd.service-bvBDOA pi@teslausb:~ $ ls /tmp/php ls: cannot access '/tmp/php': No such file or directory pi@teslausb:~ $ ls -la /mnt/cam/TeslaCam ls: cannot access '/mnt/cam/TeslaCam': No such file or directory pi@teslausb:~ $ ls -la /mnt/cam/ total 8 drwxr-xr-x 2 root root 4096 Apr 7 07:42 . drwxr-xr-x 4 root root 4096 Apr 7 07:43 .. pi@teslausb:~ $ ls -la /var/www/html/TeslaCam lrwxrwxrwx 1 pi pi 18 Apr 8 04:40 /var/www/html/TeslaCam -> /mnt/cam/TeslaCam/ pi@teslausb:~ $

This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.

pi@teslausb:~ $ ls -la /tmp/php/sessions ls: cannot access '/tmp/php/sessions': No such file or directory pi@teslausb:~ $ sudo ls -la /tmp/php/sessions ls: cannot access '/tmp/php/sessions': No such file or directory pi@teslausb:~ $ nano /etc/php/7.0/fpm/php.ini pi@teslausb:~ $ ls /tmp rc.local.log rclone.conf systemd-private-8abe56483a974729b61528eaee28b72d-systemd-timesyncd.service-bvBDOA pi@teslausb:~ $ ls /tmp/php ls: cannot access '/tmp/php': No such file or directory pi@teslausb:~ $ ls -la /mnt/cam/TeslaCam ls: cannot access '/mnt/cam/TeslaCam': No such file or directory pi@teslausb:~ $ ls -la /mnt/cam/ total 8 drwxr-xr-x 2 root root 4096 Apr 7 07:42 . drwxr-xr-x 4 root root 4096 Apr 7 07:43 .. pi@teslausb:~ $ ls -la /var/www/html/TeslaCam lrwxrwxrwx 1 pi pi 18 Apr 8 04:40 /var/www/html/TeslaCam -> /mnt/cam/TeslaCam/ pi@teslausb:~ $

John

On Apr 24, 2019, at 1:06 PM, ppamidimarri notifications@github.com wrote:

However, I have just found that if I click on “prepare video list” and the drives were showing, it unmounts the drives but the iMac thinks the disks were not ejected properly and I get that error message.

So that part is working as intended. "Preparing the video list" requires unmounting the drives from the laptop so we can access the files safely on the Pi. Behind the scenes, it runs sudo modprobe -r g_mass_storage and sudo mount /mnt/cam. Both are working, which means your www-data user has sudo privileges.

I also discovered that reboot unmounts the drives (not properly ejected) but does not do a reboot. Shutdown does not do a shutdown either.

I looked in the code and found the reason... I had commented out the code that actually does the reboot/shutdown! I will fix that.

The problem you are experiencing is clearly unrelated to sudo privileges. Please check that your PHP sessions are correctly getting saved: ls -la /tmp/php/sessions and verifying that your file /etc/php/7.0/fpm/php.ini has this line exactly like this:

session.save_path = “/tmp/php/sessions” If this looks OK, please check the permissions of the files in your cam folder, like this: ls -la /mnt/cam/TeslaCam and ls -la /var/www/html/TeslaCam. The user should be pi / www-data and permissions should be "-rw-r--r--" for the video files. If they are not, we will need to troubleshoot why.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ppamidimarri/TeslaDashcamWeb/issues/4#issuecomment-486405275, or mute the thread https://github.com/notifications/unsubscribe-auth/ALOESM4KJDNJL5TXFKXCXG3PSC4VXANCNFSM4HDY6MDA.

ppamidimarri commented 5 years ago

@barjohn It gets weirder still. Can you check the contents of rc.local.log with cat /tmp/rc.local/log? Also, can you run mount /mnt/cam first and then run ls -la /mnt/cam/TeslaCam?

barjohn commented 5 years ago

Here are the results (note that I got a file doesn’t exist with /tmp/rc.local/log) I had to use /tmp/rc.local.log

pi@teslausb:~ $ ls dash pi@teslausb:~ $ ls /tmp rc.local.log rclone.conf systemd-private-d1849281fbfb40579294cbfc676ea1f2-systemd-timesyncd.service-gc5wuC pi@teslausb:~ $ cat /tmp/rc.local.log Wed 24 Apr 23:47:32 BST 2019: Running fsck... fsck from util-linux 2.29.2 Logical sector size is zero. fsck.fat 4.1 (2017-01-24) Wed 24 Apr 23:47:33 BST 2019: Running modprobe... Wed 24 Apr 23:47:33 BST 2019: Preparing temp files... /bin/mkdir: cannot create directory ‘/var/log/nginx’: File exists pi@teslausb:~ $ ls -la /mnt/cam/TeslaCam total 128 drwxrwxrwx 4 root root 32768 Apr 8 03:30 . drwxrwxrwx 7 root root 32768 Jan 1 1970 .. drwxrwxrwx 2 root root 32768 Apr 23 19:41 RecentClips drwxrwxrwx 5 root root 32768 Apr 8 03:26 SavedClips pi@teslausb:~ $

On Apr 25, 2019, at 6:53 AM, ppamidimarri notifications@github.com wrote:

@barjohn https://github.com/barjohn It gets weirder still. Can you check the contents of rc.local.log with cat /tmp/rc.local/log? Also, can you run mount /mnt/cam first and then run ls -la /mnt/cam/TeslaCam?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ppamidimarri/TeslaDashcamWeb/issues/4#issuecomment-486682271, or mute the thread https://github.com/notifications/unsubscribe-auth/ALOESM3VZLCDWSX5ZLVIU3TPSGZU5ANCNFSM4HDY6MDA.

barjohn commented 5 years ago

I forgot to mention that I accompilshed the mount operation via the web interface when I asked it to prepare the files and it unmounted the drives from my iMac.

On Apr 25, 2019, at 6:53 AM, ppamidimarri notifications@github.com wrote:

@barjohn https://github.com/barjohn It gets weirder still. Can you check the contents of rc.local.log with cat /tmp/rc.local/log? Also, can you run mount /mnt/cam first and then run ls -la /mnt/cam/TeslaCam?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ppamidimarri/TeslaDashcamWeb/issues/4#issuecomment-486682271, or mute the thread https://github.com/notifications/unsubscribe-auth/ALOESM3VZLCDWSX5ZLVIU3TPSGZU5ANCNFSM4HDY6MDA.

ppamidimarri commented 5 years ago

OK I think we are on to something here. Please try these steps.

barjohn commented 5 years ago

I am still getting the forbiden. Here is what I am getting from issuing those commands after making the change suggested, saving it and rebooting.

pi@teslausb:~ $ cat /tmp/rc.local.log Thu 25 Apr 16:12:46 BST 2019: Running fsck... fsck from util-linux 2.29.2 Logical sector size is zero. fsck.fat 4.1 (2017-01-24) Thu 25 Apr 16:12:46 BST 2019: Running modprobe... Thu 25 Apr 16:12:46 BST 2019: Preparing temp files... Thu 25 Apr 16:12:47 BST 2019: Starting nginx... Thu 25 Apr 16:12:50 BST 2019: All done pi@teslausb:~ $ ls -la /tmp/php/sessions total 8 drwxr-xr-x 2 www-data pi 4096 Apr 25 16:12 . drwxr-xr-x 3 root root 4096 Apr 25 16:12 .. pi@teslausb:~ $

On Apr 25, 2019, at 8:06 AM, ppamidimarri notifications@github.com wrote:

OK I think we are on to something here. Please try these steps.

sudo mount -o remount,rw / sudo nano /etc/rc.local In the file, change the line /bin/mkdir /var/log/nginx >> "$LOGFILE" 2>&1 to /bin/mkdir -p /var/log/nginx >> "$LOGFILE" 2>&1. Alternatively you can delete that line altogether. Save and reboot After it boots up, check the log again with cat /tmp/rc.local.log (that is the correct name, sorry about the typo in my last response). It should say "Starting nginx..." and then "All done" after timestamps. Now open the website. Then check ls -la /tmp/php/sessions. If it exists and has at least one line, I think your problem should be solved. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ppamidimarri/TeslaDashcamWeb/issues/4#issuecomment-486713216, or mute the thread https://github.com/notifications/unsubscribe-auth/ALOESM7G2OBFPIAKZIYLXTLPSHCGVANCNFSM4HDY6MDA.

ppamidimarri commented 5 years ago

Here is how /tmp/php/sessions looks for me after I click "prepare video list" and then "show video list".

pi@dpi:~ $ ls -la /tmp/php/sessions
total 4
drwxr-xr-x 2 www-data pi        60 Apr 25 08:35 .
drwxr-xr-x 3 root     root      60 Nov  3  2016 ..
-rw------- 1 www-data www-data 218 Apr 25 08:35 sess_93lajtlskuf869oqpqgdf7mp24

In your case, it is not showing any session info. That's why you are getting the "forbiden" error. Can you check this command? grep save_path /etc/php/7.0/fpm/php.ini

It should look like this, with only one line that does not start with a ; and that line should be set to "/tmp/php/sessions"

;     session.save_path = "N;/path"
;     session.save_path = "N;MODE;/path"
session.save_path = "/tmp/php/sessions"
;       (see session.save_path above), then garbage collection does *not*

Please also check grep fix_path /etc/php/7.0/fpm/php.ini. The result should have exactly one line that does not start with a ; that looks like this:

; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI.  PHP's
cgi.fix_pathinfo=0

Finally, please run this command paste the results here: cat /tmp/log/nginx/error.log

barjohn commented 5 years ago

Here is what I get after a reboot, logging in going to web page, preparing video list and show video list using the same commands in terminal:

pi@teslausb:~ $ grep save_path /etc/php/7.0/fpm/php.ini ; session.save_path = "N;/path" ; session.save_path = "N;MODE;/path" session.save_path = “/tmp/php/sessions” ; (see session.save_path above), then garbage collection does not pi@teslausb:~ $ ls -la /tmp/php/sessions total 8 drwxr-xr-x 2 www-data pi 4096 Apr 25 16:37 . drwxr-xr-x 3 root root 4096 Apr 25 16:37 .. pi@teslausb:~ $

On Apr 25, 2019, at 8:42 AM, ppamidimarri notifications@github.com wrote:

grep save_path /etc/php/7.0/fpm/php.ini

ppamidimarri commented 5 years ago

Can you check for fix_pathinfo as well, and check the nginx error log? I updated my last post with those commands.

barjohn commented 5 years ago

I’m not sure how to do that. Instructions please.

On Apr 25, 2019, at 9:05 AM, ppamidimarri notifications@github.com wrote:

Can you check for fix_pathinfo as well, and check the nginx error log? I updated my last post with those commands.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ppamidimarri/TeslaDashcamWeb/issues/4#issuecomment-486736082, or mute the thread https://github.com/notifications/unsubscribe-auth/ALOESM7RHXSERSERZ723VUDPSHJEBANCNFSM4HDY6MDA.

ppamidimarri commented 5 years ago

Please check grep fix_path /etc/php/7.0/fpm/php.ini. The result should have exactly one line that does not start with a ; that looks like this:

; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI.  PHP's
cgi.fix_pathinfo=0

Finally, please run this command paste the results here: cat /tmp/log/nginx/error.log

barjohn commented 5 years ago

First command produced identical results. Second command no such file

pi@teslausb:~ $ grep save_path /etc/php/7.0/fpm/php.ini ; session.save_path = "N;/path" ; session.save_path = "N;MODE;/path" session.save_path = “/tmp/php/sessions” ; (see session.save_path above), then garbage collection does not pi@teslausb:~ $ ls -la /tmp/php/sessions total 8 drwxr-xr-x 2 www-data pi 4096 Apr 25 16:37 . drwxr-xr-x 3 root root 4096 Apr 25 16:37 .. pi@teslausb:~ $ grep fix_path /etc/php/7.0/fpm/php.ini ; cgi.fix_pathinfo provides real PATH_INFO/PATH_TRANSLATED support for CGI. PHP's cgi.fix_pathinfo=0 pi@teslausb:~ $ cat /tmp/log/nginx/error.log cat: /tmp/log/nginx/error.log: No such file or directory pi@teslausb:~ $

On Apr 25, 2019, at 9:28 AM, ppamidimarri notifications@github.com wrote:

Please check grep fix_path /etc/php/7.0/fpm/php.ini. The result should have exactly one line that does not start with a ; that looks like this:

; cgi.fix_pathinfo provides real PATH_INFO/PATH_TRANSLATED support for CGI. PHP's cgi.fix_pathinfo=0 Finally, please run this command paste the results here: cat /tmp/log/nginx/error.log

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ppamidimarri/TeslaDashcamWeb/issues/4#issuecomment-486744429, or mute the thread https://github.com/notifications/unsubscribe-auth/ALOESM4IKNX5AK76ECHDMLTPSHL3XANCNFSM4HDY6MDA.

ppamidimarri commented 5 years ago

That is weird. Let's try these two:

cat /var/log/nginx/error.log and cat /tmp/log/nginx/access.log

barjohn commented 5 years ago

Here is the result of the first one: cat: /tmp/log/nginx/error.log: No such file or directory pi@teslausb:~ $ cat /var/log/nginx/error.log 2019/04/25 16:15:39 [error] 492#492: 1 FastCGI sent in stderr: "PHP message: PHP Warning: session_start(): open(“/tmp/php/sessions”/sess_1idlnfpl8fm5o3h01e70vqclk2, ORDWR) failed: No such file or directory (2) in /var/www/html/filemanager/config/config.php on line 3" while reading response header from upstream, client: 192.168.86.82, server: , request: "GET /filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "192.168.86.194", referrer: "http://192.168.86.194/videoList.php?" 2019/04/25 16:15:39 [error] 492#492: 1 FastCGI sent in stderr: "PHP message: PHP Warning: Unknown: open(“/tmp/php/sessions”/sess_1idlnfpl8fm5o3h01e70vqclk2, O_RDWR) failed: No such file or directory (2) in Unknown on line 0 PHP message: PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.savepath is correct (“/tmp/php/sessions”) in Unknown on line 0" while reading upstream, client: 192.168.86.82, server: , request: "GET /filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "192.168.86.194", referrer: "http://192.168.86.194/videoList.php?" 2019/04/25 16:15:45 [error] 492#492: 1 FastCGI sent in stderr: "PHP message: PHP Warning: session_start(): open(“/tmp/php/sessions”/sess_1idlnfpl8fm5o3h01e70vqclk2, ORDWR) failed: No such file or directory (2) in /var/www/html/filemanager/config/config.php on line 3" while reading response header from upstream, client: 192.168.86.82, server: , request: "GET /filemanager/dialog.php?type=0&lang=en_EN&popup=0&crossdomain=0&relative_url=0&akey=key&fldr=RecentClips%2F&5cc1cf1b805f5 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "192.168.86.194", referrer: "http://192.168.86.194/filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1" 2019/04/25 16:15:45 [error] 492#492: 1 FastCGI sent in stderr: "PHP message: PHP Warning: Unknown: open(“/tmp/php/sessions”/sess_1idlnfpl8fm5o3h01e70vqclk2, O_RDWR) failed: No such file or directory (2) in Unknown on line 0 PHP message: PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.savepath is correct (“/tmp/php/sessions”) in Unknown on line 0" while reading upstream, client: 192.168.86.82, server: , request: "GET /filemanager/dialog.php?type=0&lang=en_EN&popup=0&crossdomain=0&relative_url=0&akey=key&fldr=RecentClips%2F&5cc1cf1b805f5 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "192.168.86.194", referrer: "http://192.168.86.194/filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1" 2019/04/25 16:15:53 [error] 492#492: 1 FastCGI sent in stderr: "PHP message: PHP Warning: session_start(): open(“/tmp/php/sessions”/sess_1idlnfpl8fm5o3h01e70vqclk2, ORDWR) failed: No such file or directory (2) in /var/www/html/filemanager/config/config.php on line 3 PHP message: PHP Notice: Undefined index: RF in /var/www/html/filemanager/include/utils.php on line 3" while reading response header from upstream, client: 192.168.86.82, server: , request: "GET /filemanager/ajax_calls.php?action=media_preview&title=file._2019-04-07_19-12-right_repeater&file=RecentClips/file._2019-04-07_19-12-right_repeater.mp4 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "192.168.86.194", referrer: "http://192.168.86.194/filemanager/dialog.php?type=0&lang=en_EN&popup=0&crossdomain=0&relative_url=0&akey=key&fldr=RecentClips%2F&5cc1cf1b805f5" 2019/04/25 16:15:53 [error] 492#492: 1 FastCGI sent in stderr: "PHP message: PHP Warning: Unknown: open(“/tmp/php/sessions”/sess_1idlnfpl8fm5o3h01e70vqclk2, O_RDWR) failed: No such file or directory (2) in Unknown on line 0 PHP message: PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.savepath is correct (“/tmp/php/sessions”) in Unknown on line 0" while reading upstream, client: 192.168.86.82, server: , request: "GET /filemanager/ajax_calls.php?action=media_preview&title=file._2019-04-07_19-12-right_repeater&file=RecentClips/file._2019-04-07_19-12-right_repeater.mp4 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "192.168.86.194", referrer: "http://192.168.86.194/filemanager/dialog.php?type=0&lang=en_EN&popup=0&crossdomain=0&relative_url=0&akey=key&fldr=RecentClips%2F&5cc1cf1b805f5" 2019/04/25 16:35:16 [error] 492#492: 13 FastCGI sent in stderr: "PHP message: PHP Warning: session_start(): open(“/tmp/php/sessions”/sess_1idlnfpl8fm5o3h01e70vqclk2, ORDWR) failed: No such file or directory (2) in /var/www/html/filemanager/config/config.php on line 3 PHP message: PHP Notice: Undefined index: RF in /var/www/html/filemanager/include/utils.php on line 3" while reading response header from upstream, client: 192.168.86.82, server: , request: "POST /filemanager/sync_drive.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "192.168.86.194", referrer: "http://192.168.86.194/filemanager/dialog.php?type=0&lang=en_EN&popup=0&crossdomain=0&relative_url=0&akey=key&fldr=RecentClips%2F&5cc1cf1b805f5" 2019/04/25 16:35:16 [error] 492#492: 13 FastCGI sent in stderr: "PHP message: PHP Warning: Unknown: open(“/tmp/php/sessions”/sess_1idlnfpl8fm5o3h01e70vqclk2, O_RDWR) failed: No such file or directory (2) in Unknown on line 0 PHP message: PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.savepath is correct (“/tmp/php/sessions”) in Unknown on line 0" while reading upstream, client: 192.168.86.82, server: , request: "POST /filemanager/sync_drive.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "192.168.86.194", referrer: "http://192.168.86.194/filemanager/dialog.php?type=0&lang=en_EN&popup=0&crossdomain=0&relative_url=0&akey=key&fldr=RecentClips%2F&5cc1cf1b805f5" 2019/04/25 16:47:10 [error] 488#488: 1 FastCGI sent in stderr: "PHP message: PHP Warning: session_start(): open(“/tmp/php/sessions”/sess_1idlnfpl8fm5o3h01e70vqclk2, ORDWR) failed: No such file or directory (2) in /var/www/html/filemanager/config/config.php on line 3" while reading response header from upstream, client: 192.168.86.82, server: , request: "GET /filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "192.168.86.194", referrer: "http://192.168.86.194/videoList.php?" 2019/04/25 16:47:10 [error] 488#488: 1 FastCGI sent in stderr: "PHP message: PHP Warning: Unknown: open(“/tmp/php/sessions”/sess_1idlnfpl8fm5o3h01e70vqclk2, O_RDWR) failed: No such file or directory (2) in Unknown on line 0 PHP message: PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.savepath is correct (“/tmp/php/sessions”) in Unknown on line 0" while reading upstream, client: 192.168.86.82, server: , request: "GET /filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "192.168.86.194", referrer: "http://192.168.86.194/videoList.php?" 2019/04/25 16:47:17 [error] 488#488: 1 FastCGI sent in stderr: "PHP message: PHP Warning: session_start(): open(“/tmp/php/sessions”/sess_1idlnfpl8fm5o3h01e70vqclk2, ORDWR) failed: No such file or directory (2) in /var/www/html/filemanager/config/config.php on line 3" while reading response header from upstream, client: 192.168.86.82, server: , request: "GET /filemanager/dialog.php?type=0&lang=en_EN&popup=0&crossdomain=0&relative_url=0&akey=key&fldr=RecentClips%2F&5cc1d67e99f38 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "192.168.86.194", referrer: "http://192.168.86.194/filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1" 2019/04/25 16:47:17 [error] 488#488: 1 FastCGI sent in stderr: "PHP message: PHP Warning: Unknown: open(“/tmp/php/sessions”/sess_1idlnfpl8fm5o3h01e70vqclk2, O_RDWR) failed: No such file or directory (2) in Unknown on line 0 PHP message: PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.savepath is correct (“/tmp/php/sessions”) in Unknown on line 0" while reading upstream, client: 192.168.86.82, server: , request: "GET /filemanager/dialog.php?type=0&lang=en_EN&popup=0&crossdomain=0&relative_url=0&akey=key&fldr=RecentClips%2F&5cc1d67e99f38 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "192.168.86.194", referrer: "http://192.168.86.194/filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1" 2019/04/25 16:47:20 [error] 488#488: 1 FastCGI sent in stderr: "PHP message: PHP Warning: session_start(): open(“/tmp/php/sessions”/sess_1idlnfpl8fm5o3h01e70vqclk2, ORDWR) failed: No such file or directory (2) in /var/www/html/filemanager/config/config.php on line 3 PHP message: PHP Notice: Undefined index: RF in /var/www/html/filemanager/include/utils.php on line 3" while reading response header from upstream, client: 192.168.86.82, server: , request: "GET /filemanager/ajax_calls.php?action=media_preview&title=file._2019-04-07_19-12-right_repeater&file=RecentClips/file._2019-04-07_19-12-right_repeater.mp4 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "192.168.86.194", referrer: "http://192.168.86.194/filemanager/dialog.php?type=0&lang=en_EN&popup=0&crossdomain=0&relative_url=0&akey=key&fldr=RecentClips%2F&5cc1d67e99f38" 2019/04/25 16:47:20 [error] 488#488: 1 FastCGI sent in stderr: "PHP message: PHP Warning: Unknown: open(“/tmp/php/sessions”/sess_1idlnfpl8fm5o3h01e70vqclk2, O_RDWR) failed: No such file or directory (2) in Unknown on line 0 PHP message: PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.savepath is correct (“/tmp/php/sessions”) in Unknown on line 0" while reading upstream, client: 192.168.86.82, server: , request: "GET /filemanager/ajax_calls.php?action=media_preview&title=file._2019-04-07_19-12-right_repeater&file=RecentClips/file._2019-04-07_19-12-right_repeater.mp4 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "192.168.86.194", referrer: "http://192.168.86.194/filemanager/dialog.php?type=0&lang=en_EN&popup=0&crossdomain=0&relative_url=0&akey=key&fldr=RecentClips%2F&5cc1d67e99f38" 2019/04/25 16:52:39 [error] 488#488: 8 FastCGI sent in stderr: "PHP message: PHP Warning: session_start(): open(“/tmp/php/sessions”/sess_1idlnfpl8fm5o3h01e70vqclk2, ORDWR) failed: No such file or directory (2) in /var/www/html/filemanager/config/config.php on line 3" while reading response header from upstream, client: 192.168.86.82, server: , request: "GET /filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "192.168.86.194", referrer: "http://192.168.86.194/videoList.php?" 2019/04/25 16:52:39 [error] 488#488: 8 FastCGI sent in stderr: "PHP message: PHP Warning: Unknown: open(“/tmp/php/sessions”/sess_1idlnfpl8fm5o3h01e70vqclk2, O_RDWR) failed: No such file or directory (2) in Unknown on line 0 PHP message: PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.savepath is correct (“/tmp/php/sessions”) in Unknown on line 0" while reading upstream, client: 192.168.86.82, server: , request: "GET /filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "192.168.86.194", referrer: "http://192.168.86.194/videoList.php?" pi@teslausb:~ $ and here is the second one:

pi@teslausb:~ $ cat /tmp/log/nginx/access.log cat: /tmp/log/nginx/access.log: No such file or directory pi@teslausb:~ $

On Apr 25, 2019, at 9:43 AM, ppamidimarri notifications@github.com wrote:

That is weird. Let's try these two:

cat /var/log/nginx/error.log and cat /tmp/log/nginx/access.log

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ppamidimarri/TeslaDashcamWeb/issues/4#issuecomment-486749452, or mute the thread https://github.com/notifications/unsubscribe-auth/ALOESM6MD4YVD2SP4YH3NY3PSHNSDANCNFSM4HDY6MDA.

ppamidimarri commented 5 years ago

Clearly the problem is your PHP session not getting saved. Can you check these things?

  1. grep save_handler /etc/php/7.0/fpm/php.ini, should be set to "files" like this:
session.save_handler = files
; Argument passed to save_handler.  In the case of files, this is the path
  1. May be unrelated to the core issue, but your nginx log files are not in the correct place. Can you check cat /var/log/nginx/access.log? Also check grep log /etc/nginx/nginx.conf, should be:
        access_log /tmp/log/nginx/access.log;
        error_log /tmp/log/nginx/error.log;
barjohn commented 5 years ago

Here is the info. The last one had incorrect data so I edited it and will reboot and try again.

cat: '/var/log/nginx/access.log?': No such file or directory pi@teslausb:~ $ cat /var/log/nginx/access.log 192.168.86.82 - - [25/Apr/2019:15:15:37 +0100] "GET / HTTP/1.1" 200 814 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:15:15:55 +0100] "GET /fixCar.php? HTTP/1.1" 200 639 "http://192.168.86.194/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:15:16:27 +0100] "GET /index.php? HTTP/1.1" 200 814 "http://192.168.86.194/fixCar.php?" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:15:16:38 +0100] "GET /readyShow.php? HTTP/1.1" 200 717 "http://192.168.86.194/index.php?" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:15:30 +0100] "GET /dashtheme.css HTTP/1.1" 304 0 "http://192.168.86.194/index.php?" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:15:30 +0100] "GET /index.php? HTTP/1.1" 200 814 "http://192.168.86.194/readyShow.php?" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:15:30 +0100] "GET /dashtheme.css HTTP/1.1" 304 0 "http://192.168.86.194/index.php?" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:15:37 +0100] "GET /readyShow.php? HTTP/1.1" 200 717 "http://192.168.86.194/index.php?" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:15:39 +0100] "GET /videoList.php? HTTP/1.1" 200 695 "http://192.168.86.194/readyShow.php?" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:15:39 +0100] "GET /filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1 HTTP/1.1" 200 5754 "http://192.168.86.194/videoList.php?" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:15:39 +0100] "GET /filemanager/js/jquery.fileupload-process.js HTTP/1.1" 200 6161 "http://192.168.86.194/filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:15:39 +0100] "GET /filemanager/js/jquery.iframe-transport.js HTTP/1.1" 200 10891 "http://192.168.86.194/filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:15:39 +0100] "GET /filemanager/js/jquery.fileupload-audio.js HTTP/1.1" 200 3604 "http://192.168.86.194/filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:15:39 +0100] "GET /filemanager/js/jquery.fileupload-ui.js HTTP/1.1" 200 28065 "http://192.168.86.194/filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:15:39 +0100] "GET /filemanager/css/style.css?v=9.13.2 HTTP/1.1" 304 0 "http://192.168.86.194/filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:15:39 +0100] "GET /filemanager/css/jquery.fileupload.css HTTP/1.1" 304 0 "http://192.168.86.194/filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:15:39 +0100] "GET /filemanager/js/include.js?v=9.13.2 HTTP/1.1" 304 0 "http://192.168.86.194/filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:15:39 +0100] "GET /filemanager/js/modernizr.custom.js HTTP/1.1" 304 0 "http://192.168.86.194/filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:15:39 +0100] "GET /filemanager/js/jquery.fileupload.js HTTP/1.1" 304 0 "http://192.168.86.194/filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:15:39 +0100] "GET /filemanager/js/jquery.fileupload-image.js HTTP/1.1" 304 0 "http://192.168.86.194/filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:15:39 +0100] "GET /filemanager/img/storing_animation.gif HTTP/1.1" 304 0 "http://192.168.86.194/filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:15:39 +0100] "GET /filemanager/js/jquery.fileupload-validate.js HTTP/1.1" 304 0 "http://192.168.86.194/filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:15:39 +0100] "GET /filemanager/img/spinner.gif HTTP/1.1" 200 199923 "http://192.168.86.194/filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:15:39 +0100] "GET /filemanager/img/glyphicons-halflings.png HTTP/1.1" 304 0 "http://192.168.86.194/filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:15:39 +0100] "GET /filemanager/img/down.png HTTP/1.1" 304 0 "http://192.168.86.194/filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:15:39 +0100] "GET /filemanager/[object%20Object] HTTP/1.1" 404 143 "http://192.168.86.194/filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:15:45 +0100] "GET /filemanager/dialog.php?type=0&lang=en_EN&popup=0&crossdomain=0&relative_url=0&akey=key&fldr=RecentClips%2F&5cc1cf1b805f5 HTTP/1.1" 200 23194 "http://192.168.86.194/filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:15:45 +0100] "GET /filemanager/[object%20Object] HTTP/1.1" 404 143 "http://192.168.86.194/filemanager/dialog.php?type=0&lang=en_EN&popup=0&crossdomain=0&relative_url=0&akey=key&fldr=RecentClips%2F&5cc1cf1b805f5" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:15:53 +0100] "GET /filemanager/ajax_calls.php?action=media_preview&title=file._2019-04-07_19-12-right_repeater&file=RecentClips/file._2019-04-07_19-12-right_repeater.mp4 HTTP/1.1" 200 39 "http://192.168.86.194/filemanager/dialog.php?type=0&lang=en_EN&popup=0&crossdomain=0&relative_url=0&akey=key&fldr=RecentClips%2F&5cc1cf1b805f5" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:35:16 +0100] "POST /filemanager/sync_drive.php HTTP/1.1" 200 39 "http://192.168.86.194/filemanager/dialog.php?type=0&lang=en_EN&popup=0&crossdomain=0&relative_url=0&akey=key&fldr=RecentClips%2F&5cc1cf1b805f5" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:35:20 +0100] "GET /index.php? HTTP/1.1" 200 734 "http://192.168.86.194/videoList.php?" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:35:29 +0100] "GET /readyRecord.php? HTTP/1.1" 200 668 "http://192.168.86.194/index.php?" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:35:40 +0100] "GET /reboot.php? HTTP/1.1" 200 633 "http://192.168.86.194/readyRecord.php?" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:35:52 +0100] "GET /shutdown.php? HTTP/1.1" 200 597 "http://192.168.86.194/reboot.php?" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:36:07 +0100] "GET /index.php? HTTP/1.1" 200 814 "http://192.168.86.194/shutdown.php?" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:47:08 +0100] "GET /readyShow.php? HTTP/1.1" 200 717 "http://192.168.86.194/index.php?" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:47:10 +0100] "GET /videoList.php? HTTP/1.1" 200 694 "http://192.168.86.194/readyShow.php?" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:47:10 +0100] "GET /filemanager/[object%20Object] HTTP/1.1" 404 143 "http://192.168.86.194/filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:47:10 +0100] "GET /filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1 HTTP/1.1" 200 5755 "http://192.168.86.194/videoList.php?" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:47:17 +0100] "GET /filemanager/dialog.php?type=0&lang=en_EN&popup=0&crossdomain=0&relative_url=0&akey=key&fldr=RecentClips%2F&5cc1d67e99f38 HTTP/1.1" 200 23195 "http://192.168.86.194/filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:47:17 +0100] "GET /filemanager/[object%20Object] HTTP/1.1" 404 143 "http://192.168.86.194/filemanager/dialog.php?type=0&lang=en_EN&popup=0&crossdomain=0&relative_url=0&akey=key&fldr=RecentClips%2F&5cc1d67e99f38" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:47:20 +0100] "GET /filemanager/ajax_calls.php?action=media_preview&title=file._2019-04-07_19-12-right_repeater&file=RecentClips/file._2019-04-07_19-12-right_repeater.mp4 HTTP/1.1" 200 39 "http://192.168.86.194/filemanager/dialog.php?type=0&lang=en_EN&popup=0&crossdomain=0&relative_url=0&akey=key&fldr=RecentClips%2F&5cc1d67e99f38" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:52:36 +0100] "GET /index.php? HTTP/1.1" 200 734 "http://192.168.86.194/videoList.php?" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:52:39 +0100] "GET /videoList.php? HTTP/1.1" 200 695 "http://192.168.86.194/index.php?" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:52:39 +0100] "GET /filemanager/[object%20Object] HTTP/1.1" 404 143 "http://192.168.86.194/filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" 192.168.86.82 - - [25/Apr/2019:16:52:39 +0100] "GET /filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1 HTTP/1.1" 200 5757 "http://192.168.86.194/videoList.php?" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15" pi@teslausb:~ $ grep log /etc/nginx/nginx.conf access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; pi@teslausb:~ $ nano /etc/nginx/nginx.conf pi@teslausb:~ $ sudo nano /etc/nginx/nginx.conf pi@teslausb:~ $

On Apr 25, 2019, at 10:47 AM, ppamidimarri notifications@github.com wrote:

Clearly the problem is your PHP session not getting saved. Can you check these things?

grep save_handler /etc/php/7.0/fpm/php.ini, should be set to "files" like this: session.save_handler = files ; Argument passed to save_handler. In the case of files, this is the path May be unrelated to the core issue, but your nginx log files are not in the correct place. Can you check cat /var/log/nginx/access.log? Also check grep log /etc/nginx/nginx.conf, should be: access_log /tmp/log/nginx/access.log; error_log /tmp/log/nginx/error.log; — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ppamidimarri/TeslaDashcamWeb/issues/4#issuecomment-486772184, or mute the thread https://github.com/notifications/unsubscribe-auth/ALOESM2SBILLLUWKEKDWFKLPSHVD5ANCNFSM4HDY6MDA.

ppamidimarri commented 5 years ago

Did you change /etc/nginx/nginx.conf to the new values after the sudo nano command? Can you check the php-fpm and nginx configuration steps in the README and make sure that your configuration fully matches those instructions?

barjohn commented 5 years ago

I thought I did those the first time. Maybe I inadvertently over wrote the file with the old version at some point. After rebooting with those two changes, the web page won’t come up. My router shows it connected.

pi@teslausb:~ $ ifconfig lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 1000 (Local Loopback) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.86.194 netmask 255.255.255.0 broadcast 192.168.86.255 inet6 fe80::5ad3:a8e5:8cf9:6e79 prefixlen 64 scopeid 0x20 ether b8:27:eb:91:da:3a txqueuelen 1000 (Ethernet) RX packets 678 bytes 159183 (155.4 KiB) RX errors 0 dropped 1 overruns 0 frame 0 TX packets 88 bytes 14733 (14.3 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

pi@teslausb:~ $

On Apr 25, 2019, at 11:00 AM, ppamidimarri notifications@github.com wrote:

Did you change /etc/nginx/nginx.conf to the new values after the sudo nano command? Can you check the php-fpm and nginx configuration steps in the README and make sure that your configuration fully matches those instructions?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ppamidimarri/TeslaDashcamWeb/issues/4#issuecomment-486776872, or mute the thread https://github.com/notifications/unsubscribe-auth/ALOESM6BPXBVEIJPVUTFXPLPSHWTHANCNFSM4HDY6MDA.

ppamidimarri commented 5 years ago

Another thing you can do to troubleshoot PHP session info...

  1. nano /var/www/html/test.php
  2. Add in that file just one line: <?php phpinfo(); ?>
  3. From your browser, navigate to http://teslausb.local/test.php
  4. In the page that shows up, check the "session" section against the below from my output:
Session Support enabled
Registered save handlers files user
Registered serializer handlers php_serialize php php_binary
Directive Local Value Master Value
session.auto_start Off Off
session.cache_expire 180 180
session.cache_limiter nocache nocache
session.cookie_domain no value no value
session.cookie_httponly Off Off
session.cookie_lifetime 0 0
session.cookie_path / /
session.cookie_secure Off Off
session.entropy_file /dev/urandom /dev/urandom
session.entropy_length 32 32
session.gc_divisor 1000 1000
session.gc_maxlifetime 1440 1440
session.gc_probability 0 0
session.hash_bits_per_character 5 5
session.hash_function 0 0
session.lazy_write On On
session.name PHPSESSID PHPSESSID
session.referer_check no value no value
session.save_handler files files
session.save_path /tmp/php/sessions /tmp/php/sessions
session.serialize_handler php php
session.upload_progress.cleanup On On
session.upload_progress.enabled On On
session.upload_progress.freq 1% 1%
session.upload_progress.min_freq 1 1
session.upload_progress.name PHP_SESSION_UPLOAD_PROGRESS PHP_SESSION_UPLOAD_PROGRESS
session.upload_progress.prefix uploadprogress uploadprogress
session.use_cookies On On
session.use_only_cookies On On
session.use_strict_mode Off Off
session.use_trans_sid 0 0
ppamidimarri commented 5 years ago

I thought I did those the first time. Maybe I inadvertently over wrote the file with the old version at some point. After rebooting with those two changes, the web page won’t come up.

barjohn commented 5 years ago

I did that but the web page doesn’t come up.

pi@teslausb:~ $ nano /var/www/html/test.php pi@teslausb:~ $ ls /var/www/html/ dashtheme.css fixCar.php header.php index.php readyShow.php shutdown.php test.php videoList.php filemanager footer.php index.nginx-debian.html readyRecord.php reboot.php TeslaCam thumbs pi@teslausb:~ $

On Apr 25, 2019, at 11:16 AM, ppamidimarri notifications@github.com wrote:

I thought I did those the first time. Maybe I inadvertently over wrote the file with the old version at some point. After rebooting with those two changes, the web page won’t come up.

sudo service nginx status to see if nginx is running (my guess is that it is not) Check whether your nginx configuration file is valid, with: sudo nginx -t — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ppamidimarri/TeslaDashcamWeb/issues/4#issuecomment-486782813, or mute the thread https://github.com/notifications/unsubscribe-auth/ALOESM6YKFVJN2H4PPV6IMLPSHYRRANCNFSM4HDY6MDA.

ppamidimarri commented 5 years ago

Try the sudo nginx -t first. If that says "OK", then sudo /etc/init.d/nginx restart to bring up the web server.

barjohn commented 5 years ago

I found a typo I made in the nginx.conf file and after that ran the php test and it worked and the sessions section matched yours. Then I was able to bring up the web page but I still get the forbidden error.

pi@teslausb:~ $ sudo nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful pi@teslausb:~ $ sudo /etc/init.d/nginx restart [ ok ] Restarting nginx (via systemctl): nginx.service. pi@teslausb:~ $

On Apr 25, 2019, at 11:26 AM, ppamidimarri notifications@github.com wrote:

Try the sudo nginx -t first. If that says "OK", then sudo /etc/init.d/nginx restart to bring up the web server.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ppamidimarri/TeslaDashcamWeb/issues/4#issuecomment-486786343, or mute the thread https://github.com/notifications/unsubscribe-auth/ALOESMZ5KLLLE5PCC4ZEW33PSHZXBANCNFSM4HDY6MDA.

ppamidimarri commented 5 years ago

I found a typo I made in the nginx.conf file and after that ran the php test and it worked and the sessions section matched yours. Then I was able to bring up the web page but I still get the forbidden error. pi@teslausb:~ $ sudo nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful pi@teslausb:~ $ sudo /etc/init.d/nginx restart [ ok ] Restarting nginx (via systemctl): nginx.service. pi@teslausb:~ $ On Apr 25, 2019, at 11:26 AM, ppamidimarri @.***> wrote: Try the sudo nginx -t first. If that says "OK", then sudo /etc/init.d/nginx restart to bring up the web server. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#4 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/ALOESMZ5KLLLE5PCC4ZEW33PSHZXBANCNFSM4HDY6MDA.

Excellent! I think you are nearly there. Can you reboot the Pi, replicate the 'forbiden' issue, and then do cat /tmp/log/nginx/error.log and paste it here?

barjohn commented 5 years ago

Here is the log dump:

Last login: Thu Apr 25 19:05:21 2019 from fe80::10fb:a80c:9131:e4fb%wlan0

SSH is enabled and the default password for the 'pi' user has not been changed. This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.

pi@teslausb:~ $ cat /tmp/log/nginx/error.log 2019/04/25 19:56:00 [error] 507#507: 1 FastCGI sent in stderr: "PHP message: PHP Warning: session_start(): open(“/tmp/php/sessions”/sess_7fne5e5he35j2t6ivjthas8u47, ORDWR) failed: No such file or directory (2) in /var/www/html/filemanager/config/config.php on line 3" while reading response header from upstream, client: fe80::10fb:a80c:9131:e4fb, server: , request: "GET /filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "teslausb.local", referrer: "http://teslausb.local/videoList.php?" 2019/04/25 19:56:00 [error] 507#507: 1 FastCGI sent in stderr: "PHP message: PHP Warning: Unknown: open(“/tmp/php/sessions”/sess_7fne5e5he35j2t6ivjthas8u47, O_RDWR) failed: No such file or directory (2) in Unknown on line 0 PHP message: PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.savepath is correct (“/tmp/php/sessions”) in Unknown on line 0" while reading upstream, client: fe80::10fb:a80c:9131:e4fb, server: , request: "GET /filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "teslausb.local", referrer: "http://teslausb.local/videoList.php?" 2019/04/25 19:56:02 [error] 507#507: 1 FastCGI sent in stderr: "PHP message: PHP Warning: session_start(): open(“/tmp/php/sessions”/sess_7fne5e5he35j2t6ivjthas8u47, ORDWR) failed: No such file or directory (2) in /var/www/html/filemanager/config/config.php on line 3" while reading response header from upstream, client: fe80::10fb:a80c:9131:e4fb, server: , request: "GET /filemanager/dialog.php?type=0&lang=en_EN&popup=0&crossdomain=0&relative_url=0&akey=key&fldr=RecentClips%2F&5cc202c053515 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "teslausb.local", referrer: "http://teslausb.local/filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1" 2019/04/25 19:56:02 [error] 507#507: 1 FastCGI sent in stderr: "PHP message: PHP Warning: Unknown: open(“/tmp/php/sessions”/sess_7fne5e5he35j2t6ivjthas8u47, O_RDWR) failed: No such file or directory (2) in Unknown on line 0 PHP message: PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.savepath is correct (“/tmp/php/sessions”) in Unknown on line 0" while reading upstream, client: fe80::10fb:a80c:9131:e4fb, server: , request: "GET /filemanager/dialog.php?type=0&lang=en_EN&popup=0&crossdomain=0&relative_url=0&akey=key&fldr=RecentClips%2F&5cc202c053515 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "teslausb.local", referrer: "http://teslausb.local/filemanager/dialog.php?type=0&fldr=/&sort_by=date&descending=1" 2019/04/25 19:56:05 [error] 507#507: 1 FastCGI sent in stderr: "PHP message: PHP Warning: session_start(): open(“/tmp/php/sessions”/sess_7fne5e5he35j2t6ivjthas8u47, ORDWR) failed: No such file or directory (2) in /var/www/html/filemanager/config/config.php on line 3 PHP message: PHP Notice: Undefined index: RF in /var/www/html/filemanager/include/utils.php on line 3" while reading response header from upstream, client: fe80::10fb:a80c:9131:e4fb, server: , request: "GET /filemanager/ajax_calls.php?action=media_preview&title=file._2019-04-07_19-12-right_repeater&file=RecentClips/file._2019-04-07_19-12-right_repeater.mp4 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "teslausb.local", referrer: "http://teslausb.local/filemanager/dialog.php?type=0&lang=en_EN&popup=0&crossdomain=0&relative_url=0&akey=key&fldr=RecentClips%2F&5cc202c053515" 2019/04/25 19:56:05 [error] 507#507: 1 FastCGI sent in stderr: "PHP message: PHP Warning: Unknown: open(“/tmp/php/sessions”/sess_7fne5e5he35j2t6ivjthas8u47, O_RDWR) failed: No such file or directory (2) in Unknown on line 0 PHP message: PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.savepath is correct (“/tmp/php/sessions”) in Unknown on line 0" while reading upstream, client: fe80::10fb:a80c:9131:e4fb, server: , request: "GET /filemanager/ajax_calls.php?action=media_preview&title=file._2019-04-07_19-12-right_repeater&file=RecentClips/file._2019-04-07_19-12-right_repeater.mp4 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "teslausb.local", referrer: "http://teslausb.local/filemanager/dialog.php?type=0&lang=en_EN&popup=0&crossdomain=0&relative_url=0&akey=key&fldr=RecentClips%2F&5cc202c053515" pi@teslausb:~ $

On Apr 25, 2019, at 11:53 AM, ppamidimarri notifications@github.com wrote:

I found a typo I made in the nginx.conf file and after that ran the php test and it worked and the sessions section matched yours. Then I was able to bring up the web page but I still get the forbidden error. pi@teslausb:~ $ sudo nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful pi@teslausb:~ $ sudo /etc/init.d/nginx restart [ ok ] Restarting nginx (via systemctl): nginx.service. pi@teslausb:~ $ … <x-msg://159/#> On Apr 25, 2019, at 11:26 AM, ppamidimarri @.***> wrote: Try the sudo nginx -t first. If that says "OK", then sudo /etc/init.d/nginx restart to bring up the web server. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#4 (comment) https://github.com/ppamidimarri/TeslaDashcamWeb/issues/4#issuecomment-486786343>, or mute the thread https://github.com/notifications/unsubscribe-auth/ALOESMZ5KLLLE5PCC4ZEW33PSHZXBANCNFSM4HDY6MDA https://github.com/notifications/unsubscribe-auth/ALOESMZ5KLLLE5PCC4ZEW33PSHZXBANCNFSM4HDY6MDA.

Excellent! I think you are nearly there. Can you reboot the Pi, replicate the 'forbiden' issue, and then do cat /tmp/log/nginx/error.log and paste it here?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ppamidimarri/TeslaDashcamWeb/issues/4#issuecomment-486795783, or mute the thread https://github.com/notifications/unsubscribe-auth/ALOESM6NGEXKMUFNCUHHLZLPSH44FANCNFSM4HDY6MDA.

ppamidimarri commented 5 years ago

I don't know why this is happening. Can you try removing the " characters before and after /tmp/php/sessions in php.ini? It is working with those characters for me, but the error message seems to indicate that PHP is trying the open with those characters in the file name:

session_start(): open(“/tmp/php/sessions”/sess_7fne5e5he35j2t6ivjthas8u47, O_RDWR) 
barjohn commented 5 years ago

What is the path to the php.ini file

On Apr 25, 2019, at 12:01 PM, ppamidimarri notifications@github.com wrote:

I don't know why this is happening. Can you try removing the " characters before and after /tmp/php/sessions in php.ini? It is working with those characters for me, but the error message seems to indicate that PHP is trying the open with those characters in the file name:

session_start(): open(“/tmp/php/sessions”/sess_7fne5e5he35j2t6ivjthas8u47, O_RDWR) — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ppamidimarri/TeslaDashcamWeb/issues/4#issuecomment-486798271, or mute the thread https://github.com/notifications/unsubscribe-auth/ALOESMYMAL4GSBNBZ73FEBLPSH5XLANCNFSM4HDY6MDA.

ppamidimarri commented 5 years ago

/etc/php/7.0/fpm/php.ini