cimryan / teslausb

Steps and scripts for turning a Raspberry Pi into a useful USB drive for a Tesla
MIT License
580 stars 492 forks source link

Sync? #123

Open mg-chen opened 5 years ago

mg-chen commented 5 years ago

I've gone through all the steps and now have footage on my rpi. I originally thought the footage would automatically save to Google Drive but my drive is still empty and I haven't received a notification. Am I supposed to do something for the rpi to save the footage to Google Drive?

marcone commented 5 years ago

Did you manually save the clips (by pressing the button on the screen) ? By default the archive script only backs up the manually saved clips, not the 1-minute continuously recorded clips.

Did you check /mutable/archiveloop.log ?

rtanaka commented 5 years ago

Can you check to make sure rclone is configured correctly? You should see something like this if it is correct.

root@teslausb:/home/pi# rclone lsd gdrive:
            -1 2018-10-23 00:17:26        -1 TeslaCam
mg-chen commented 5 years ago

@therealmarcone Yea I've been manually pressing the button on the screen and have saved footage on the rpi. See attached for my logs

Logs.txt

@rtanaka Below is what I'm getting after running that command but this worked during the setup process and created/displayed my TeslaCam folder. So I'm guessing it stops working after I run './setup-teslausb' in the final steps

root@teslausb:/home/pi# rclone lsd gdrive: 2019/03/06 01:04:33 NOTICE: Config file "/root/.rclone.conf" not found - using defaults 2019/03/06 01:04:33 Failed to create file system for "gdrive:": didn't find section in config file

mg-chen commented 5 years ago

Update- I am now able to receive notifications. I was notified my files were uploaded by Pushover but I still do not see the files in my Google Drive folder.

rtanaka commented 5 years ago

@mg-chen - oops. sorry it's been a while since i looked at this... can you first confirm the config is set up correctly by running this command?

root@teslausb:~# ls -l /root/.config
total 0
lrwxrwxrwx 1 root root 23 Oct 31 10:25 rclone -> /mutable/configs/rclone
root@teslausb:~# 

and then run this command if the above works.

root@teslausb:~/bin# rclone --config /root/.config/rclone/rclone.conf lsd gdrive:
          -1 2018-10-23 00:17:26        -1 TeslaCam
root@teslausb:~/bin# 
mg-chen commented 5 years ago

@rtanaka the first command worked but not the second one. See below

screen shot 2019-03-06 at 3 11 35 pm
rtanaka commented 5 years ago

@mg-chen - so it looks like your rclone drive configuration is not correct. you'll have to re-do it.

create the file as root with this command:

rclone --config  /root/.config/rclone/rclone.conf config
  1. select "n" for new remotes
  2. use "gdrive" for name
  3. select google drive for type (should be 12)
  4. leave client_id and client_secret blank
  5. use drive.file as the scope (option 3)
  6. leave root_folder_id and service_account_file blank
  7. skip advanced config (n)
  8. select "N" for autoconfig
  9. copy the link to create a token
  10. copy that verification code
  11. say no to team drive
  12. y to confirm

try the command again and hopefully it'll work

mg-chen commented 5 years ago

@rtanaka I'm going through the setup process but I'm receiving this notice. I was thinking I can just create the file but I'm not sure if there is supposed to be code in it to begin with.

screen shot 2019-03-06 at 4 04 40 pm
rtanaka commented 5 years ago

@mg-chen - not sure exactly what happened but it's clear the config file got removed, deleted or was never created. without it, there's no way it will work.

mg-chen commented 5 years ago

@rtanaka That's a bummer. Thank for your help though!

rtanaka commented 5 years ago

no problem @mg-chen - were you able to get it to work after you restored the config?

mg-chen commented 5 years ago

@rtanaka Sorry for the late response, I've been pretty busy the last few days so I haven't been able to work on it as much. When I was last working on it my rclone.conf file would get removed by running ./ setup-teslausb even when I manually created the file.

I believe my next option would be to create the rclone.conf file in the .config directory and find out how to change the path to /root/.config/rclone.conf instead of /root/.config/rclone/rclone.conf

rtanaka commented 5 years ago

the set up scrips do not delete the rclone.conf file, it only just moves it.

you can see how to specify the config file location in one of my previous comments above. if the file is not there, it will create it after you successfully complete the config process.

mg-chen commented 5 years ago

@rtanaka Where does the script move rclone.conf to? Because I'm still getting the following in my logs.

Screen Shot 2019-03-14 at 2 51 36 PM
rtanaka commented 5 years ago

@mg-chen - the command that moves the configs is part of configure-archive.sh and does the following:

    mv /root/.config/rclone /mutable/configs
    ln -s /mutable/configs/rclone /root/.config/rclone
schmug commented 5 years ago

Did you manually save the clips (by pressing the button on the screen) ? By default the archive script only backs up the manually saved clips, not the 1-minute continuously recorded clips.

Did you check /mutable/archiveloop.log ?

I think I am having this issue as well but I do not have a /mutable/archiveloop.log

rclone lsd tesla3: works when I am mounted as read/write, I have files in TeslaCam and SavedClips but I don't believe the scripts are running.

marcone commented 5 years ago

@schmug did you do headless setup from the prebuilt images from rtgoodwin by any chance? I found the included sample conf file is missing the export ARCHIVE_SYSTEM=... line, and without that it won't install the proper scripts for your chosen backup method.

schmug commented 5 years ago

@therealmarcone

@schmug did you do headless setup from the prebuilt images from rtgoodwin by any chance? I found the included sample conf file is missing the export ARCHIVE_SYSTEM=... line, and without that it won't install the proper scripts for your chosen backup method.

I may have crippled myself but I have rebuilt so many times I cannot remember my last steps, should have documented. I tried to follow jspv's advice and I think I have everything working but no rclone script running

I will look there. I believe #128 is happening for me as well but running sudo modprobe -r g_mass_storage and sudo modprobe g_mass_storage seems to flip from Dashcam icon with gray dot to red dot (and working)

Rykemapo commented 5 years ago

If these pull requests don't get merged soon, we may need to make @therealmarcone fork the new master.

jspv commented 5 years ago

@schmug Did you try running configure.sh to configure the scripts (last section on my advice) I've had times that I needed to run that manually.

Also if you are using s3, you may want to double check your s3 policies to ensure you're allowing write. Trying a a manual 'rclone copy' to your bucket would be a good test.

schmug commented 5 years ago

@jspv thanks for the reply. I had in one iteration but I think I hadn't since I got it working better. I manually edited configure.sh since it had reference to cimryan to jspv and just ran it and rebooted but it isn't back yet so I'm headed to my car to take a peek and see what's wrong. Also am I reading it right that it will only occur on power on?

edit: It is working now. Just trying to figure out if it is working properly or not or if I need to manually get it to show up in the car with modprobe. Also I monitor my car with Zabbix so it never sleeps.. could throw a wrench.

jspv commented 5 years ago

You don’t need to edit configure.sh to change REPO or BRANCH, the hard coded cimryan only takes effect if you aren’t setting the BRANCH and REPO environment variables. If you set the variables, it will pull the script from the repo you specify.

Only need to run configure.sh once, it downloads the scrips to automate the device.

schmug commented 5 years ago

@jspv makes sense I think I was just being dense because it took me around 6 tries to get working haha. Does rclone only trigger automatically on boot or is it on wireless connect?

jspv commented 5 years ago

When you boot, archiveloop gets automatically run and keeps running forever. Archiveloop will check for a network connection, if it finds one it will sync the files. When done, it will turn the device into a usb drive and wait for a network disconnect and a later reconnect, at which time it will sync the new files and repeat the process.

You can fake a connection or disconnect by touching /tmp/archive_is_reachable and /tmp/archive_is_unreachable respectively for testing.

schmug commented 5 years ago

@jspv so I can say that your advice also worked for me on 2019.5.15. thanks!

rochec commented 5 years ago

Has anyone been able to find a solution for the config issues? I'm having the same issue that @mg-chen was having.

Should there be a .config directory? The contents of root are bin rpi-sync teslausb.conf

I've run through the config setup repeatedly and this happens each time.