I searched and found similar questions but none were specific enough or solved my issue. An example would be this question Starting remote script/terminal based programs through ssh gives error (Error opening terminal: unknown.) which I am not using ssh
so -t
will not help.
Running webmin, has been fine for months and now I get this error.
Basically when I type nano or vi into terminal, I get the error "Error opening terminal: unknown."
[user@host ~]# nano
Error opening terminal: unknown.
[user@host ~]# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial
[user@host ~]# nano
Error opening terminal: unknown.
[user@host ~]#
How do I fix "Error opening terminal: unknown." on Ubuntu 16.04.3 LTS running webmin?
New information:
- When I try running vi or nano directly on the server instead of using webmin or ssh to remote in, it works. Could this just be a problem with webmin?
- When I examine the environment variables it say's
TERM=linux
which is consistent with my other server which is running all the same software.
Try to run /bin/bash, I think it will allocate pseudo tty
Also try:
TERM=linux
then run nanoWebmin terminal is not interactive yet. In-fact, it's a command line interface.
You can read more about it, we discussed it quite a lot.
It's in our todo to make it interactive.
I encountered this problem when I was trying to edit files inside the initramfs. This was the only thread I found so instead of hunting for another fix, I wrote a python script to make a simple text editor that works inside the initramfs (and other feature poor terminals)
It's pretty simple, only displays one line at a time so you press up and down to change lines and left and right to move the cursor and enter to save. Nothing fancy, but it seems to work okay for quick edits.
It requires only the readchar module: python3 -m pip install readchar
I had the same problem and it was solved in the following way: