NOTE: this post is describing how to (hopefully) 'fix' an Infotainment system that you have broken by making modifications to it. If you haven't already been making modifications to the software, then this post doesn't apply to you. PLEASE don't follow any of these instructions unless you have been modifying the software as described below.
The Infotainment Project is a very long thread with discussion on how to make modifications to the software on your Infotainment system.
There are risks with making such mods - several people (including myself) have made changes that caused the main user-interface to 'crash'. The result is an Infotainment system that gets stuck in a "reboot loop" (it starts up, the user interface crashes (because of a bug you introduced), and then it eventually 'reboots' and does this over and over again).
It can be quite difficult to 'fix' the problem once it gets into this situation. You probably created the problem by using a USB->ethernet adapter, and copying modified user-interface ".js" files (with bugs) onto the system. But, when it's in the "reboot loop", it reboots so quickly that it's nearly impossible to connect with ssh, remount the filesystem as read-write, and restore the original version of the file that you corrupted.
When the problem happened to me, it took me several hours to fix the problem. I felt lucky to have timed things just right in order to restore the original file that I had corrupted.
Since then, I've come up with a script to help with the recovery process. The script just connects (over ssh) as quickly as possible, and issues a single command to prevent the Infotainment system from auto-rebooting (it disables the hardware "watchdog timer"). With the watchdog disabled, it's then possible to ssh-into the system as you normally would, and "un-do" whatever changes you made that caused the reboot loop in the first place.
The script isn't perfect, and I can't guarantee that it can connect to any system in a 'reboot loop'. But, it may be helpful to others, so I thought I should post it.
Currently, the script only works on Linux and MacOS. I hope to re-write the code in Java at some point, so there will be a 'platform-independent' solution (which would also work on Windows, for example).
In order to run the script, it's best if you have a DHCP server (could be your router) and that your Infotainment system is connected to that router to get a DHCP IP address. Using DHCP is faster than waiting for the 10-second timeout to 'fall back' to the default 192.168.42.1 IP address. Every second counts while stuck in a 'reboot loop', so using DHCP is a help. You'll need a way to find out which IP address is assigned to your Infotainment system - usually, your router's configuration/status web page can tell you which IP address it has assigned to which device. Even better, most routers can be configured to use "DHCP reservations", where you can tell the router what IP address it should give to your Infotainment system (based on the MAC address of your USB->ethernet adapter). All of this DHCP configuration is beyond the scope of this post - I assume you know how to do this/can get help from someone who knows.
The script relies on two external utilities: "fping" (a special version of "ping" that allows for really short timeouts), and "sshpass".
If you are running Linux, you can install these utilities with the following command:
If you are running on MacOS, you can download an "fping" package from here: Rudix ? Packages ? Fping. Choose the appropriate version (Yosemite vs Lion/etc), download the package, run the package and follow the installation instructions.
I don't know of a pre-built MacOS package for "sshpass" - I've included a binary that I built on my system. I built it on OS X 10.10.3 (Yosemite) X86. I don't know if it's compatible with earlier versions of MacOS. If not, you'll have to find it online somewhere.
MacOS instructions:
The attached .zip file includes my script (called "fix_watchdog.sh") and the MacOS binary for "sshpass". When you download the ".zip" (using Safari, for example), it may automatically UN-zip the file (so, instead of a "~/Downloads/fix_watchdog_sshpass.zip", you may find a directory called "~/Downloads/fix_watchdog_sshpass"). If Safari doesn't automatically UN-zip it for you, then you should.
To run the script, you should open a "Terminal" command-line window. Assuming the attached .zip downloaded/unzipped to "~/Downloads/fix_watchdog_sshpass", then you should "cd" to it as follows:
Then, run the command as follows:
(where IPADDR is the IP address of your Infotainment system)
This script will run 'forever', until it believes that it has successfully connected to the Infotainment system and disabled the watchdog.
NOTE: this script can be difficult to STOP - "control-C" may be ignored. If you want to STOP the script, then close the "Terminal" window.
Linux instructions:
I'm assuming you are familiar with the Linux command line. UN-zip the attached .zip file, "cd" to where you unzipped it, then run:
(where IPADDR is the IP address of your Infotainment system)
This script will run 'forever', until it believes that it has successfully connected to the Infotainment system and disabled the watchdog.
NOTE: this script can be difficult to STOP - "control-C" may be ignored. If you want to STOP the script, then "kill" the "fix_watchdog.sh" process (use "ps" to find it) or close the the console window where you started the script.
The following applies to both MacOS and Linux versions:
The script will initially try to 'ping' ('fping') the Infotainment system, until it gets a response. It will do this over-and-over until it hears back from the Infotainment system. While it's doing this, your screen will fill up with something like the following:
This is normal - just let it fill the screen.
Once it hears a response from the Infotainment system, it will immediately try to "login" to the Infotainment system using ssh. If this succeeds, it will send the command to disable the hardware watchdog. At that point, you can ssh-in to your Infotainment system as you have done before - but this time you can 'fix' the files that you modified (which caused the 'reboot loop' that you are now tring to fix)
If it fails to connect with ssh, it will go back to the 'ping loop', waiting for the Infotainment system to respond (at which point it tries to connect with ssh again - all of this will be done over-and-over until (hopefully) a successful connection)
Once the script successfully connects, it will echo "It seems like we were able to disable the Infotainment watchdog!" to the console and exit. At this point, you can ssh-in to the Infotainment system and fix whatever files were broken - without worrying about an automatic watchdog reboot preventing you from doing this.
This script is by no means perfect, but it will hopefully be useful to others. Enjoy! (and good luck recovering your system!)
ATTACHED file (forum wouldn't let me attach a .zip, so here's a link):
http://hackspot.net/files/mazda/fix_watchdog_sshpass.zip
- Paulb
The Infotainment Project is a very long thread with discussion on how to make modifications to the software on your Infotainment system.
There are risks with making such mods - several people (including myself) have made changes that caused the main user-interface to 'crash'. The result is an Infotainment system that gets stuck in a "reboot loop" (it starts up, the user interface crashes (because of a bug you introduced), and then it eventually 'reboots' and does this over and over again).
It can be quite difficult to 'fix' the problem once it gets into this situation. You probably created the problem by using a USB->ethernet adapter, and copying modified user-interface ".js" files (with bugs) onto the system. But, when it's in the "reboot loop", it reboots so quickly that it's nearly impossible to connect with ssh, remount the filesystem as read-write, and restore the original version of the file that you corrupted.
When the problem happened to me, it took me several hours to fix the problem. I felt lucky to have timed things just right in order to restore the original file that I had corrupted.
Since then, I've come up with a script to help with the recovery process. The script just connects (over ssh) as quickly as possible, and issues a single command to prevent the Infotainment system from auto-rebooting (it disables the hardware "watchdog timer"). With the watchdog disabled, it's then possible to ssh-into the system as you normally would, and "un-do" whatever changes you made that caused the reboot loop in the first place.
The script isn't perfect, and I can't guarantee that it can connect to any system in a 'reboot loop'. But, it may be helpful to others, so I thought I should post it.
Currently, the script only works on Linux and MacOS. I hope to re-write the code in Java at some point, so there will be a 'platform-independent' solution (which would also work on Windows, for example).
In order to run the script, it's best if you have a DHCP server (could be your router) and that your Infotainment system is connected to that router to get a DHCP IP address. Using DHCP is faster than waiting for the 10-second timeout to 'fall back' to the default 192.168.42.1 IP address. Every second counts while stuck in a 'reboot loop', so using DHCP is a help. You'll need a way to find out which IP address is assigned to your Infotainment system - usually, your router's configuration/status web page can tell you which IP address it has assigned to which device. Even better, most routers can be configured to use "DHCP reservations", where you can tell the router what IP address it should give to your Infotainment system (based on the MAC address of your USB->ethernet adapter). All of this DHCP configuration is beyond the scope of this post - I assume you know how to do this/can get help from someone who knows.
The script relies on two external utilities: "fping" (a special version of "ping" that allows for really short timeouts), and "sshpass".
If you are running Linux, you can install these utilities with the following command:
Code:
sudo yum install fping sshpass
I don't know of a pre-built MacOS package for "sshpass" - I've included a binary that I built on my system. I built it on OS X 10.10.3 (Yosemite) X86. I don't know if it's compatible with earlier versions of MacOS. If not, you'll have to find it online somewhere.
MacOS instructions:
The attached .zip file includes my script (called "fix_watchdog.sh") and the MacOS binary for "sshpass". When you download the ".zip" (using Safari, for example), it may automatically UN-zip the file (so, instead of a "~/Downloads/fix_watchdog_sshpass.zip", you may find a directory called "~/Downloads/fix_watchdog_sshpass"). If Safari doesn't automatically UN-zip it for you, then you should.
To run the script, you should open a "Terminal" command-line window. Assuming the attached .zip downloaded/unzipped to "~/Downloads/fix_watchdog_sshpass", then you should "cd" to it as follows:
Code:
cd ~/Downloads/fix_watchdog_sshpass
Code:
./fix_watchdog.sh IPADDR
This script will run 'forever', until it believes that it has successfully connected to the Infotainment system and disabled the watchdog.
NOTE: this script can be difficult to STOP - "control-C" may be ignored. If you want to STOP the script, then close the "Terminal" window.
Linux instructions:
I'm assuming you are familiar with the Linux command line. UN-zip the attached .zip file, "cd" to where you unzipped it, then run:
Code:
./fix_watchdog.sh IPADDR
This script will run 'forever', until it believes that it has successfully connected to the Infotainment system and disabled the watchdog.
NOTE: this script can be difficult to STOP - "control-C" may be ignored. If you want to STOP the script, then "kill" the "fix_watchdog.sh" process (use "ps" to find it) or close the the console window where you started the script.
The following applies to both MacOS and Linux versions:
The script will initially try to 'ping' ('fping') the Infotainment system, until it gets a response. It will do this over-and-over until it hears back from the Infotainment system. While it's doing this, your screen will fill up with something like the following:
Code:
192.168.42.1 : xmt/rcv/%loss = 1/0/100%
192.168.42.1 : xmt/rcv/%loss = 1/0/100%
192.168.42.1 : xmt/rcv/%loss = 1/0/100%
192.168.42.1 : xmt/rcv/%loss = 1/0/100%
192.168.42.1 : xmt/rcv/%loss = 1/0/100%
This is normal - just let it fill the screen.
Once it hears a response from the Infotainment system, it will immediately try to "login" to the Infotainment system using ssh. If this succeeds, it will send the command to disable the hardware watchdog. At that point, you can ssh-in to your Infotainment system as you have done before - but this time you can 'fix' the files that you modified (which caused the 'reboot loop' that you are now tring to fix)
If it fails to connect with ssh, it will go back to the 'ping loop', waiting for the Infotainment system to respond (at which point it tries to connect with ssh again - all of this will be done over-and-over until (hopefully) a successful connection)
Once the script successfully connects, it will echo "It seems like we were able to disable the Infotainment watchdog!" to the console and exit. At this point, you can ssh-in to the Infotainment system and fix whatever files were broken - without worrying about an automatic watchdog reboot preventing you from doing this.
This script is by no means perfect, but it will hopefully be useful to others. Enjoy! (and good luck recovering your system!)
ATTACHED file (forum wouldn't let me attach a .zip, so here's a link):
http://hackspot.net/files/mazda/fix_watchdog_sshpass.zip
- Paulb