Page 1 of 1

strange thing happens (config.txt empty after edit)

Posted: Mon Sep 03, 2018 4:01 pm
by tony1812
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?

Re: strange thing happens

Posted: Mon Sep 03, 2018 4:25 pm
by lmarmisa
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.

Re: strange thing happens

Posted: Mon Sep 03, 2018 5:22 pm
by tony1812
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.

Re: strange thing happens

Posted: Mon Sep 03, 2018 5:59 pm
by DirkS
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?

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

Posted: Mon Sep 03, 2018 6:10 pm
by epoch1970
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.)

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

Posted: Mon Sep 03, 2018 9:00 pm
by lmarmisa
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

pi@rpi:~ $ ls -l /boot/config.txt 
-rwxr-xr-x 1 root root 1588 Aug 24 15:05 /boot/config.txt
pi@rpi:~ $ 
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?.