Score:1

What is executed?

in flag
$ which -a chia
/usr/bin/chia
/bin/chia
$ ll /bin/chia
lrwxrwxrwx 1 root root 49 janv.  9 08:40 /bin/chia -> /opt/chia/resources/app.asar.unpacked/daemon/chia*
$ ll /usr/bin/chia
lrwxrwxrwx 1 root root 49 janv.  9 08:40 /usr/bin/chia -> /opt/chia/resources/app.asar.unpacked/daemon/chia*
$ ll /opt/chia/resources/app.asar.unpacked/daemon/chia
-rwxr-xr-x 1 root root 5522760 janv.  3 20:57 /opt/chia/resources/app.asar.unpacked/daemon/chia*
$ chia
bash: /usr/lib/chia-blockchain/resources/app.asar.unpacked/daemon/chia: No such file or directory

I'm lost: it seems that the command chia that is executed is not one of these listed by which -a.

What the heck is happening here?

A little history of this computer: the chia blockchain which includes the command chia was once installed in /usr/lib/chia-blockchain. But this directory does not exist anymore.

Can someone explain how the shell comes to the idea of starting chia from /usr/lib/chia-blockchain?

I did the "work of which -a" manually by checking the presence of a chia executable in each of the directories in my $PATH and only found the 2 that are listed...

I also do not have a variable "chia" defined. (echo $chia => nothing)

Thanks in advance for taking some time to answer.

best regards Philippe

Edit asked by terdon (thanks):

$ type -a chia
chia is aliased to `/usr/lib/chia-blockchain/resources/app.asar.unpacked/daemon/chia'
chia is /usr/bin/chia
chia is /bin/chia

Yeah, looks like there is an alias.

$ readlink -f /bin/chia
/opt/chia/resources/app.asar.unpacked/daemon/chia
$ readlink -f /usr/bin/chia
/opt/chia/resources/app.asar.unpacked/daemon/chia

How can I remove this "chia alias" ?

in flag
If the alias is something that you set a while ago, then it may be in `.bash_aliases`
Score:1
cn flag

So, as you can see, the issue here is that you have an alias, chia, which points to /usr/lib/chia-blockchain/resources/app.asar.unpacked/daemon/chia. Aliases take precedence over anything else so if there is an alias, that will always be executed instead of any command of the same name.

You need to find where the alias is defined. This command should show you which file you have added it in:

grep ' chia=' ~/.bashrc ~/.profile ~/.bash_profile ~/bash.login ~/.bash_aliases /etc/bash.bashrc /etc/profile /etc/profile.d/* /etc/environment 2> /dev/null

If that returns nothing, you have defined the alias in one of the files sourced by the one of the files listed above. Finding it then will be more complicated, but you can start by looking source or grep -F '. ' in those files to see what they source. But chances are, the first command will find it.

Once you have found where the alias is defined, edit that file and delete or comment out (add a # to the start of the line) the line to remove the alias definition.

Alternatively, you can override the alias by using the full path:

/usr/bin/chia

Or by escaping the alias:

\chia

You can also remove the alias temporarily, for the current shell session only with:

unalias chia
philippe.kienner avatar
in flag
Exactly. Thanks.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.