duck123
Posts: 7
Joined: Thu Sep 06, 2012 12:45 pm

Can't edit config.txt

Sat Sep 15, 2012 6:45 pm

Hi guys

I'm new to this, just started my Pi the 2nd time today and wanted to change the screen resolution.

I went to start - run, typed

Code: Select all

sudo nano /boot/config.txt
like the wiki said, enter, but nothing happened.

So went to /boot, opened the config.txt file with leafpad, made changes, tried to save but it gave me the "save as" window and told me "Can't open file to write" when trying to overwrite the file.

I tried making changes, doing control-X Y ENTER like the wiki said, nothing happened.

I bought a preprogrammed SDcard from farnell with Debian

This is embarassing, any help appreciated.

duck123
Posts: 7
Joined: Thu Sep 06, 2012 12:45 pm

Re: Can't edit config.txt

Sat Sep 15, 2012 8:14 pm

Tried rebooting, didn't work, tried it a couple times, tried removing power while the file was open and changed hoping it would somehow be saved, didn't work.

put off the power from the pi because I had something to do, came back 30 min later, put it back on, it doesn't start :shock: gives me a black screen.

Took the SDcard out, put it in my laptop, I could open the config and it was unchanged. I put it back in the pi, unplugged all connections but the power like the wiki said, it just gave me the red light with the green blinking fast a couple times before going out, tried 2 different adapters, still gives me the same. :?: :?: Literally nothing has changed because I couldn't even change anything and I can't even turn it on now :evil:

It's sick because I was looking forward to learning to work with what seemed like a cool thing, but after 2 sessions I'm so [admin edit for language] close to grabbing the thing and destroying it.

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2869
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: Can't edit config.txt

Sat Sep 15, 2012 9:06 pm

You've corrupted your sd card and will need to write it again. Lots of instructions out there. Here are mine...

http://raspi.tv/2012/how-to-make-a-rasp ... diskimager

Don't ever pull the plug on your pi without shutting down properly unless it's crashed unrecoverably. This is how you should shut down.

http://raspi.tv/2012/how-to-safely-shut ... spberry-pi

Next time you boot into your Pi. Don't go straight into the gui by typeing startx. Stay in the command line and do the sudo nano /boot/config.txt from there. It will work.
Alex Eames RasPi.TV, RasP.iO

bredman
Posts: 1415
Joined: Tue Jan 17, 2012 2:38 pm

Re: Can't edit config.txt

Sun Sep 16, 2012 11:17 am

duck123 wrote:I went to start - run, typed

Code: Select all

sudo nano /boot/config.txt
like the wiki said, enter, but nothing happened.
These instructions are Linux commands to be used on the Raspberry Pi, it seems you are entering them on a Windows command line.

Full instructions to edit this file from Windows or OSX or Linux are at
http://elinux.org/R-Pi_ConfigurationFile

duck123
Posts: 7
Joined: Thu Sep 06, 2012 12:45 pm

Re: Can't edit config.txt

Mon Sep 17, 2012 10:39 am

bredman wrote: These instructions are Linux commands to be used on the Raspberry Pi, it seems you are entering them on a Windows command line.

Full instructions to edit this file from Windows or OSX or Linux are at
http://elinux.org/R-Pi_ConfigurationFile
I did it on the pi, when I said "start" I meant the bottom left button that works like the windows start thing, not sure what it's called in linux. I followed the instructions in that wiki link to the letter but nothing happened.

Anyway, I'll try to rewrite the SDcard like alexeames said when I get time, sucks that I paid the premium to have a pre written SDcard and have to erase it and write it myself but it seems there's no other way.

User avatar
RaTTuS
Posts: 10559
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: Can't edit config.txt

Mon Sep 17, 2012 10:42 am

you have to edit the config file as root
sudo nano /boot/config.txt
from the command line
will ask you for the root password then edit the file
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

User avatar
pluggy
Posts: 3635
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
Contact: Website

Re: Can't edit config.txt

Mon Sep 17, 2012 2:17 pm

The OP's instructions don't work (there shouldn't be any reason why they won't but they don't work for me either).

What does work is double click the LXTerminal icon from the Pi desktop and put the same command in there

Code: Select all

sudo nano /boot/config.txt
It works fine before you run startx as well.

I would expect "sudo leafpad /boot/config.txt" to work both from run and LXTerminal as well but it doesn't. It will run without sudo OK but then you can't edit said file.

Some holes in the Pi implementation of a GUI I feel........
Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......

User avatar
jojopi
Posts: 3271
Joined: Tue Oct 11, 2011 8:38 pm

Re: Can't edit config.txt

Mon Sep 17, 2012 3:33 pm

pluggy wrote:Some holes in the Pi implementation of a GUI I feel........
It is standard lxpanel behaviour, not Pi specific. Swallow→Run is only intended for launching graphical applications that will open their own window.

Text programs like nano that expect to have a terminal pre-attached to standard-I/O should be started in a terminal emulator. (Swallow→Run→"lxterminal -e sudo nano /boot/config.txt" will also work, but that is obviously too cumbersome to be useful.)

I cannot reproduce any problem with Swallow→Run→"sudo leafpad /boot/config.txt".

User avatar
Burngate
Posts: 6302
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: Can't edit config.txt

Mon Sep 17, 2012 3:35 pm

pluggy wrote:... Some holes in the Pi implementation of a GUI I feel........
No, just Nanny Linux.

I've just tried sudo startx, and can edit config.txt from there using >Run > "leafpad /boot/config.txt" as you would expect.
Gets rid of most of the nannyism

User avatar
pluggy
Posts: 3635
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
Contact: Website

Re: Can't edit config.txt

Mon Sep 17, 2012 4:39 pm

I didn't run the whole desktop as sudo. I was expecting it to work like Gnome or Unity and run gedit with sudo whilst the desktop is bog standard user. I'm not really a fan of LXDE.
Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......

HiToAll
Posts: 1
Joined: Sat Jun 08, 2013 6:58 pm

Re: Can't edit config.txt

Sat Jun 08, 2013 7:11 pm

Looks like I am replying to a very old post. I had the same problem, searched it online and came here but couldn't find proper answer. The easiest way to overcome this problem is: Click on Start --> X-Terminal as root(GKsu), now you are working as a root user, from here change the directory to where the file is located, e.g(cd /etc/apache2/sites-available) then open your file with leafpad (sudo leafpad /etc/apache2/sites-available/default), make changes and save it. It worked perfectly fine for me.

swan
Posts: 1
Joined: Thu Oct 09, 2014 4:18 am

Re: Can't edit config.txt

Thu Oct 09, 2014 4:29 am

To alexeames
You wrote "Next time you boot into your Pi. Don't go straight into the gui by typeing startx. Stay in the command line and do the sudo nano /boot/config.txt from there. It will work."

How do you stop the automatic gui from booting and have the opportunity to type "startx"?

Thank you.

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

Re: Can't edit config.txt

Thu Oct 09, 2014 2:01 pm

There's an option in sudo raspi-config to do that.

Or simply press [CTRL]+[ALT]+[F2] on your keyboard to get a new login screen. Login with id pi and password raspberry (which won't display as you type it) and you will get a bash shell (which works like a DOS command line).

Press [CTRL]+[ALT]+[F1] or [CTRL]+[ALT]+[F7] to get back to the GUI when you're done.
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.

johnnythefridge
Posts: 1
Joined: Sat Nov 01, 2014 3:34 pm

Re: Can't edit config.txt

Fri Mar 02, 2018 9:23 am

I had a similar experience to this. I was trying out a new TV as a monitor and kept getting signal out of range. I was trying different settings in the config.txt file but was not immediately aware that the writes to the sd card from my laptop were failing. (I tried it from Windows 7 and also Ubuntu). I even tried a fresh install of Raspbian to the SD card with Etcher but that failed the verification stage. I switched to another sd card and problem solved. I guess SD cards can go bad in spectacular and interesting ways.

rohan katreddy
Posts: 1
Joined: Tue Jul 21, 2020 2:16 pm

[SOLVED] rpi sd card write protected

Tue Jul 21, 2020 2:19 pm

The case for me was that I put my SD card reader in lock by accident and that's the reason I couldn't write or edit it.
Hope it helps!

Return to “Beginners”