deety
Posts: 39
Joined: Tue Jul 16, 2013 9:04 pm

cant open config from Raspi command line.

Tue Dec 03, 2019 11:28 pm

I am trying to open (for example) the config.txt file using the command "sudo nano config.txt" (with the correct path to the file used in the actual command). When I try this from the Raspi terminal itself I get "Error opening terminal: unknown." (It's the same whatever file I try to access, not just the config.txt file)
If I then use PuTTY from my W10 computer and enter the same command it works as expected, opening the file for editing.
I've had a quick look around the forums but can't actually find the same issue anywhere.
I'm on the latest version of raspian, updated and upgraded, and have made no changes to the installation. As you can tell I'm a relative noobie to Raspian, Linux and the Raspberry Pi.
Ideas?

User avatar
neilgl
Posts: 1181
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: cant open config from Raspi command line.

Tue Dec 03, 2019 11:52 pm

What happens if you type in at the termial

Code: Select all

sudo nano /boot/config.txt

User avatar
rpdom
Posts: 15574
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: cant open config from Raspi command line.

Wed Dec 04, 2019 5:45 am

I have vague memories of some issue with the terminal type not being set under certain circumstances, but no idea where I saw that.

If you type

Code: Select all

echo $TERM
I assume it will return "unknown" or nothing when typed in your terminal and "xterm" or "linux" or something else when you do it on PuTTy.

deety
Posts: 39
Joined: Tue Jul 16, 2013 9:04 pm

Re: cant open config from Raspi command line.

Wed Dec 04, 2019 8:21 am

Thanks for the replies.
When I type sudo nano /boot/config.txt at the terminal I get "Error opening terminal: unknown" error and echo $TERM I get "unknown" and from PuTTY I get "xterm".
:?:

User avatar
rpdom
Posts: 15574
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: cant open config from Raspi command line.

Wed Dec 04, 2019 9:37 am

As a workaround you can try

Code: Select all

TERM=xterm sudo nano /boot/config.txt
and that should set the terminal type. I think TERM=linux will work if xterm doesn't.

It still doesn't fix the problem, but lets you edit the file locally for now. I'll see if I can remember where/if I saw that about the TERM not being set correctly.

jahboater
Posts: 4831
Joined: Wed Feb 04, 2015 6:38 pm

Re: cant open config from Raspi command line.

Wed Dec 04, 2019 10:58 am

You could put:

Code: Select all

export TERM=xterm 
in ~/.bashrc

:) Or you could use :)

Code: Select all

sudo ed /boot/config.txt
"ed" does not require TERM to be set.
:)

Incidentally you can type:

nano /boot/con<TAB> and it will complete the name for you (saves time if you often edit the file).

deety
Posts: 39
Joined: Tue Jul 16, 2013 9:04 pm

Re: cant open config from Raspi command line.

Thu Dec 05, 2019 8:28 am

Thanks for the replies.
I'll try them out when I get the time.
Cheers

Return to “Beginners”