tony1812
Posts: 354
Joined: Sat Jul 15, 2017 12:40 pm
Location: Boston MA.

strange thing happens (config.txt empty after edit)

Mon Sep 03, 2018 4:01 pm

Hello, I use vnc on Mac to my Pi3, edited the /boot/config.txt, then I use the same SD but boot it up on another pi 3 with a 7" official Pi LCD, the odd thing happened, the /boot/config.txt is all empty, all text are gone, but the pi still boot up. What happen?

User avatar
lmarmisa
Posts: 1222
Joined: Thu Feb 14, 2013 2:22 am
Location: Jávea, Spain

Re: strange thing happens

Mon Sep 03, 2018 4:25 pm

Not sure if I understand your comment.

The SD has two partitions:

1) BOOT (VFAT partition). The file config.txt is stored in this partition.

2) root (ext4). A folder /boot is defined in this partition but its content is empty because is only defined as a mountpoint.

When the RPi system is started, the BOOT partition is mounted on the mountpoint /boot. So, in this case, you will be able to edit the file /boot/config.txt correctly.

Code: Select all

mount | grep boot
If you use the same SD on other computer (but not booting from it), the partition BOOT will be not mounted on /boot. So, if you wish to edit the file config.txt, you should access to the file located at the partition BOOT (VFAT). Do not use the file /boot/config.txt in this case because you will edit an empty file.

tony1812
Posts: 354
Joined: Sat Jul 15, 2017 12:40 pm
Location: Boston MA.

Re: strange thing happens

Mon Sep 03, 2018 5:22 pm

Hmmm, I realized one thing, I transfer the /boot/config.txt from my pi to my Mac ( my Mac has BBEdit) all the text are intacted. But when I load the same file to my pi3 open it with pi3's text editor or nano or leafpad, all text dispeared. I can only thing it is some king on text encoding the pi doesn't recognize.

DirkS
Posts: 9841
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: strange thing happens

Mon Sep 03, 2018 5:59 pm

tony1812 wrote:
Mon Sep 03, 2018 5:22 pm
Hmmm, I realized one thing, I transfer the /boot/config.txt from my pi to my Mac ( my Mac has BBEdit) all the text are intacted. But when I load the same file to my pi3 open it with pi3's text editor or nano or leafpad, all text dispeared. I can only thing it is some king on text encoding the pi doesn't recognize.
Are you sure you're looking at the same file?
How do you know it *is* actually the same file?
What is the size of the file if you look at it on the Pi itself?

epoch1970
Posts: 3047
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: strange thing happens (config.txt empty after edit)

Mon Sep 03, 2018 6:10 pm

Beware of text encodings AND of Carriage Return encoding.
UTF-8, CR-LF is a safe choice. UTF-8, LF is the native unix/linux format.

(In BBEdit/TextWrangler, take a look at the bottom of your edit window, there are menus to set the file format. Change it, save the file -preferably to a new name-, open the new file, check the format BBEdit thinks the file is.)
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

User avatar
lmarmisa
Posts: 1222
Joined: Thu Feb 14, 2013 2:22 am
Location: Jávea, Spain

Re: strange thing happens (config.txt empty after edit)

Mon Sep 03, 2018 9:00 pm

Apparently you tranfer the file /boot/config.txt in both directions. But you will need root privileges for the tranfer from your Mac to your RPi.

Code: Select all

[email protected]:~ $ ls -l /boot/config.txt 
-rwxr-xr-x 1 root root 1588 Aug 24 15:05 /boot/config.txt
[email protected]:~ $ 
But when I load the same file to my pi3 open it with pi3's text editor or nano or leafpad, all text dispeared.
How do you load the file config.txt to your RPi?.

Return to “Beginners”