12

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 +++
2
  • Hmm... have you messed with how the linker resolves dynamic dependencies (such as setting LD_RUN_PATH or LD_LIBRARY_PATH or similar)? what is the output of printenv | grep LIB? Dec 22, 2017 at 17:30
  • @steeldriver anaconda3 is interfering with the clear command.
    – Harwee
    Dec 22, 2017 at 17:46

9 Answers 9

6

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

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
  • How does this differ from the other answer? Jun 13, 2018 at 3:14
  • Not necessarily, seems like the installation of Anaconda has conflicts with clear command...
    – zyy
    Feb 4, 2022 at 12:09
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
1
export TERMINFO=/usr/share/terminfo

this works for me.

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.

0
sudo mv $CONDA_PREFIX/bin/clear $CONDA_PREFIX/bin/clear_old
This Worked for me on Ubuntu 20.04 too. Thanks
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.
0

this did work to me:

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

add it to the .bashrc file

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .