teslausb icon indicating copy to clipboard operation
teslausb copied to clipboard

Model 3 doesn't recognize the drive after 2019.5.x

Open ppamidimarri opened this issue 6 years ago • 51 comments

I got a grey X on my Model 3 display after the 2019.5.3 update. I rebuilt my drive again (and now I am on 2019.5.4) but same error.

I am setting up my drive using an older version of setup-teslausb after setting the environment variables for rclone (and campercent=60). I am setting up my Pi Zero W first to have an nginx webserver and then running setup-teslausb to create the partitions and make the / filesystem read-only. This method worked reliably on 2018.x.x versions of the car software.

The drive works properly when my Pi Zero W is plugged into my Windows 10 laptop. But it won't get recognized by the car. Is this a known issue, and is there a different way to create the partitions now?

ppamidimarri avatar Feb 25 '19 21:02 ppamidimarri

Same here!

Somebody please take a look. I was very happy with this setup until the recent Tesla Sentry Mode update.

I tried rebuilding without the music partition, same issue. The music partition by itself is recognized by Tesla.

lolento avatar Feb 26 '19 00:02 lolento

Same here... Model 3 on 2019.5.4 4c3c414. Tried a few times with 3 different SD cards (latest one a SanDisk Ultra 400 GB with class 10 / A1 / U1 rating). On first plugin after setting up the Pi, it looks like it might work for a second, then grey X. Next plugin, goes straight to grey X.

Thanks for the great project... I hope I can get it back to being functional!

acostein avatar Mar 03 '19 06:03 acostein

hey @ppamidimarri @lolento @acostein - i just got the update and noticed the same thing. can you guys try and post your logs -- i will do the same and try and see what's going on.

rtanaka avatar Mar 06 '19 00:03 rtanaka

hey @ppamidimarri @lolento @acostein - i just got the update and noticed the same thing. can you guys try and post your logs -- i will do the same and try and see what's going on.

I am on a trip out of town, will post my logs when I get home.

ppamidimarri avatar Mar 07 '19 02:03 ppamidimarri

I wish I can help but I'm also traveling and I already repurpose the Pi0W as a pi-hole.

lolento avatar Mar 08 '19 05:03 lolento

@rtanaka I just got back home and I have been trying to find any relevant logs. I don't see anything. The process I used to set up my Pi is non-standard. Here is what I am doing:

  1. Start with a clean install of Raspbian Stretch Lite
  2. Install nginx, php-fpm and php-mbstring
  3. Install and configure rclone, download my website scripts, verify that my website is running
  4. Change /etc/rc.local to do a filesystem check, run modprobe and prepare some temp files for PHP and nginx to run properly:
pi@dpi:~ $ cat /etc/rc.local
#!/bin/bash -e
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
        printf "My IP address is %s\n" "$_IP"
fi
LOGFILE=/tmp/rc.local.log

function log () {
        echo -n "$( date )" >> "$LOGFILE"
        echo -n ": " >> "$LOGFILE"
        echo "$1" >> "$LOGFILE"
}

log "Running fsck..."
/sbin/fsck /mnt/cam -- -a >> "$LOGFILE" 2>&1 || echo ""
log "Running modprobe..."
/sbin/modprobe g_mass_storage >> "$LOGFILE" 2>&1
log "Preparing temp files..."
/bin/cp /root/.config/rclone/rclone.conf /tmp/rclone.conf >> "$LOGFILE" 2>&1
/bin/chmod 644 /tmp/rclone.conf >> "$LOGFILE" 2>&1
/bin/mkdir /var/log/nginx >> "$LOGFILE" 2>&1
/bin/mkdir -p /tmp/php/sessions >> "$LOGFILE" 2>&1
/bin/chown www-data:pi /tmp/php/sessions >> "$LOGFILE" 2>&1
/bin/mkdir -p /tmp/log/nginx >> "$LOGFILE" 2>&1
log "Starting nginx..."
/usr/sbin/service nginx start >> "$LOGFILE" 2>&1
log "All done"

exit 0
  1. Download setup-teslausb from this repository, export shell variables RCLONE_ENABLE, RCLONE_DRIVE, RCLONE_PATH and campercent and run the setup script
  2. Reboot

This process used to work perfectly before 2019.5.x. Now with a newly formatted Micro SD card, I ran all these steps. It ran fine with no error messages at all.

The log files I do see now are the ones for my nginx server and they are working just fine. The rc.local log file in /tmp looks normal as well:

pi@dpi:~ $ cat /tmp/rc.local.log 
Thu Nov  3 10:17:04 PDT 2016: Running fsck...
fsck from util-linux 2.29.2
fsck.fat 4.1 (2017-01-24)
/backingfiles/cam_disk.bin: 5 files, 5/2144943 clusters
Thu Nov  3 10:17:07 PDT 2016: Running modprobe...
Thu Nov  3 10:17:07 PDT 2016: Preparing temp files...
Thu Nov  3 10:17:07 PDT 2016: Starting nginx...
Thu Nov  3 10:17:10 PDT 2016: All done

Now when I plug my Pi0W into my Windows 10 computer, even the computer is not showing the CAM and MUSIC drives. Those drives showed up fine on the computer the first time it rebooted (after step 5 above), before I tried the Pi0W (without success) in the car with 2019.5.3.

To try to see what's going on, I tried running sudo modprobe g_mass_storage over SSH. It ran without any error messages, but still no drives show up on the computer. After that, if I do mount /mnt/cam on the Pi, I can cd /mnt/cam and ls to see that there is a directory called TeslaCam in there. It is empty. umount /mnt/cam works without producing any error messages either, as does sudo modprobe -r g_mass_storage.

As far as I can tell, the contents of /etc/modprobe.d/g_mass_storage.conf look good:

pi@dpi:~ $ cat /etc/modprobe.d/g_mass_storage.conf
options g_mass_storage file=/backingfiles/music_disk.bin,/backingfiles/cam_disk.bin removable=1,1 ro=0,0 stall=0 iSerialNumber=123456

and df -H shows mutable and backingfiles with space allocated to them:

pi@dpi:~ $ df -H
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       1.8G  1.3G  434M  74% /
devtmpfs        223M     0  223M   0% /dev
tmpfs           228M     0  228M   0% /dev/shm
tmpfs           228M  6.1M  222M   3% /run
tmpfs           5.3M  4.1k  5.3M   1% /run/lock
tmpfs           228M     0  228M   0% /sys/fs/cgroup
tmpfs           228M   17k  228M   1% /var/log
tmpfs           228M   13k  228M   1% /tmp
tmpfs           228M     0  228M   0% /var/tmp
/dev/mmcblk0p1   46M   23M   23M  51% /boot
/dev/mmcblk0p4   99M  1.6M   90M   2% /mutable
/dev/mmcblk0p3  124G  118G     0 100% /backingfiles
tmpfs            46M     0   46M   0% /run/user/1000

This is what my /etc/fstab looks like:

pi@dpi:~ $ cat /etc/fstab
proc            /proc           proc    defaults          0       0
PARTUUID=ee3c92e0-01  /boot           vfat    defaults,ro          0       2
PARTUUID=ee3c92e0-02  /               ext4    defaults,noatime,ro  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that

/dev/mmcblk0p3 /backingfiles ext4 auto,rw,noatime 0 2
/dev/mmcblk0p4 /mutable ext4 auto,rw 0 2
/backingfiles/cam_disk.bin /mnt/cam vfat noauto,users,umask=000 0 0
/backingfiles/music_disk.bin /mnt/music vfat noauto,users,umask=000 0 0

tmpfs /var/log tmpfs nodev,nosuid 0 0
tmpfs /var/tmp tmpfs nodev,nosuid 0 0
tmpfs /tmp    tmpfs nodev,nosuid 0 0

Is there anything else I can check to find what the problem is?

ppamidimarri avatar Mar 10 '19 00:03 ppamidimarri

@ppamidimarri - thanks for a bunch of information. i've been trying to get to the bottom of it myself with no luck. can you please share your /tmp/archivelog.txt and dmesg contents preferably after it fails to mount (i.e. the "X" shows up for the camera). i've tried re-formatting as well as numerous fsck attempts but i still can't seem to get to the bottom of it.

rtanaka avatar Mar 10 '19 03:03 rtanaka

@rtanaka I don't have a file called /tmp/archivelog.txt and I think that is because my set up process doesn't install an auto-archiving script. I archive selected files to gdrive using the web interface I built. That was working on previous versions of the car software. Now the car won't see the drive so there are no files to display and select for archiving.

Edit: I will try to get the dmesg contents and share them.

ppamidimarri avatar Mar 10 '19 04:03 ppamidimarri

Finally got 2019.5.15 today, and also got the grey X after the update. The problem seems to be caused by the filesystem image itself though, because when I used 'dd' to make a copy of an existing working sd card and then copied that onto the Pi in place of /backingfiles/cam_disk.bin, it worked again.

While playing with this I also noticed some peculiar behavior with Windows 10:

  • right click and eject the music and cam drives
  • unplug the pi (I have it on a battery, so it stays powered)
  • plug it back in
  • Windows will show the drives, but will show them as unformatted / unknown filesystem
  • ssh into the pi, "modprobe -r g_mass_storage", the drives will disappear from Windows
  • "modprobe g_mass_storage", and the drives will reappear, this time correctly as music/cam drives
  • repeat from step 1

Not sure if it behaved like this before, but I had to this once while it was connected to the car as well, before it would see the drives.

marcone avatar Mar 10 '19 06:03 marcone

@rtanaka Here are my dmesg contents from boot (a few hours ago), connected to my Windows 10 laptop, until now:

[Mar 9 15:19] Booting Linux on physical CPU 0x0
[  +0.000000] Linux version 4.14.98+ (dom@dom-XPS-13-9370) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1200 Tue 
[  +0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d
[  +0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
[  +0.000000] OF: fdt: Machine model: Raspberry Pi Zero W Rev 1.1
[  +0.000000] Memory policy: Data cache writeback
[  +0.000000] cma: Reserved 8 MiB at 0x1b400000
[  +0.000000] On node 0 totalpages: 114688
[  +0.000000] free_area_init_node: node 0, pgdat c09caaf0, node_mem_map db010000
[  +0.000000]   Normal zone: 1008 pages used for memmap
[  +0.000000]   Normal zone: 0 pages reserved
[  +0.000000]   Normal zone: 114688 pages, LIFO batch:31
[  +0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[  +0.000000] pcpu-alloc: [0] 0 
[  +0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 113680
[  +0.000000] Kernel command line: 8250.nr_uarts=0 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708_fb.fbswap=1 smsc95xx.macaddr=B
[  +0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
[  +0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[  +0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[  +0.000000] Memory: 435212K/458752K available (6451K kernel code, 589K rwdata, 1992K rodata, 440K init, 673K bss, 15348K reserved, 819
[  +0.000000] Virtual kernel memory layout:
                  vector  : 0xffff0000 - 0xffff1000   (   4 kB)
                  fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
                  vmalloc : 0xdc800000 - 0xff800000   ( 560 MB)
                  lowmem  : 0xc0000000 - 0xdc000000   ( 448 MB)
                  modules : 0xbf000000 - 0xc0000000   (  16 MB)
                    .text : 0xc0008000 - 0xc0655050   (6453 kB)
                    .init : 0xc08d4000 - 0xc0942000   ( 440 kB)
                    .data : 0xc0942000 - 0xc09d54f8   ( 590 kB)
                     .bss : 0xc09dadf0 - 0xc0a8338c   ( 674 kB)
[  +0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[  +0.000000] ftrace: allocating 24128 entries in 71 pages
[  +0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[  +0.000000] sched_clock: 32 bits at 1000kHz, resolution 1000ns, wraps every 2147483647500ns
[  +0.000033] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275 ns
[  +0.000084] bcm2835: system timer (irq = 27)
[  +0.000569] Console: colour dummy device 80x30
[  +0.000026] console [tty1] enabled
[  +0.000035] Calibrating delay loop... 697.95 BogoMIPS (lpj=3489792)
[  +0.059513] pid_max: default: 32768 minimum: 301
[  +0.000492] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[  +0.000020] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[  +0.001299] Disabling memory control group subsystem
[  +0.000167] CPU: Testing write buffer coherency: ok
[  +0.001140] Setting up static identity map for 0x8200 - 0x8238
[  +0.001244] devtmpfs: initialized
[  +0.009641] random: get_random_u32 called from bucket_table_alloc+0x88/0x1c4 with crng_init=0
[  +0.001012] VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5
[  +0.000384] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[  +0.000030] futex hash table entries: 256 (order: -1, 3072 bytes)
[  +0.001360] pinctrl core: initialized pinctrl subsystem
[  +0.001344] NET: Registered protocol family 16
[  +0.003087] DMA: preallocated 1024 KiB pool for atomic coherent allocations
[  +0.006679] hw-breakpoint: found 6 breakpoint and 1 watchpoint registers.
[  +0.000017] hw-breakpoint: maximum watchpoint size is 4 bytes.
[  +0.000132] Serial: AMBA PL011 UART driver
[  +0.002947] bcm2835-mbox 2000b880.mailbox: mailbox enabled
[  +0.000721] uart-pl011 20201000.serial: could not find pctldev for node /soc/gpio@7e200000/uart0_pins, deferring probe
[  +0.039236] bcm2835-dma 20007000.dma: DMA legacy API manager at dc80d000, dmachans=0x1
[  +0.002305] SCSI subsystem initialized
[  +0.000220] usbcore: registered new interface driver usbfs
[  +0.000095] usbcore: registered new interface driver hub
[  +0.000210] usbcore: registered new device driver usb
[  +0.006736] raspberrypi-firmware soc:firmware: Attached to firmware from 2019-02-12 19:42
[  +0.002132] clocksource: Switched to clocksource timer
[  +0.085898] VFS: Disk quotas dquot_6.6.0
[  +0.000123] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[  +0.000293] FS-Cache: Loaded
[  +0.000326] CacheFiles: Loaded
[  +0.017238] NET: Registered protocol family 2
[  +0.001191] TCP established hash table entries: 4096 (order: 2, 16384 bytes)
[  +0.000089] TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
[  +0.000094] TCP: Hash tables configured (established 4096 bind 4096)
[  +0.000154] UDP hash table entries: 256 (order: 0, 4096 bytes)
[  +0.000029] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[  +0.000345] NET: Registered protocol family 1
[  +0.000722] RPC: Registered named UNIX socket transport module.
[  +0.000011] RPC: Registered udp transport module.
[  +0.000006] RPC: Registered tcp transport module.
[  +0.000005] RPC: Registered tcp NFSv4.1 backchannel transport module.
[  +0.002038] hw perfevents: no irqs for PMU, sampling events not supported
[  +0.000082] hw perfevents: enabled with armv6_1176 PMU driver, 3 counters available
[  +0.003794] workingset: timestamp_bits=14 max_order=17 bucket_order=3
[  +0.012268] FS-Cache: Netfs 'nfs' registered for caching
[  +0.001331] NFS: Registering the id_resolver key type
[  +0.000052] Key type id_resolver registered
[  +0.000008] Key type id_legacy registered
[  +0.000025] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[  +0.004829] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[  +0.000424] io scheduler noop registered
[  +0.000014] io scheduler deadline registered (default)
[  +0.000534] io scheduler cfq registered
[  +0.000013] io scheduler mq-deadline registered
[  +0.000008] io scheduler kyber registered
[  +0.002277] BCM2708FB: allocated DMA memory 5b500000
[  +0.000064] BCM2708FB: allocated DMA channel 0 @ dc80d000
[  +0.008087] Console: switching to colour frame buffer device 82x26
[  +0.007986] bcm2835-rng 20104000.rng: hwrng registered
[  +0.000235] vc-mem: phys_addr:0x00000000 mem_base=0x1ec00000 mem_size:0x20000000(512 MiB)
[  +0.001014] vc-sm: Videocore shared memory driver
[  +0.000607] gpiomem-bcm2835 20200000.gpiomem: Initialised: Registers at 0x20200000
[  +0.018706] brd: module loaded
[  +0.011972] loop: module loaded
[  +0.000022] Loading iSCSI transport class v2.0-870.
[  +0.000873] usbcore: registered new interface driver smsc95xx
[  +0.000031] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
[  +0.000173] dwc_otg: FIQ enabled
[  +0.000007] dwc_otg: NAK holdoff enabled
[  +0.000007] dwc_otg: FIQ split-transaction FSM enabled
[  +0.000017] Module dwc_common_port init
[  +0.000426] usbcore: registered new interface driver usb-storage
[  +0.000413] mousedev: PS/2 mouse device common for all mice
[  +0.000059] IR NEC protocol handler initialized
[  +0.000008] IR RC5(x/sz) protocol handler initialized
[  +0.000005] IR RC6 protocol handler initialized
[  +0.000005] IR JVC protocol handler initialized
[  +0.000006] IR Sony protocol handler initialized
[  +0.000005] IR SANYO protocol handler initialized
[  +0.000005] IR Sharp protocol handler initialized
[  +0.000006] IR MCE Keyboard/mouse protocol handler initialized
[  +0.000004] IR XMP protocol handler initialized
[  +0.001286] bcm2835-wdt 20100000.watchdog: Broadcom BCM2835 watchdog timer
[  +0.000523] bcm2835-cpufreq: min=700000 max=1000000
[  +0.000611] sdhci: Secure Digital Host Controller Interface driver
[  +0.000010] sdhci: Copyright(c) Pierre Ossman
[  +0.000590] mmc-bcm2835 20300000.mmc: could not get clk, deferring probe
[  +0.000607] sdhost-bcm2835 20202000.mmc: could not get clk, deferring probe
[  +0.000186] sdhci-pltfm: SDHCI platform and OF driver helper
[  +0.000565] ledtrig-cpu: registered to indicate activity on CPUs
[  +0.000131] hidraw: raw HID events driver (C) Jiri Kosina
[  +0.000227] usbcore: registered new interface driver usbhid
[  +0.000008] usbhid: USB HID core driver
[  +0.001013] vchiq: vchiq_init_state: slot_zero = db580000, is_master = 0
[  +0.002004] [vc_sm_connected_init]: start
[  +0.009438] [vc_sm_connected_init]: end - returning 0
[  +0.000960] Initializing XFRM netlink socket
[  +0.000061] NET: Registered protocol family 17
[  +0.000157] Key type dns_resolver registered
[  +0.001843] registered taskstats version 1
[  +0.008182] uart-pl011 20201000.serial: cts_event_workaround enabled
[  +0.000149] 20201000.serial: ttyAMA0 at MMIO 0x20201000 (irq = 81, base_baud = 0) is a PL011 rev2
[  +0.002908] mmc-bcm2835 20300000.mmc: mmc_debug:0 mmc_debug2:0
[  +0.000020] mmc-bcm2835 20300000.mmc: DMA channel allocated
[  +0.055118] sdhost: log_buf @ db510000 (5b510000)
[  +0.036443] mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
[  +0.001708] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[  +0.001673] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[  +0.002934] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
[  +0.035744] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
[  +0.021359] of_cfs_init
[  +0.000145] of_cfs_init: OK
[  +0.001030] Waiting for root device PARTUUID=ee3c92e0-02...
[  +0.000929] random: fast init done
[  +0.043900] mmc0: host does not support reading read-only switch, assuming write-enable
[  +0.002495] mmc0: new high speed SDXC card at address 0001
[  +0.000916] mmcblk0: mmc0:0001 JD4RT 119 GiB
[  +0.002498]  mmcblk0: p1 p2 p3 p4
[  +0.023145] mmc1: new high speed SDIO card at address 0001
[  +0.001165] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[  +0.000093] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
[  +0.009049] devtmpfs: mounted
[  +0.002469] Freeing unused kernel memory: 440K
[  +0.000011] This architecture does not have kernel memory protection.
[  +0.536464] systemd[1]: System time before build time, advancing clock.
[  +0.149146] NET: Registered protocol family 10
[  +0.001841] Segment Routing with IPv6
[  +0.021429] ip_tables: (C) 2000-2006 Netfilter Core Team
[  +0.024035] random: systemd: uninitialized urandom read (16 bytes read)
[  +0.009354] systemd[1]: systemd 232 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETU
[  +0.001043] systemd[1]: Detected architecture arm.
[  +0.001784] systemd[1]: Set hostname to <dpi>.
[  +0.045297] random: systemd: uninitialized urandom read (16 bytes read)
[  +0.228754] random: systemd-cryptse: uninitialized urandom read (16 bytes read)
[  +0.836066] systemd[1]: Listening on Journal Socket (/dev/log).
[  +0.002645] systemd[1]: Created slice System Slice.
[  +0.036131] systemd[1]: Mounting RPC Pipe File System...
[  +0.002319] systemd[1]: Created slice User and Session Slice.
[  +0.002203] systemd[1]: Created slice system-systemd\x2dfsck.slice.
[  +0.001003] systemd[1]: Listening on udev Kernel Socket.
[  +0.001096] systemd[1]: Listening on Journal Socket.
[  +0.379138] dwc2 20980000.usb: 20980000.usb supply vusb_d not found, using dummy regulator
[  +0.000164] dwc2 20980000.usb: 20980000.usb supply vusb_a not found, using dummy regulator
[  +0.461076] dwc2 20980000.usb: EPs: 8, dedicated fifos, 4080 entries in SPRAM
[  +0.001262] dwc2 20980000.usb: DWC OTG Controller
[  +0.000065] dwc2 20980000.usb: new USB bus registered, assigned bus number 1
[  +0.000078] dwc2 20980000.usb: irq 33, io mem 0x20980000
[  +0.000420] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[  +0.000017] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[  +0.000011] usb usb1: Product: DWC OTG Controller
[  +0.000010] usb usb1: Manufacturer: Linux 4.14.98+ dwc2_hsotg
[  +0.000009] usb usb1: SerialNumber: 20980000.usb
[  +0.001188] hub 1-0:1.0: USB hub found
[  +0.000106] hub 1-0:1.0: 1 port detected
[  +1.186366] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[  +2.126123] systemd-journald[65]: Received request to flush runtime journal from PID 1
[  +1.514333] snd_bcm2835: module is from the staging directory, the quality is unknown, you have been warned.
[  +0.033848] bcm2835_alsa bcm2835_alsa: card created with 8 channels
[  +0.685600] brcmfmac: F1 signature read @0x18000000=0x1541a9a6
[  +0.042772] brcmfmac: brcmf_fw_map_chip_to_name: using brcm/brcmfmac43430-sdio.bin for chip 0x00a9a6(43430) rev 0x000001
[  +0.000386] usbcore: registered new interface driver brcmfmac
[  +0.314187] EXT4-fs (mmcblk0p4): mounted filesystem with ordered data mode. Opts: (null)
[  +0.146566] brcmfmac: brcmf_c_preinit_dcmds: Firmware version = wl0: Oct 23 2017 03:55:53 version 7.45.98.38 (r674442 CY) FWID 01-e58
[  +0.001240] brcmfmac: brcmf_c_preinit_dcmds: CLM version = API: 12.2 Data: 7.11.15 Compiler: 1.24.2 ClmImport: 1.24.1 Creation: 2014-
[  +0.032772] EXT4-fs (mmcblk0p3): recovery complete
[  +0.005957] EXT4-fs (mmcblk0p3): mounted filesystem with ordered data mode. Opts: (null)
[  +2.888808] uart-pl011 20201000.serial: no DMA platform data
[  +2.647369] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[  +0.000041] brcmfmac: power management disabled
[  +1.877382] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[  +0.097001] Bluetooth: Core ver 2.22
[  +0.000153] NET: Registered protocol family 31
[  +0.000009] Bluetooth: HCI device and connection manager initialized
[  +0.000024] Bluetooth: HCI socket layer initialized
[  +0.000014] Bluetooth: L2CAP socket layer initialized
[  +0.000046] Bluetooth: SCO socket layer initialized
[  +0.020415] Bluetooth: HCI UART driver ver 2.3
[  +0.000016] Bluetooth: HCI UART protocol H4 registered
[  +0.000005] Bluetooth: HCI UART protocol Three-wire (H5) registered
[  +0.000272] Bluetooth: HCI UART protocol Broadcom registered
[  +0.434999] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[  +0.000012] Bluetooth: BNEP filters: protocol multicast
[  +0.000029] Bluetooth: BNEP socket layer initialized
[  +9.139702] Mass Storage Function, version: 2009/09/11
[  +0.000020] LUN: removable file: (no medium)
[  +0.000029] Bluetooth: BNEP socket layer initialized
[  +9.139702] Mass Storage Function, version: 2009/09/11
[  +0.000020] LUN: removable file: (no medium)
[  +0.004239] LUN: removable file: /backingfiles/music_disk.bin
[  +0.000141] LUN: removable file: /backingfiles/cam_disk.bin
[  +0.000008] Number of LUNs=2
[  +0.007933] g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11
[  +0.000018] g_mass_storage gadget: g_mass_storage ready
[  +0.000015] dwc2 20980000.usb: bound driver g_mass_storage
[Mar 9 15:23] random: crng init done
[  +0.000023] random: 7 urandom warning(s) missed due to ratelimiting
[Mar 9 15:30] Mass Storage Function, version: 2009/09/11
[  +0.000018] LUN: removable file: (no medium)
[  +0.000161] LUN: removable file: /backingfiles/music_disk.bin
[  +0.000095] LUN: removable file: /backingfiles/cam_disk.bin
[  +0.000009] Number of LUNs=2
[  +0.003192] g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11
[  +0.000018] g_mass_storage gadget: g_mass_storage ready
[  +0.000014] dwc2 20980000.usb: bound driver g_mass_storage
[Mar 9 16:27] Mass Storage Function, version: 2009/09/11
[  +0.000024] LUN: removable file: (no medium)
[  +0.000219] LUN: removable file: /backingfiles/music_disk.bin
[  +0.007542] LUN: removable file: /backingfiles/cam_disk.bin
[  +0.000027] Number of LUNs=2
[  +0.005013] g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11
[  +0.000024] g_mass_storage gadget: g_mass_storage ready
[  +0.000020] dwc2 20980000.usb: bound driver g_mass_storage
[Mar 9 16:30] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)

Now I just ran sudo dmesg -C to clear the contents, and then ran sudo modprobe g_mass_storage and then dmesg -H, here is the full result:

[Mar 9 22:44] Mass Storage Function, version: 2009/09/11
[  +0.000021] LUN: removable file: (no medium)
[  +0.000156] LUN: removable file: /backingfiles/music_disk.bin
[  +0.000091] LUN: removable file: /backingfiles/cam_disk.bin
[  +0.000009] Number of LUNs=2
[  +0.003197] g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11
[  +0.000018] g_mass_storage gadget: g_mass_storage ready
[  +0.000014] dwc2 20980000.usb: bound driver g_mass_storage

I am not sure if this is what I should expect on successful completion. Are you able to glean anything from this?

Edit: After the last step, I again ran sudo modprobe -r g_mass_storage and it did not add anything to dmesg contents.

ppamidimarri avatar Mar 10 '19 06:03 ppamidimarri

@therealmarcone I used to do sudo modprobe -r g_mass_storage to make the drives disappear from the car so I could display the saved dashcam clips in my website, and once all done with archiving to gdrive, I would run sudo modprobe g_mass_storage to make them visible to the car. I tested this many times on my Windows 10 laptop and it worked fine, and in the car, all the way until my car upgraded to 2019.5.3. Now my CAM and MUSIC drives won't even show up on the laptop after I run sudo modprobe g_mass_storage from a clean reboot, when then Pi is plugged into the USB drive of my laptop.

ppamidimarri avatar Mar 10 '19 06:03 ppamidimarri

@rtanaka @therealmarcone I feel so stupid. The reason the drives were not showing on my laptop was that I had the wrong Micro USB port on the Pi connected. The CAM and MUSIC drives now show up properly on my laptop, but the car still shows the grey X after the Pi boots up.

I will get the dmesg output when the Pi is connected in the car tomorrow.

ppamidimarri avatar Mar 10 '19 07:03 ppamidimarri

Dying to get to the bottom of why it is showing up with an X on the Tesla...

If anyone wants to put their heads together and debug I'm here

omarqazi avatar Mar 10 '19 08:03 omarqazi

OK, so it appears that the dashcam-side of things wants to see a partitioned device, and not an entire device formatted as fat32. In other words, if you simply fallocate -l 16777216K cam_disk.bin and then mkfs.vfat cam_disk.bin -F 32 -n CAM like the setup scripts do, it won't work. Instead you have to partition the image, then format the partition. At least that's what worked for me. Here's what I did:

  • fallocate -l 16777216K cam_disk.bin
  • fdisk cam_disk.bin
  • create new primary partition: n, p, <enter>, <enter>, <enter>
  • set partition type to 'W95 FAT32 (LBA)': t, c, <enter>
  • write partition table: w, <enter>
  • quit fdisk: q, <enter>

Verify you have a partitioned image with "fdisk -l cam_disk.bin", it should show something like:

Device             Boot Start      End  Sectors Size Id Type
cam_disk.bin1            2048 33554431 33552384  16G  c W95 FAT32 (LBA)

Now since mkfs can only deal with whole devices, you'll need to loopback-mount the partition you just created, so you can create a filesystem on it:

  • losetup -o 1048576 loop0 /backingfiles/cam_disk.bin

(the number will vary based on how you partitioned the image file. In my case the partition started at sector 2048, so the offset is 2048*512=1048576)

Create the filesystem and teslacam folder:

  • mkfs.vfat /dev/loop0 -F 32 -n CAM
  • mount /dev/loop0 /mnt/cam
  • mkdir /mnt/cam/TeslaCam
  • umount /mnt/cam/
  • losetup -d /dev/loop0

Now when you export the image as usb storage, the Tesla will recognize it properly. For some reason this isn't necessary for the music disk.

Note that the cam_disk.bin image created this way will need to be mounted with the correct offset for the partition, so /etc/fstab needs to be updated to reflect that. In the above example, adding "offset=1048576" to the list of mount options should do the trick

marcone avatar Mar 10 '19 20:03 marcone

https://github.com/cimryan/teslausb/pull/125 implements what I described above

marcone avatar Mar 11 '19 04:03 marcone

Hey @therealmarcone -- if we ever meet in real life I owe you a beer or something. I am in California. Let me know. Don't know how you figured that one out.

omarqazi avatar Mar 11 '19 04:03 omarqazi

@therealmarcone - fantastic detective work. i just added the partition to my image and will try on my drive back and report back with the results. it looks promising.

@ppamidimarri - thanks so much for the logs. it definitely helped me narrow down the issue and confirm some of my suspicions.

@cimryan - looks like the @therealmarcone submitted pull request #125 to address this issue. would be good to make sure this is backwards compatible with the older firmware.

rtanaka avatar Mar 11 '19 22:03 rtanaka

Note that 2019.5.15 also writes the recording files in a different location, and with different names. Instead of creating recent-*.mp4 and saved-*.mp4 files directly in the TeslaCam folder, there are now two folders: TeslaCam/RecentClips and TeslaCam/SavedClips. Every time you hit the save button, it creates another folder under the SavedClips folder, and that folder in turn contains the saved files. The subfolders are named <date>_<time you pressed save>, and the files themselves also have a different naming pattern, <date>_<time>-front.mp4. I.e. you might see something like:

/mnt/cam/TeslaCam
/mnt/cam/TeslaCam/RecentClips
/mnt/cam/TeslaCam/RecentClips/2019-03-11_17-15-front.mp4
/mnt/cam/TeslaCam/RecentClips/2019-03-11_17-16-front.mp4
/mnt/cam/TeslaCam/RecentClips/2019-03-11_17-17-front.mp4
/mnt/cam/TeslaCam/RecentClips/2019-03-11_17-18-front.mp4
/mnt/cam/TeslaCam/RecentClips/2019-03-11_17-20-front.mp4
/mnt/cam/TeslaCam/RecentClips/2019-03-11_17-25-front.mp4
/mnt/cam/TeslaCam/RecentClips/2019-03-11_17-26-front.mp4
/mnt/cam/TeslaCam/RecentClips/2019-03-11_17-27-front.mp4
/mnt/cam/TeslaCam/RecentClips/2019-03-11_17-28-front.mp4
/mnt/cam/TeslaCam/RecentClips/2019-03-11_17-29-front.mp4
/mnt/cam/TeslaCam/SavedClips
/mnt/cam/TeslaCam/SavedClips/2019-03-11_17-12-06
/mnt/cam/TeslaCam/SavedClips/2019-03-11_17-12-06/2019-03-11_17-10-front.mp4
/mnt/cam/TeslaCam/SavedClips/2019-03-11_17-12-06/2019-03-11_17-11-front.mp4
/mnt/cam/TeslaCam/SavedClips/2019-03-11_17-13-54
/mnt/cam/TeslaCam/SavedClips/2019-03-11_17-13-54/2019-03-11_17-12-front.mp4
/mnt/cam/TeslaCam/SavedClips/2019-03-11_17-13-54/2019-03-11_17-13-front.mp4
/mnt/cam/TeslaCam/SavedClips/2019-03-11_17-15-05
/mnt/cam/TeslaCam/SavedClips/2019-03-11_17-15-05/2019-03-11_17-13-front.mp4
/mnt/cam/TeslaCam/SavedClips/2019-03-11_17-15-05/2019-03-11_17-14-front.mp4

So the various archive-clips.sh scripts need to be updated too, and possibly support both the old and new naming schemes for a while.

marcone avatar Mar 12 '19 00:03 marcone

@therealmarcone Thank you for the fantastic work! I used your updated script to build my drive and it just works. I would have never been able to figure it out. Great job!

Edit: my car is on 2019.5.15 now.

ppamidimarri avatar Mar 12 '19 01:03 ppamidimarri

https://github.com/cimryan/teslausb/pull/126 backs up files from both the old and new naming scheme. I only tested CIFS backup.

marcone avatar Mar 12 '19 01:03 marcone

@therealmarcone - I just updated in 2019.5.15 as well and it looks like it's recording just fine with the changes.

rtanaka avatar Mar 12 '19 20:03 rtanaka

Thanks @therealmarcone now waiting for @cimryan to merge. In the meantime, how can i install your version? thanks

leofaoro avatar Mar 15 '19 00:03 leofaoro

I haven't tried this so I'm not 100% sure this will work, but I think that if you're using the teslausb_setup_variables.conf file to configure your system, you can just set the REPO variable's value to therealmarcone, and the BRANCH variable to main-dev (at the bottom of the conf file). This should then make the setup scripts pull the updated versions from my branch.

marcone avatar Mar 15 '19 16:03 marcone

@leofaoro The way I used the code from @therealmarcone was to edit setup_teslausb to exit after calling fix_cmdline_txt_modules_load, manually getting the correct create-backingfiles.sh into /tmp using a wget command, and then editing setup_teslausb again to run the rest of the steps. That worked for me.

I don't use the auto-archiving feature, so I didn't do this with the updated archiving scripts.

ppamidimarri avatar Mar 15 '19 16:03 ppamidimarri

I was able to reformat the camera partition without rebuilding the Pi from scratch. It took me two days to copy all my music onto the SD card so I wasn't looking forward to doing it all over again.

This will wipe out your camera partition, so copy off any clips you want to keep before doing this.

Here are the steps as I recall them:

  1. Power up the Pi, wait a minute for it to boot and connect via WiFi, then SSH into it
  2. Become superuser, make filesystem writeable, unmount the camera storage sudo -i /root/bin/remountfs_rw umount /mnt/cam
  3. Follow the instructions above by @therealmarcone: https://github.com/cimryan/teslausb/issues/119#issuecomment-471342299 starting with the fdisk command (skip the fallocate because you already have a disk image)
  4. As referenced in his explanation, add 'offset=...' to /etc/fstab: pico /etc/fstab or vi /etc/fstab as you prefer     ...and add offset= (use the same number you used for losetup) to the cam_disk.bin line: /backingfiles/cam_disk.bin /mnt/cam vfat noauto,users,umask=000,offset=1048576 0 0
  5. Mount the new partition and you should be good to go mount /mnt/cam

acostein avatar Mar 15 '19 17:03 acostein

I haven't tried this so I'm not 100% sure this will work, but I think that if you're using the teslausb_setup_variables.conf file to configure your system, you can just set the REPO variable's value to therealmarcone, and the BRANCH variable to main-dev (at the bottom of the conf file). This should then make the setup scripts pull the updated versions from my branch.

Thanks so much I did the headless install and it worked perfectly. Now I'm trying to see if it will send files to my file store.

leofaoro avatar Mar 15 '19 20:03 leofaoro

I am on my 5th reload.... I have never used a Pi before and am learning through this process, so I appreciate any help for an absolute newbie. If you want to ignore my silly questions, great I get it :) I ran into the same exact issue as above. I opened a github account and copied the setup-teslausb from cimryan's page and made my own, editing the branch and repo. I had no idea how to do it otherwise; had no idea how to upload from local machine (again complete newbie w/no programming experience!

So that actually seemed to work! But it would not upload... Can anyone help me diagnose? Thank you!

REPO=${REPO:-therealmarcone} BRANCH=${BRANCH:-main-dev}

nate977p avatar Mar 17 '19 01:03 nate977p

@nate977p Here is my 'fresh build' process. I have this saved in a file so it's down to just cut/paste. It allows me to use anyone's repo and branch easily. Below it is set for my repo (jspv) and branch (main), replace accordingly. Mine is pulls in the necessary changes from @therealmarcone (thank you!) and adds a minor tweak to handle the new subdirectory structure. Just set REPO and BRANCH accordingly to pull in whoever's built you want.

After flashing, setting the wpa_supplicant for WFi, removing any old Pi keys in ~/.ssh/known_hosts, eject and put in Pi

ssh [email protected]
sudo -i

customize the next three lines to whatever hostname, and repo, and branch you want to use

export TESLAUSB_HOSTNAME=teslausb  
export REPO=jspv 
export BRANCH=master 

if you don't use pushover, skip the next three lines

export pushover_enabled=true 
export pushover_user_key=_my_pushover_user_key 
export pushover_app_key=_my_pushover_app_key

next steps are for rclone setup curl -L https://raw.github.com/pageauc/rclone4pi/master/rclone-install.sh | bash you can now do rclone config or if you know your settings, just write them to the conf file. Below are my settings for using AWS S3

cat > /root/.config/rclone/rclone.conf
[teslas3]
type = s3
provider = AWS
access_key_id =_my_AWS Access Key_
secret_access_key = __my_AWS_Secret_Access_Key_
region = us-east-1
server_side_encryption = AES256
<ctrl-D>
export RCLONE_PATH=_My_AWS_S3_Bucket_Name_
export RCLONE_DRIVE=teslas3

almost done, grab the setup and run it

wget https://raw.githubusercontent.com/$REPO/teslausb/$BRANCH/setup/pi/setup-teslausb
./setup-teslausb
exit
passwd

(change passwd) sudo halt sometimes the archive doesn't actually get configured, don't know why yet - but if it isn't configured: (login)

mount / -o remount,rw
BRANCH=master
export REPO=jspv
export ARCHIVE_SYSTEM=rclone
export RCLONE_PATH=_My_AWS_S3_Bucket_Name_
export RCLONE_DRIVE=teslas3
export pushover_enabled=true
export pushover_user_key=_my_pushover_user_key 
export pushover_app_key=_my_pushover_app_key
./configure.sh
reboot

jspv avatar Mar 17 '19 20:03 jspv

Where should I be looking if I'm not seeing any errors yet Tesla is not changing from x status for the dashcam? I tried complete rebuild using #119 and some of the other suggestions here. TeslaCam folder shows when plugging into windows laptop, Google drive looks all good, etc. Haven't seen any errors. 2019.5.15.

schmug avatar Mar 19 '19 02:03 schmug

Has anyone determined what the max partition size is that's supported by Tesla? I've read that FAT-32 can theoretically support up to 16 TB drives, but I'm curious what the largest partition is that's been tested and shown to work with 2019.5.15. Oh, and from the fallocate command up there it appears to only be allocating 16 GB.

Thanks!

jbienz avatar Mar 19 '19 14:03 jbienz