bobgardner
Posts: 41
Joined: Sat Apr 04, 2020 2:00 am
Location: Orlando
Contact: AOL

How to recover from config.txt problem?

Wed Apr 15, 2020 9:11 pm

Howdy folks. I have a pi0W with a hdmi to vga adapter for a monitor, and a wifi mouse and keyboard plugged into the usb. My project is to bring up this cute little 2" round 480x480 tft using DPI and 666 mode. This will use all but a couple of the gpios, and it involves editing the config.txt to put it into the mode that uses the parallel interface. Nothing ever works the first time, so my question is, if I turn on force vga mode in the config.txt, will I still have the desktop on the hdmi out, even if I need to edit the config.txt again? In otherwords, how do I recover from boogering the config.txt? Can I stick the sd card into a card reader on a pc and see the file? Maybe not because its ext4? Other ideas? Thanks.

trejan
Posts: 1873
Joined: Tue Jul 02, 2019 2:28 pm

Re: How to recover from config.txt problem?

Wed Apr 15, 2020 9:16 pm

bobgardner wrote:
Wed Apr 15, 2020 9:11 pm
Can I stick the sd card into a card reader on a pc and see the file?
Yes. The /boot partition is FAT32 so basically everything can modify it.

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5590
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: How to recover from config.txt problem?

Wed Apr 15, 2020 9:54 pm

bobgardner wrote:
Wed Apr 15, 2020 9:11 pm
Howdy folks. I have a pi0W with a hdmi to vga adapter for a monitor, and a wifi mouse and keyboard plugged into the usb. My project is to bring up this cute little 2" round 480x480 tft using DPI and 666 mode. This will use all but a couple of the gpios, and it involves editing the config.txt to put it into the mode that uses the parallel interface. Nothing ever works the first time, so my question is, if I turn on force vga mode in the config.txt, will I still have the desktop on the hdmi out, even if I need to edit the config.txt again? In otherwords, how do I recover from boogering the config.txt? Can I stick the sd card into a card reader on a pc and see the file? Maybe not because its ext4? Other ideas? Thanks.
1) If you've enabled SSH and can login over the network you can edit config.txt w/o using another m/c.
2) But maybe better to make use of config.txt's conditional filters? https://www.raspberrypi.org/documentati ... itional.md
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

User avatar
DougieLawson
Posts: 38882
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: How to recover from config.txt problem?

Wed Apr 15, 2020 10:02 pm

trejan wrote:
Wed Apr 15, 2020 9:16 pm
bobgardner wrote:
Wed Apr 15, 2020 9:11 pm
Can I stick the sd card into a card reader on a pc and see the file?
Yes. The /boot partition is FAT32 so basically everything can modify it.
You don't even need to edit it. Just rename the broken file to config.txt~, then create a new empty file. The system will come up with an empty file (it may not work optimally but will get to a point where you can use Raspbian Linux to repair the broken config).
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
thagrol
Posts: 2961
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: How to recover from config.txt problem?

Wed Apr 15, 2020 10:48 pm

Backup the unmodified config.txt first (to, for example, config.bak). That way you have a known good version you can restore via ssh or via another machine.

Dougie's suggestion is fine but there have been times when I've needed/wanted to revert to the stock config.txt and it's a pain having to copy that from another Pi or extract it from an image.

editied for tpyos
Attempts to contact me outside of these forums will be ignored unless signed in triplicate, sent in, sent back, queried, lost, found, subjected to public enquiry, lost again, and finally buried in soft peat for three months and recycled as firelighters

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 8739
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: How to recover from config.txt problem?

Fri Apr 17, 2020 11:14 am

One trick I use is to add any testing parameters under a [gpio27=1] tag. GPIO27 (40pin header pin 13) is normally low, so add a jumper between it and 3.3V to activate your test parameters. If it doesn't work, remove the jumper and reboot with your known good settings. Fix config.txt, reapply the jumper, and reboot for a second attempt.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

User avatar
DougieLawson
Posts: 38882
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: How to recover from config.txt problem?

Fri Apr 17, 2020 12:01 pm

6by9 wrote:
Fri Apr 17, 2020 11:14 am
One trick I use is to add any testing parameters under a [gpio27=1] tag. GPIO27 (40pin header pin 13) is normally low, so add a jumper between it and 3.3V to activate your test parameters. If it doesn't work, remove the jumper and reboot with your known good settings. Fix config.txt, reapply the jumper, and reboot for a second attempt.
Tricky. Why isn't that stuff documented somewhere?
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 8739
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: How to recover from config.txt problem?

Fri Apr 17, 2020 1:13 pm

DougieLawson wrote:
Fri Apr 17, 2020 12:01 pm
6by9 wrote:
Fri Apr 17, 2020 11:14 am
One trick I use is to add any testing parameters under a [gpio27=1] tag. GPIO27 (40pin header pin 13) is normally low, so add a jumper between it and 3.3V to activate your test parameters. If it doesn't work, remove the jumper and reboot with your known good settings. Fix config.txt, reapply the jumper, and reboot for a second attempt.
Tricky. Why isn't that stuff documented somewhere?
The use of GPIO conditionals is documented - https://www.raspberrypi.org/documentati ... itional.md

The use to switch between alternate configs was one I came up with a month or two back when developing the KMS driver. Getting it wrong generally meant not booting, so having a quick way to get a bootable system back was useful. I could have used an NFS mount for / instead (probably still should to avoid killing the SD card), but having it on an SD card was more covenient.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

User avatar
DougieLawson
Posts: 38882
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: How to recover from config.txt problem?

Fri Apr 17, 2020 1:35 pm

Ah, you've added new stuff since I last looked.

I've been using the serial number filters for ages, that means every /boot/config.txt is identical and I've got a master copy and a script to keep them that way.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
davidcoton
Posts: 4908
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK
Contact: Website

Re: How to recover from config.txt problem?

Fri Apr 17, 2020 2:15 pm

6by9 wrote:
Fri Apr 17, 2020 1:13 pm
... more covenient.
Ouch, is that a virus hiding there :lol: (Sorry, couldn't resist)
Signature retired

Return to “Beginners”