question

tslewis99 avatar image
tslewis99 asked

Testing Cerbo GitHuB Package (oops)

While testing a package I am developing and deploying using SetupHelper, I was testing the uninstall process and did a rogue command. The rogue command was supposed to remove a full qualified path and file. It was added to a string of other directories/files to eliminate. Sadly, without those variables filled properly, my command:


rm -rf /usr/local/etc/tinc $TARGETDIR/$TARGETFILE


was executed as:


rm -rf /usr/local/etc/tic /


So, I nuked the root FS and need a method of recovery. I did attach the USB cable to the header and saw the kernel trying to initiate /bin/sh (which is now gone). IF there is a SD card image or other recovery process... all I need to do is get the bits back into the Cerbo in the right spots. I had killed the process and was trying to tar up another cerbo and get it over but I lost connectivity before I could hail mary the fix.


So, since I plan to never to do this again (but probably will) do you have an end power user method to get this back.


Tim

Tags:

@mvader (Victron Energy)

@Guy Stewart (Victron Community Manager)

@Simon Ytterbom

@Kevin Windrem

cerbo gx
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

5 Answers
bathnm avatar image
bathnm answered ·

@TSLewis99 If you have the serial console available, then yous hold see u-boot start and should be able to stop it and select the backup image. It is also possible to do a reset by downloading the correct image from updates.victronenergy.com, writing it to SDCard and inserting it into the unit and powering it up. I did it many moons ago and can't remember the details, or where I found it.

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

tslewis99 avatar image
tslewis99 answered ·

Hey all, just wanted to give feedback and thanks. I hooked up the serial to watch the console and did indeed interrupt the boot process. I did not see the way to boot to an alternate image, I imagine that it works with the base address command in the mini shell. In any case, I can investigate that later. I was able to download the rebuild image and put it on an SD. Monitoring both the serial and I had an HDMI monitor plugged in, I was able to see behind the scenes copy and the output to the screen for the end user. So, in the field, you can see what to do.

So basic steps:

1. Download image.

2. Put image on SD card (I used Balena Etcher).

3. Insert, power up and monitor the CerboGX. It will indicate when done. Power down, Pull card.

4. Boot as usual, enjoy!

So, in the case someone nukes their box (I think I saw another post on this) you'll be able to recover the brains. In my case, I simply was testing the uninstall of a package through SetupHelper and I nuked root. Some variables did not populate correctly. I now operate with a much more timid approach. SH installs and has the power of root, so be careful... with great power .. well, ya know.

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

bathnm avatar image
bathnm answered ·

@TSLewis99 glad if all worked. Maybe consider not remounting the root partition as RW. Leaving it as read only prevents this !

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

tslewis99 avatar image
tslewis99 answered ·

Actually, I never re-mounted as R/W. This must be done by another package.

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

mvader (Victron Energy) avatar image
mvader (Victron Energy) answered ·

Hi, for anyone in the future running into this, see procedure here:

https://community.victronenergy.com/questions/204255/cerbo-gx-bricked-how-to-recover.html

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.