Tesla not seeing USB drive
natrlhy opened this issue · 51 comments
Thanks for this code. Hoping to get it fully working. Here are the steps I've taken to go through the install. I've done everything thus far as root:
`Insert your SDHC card into your PC. Launch Etcher. Point it to the location of the Raspbian .zip file and flash the card. When that is completed, I ejected the card and reinserted it.
Connect the Micro USB to USB cable to the USB labeled port on the Pi Zero W
Use an SSH client to SSH to the Pi Zero W
hostname: rasbperrypi.local
username: pi
password: raspberry
Do everything as root:
sudo su -
cd /boot
vi wpa_supplicant.conf
Paste this for the WiFi Setup:
country=us
update_config=1
ctrl_interface=/var/run/wpa_supplicant
network={
scan_ssid=1
ssid="yourwifi"
psk="yourpassword"
}
reboot
SSH back into the Pi to install DaemonTools:
mkdir -p /package
chmod 1755 /package
cd /package
wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
tar -xpf daemontools-0.76.tar.gz
rm -f daemontools-0.76.tar.gz
cd admin/daemontools-0.76
ed ./src/conf-cc
1s/$/ -include errno.h/
wq
package/install
apt-get install csh
csh -cf '/command/svscanboot &'
sed -i "1 a\csh -cf '/command/svscanboot &'" /etc/rc.local
chmod +x /etc/rc.local
Install Node.js:
mkdir -p /opt/node; cd /opt/node
wget https://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-armv6l.tar.xz
tar -xvf node-v10.16.0-linux-armv6l.tar.xz
chown -R root:root node-v10.16.0-linux-armv6l
ln -s /opt/node/node-v10.16.0-linux-armv6l/bin/* /usr/bin/
apt-get install git
git config --global user.name "Me"
git config --global user.email myemail@user.com
cd /home/pi
git clone https://github.com/milesburton/teslacam
mkdir -p /etc/service;cd /etc/service;ln -s /home/pi/teslacam/services/* .
cd /home/pi/teslacam;npm install
cd /home/pi/teslacam/src/remote;npm install`
When I plug it into the USB port on the PI and the front USB on the Tesla M3, I never see the icon on the touchscreen that signifies the USB drive is seen.
I haven't done any DropBox integration yet as ultimately I want to upload to my Synology NAS
Does the drive mount when you plug it in to your PC? That's the first ACID test to make sure it appears
When I first flashed it I saw /boot. Now I don't see that in Explorer.
SSH:
pi@teslacam:~ $ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 59G 1.6G 55G 3% /
devtmpfs 213M 0 213M 0% /dev
tmpfs 217M 0 217M 0% /dev/shm
tmpfs 217M 3.1M 214M 2% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 217M 0 217M 0% /sys/fs/cgroup
/dev/mmcblk0p1 253M 40M 214M 16% /boot
tmpfs 44M 0 44M 0% /run/user/1000
Not seeing any logs in that dir...
root@teslacam:/home/pi# npm start
npm ERR! path /home/pi/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/home/pi/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-07-18T14_43_17_323Z-debug.log
root@teslacam:/home/pi# more /root/.npm/_logs/2019-07-18T14_43_17_323Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/opt/node/node-v10.16.0-linux-armv6l/bin/node',
1 verbose cli '/usr/bin/npm',
1 verbose cli 'start' ]
2 info using npm@6.9.0
3 info using node@v10.16.0
4 verbose stack Error: ENOENT: no such file or directory, open '/home/pi/package.json'
5 verbose cwd /home/pi
6 verbose Linux 4.19.57+
7 verbose argv "/opt/node/node-v10.16.0-linux-armv6l/bin/node" "/usr/bin/npm" "start"
8 verbose node v10.16.0
9 verbose npm v6.9.0
10 error path /home/pi/package.json
11 error code ENOENT
12 error errno -2
13 error syscall open
14 error enoent ENOENT: no such file or directory, open '/home/pi/package.json'
15 error enoent This is related to npm not being able to find a file.
16 verbose exit [ -2, true ]
Ok...
root@teslacam:/home/pi/teslacam# npm start
teslacam@1.0.0 start /home/pi/teslacam
node src/services start
Running [sudo svc -u /home/pi/teslacam/./services/dashcam-monitor]
svc: warning: unable to control /home/pi/teslacam/./services/dashcam-monitor: file does not exist
Running [sudo svc -u /home/pi/teslacam/./services/dropbox-upload]
svc: warning: unable to control /home/pi/teslacam/./services/dropbox-upload: file does not exist
Running [sudo svc -u /home/pi/teslacam/./services/rotate-video]
svc: warning: unable to control /home/pi/teslacam/./services/rotate-video: file does not exist
(node:648) ExperimentalWarning: The fs.promises API is experimental
Looks like it's not installed correctly. Can you run an "ls -lart" within the teslacam folder and again in the services folder? You may need to clone the repo again
root@teslacam:/home/pi/teslacam# pwd
/home/pi/teslacam
root@teslacam:/home/pi/teslacam# ls -lart
total 208
drwxr-xr-x 4 pi pi 4096 Jul 17 16:58 ..
-rw-r--r-- 1 root root 222 Jul 17 16:58 .eslintrc.json
-rw-r--r-- 1 root root 13 Jul 17 16:58 .eslintignore
-rw-r--r-- 1 root root 8307 Jul 17 16:58 README.md
-rw-r--r-- 1 root root 703 Jul 17 16:58 package.json
-rw-r--r-- 1 root root 11357 Jul 17 16:58 LICENSE
drwxr-xr-x 2 root root 4096 Jul 17 16:58 installation
drwxr-xr-x 2 root root 4096 Jul 17 16:58 images
-rw-r--r-- 1 root root 1324 Jul 17 16:58 .gitignore
drwxr-xr-x 2 root root 4096 Jul 17 16:58 etc
drwxr-xr-x 5 root root 4096 Jul 17 16:58 services
drwxr-xr-x 3 root root 4096 Jul 17 16:58 src
-rw-r--r-- 1 root root 57247 Jul 17 16:58 yarn.lock
drwxr-xr-x 2 root root 4096 Jul 17 16:58 video
drwxr-xr-x 2 root root 4096 Jul 17 16:58 supervise
drwxr-xr-x 8 root root 4096 Jul 17 16:58 .git
lrwxrwxrwx 1 root root 39 Jul 17 16:59 rotate-video -> /home/pi/teslacam/services/rotate-video
lrwxrwxrwx 1 root root 41 Jul 17 16:59 dropbox-upload -> /home/pi/teslacam/services/dropbox-upload
lrwxrwxrwx 1 root root 42 Jul 17 16:59 dashcam-monitor -> /home/pi/teslacam/services/dashcam-monitor
drwxr-xr-x 194 root root 4096 Jul 17 17:17 node_modules
-rw-r--r-- 1 root root 66747 Jul 17 17:17 package-lock.json
drwxr-xr-x 11 root root 4096 Jul 17 17:17 .
root@teslacam:/home/pi/teslacam/services# ls -latrh
total 20K
drwxr-xr-x 4 root root 4.0K Jul 17 16:58 rotate-video
drwxr-xr-x 4 root root 4.0K Jul 17 16:58 dropbox-upload
drwxr-xr-x 4 root root 4.0K Jul 17 16:58 dashcam-monitor
drwxr-xr-x 5 root root 4.0K Jul 17 16:58 .
drwxr-xr-x 11 root root 4.0K Jul 17 17:17 ..
Ok, and it's not an issue that it's all running as root?
Should I reflash?
My steps for cloning the repo is valid?
cd /home/pi
git clone https://github.com/milesburton/teslacam
Ok... I know one of your desires was to get an updated install guide setup. I'd be happy to help flush things out during my initial testing of this. I didn't see anything about the ~/teslacam/installation/sudoers installation so I'll add that to my notes thus far
I wonder if one of my issues is using this:
2019-07-10-raspbian-buster-lite.zip
When doing the 1st npm install I get this. Is this of concern?
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN react-virtualized@9.21.1 requires a peer of react@^15.3.0 || ^16.0.0-alpha but none is installed. You must install peer dependencies yourself.
npm WARN react-virtualized@9.21.1 requires a peer of react-dom@^15.3.0 || ^16.0.0-alpha but none is installed. You must install peer dependencies yourself.
npm WARN teslacam@1.0.0 No repository field.
added 216 packages from 153 contributors and audited 620 packages in 191.416s
found 0 vulnerabilities
Re-did everything. Services don't seem to ever start. I tried entering things into the /etc/rc.local but no go. Not sure where I'm going wrong. These are my steps:
Steps to get a Raspberry Pi Zero W setup for TeslaCam on Windows
Hardware:
https://www.amazon.com/gp/product/B013G4EAEI/
https://www.amazon.com/gp/product/B0748MPQT4/
64GB SDHC Card (already had one I got from Costco)
Download and the latest "lite" Raspbian: https://www.raspberrypi.org/downloads/raspbian/
Download and install Etcher: https://www.balena.io/etcher/
Insert your SDHC card into your PC. Launch Etcher. Point it to the location of the Raspbian .zip file and flash the card. When that is completed, re-insert the SDHC card into your PC
===== Enable OTG on the Pi Zero W =====
Follow this great guide to setup OTG on the Pi Zero W: https://blog.gbaman.info/?p=791
Browse to the /boot partition on the SDHC card on your PC
Add this to the bottom of the config.txt file:
dtoverlay=dwc2
Save the file
Add this to the cmdline.txt file. Place it right after rootwait with a space at the end of it. Be careful as syntax is critical:
modules-load=dwc2,g_ether
Save the file
===== Configure WiFi =====
Follow this guide for WiFi setup: https://www.raspberrypi-spy.co.uk/2017/04/manually-setting-up-pi-wifi-using-wpa_supplicant-conf/
Create a file called wpa_supplicant.conf
Paste this for the WiFi Setup:
country=us
update_config=1
ctrl_interface=/var/run/wpa_supplicant
network={
scan_ssid=1
ssid="yourwifi"
psk="yourpassword"
}
Save the file
==== Boot the Pi Zero W for the first time =====
Eject the SDHC card from your PC
Place the SDHC card into the proper slot on the Pi Zero W
Connect your USB Micro to USB cable to the USB port on the Pi Zero W
Connect the this to your PC and wait for the Pi to boot (about 2 minutes. The green light on the Pi will be solid green)
Use an SSH client to SSH to the Pi Zero W
hostname: rasbperrypi.local
username: pi
password: raspberry
===== Installing daemontools =====
https://isotope11.com/blog/manage-your-services-with-daemontools
SSH back into the Pi to install daemontools:
sudo su -
mkdir -p /package
chmod 1755 /package
cd /package
wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
tar -xpf daemontools-0.76.tar.gz
rm -f daemontools-0.76.tar.gz
cd admin/daemontools-0.76
ed ./src/conf-cc
1s/$/ -include errno.h/
wq
package/install
apt-get install csh
csh -cf '/command/svscanboot &'
sed -i "1 a\csh -cf '/command/svscanboot &'" /etc/rc.local
chmod +x /etc/rc.local
reboot
===== Install Node.js =====
mkdir -p /opt/node; cd /opt/node
wget https://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-armv6l.tar.xz
tar -xvf node-v10.16.0-linux-armv6l.tar.xz
chown -R root:root node-v10.16.0-linux-armv6l
ln -s /opt/node/node-v10.16.0-linux-armv6l/bin/* /usr/bin/
===== Install GIT =====
apt-get install git
As the pi User:
cd /home/pi
git clone https://github.com/milesburton/teslacam
===== Final Steps =====
As root:
mkdir -p /etc/service;cd /etc/service;ln -s /home/pi/teslacam/services/* .
vi /etc/sudoers
r /home/pi/teslacam/installation/sudoers
reboot
As the pi User:
cd /home/pi/teslacam;npm install
cd /home/pi/teslacam/src/remote;npm install
sudo poweroff
Plug the Pi Zero W into the Tesla media USB ports (the front ports). Make sure you use the data port on the Pi, google if you are unsure.
Reboot, once the automatic configuration completes (circa 1 minute) the car should detect the Pi as a USB drive.
I got this error when just using the command:
pi@raspberrypi:~ $ /home/pi/teslacam/src; node dashcam-monitor.js
-bash: /home/pi/teslacam/src: Is a directory
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module '/home/pi/dashcam-monitor.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
But when I cd to the /home/pi/teslacam/src and run node dashcam-monitor.js:
pi@raspberrypi:~/teslacam/src $ node dashcam-monitor.js
Starting Tesla Sync script
Unmounting image All
Running [sudo /sbin/modprobe -r g_mass_storage]
Preparing to unmount local image 0
Running [sudo /bin/umount /mnt]
umount: /mnt: not mounted.
Failed: code [32]: umount: /mnt: not mounted.
Running [sudo /sbin/losetup -d /dev/loop0]
losetup: /dev/loop0: detach failed: No such device or address
Failed: code [1]: losetup: /dev/loop0: detach failed: No such device or address
(node:507) ExperimentalWarning: The fs.promises API is experimental
Video /home/pi/teslacam/video/.gitkeep is 0 bytes. Deleting file
Running [rm /home/pi/teslacam/video/.gitkeep]
Running [fallocate -l 1024M /home/pi/teslacam/images/cam0]
Running [echo "type=c" | /sbin/sfdisk /home/pi/teslacam/images/cam0]
======================= Success
Checking that no-one is using this disk right now ... OK
Disk /home/pi/teslacam/images/cam0: 1 GiB, 1073741824 bytes, 2097152 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Created a new DOS disklabel with disk identifier 0x7958db6d.
/home/pi/teslacam/images/cam0p1: Created a new partition 1 of type 'W95 FAT32 (LBA)' and of size 1023 MiB.
/home/pi/teslacam/images/cam0p2: Done.
New situation:
Disklabel type: dos
Disk identifier: 0x7958db6d
Device Boot Start End Sectors Size Id Type
/home/pi/teslacam/images/cam0p1 2048 2097151 2095104 1023M c W95 FAT32 (LBA)
The partition table has been altered.
Syncing disks.
======================= /Success
Preparing to local mount image 0
Running [sfdisk -l -o Size -q --bytes "/home/pi/teslacam/images/cam0" | tail -1]
Success: 1072693248
Running [sfdisk -l -o Sectors -q "/home/pi/teslacam/images/cam0" | tail -1]
Success: 2095104
Sector size: 512
Running [sfdisk -l -o Start -q "/home/pi/teslacam/images/cam0" | tail -1]
Success: 2048
Running [sudo /sbin/losetup -o 1048576 /dev/loop0 /home/pi/teslacam/images/cam0]
Running [sudo /sbin/mkfs.vfat /dev/loop0 -F 32 -I]
Success: mkfs.fat 4.1 (2017-01-24)
Preparing to unmount local image 0
Running [sudo /bin/umount /mnt]
umount: /mnt: not mounted.
Failed: code [32]: umount: /mnt: not mounted.
Running [sudo /sbin/losetup -d /dev/loop0]
Running [fallocate -l 1024M /home/pi/teslacam/images/cam1]
Running [echo "type=c" | /sbin/sfdisk /home/pi/teslacam/images/cam1]
======================= Success
Checking that no-one is using this disk right now ... OK
Disk /home/pi/teslacam/images/cam1: 1 GiB, 1073741824 bytes, 2097152 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Created a new DOS disklabel with disk identifier 0xb8117a6c.
/home/pi/teslacam/images/cam1p1: Created a new partition 1 of type 'W95 FAT32 (LBA)' and of size 1023 MiB.
/home/pi/teslacam/images/cam1p2: Done.
New situation:
Disklabel type: dos
Disk identifier: 0xb8117a6c
Device Boot Start End Sectors Size Id Type
/home/pi/teslacam/images/cam1p1 2048 2097151 2095104 1023M c W95 FAT32 (LBA)
The partition table has been altered.
Syncing disks.
======================= /Success
Preparing to local mount image 1
Running [sfdisk -l -o Size -q --bytes "/home/pi/teslacam/images/cam1" | tail -1]
Success: 1072693248
Running [sfdisk -l -o Sectors -q "/home/pi/teslacam/images/cam1" | tail -1]
Success: 2095104
Sector size: 512
Running [sfdisk -l -o Start -q "/home/pi/teslacam/images/cam1" | tail -1]
Success: 2048
Running [sudo /sbin/losetup -o 1048576 /dev/loop1 /home/pi/teslacam/images/cam1]
Running [sudo /sbin/mkfs.vfat /dev/loop1 -F 32 -I]
Success: mkfs.fat 4.1 (2017-01-24)
Preparing to unmount local image 1
Running [sudo /bin/umount /mnt]
umount: /mnt: not mounted.
Failed: code [32]: umount: /mnt: not mounted.
Running [sudo /sbin/losetup -d /dev/loop1]
Preparing to local mount image 0
Running [sfdisk -l -o Size -q --bytes "/home/pi/teslacam/images/cam0" | tail -1]
Success: 1072693248
Running [sfdisk -l -o Sectors -q "/home/pi/teslacam/images/cam0" | tail -1]
Success: 2095104
Sector size: 512
Running [sfdisk -l -o Start -q "/home/pi/teslacam/images/cam0" | tail -1]
Success: 2048
Running [sudo /sbin/losetup -o 1048576 /dev/loop0 /home/pi/teslacam/images/cam0]
Running [sudo /bin/mount -o gid=pi,uid=pi /dev/loop0 /mnt]
No files found
Preparing to unmount local image 0
Running [sudo /bin/umount /mnt]
Running [sudo /sbin/losetup -d /dev/loop0]
Preparing to local mount image 1
Running [sfdisk -l -o Size -q --bytes "/home/pi/teslacam/images/cam1" | tail -1]
Success: 1072693248
Running [sfdisk -l -o Sectors -q "/home/pi/teslacam/images/cam1" | tail -1]
Success: 2095104
Sector size: 512
Running [sfdisk -l -o Start -q "/home/pi/teslacam/images/cam1" | tail -1]
Success: 2048
Running [sudo /sbin/losetup -o 1048576 /dev/loop1 /home/pi/teslacam/images/cam1]
Running [sudo /bin/mount -o gid=pi,uid=pi /dev/loop1 /mnt]
No files found
Preparing to unmount local image 1
Running [sudo /bin/umount /mnt]
Running [sudo /sbin/losetup -d /dev/loop1]
Preparing to mount image 0
Running [sudo /sbin/modprobe g_mass_storage file=/home/pi/teslacam/images/cam0 removable=1 ro=0 stall=0 iSerialNumber=11610]
Waiting for video files
As the pi user here's the output for npm:
pi@raspberrypi:/teslacam $ pwd/teslacam $ npm run start
/home/pi/teslacam
pi@raspberrypi:
teslacam@1.0.0 start /home/pi/teslacam
node src/services start
Running [sudo svc -u /home/pi/teslacam/./services/dashcam-monitor]
svc: warning: unable to control /home/pi/teslacam/./services/dashcam-monitor: file does not exist
Running [sudo svc -u /home/pi/teslacam/./services/dropbox-upload]
svc: warning: unable to control /home/pi/teslacam/./services/dropbox-upload: file does not exist
Running [sudo svc -u /home/pi/teslacam/./services/rotate-video]
svc: warning: unable to control /home/pi/teslacam/./services/rotate-video: file does not exist
(node:812) ExperimentalWarning: The fs.promises API is experimental
Not seeing anything to write to:
pi@raspberrypi:~/teslacam $ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 61133444 3730916 54887156 7% /
devtmpfs 217224 0 217224 0% /dev
tmpfs 221552 0 221552 0% /dev/shm
tmpfs 221552 3124 218428 2% /run
tmpfs 5120 4 5116 1% /run/lock
tmpfs 221552 0 221552 0% /sys/fs/cgroup
/dev/mmcblk0p1 258096 39969 218127 16% /boot
tmpfs 44308 0 44308 0% /run/user/1000
So I only have the USB cable connected to my PC now. I don't have external power running to the Pi at the moment. When I run the command connected like this I don't get a drive mounted on my PC. Should I be supplying external power in the outtermost USB port on the Pi then connecting it to a USB port on my PC with 2nd port towards the inside of the pi?
:( Not doing it with either a single USB cable or externally powered. I'm going to try the stretch-lite flashing and see if that is a culprit. Not sure what I'm doing wrong here otherwise...
A quick breakdown of permission stuff though. I'm doing everything as root except when I clone the repo. I'm doing that as the pi user and I'm also running the node dashcam-monitor.js command as the pi user. I have the sudoers file in place as well....
Latest output when starting it:
pi@raspberrypi:~/teslacam/src $ node dashcam-monitor.js
Starting Tesla Sync script
Unmounting image All
Running [sudo /sbin/modprobe -r g_mass_storage]
Preparing to unmount local image 0
Running [sudo /bin/umount /mnt]
umount: /mnt: not mounted.
Failed: code [32]: umount: /mnt: not mounted.
Running [sudo /sbin/losetup -d /dev/loop0]
losetup: /dev/loop0: detach failed: No such device or address
Failed: code [1]: losetup: /dev/loop0: detach failed: No such device or address
(node:479) ExperimentalWarning: The fs.promises API is experimental
Preparing to local mount image 0
Running [sfdisk -l -o Size -q --bytes "/home/pi/teslacam/images/cam0" | tail -1]
Success: 1072693248
Running [sfdisk -l -o Sectors -q "/home/pi/teslacam/images/cam0" | tail -1]
Success: 2095104
Sector size: 512
Running [sfdisk -l -o Start -q "/home/pi/teslacam/images/cam0" | tail -1]
Success: 2048
Running [sudo /sbin/losetup -o 1048576 /dev/loop0 /home/pi/teslacam/images/cam0]
Running [sudo /bin/mount -o gid=pi,uid=pi /dev/loop0 /mnt]
No files found
Preparing to unmount local image 0
Running [sudo /bin/umount /mnt]
Running [sudo /sbin/losetup -d /dev/loop0]
Preparing to local mount image 1
Running [sfdisk -l -o Size -q --bytes "/home/pi/teslacam/images/cam1" | tail -1]
Success: 1072693248
Running [sfdisk -l -o Sectors -q "/home/pi/teslacam/images/cam1" | tail -1]
Success: 2095104
Sector size: 512
Running [sfdisk -l -o Start -q "/home/pi/teslacam/images/cam1" | tail -1]
Success: 2048
Running [sudo /sbin/losetup -o 1048576 /dev/loop1 /home/pi/teslacam/images/cam1]
Running [sudo /bin/mount -o gid=pi,uid=pi /dev/loop1 /mnt]
No files found
Preparing to unmount local image 1
Running [sudo /bin/umount /mnt]
Running [sudo /sbin/losetup -d /dev/loop1]
Preparing to mount image 0
Running [sudo /sbin/modprobe g_mass_storage file=/home/pi/teslacam/images/cam0 removable=1 ro=0 stall=0 iSerialNumber=56691]
Waiting for video files
I wait there and don't see any drive getting mounted to my Windows 10 PC.
No errors doing that but I don't see a USB disk appear on the PC:
pi@raspberrypi:~ $ sudo /sbin/modprobe -r g_mass_storage
pi@raspberrypi:~ $ sudo /bin/umount /mnt
umount: /mnt: not mounted.
pi@raspberrypi:~ $ sudo /sbin/losetup -d /dev/loop0
losetup: /dev/loop0: detach failed: No such device or address
pi@raspberrypi:~ $ sudo /sbin/modprobe g_mass_storage file=/home/pi/teslacam/images/cam0 removable=1 ro=0 stall=0 iSerialNumber=56691
I'll try Stretch and doing the main branch one more time then give the ext4 branch a go if that fails again.
Thanks for all the help!
Was going to ask if you wanted to do a WebEx at some point hehe
ps did you see this (I forgot about it)
Modify the /boot partition to enable USB OTG. We need to enable g_mass_storage and dw2. 2b. Edit your cmdline.txt to include "loop.max_part=31". The file should look similar to: "dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=53202854-02 rootfstype=ext4 elevator=deadline fsck.repair=yes loop.max_part=31 rootwait modules-load=dwc2,g_mass_storage
I only have this portion:
===== Enable OTG on the Pi Zero W =====
Follow this great guide to setup OTG on the Pi Zero W: https://blog.gbaman.info/?p=791
Browse to the /boot partition on the SDHC card on your PC
Add this to the bottom of the config.txt file:
dtoverlay=dwc2
Save the file
Add this to the cmdline.txt file. Place it right after rootwait with a space at the end of it. Be careful as syntax is critical:
modules-load=dwc2,g_ether
Save the file
Ok i'm trying this out on stretch as is. I'll make the change to the cmdline.txt (you mentioned it's the config.txt file so correct me if I'm wrong) after I get it up and running again
Boom! When I added the g_mass_storage module to the cmdline.txt file, rebooted and ran node dashcam-monitor.js it mounted a 1GB USB drive on the PC. You're notes did call out having g_mass_storage setup but I was doing a copy from the URL that was referenced.
I do notice that services still aren't starting though. They don't seem to background processes so do they just run on boot and that's it?
Ok when I reboot the pi, I get an error on the PC saying USB mass storage device not recognized and I don't see a drive mounted.
I also don't see any log info here:
~/teslacam/services/dashcam-monitor/log/main
I was going by your instructions of creating the links to services:
/etc/service ln -s /home/pi/teslacam/services/* .
/etc/service doesn't exist so I'm creating it. /etc/services is a file that exists already so not sure if thing service wise are setup properly.
Thanks for all your help! Sounds good...
:( Not doing it with either a single USB cable or externally powered. I'm going to try the stretch-lite flashing and see if that is a culprit. Not sure what I'm doing wrong here otherwise...
A quick breakdown of permission stuff though. I'm doing everything as root except when I clone the repo. I'm doing that as the pi user and I'm also running the node dashcam-monitor.js command as the pi user. I have the sudoers file in place as well....
So, I'm EXACTLY the same place. I've been at this for hours and can't get this going. If you resolve this, please ping me.
Edit: I just noticed in your instructions I'm supposed to "cd /etc/service ln -s /home/pi/teslacam/services/* " /etc/service does not exist in my system. I just tried doing a mkdir but is this maybe an issue with DaemonTools not installing right?
OK let's try something simple. Let's start the dashcam-monitor.js directly. To do that, cd /home/pi/teslacam/src; node dashcam-monitor.js // whilst plugged in to your computer. The services could be something irrelevant. Now you've checked out the code again, what did npm run start do for you from /home/pi/teslacam?
…
Ok, after my above edit and a fourth attempt at redoing everything I now have node dashcam-monitor.js mount a drive to my local machine. It still doesn't run as a service but this is progress.
`pi@raspberrypi:~/teslacam $ npm start
teslacam@1.0.0 start /home/pi/teslacam
node src/services start
Running [sudo svc -u /home/pi/teslacam/./services/dashcam-monitor]
svc: warning: unable to control /home/pi/teslacam/./services/dashcam-monitor: file does not exist
Running [sudo svc -u /home/pi/teslacam/./services/dropbox-upload]
svc: warning: unable to control /home/pi/teslacam/./services/dropbox-upload: file does not exist
Running [sudo svc -u /home/pi/teslacam/./services/rotate-video]
svc: warning: unable to control /home/pi/teslacam/./services/rotate-video: file does not exist
(node:1720) ExperimentalWarning: The fs.promises API is experimental
`
Side note: is the /teslacam/./services an issue? that period in the folder stands out to me.
Right, looks like services isn't correctly cloned down. You need the files in this directory to appear
https://github.com/milesburton/teslacam/tree/master/services
you could try a git reset --hard, that should revert any changes you may have made accidentally.
I am using buster-lite and had same issue of file does not exist. Not sure this was the fix, but try creating a symbolic link to /opt/node/bin/node in /bin. we already have node in /usr/bin, but add it to /bin folder. Let me know if this fixes anyone else.
I still have a problem where supervise is not running and the rc.local does not seem to kick off /command/svscanboot. Anyone have recommendation? Even if I sudo /command/svscanboot &, I see supervise not running.
sudo supervise /etc/service/dashcam-monitor does run the service.
Hopefully the image installer will resolve these issues. It shouldn't be long before that's merged to master.
I found my two issues.
- i added the /command/svscanboot to the end of rc.local, it needed to be above the exit 0 line.
- the file svscanboot pointed to /service in three locations, I changed all to /etc/service. I will try to install in my car later today. but it boots and drive mount appears on my mac.
thank you.