atuinsh/atuin

[Bug]: Unable to fully remove atuin

Skaronator opened this issue · 11 comments

What did you expect to happen?

I expect that atuin is fully removed from my machine.

What happened?

When opening a ZSH Shell in Gnome on my Fedora machine, I got this error: atuin: requires bash >= 3.1 for the integration.
image

The error is pretty straightforward and at first glance you could say that I used the bash autocompletion in my zsh which I would agree but this is not the case.

I recently switched from bash, to bash with ble.sh to zsh and now this error persists.

I did 2 hours of searching and debugging and I could not figure it out. At this point, atuin is completely removed from my system.

~ which atuin
/usr/bin/which: no atuin in (/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin)
➜  ~ type atuin
atuin not found
➜  ~ ps aux | grep autin
n.wagner   17006  0.0  0.0 222564  2560 pts/4    S+   16:41   0:00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox autin
➜  ~ 

My zshrc is back to standard config and I don't load any custom scripts:

cat ~/.zshrc
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="robbyrussell"
plugins=(git)

source $ZSH/oh-my-zsh.sh

My system doesn't have any files called:

~ sudo find / -type f -name "atuin" 2>/dev/null

➜  ~ 

I also briefly searched for the error string, but this is quite slow / too slow for me right now:

sudo find / -type f -size -10M -print0 | pv -l | xargs -0 grep -l "requires bash >= 3.1 for the integration." 2>/dev/null

/home/n.wagner/.config/google-chrome/Default/Sync Data/LevelDB/008854.log                                                                                                                                                      ]
/home/n.wagner/.config/google-chrome/Default/Sync Data/LevelDB/008855.ldb
/home/n.wagner/.config/google-chrome/Default/Shortcuts
/home/n.wagner/.zsh_history>                                                                           

I did let it run for an hour and it didn't find anything.

What's interesting that the atuin variables are set when opening a fresh terminal:

atuin: requires bash >= 3.1 for the integration.
➜  ~ echo $__atuin_initialized
true

I did try to use set -x to see if I could figure out where this is set but no luck.

Weirdly, running this in a new shell (not interactive) doesn't trigger it:

~ zsh -c 'echo $__atuin_initialized'~ 

At this point, I have no clue where this come from.

Atuin doctor output

➜  ~ atuin doctor
zsh: atuin: command not found...
Install package 'atuin' to provide command 'atuin'? [N/y] N

Code of Conduct

  • I agree to follow this project's Code of Conduct

Ok I'm fairly confused at the mix of both zsh and bash in your errors and debugging. You say you removed Atuin from your zshrc, but is it also definitely removed from your bashrc?

and also - how did you install Atuin?

Everything here is relevant to zsh. I used bash and bash with ble.sh in the past (until last week).

I downloaded the atuin binary and placed it in /usr/local/bin and added the "atuin init bash" (or zsh) to my bashrc / zsh.rc, and I think that was it.

I can't see any atuin config stuff in the /home directory of my machine:

~ sudo find /home -type f -size -10M -print0 | xargs -0 grep -l "atuin" 2>/dev/null | grep -v google-chrome
/home/n.wagner/.local/share/gvfs-metadata/home-ca2f497b.log
/home/n.wagner/.local/share/gvfs-metadata/home
/home/n.wagner/.local/share/atuin/history.db
/home/n.wagner/.local/share/doc/blesh/ChangeLog.md
/home/n.wagner/.bash_eternal_history

Interestingly, when starting a new bash from my zsh terminal it tries to call atuin:
image

saidly, set -x doesn't help here to figure out where this comes from.

Interestingly, when starting a new bash from my zsh terminal it tries to call atuin:

In that case, could you please share your .bashrc and .bash_profile

Nothing suspicious here:

~ cat .bashrc
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
	. /etc/bashrc
fi

# User specific environment
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]
then
    PATH="$HOME/.local/bin:$HOME/bin:$PATH"
fi
export PATH

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=

# User specific aliases and functions
if [ -d ~/.bashrc.d ]; then
	for rc in ~/.bashrc.d/*; do
		if [ -f "$rc" ]; then
			. "$rc"
		fi
	done
fi

unset rc
  ~ cat .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
	. ~/.bashrc
fi

# User specific environment and startup programs

Additionally, I had a single file that would be included as well, but it only contains the old variable export. No init, nothing.

➜  ~ ls ~/.bashrc.d 
aliases
➜  ~ grep "atuin" ~/.bashrc.d/aliases 
export ATUIN_SYNC_ADDRESS=https://atuin.wagner.gg
➜  ~ 

Interestingly, I can place a atuin shell script in /usr/local/bin (or any other folder that is in my $PATH) and this script gets definitely called when starting "bash" but not when starting zsh.

I added a sleep 60 and some debugging info bot not that useful (e.g. got no output)

cat atuin
#!/bin/sh
set -x

echo "Called by: ${BASH_SOURCE[1]} at ${FUNCNAME[1]}: ${BASH_LINENO[0]}" >> /tmp/debug.log

echo $1

env

pwd

ps aux

sleep 60

I also found the process id with that shell command but yeah not really helpfull to find the source.

You could try strace-ing the shell process and checking the files it accesses

strace -fe trace=%file bash -c exit
strace -fe trace=%file zsh -c exit

Okay, found it without the -c argument strace -fe trace=%file bash:

openat(AT_FDCWD, "/etc/profile.d/", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3
newfstatat(3, "", {st_mode=S_IFDIR|0755, st_size=650, ...}, AT_EMPTY_PATH) = 0
faccessat2(AT_FDCWD, "/etc/profile.d/atuin.sh", R_OK, AT_EACCESS) = 0
openat(AT_FDCWD, "/etc/profile.d/atuin.sh", O_RDONLY) = 3

Its part of my /etc/profile.d/.. Removing that file fixes it! THANK YOU

No worries.

Mind if I ask why you removed Atuin?

Oh, I actually don't want to remove it. I really like it; it's a fantastic tool! I just thought it would be simpler to explain/debug this issue by removing it first before doing a fresh install :)

(I'm currently switching to zsh as well as to homebrew for most of my tools/packages on this machine)

Oh I see! Totally makes sense, thank you :)