prodata
Posts: 160
Joined: Tue Jan 24, 2012 5:53 pm
Contact: Website

Re: Editing config.txt

Thu Apr 19, 2012 3:25 pm

Presumably there is a way of editing config.txt from within the LXDE GUI? I'm still trying to tweak my TV display settings and rather than keep taking the SD card out and to my Windows machine for every minor tweak I was looking for a way of doing it within LXDE.

I've found the LeafPad text editor and can obviously make the text changes, but I'm not allowed to overwrite config.txt, presumably because of a permissions issue?

Is the only simple option to keep using the Windows PC for the edits?

User avatar
frying_fish
Posts: 80
Joined: Mon Jan 23, 2012 3:26 pm

Re: Editing config.txt

Thu Apr 19, 2012 3:31 pm

You could use a command line text editor, or, run leafpad with elevated permissions.

From a terminal application:

$ sudo leafpad

That would then open leafpad as a root user, and you should then be able to edit config.txt, assuming the partition it is on is mounted read/write. I haven't received my Pi yet so just going from normal linux commandline knowledge.

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Editing config.txt

Thu Apr 19, 2012 3:55 pm

I think you have to use sudo regardless of which editor you use.

Presumably, the issue is that the FAT partition is mounted in such a way that it is writable only by root.

By the way, is the FAT partition mounted by default (once you are up and running in Linux) ?  It's been a while, but it seems to me that it wasn't.  I suppose I could check.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

prodata
Posts: 160
Joined: Tue Jan 24, 2012 5:53 pm
Contact: Website

Re: Editing config.txt

Thu Apr 19, 2012 4:02 pm

Thanks. As a newcomer to Linux, I first thought that a terminal application might be the command prompt, which didn't work. Then tried the root terminal app, but I don't seem to have a password for that. Then LXTerm, which I guess should have been the obvious choice in retrospect, which did work (except that you seem to have to Save As rather than just Save).

Chris.Rowland
Posts: 239
Joined: Thu Jan 12, 2012 5:45 pm

Re: Editing config.txt

Thu Apr 19, 2012 9:14 pm

I've asked about getting GUI applications such as Leafpad and the file monitor to get admin access on a number of occasions and as far as I can tell it can't be done. You need to forget about the last 20 years of UI design and get into the terminal.

Then, to get root access (which is Linux speak for Admin) you need to prefix commands with sudo.

If you save your modified file to your user area, then start a terminal, you can use a command such as:

sudo cp source destination

Where source is the name of the file such as xorg.conf and destination is the destination, such as /etc/X11 (or possibly /etc/X11/xorg.conf) I used:

sudo cp xorg.conf /etc/X11/xorg.conf

Note that everything is case sensitive. The cp command copies files, the mv command moves files.  It's all far more complex than this of course.

That's an example of what I had to do to get a version of xorg.conf to set a resolution of 800x600 on the display, if your file name or destination is different you will need to make the obvious changes.

Hope that helps, this is not at all easy if you are used to a modern GUI.

User avatar
frying_fish
Posts: 80
Joined: Mon Jan 23, 2012 3:26 pm

Re: Editing config.txt

Fri Apr 20, 2012 7:53 am

Joe Schmoe said:


I think you have to use sudo regardless of which editor you use.


Correct, I forgot to mention that sorry. Indeed you need to be root, or have admin rights (in this case sudo gives the default user those rights).

GizmoB73
Posts: 80
Joined: Fri Jan 27, 2012 12:51 pm

Re: Editing config.txt

Fri Apr 20, 2012 10:44 am

After logging in to the Pi, no need to start the GUI, just use this:

$ sudo nano /boot/config.txt

That will do the trick.  Use ctrl-o to write the changes and ctrl-x to exit the nano text editor.

Nano is really easy to use, even as a Linux Noob (Like me).

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23417
Joined: Sat Jul 30, 2011 7:41 pm

Re: Editing config.txt

Fri Apr 20, 2012 12:22 pm

Blimey - somebody in Chatteris!
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

GizmoB73
Posts: 80
Joined: Fri Jan 27, 2012 12:51 pm

Re: Editing config.txt

Fri Apr 20, 2012 12:42 pm

JamesH said:


Blimey - somebody in Chatteris!



Thought I'd fess up.

Do you know Chatteris?

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23417
Joined: Sat Jul 30, 2011 7:41 pm

Re: Editing config.txt

Fri Apr 20, 2012 1:52 pm

I live just up the road (and grew up in Sutton)....
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

GizmoB73
Posts: 80
Joined: Fri Jan 27, 2012 12:51 pm

Re: Editing config.txt

Fri Apr 20, 2012 2:03 pm

JamesH said:


I live just up the road (and grew up in Sutton)....



I see prodata is from Ely too, it's a small world.

Gretchen2015
Posts: 7
Joined: Tue Jun 14, 2016 8:50 pm

Re: Editing config.txt

Tue Jun 28, 2016 4:59 pm

Sooner or later you are going to have to get used to using either the GUI with root access or use nano or another terminal text editor with root privileges.

If using a text editor editor like mousepad or leafpad....Just go to terminal type in sudo and the name of the editor. You will be prompted to enter your password.

If using nano, vi, or vim, or some other terminal text editor open a terminal type sudo and the editor's name. I use nano and it is like this.
sudo nano then path to file.

The easiest way...I think is to open your file manager as root ...
sudo thunar you will be prompted for password and go from there. When you find your file you can right click and the menu will let you open a terminal there. That is easier for me..

Romonga
Posts: 123
Joined: Mon May 09, 2016 7:09 pm
Location: Montgomery Il

Re: Editing config.txt

Tue Jun 28, 2016 5:56 pm

Some GUI applications that are started from the command line need a different call in order to run as a super user.

gksudo is what you would use to launch GUI based applications.
You can run, but you will only die tired.

User avatar
HawaiianPi
Posts: 4536
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: Editing config.txt

Wed Jun 29, 2016 12:07 am

Chris.Rowland wrote:I've asked about getting GUI applications such as Leafpad and the file monitor to get admin access on a number of occasions and as far as I can tell it can't be done...
It's actually quite easy to do. See below...
Romonga wrote:Some GUI applications that are started from the command line need a different call in order to run as a super user.

gksudo is what you would use to launch GUI based applications.
Or "gksu"

gksu leafpad /boot/config.txt
or
gksudo leafpad /boot/config.txt

Substitute geany or whatever GUI application you prefer for leafpad.

You can even add a root file manager to the menu.

Preferences > Main Menu Editor > Accessories, you should already see an entry for Root Terminal that is not enabled by default. Since we're going to start living dangerously, go ahead and check that box. Now click on New Item and fill it out like the picture below (click on the picture for full size, and use back to return here). You can also click on the icon image to change that.
Image
And there you go. Now, whenever you want to edit a text file that is outside your home directory, just fire up the root file manager from the menu, navigate to the file and double-click on it. It will open in the editor with admin rights and you can edit to your heart's content.

Do not use the root file manager in your home directory, and be careful outside of that. You could really hose your system with a few errant mouse clicks.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

User avatar
bensimmo
Posts: 4162
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: Editing config.txt

Wed Jun 29, 2016 5:59 am

I just click on the terminal windows in the taskbar or menu system and type (arrow up if just used)
sudo leafpad /boot/config.txt to launch and edit it in one go.

Which is the method on the Raspberry make and learn website
Also used to edit the last startup file/script as an example
sudo leafpad /etc/rc.local
Given by them

What benefit just gksudo give?

User avatar
B.Goode
Posts: 8274
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Editing config.txt

Wed Jun 29, 2016 7:40 am

Gretchen2015 wrote:Sooner or later you are going to have to get used to using either the GUI with root access or use nano or another terminal text editor with root privileges.
Indeed. And that advice was given to the Original Poster within an hour or so of the question being asked 4 years ago.

@prodata - the OP - has not logged on to the forums for over 2 years.

Return to “Troubleshooting”