14

I am using Ubuntu 16.04. When I use the clear command in a terminal, it produces this error:

terminals database is inaccessible

But when I use sudo clear it works as intended.

I have removed some files in /var/www/ and, after that, this problem started. I checked this question "clear" command in GNOME terminal returns "terminals database is inaccessible" but that did not help in any way

Here is the output of strace -etrace=open clear:

open("/home/user/anaconda3/bin/../lib/tls/x86_64/libncursesw.so.5", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/home/user/anaconda3/bin/../lib/tls/libncursesw.so.5", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/home/user/anaconda3/bin/../lib/x86_64/libncursesw.so.5", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/home/user/anaconda3/bin/../lib/libncursesw.so.5", O_RDONLY|O_CLOEXEC) = 3
open("/home/user/anaconda3/bin/../lib/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
terminals database is inaccessible
+++ exited with 1 +++
muru
  • 207,228
Harwee
  • 321
  • 1
  • 2
  • 8

10 Answers10

8

Path for Anaconda3 is set in .bashrc. It is interfering with the clear command. Removing Anaconda path from path solved the issue.

Here is the GitHub reference for the issue: https://github.com/ContinuumIO/anaconda-issues/issues/331

Harwee
  • 321
  • 1
  • 2
  • 8
4
export TERMINFO=/usr/share/terminfo

this works for me.

3

You might have moved the anaconda directory after installation and some bash script links in some files from anaconda directory are still pointing to the previous location. Simplest solution is to delete your current anaconda installation directory, remove any paths in .bashrc pointing to it and reinstall it in the desired location.

2

This is an issue you'll face after moving the Anaconda Python directory to a different location. In your $PATH variable, you will your Python home's bin directory ($PYTHON_HOME/bin). Just go this bin directory, rename the existing "clear" binary file and login again.

cd $PYTHON_HOME/bin
mv clear clear.bkup
Thyag
  • 121
1

This did work to me:

alias clear="TERM=xterm /usr/bin/clear"

Add it to the .bashrc file.

sotirov
  • 4,379
ton
  • 221
1

You can create a soft-link to your existing command (verify it first using which clear on both conda activate and conda deactivate states):

sudo rm /opt/miniconda3/bin/clear
sudo ln -s /opt/miniconda3/bin/clear /usr/bin/clear
Akumaburn
  • 111
0

In case you see "(your_env_name)" to the left, typingconda deactivate will solve your problem

0

I just edited my .bashrc file (if you use another type of shell, you should edit the respective .*rc file).

I just added this line in the end, so that it runs every time I open a new terminal:

conda deactivate

Once I found that this command solves my problem, putting it to run every time I open a terminal is an easy solution.

Adame
  • 1
0
sudo mv $CONDA_PREFIX/bin/clear $CONDA_PREFIX/bin/clear_old

This Worked for me on Ubuntu 20.04 too. Thanks

muru
  • 207,228
0

I solved this by replacing conda clear with the system clear.

  1. find the system clear command path by typing which clear, copy the results;
  2. replace by mv PATH_TO_SYSTEM_CLEAR $CONDA_PREFIX/bin/clear.