- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 746
atuin not saving new commands into local database #380
Copy link
Closed
Description
Issue body actions
I installed atuin per the README on 2022-04-28, in what I presume is local-only mode (i.e. I didn't set up any kind of sync).
I then imported my bash history, which worked great (very fast as well).
Today (2022-05-02), I noticed that recent commands seem to be missing.
~/.local/share/atuin/ looks like...
dir. .local/share/atuin/
total 6.2M
-rw-r--r--. 1 xxxx xxxx 1.9M Apr 28 17:20 history.db
-rw-r--r--. 1 xxxx xxxx 32K May 2 16:09 history.db-shm
-rw-r--r--. 1 xxxx xxxx 4.3M Apr 28 17:21 history.db-wal
# 'xxxx' is my redacted local username...so indeed the DB isn't being updated. Config is straight defaults.
(Note that I rebooted a couple of hours ago, so ALL shells have been restarted :D)
Am I missing some configuration magic?
Footnote: The fact that history.db-shm has a current timestamp suggests to me that atuin is doing its job in writing new entries, but given that I rebooted, I should think that the transactions would've been written back...
Activity
conradludgate commentedon May 3, 2022on May 3, 2022
Hmm, very perplexing. Just to ensure that the setup is valid, could you check for the existence of the ATUIN_SESSION environment variable?
ellie commentedon May 3, 2022on May 3, 2022
Oh interesting 🤔 The WAL file should be getting periodically written to the main database, I wonder why it's not happening here
Could you try opening the sqlite file with
and then run
and share the output please :)
This should force a checkpoint, and then truncate the wal file. See: https://www.sqlite.org/pragma.html#pragma_wal_checkpoint
ben-alkov commentedon May 3, 2022on May 3, 2022
Exists
0|0|0ben-alkov commentedon May 3, 2022on May 3, 2022
Note that I have since disabled atuin, started a new shell, blown away the old db, re-ran
atuin import bash, and re-enabled atuin. "Live" history append seemed to work briefly, but stopped again at some point.peterjanes commentedon May 3, 2022on May 3, 2022
I'm using sync and seeing the same issue. As with Ben's report, ATUIN_SESSION exists and the checkpoint returned
0|0|0(and updated the timestamp onhistory.dband emptiedhistory.db-wal). I also rebooted this morning.Another data point of interest: I haven't overridden the default sync, but
last_sync_timeis currently >1h ago, coincidentally (?) just before I rebooted.uthark commentedon May 4, 2022on May 4, 2022
I have the same issues, reproducible on all 3 different hosts (macOS 11 and macOS 12).
I use zsh with oh-my-zsh.
ellie commentedon May 4, 2022on May 4, 2022
So it sounds like this is happening on both Bash and Zsh?
atuin history listshow your history?sqlite3 ~/.local/share/atuin/history.db "select * from history order by timestamp asc;"show your history? The last item should have a couple of -1s after the timestamp.@peterjanes, if you run
atuin sync, does that complete successfully + is the last_sync_time updated?I'm wondering if there's something funky going on with the shell hooks
peterjanes commentedon May 4, 2022on May 4, 2022
atuin history listdoesn't show my latest commands. The most recent has a timestamp that's just before thelast_sync_time.atuin history list. I see some-1entries way back (looks like one of my imported histories) but not at the end.atuin syncupdated thelast_sync_timebut didn't change the timestamp onhistory.dbellie commentedon May 5, 2022on May 5, 2022
Hmmm interesting.
could anyone with this issue try running
and then see what's logged? Might shed light onto things. We do also need to sort out the logging experience 😅
Otherwise - what version of Atuin are people running, and which shell?
I'd basically like to determine if this is atuin not being called properly in the first place, or if it IS being called, and not inserting for some reason. A reboot would have triggered a new login, and hence a new load of .zprofile or .bash_profile, which could be messing with things here
peterjanes commentedon May 5, 2022on May 5, 2022
I don't see any log messages or files being created with the RUST_LOG variable set. However, I have seen this message occasionally (without the variable) and I'm pretty sure it's new since atuin:
Curiously, my
~/.bashrconly has 83 lines.peterjanes commentedon May 5, 2022on May 5, 2022
Aha, a data point here: I'm using bash-git-prompt and if I disable it in my .bash_profile atuin starts to update its records again. (It's executed after atuin.)
conradludgate commentedon May 5, 2022on May 5, 2022
This would imply that atuin is not running at all (the hooks would not be enabled)
Ah ok! Now we are somewhere.
Atuin for bash should be additive to your shell hooks. So you should be able to enable it after
bash-git-prompt. I'm guessing they have a bad init that overrides the hookspeterjanes commentedon May 5, 2022on May 5, 2022
Can't speak for the zsh-ers but moving the init for bash-git-prompt worked here.
jovandeginste commentedon May 5, 2022on May 5, 2022
I use (and combined) with starship.rs; I have the same issues.
3 remaining items
jovandeginste commentedon May 6, 2022on May 6, 2022
I think that did the trick for me... disabled the bash pre-exec (I got it from here)
jovandeginste commentedon May 6, 2022on May 6, 2022
... and now I upgraded that script (from V0.4.1 to V0.5.0) and it seems to work...!
ben-alkov commentedon May 9, 2022on May 9, 2022
I have a fairly complex (mostly) homemade prompt which uses (among other things) git-radar, oc (for OpenShift/k8s), a local fn for formatting, and of course PROMPT_COMMAND.
I read the usage notes for
bash-preexec.sh- they're rather contradictory:"Source this file at the end of your bash profile so as not to interfere with...PROMPT_COMMAND"
but then also
"This module requires...Bash features which you must not otherwise be using...the "PROMPT_COMMAND" variable. If you override...these after bash-preexec has been installed it will most likely break"
TL;DR - I probably have some PROMPT_COMMAND debug/engineering to do
ellie commentedon May 20, 2022on May 20, 2022
I'm going to close this one for now, it doesn't look like there's much we can do
If you're facing this problem, please ensure that your PROMPT and bash-preexec are not conflicting with each other! You may need to change the order of some commands in your bashrc.
sftblw commentedon Jun 16, 2023on Jun 16, 2023
Maybe not related but for information, I had similar symptom and the reason for me was triple initialization by running the installer script three times over time. The first one had manual edit for disabling up arrow.
~/.bashrccameronj86 commentedon Aug 26, 2023on Aug 26, 2023
@sftblw's fix worked for me as well.
For me, I had manually pasted atuin init bash into .bashrc to override the system not accepting adjustments to the key bindings and inadvertently commented out the existing part of .bashrc:
The errors I was receiving prior to this were:
Unfortunately, now it syncs but the key_binding has gone back to opening atuin via up-arrow
czue commentedon Dec 18, 2023on Dec 18, 2023
I just ran into this setting up a new machine. In my case the issue was not having
bash-preexecinstalled, and the solution was to run:philippotto commentedon Jan 10, 2024on Jan 10, 2024
For me the solution was to remove the
per-directory-historyplugin I had installed for zsh. The existence of that plugin caused only empty commands to be saved into the atuin database.jimwins commentedon Jan 24, 2024on Jan 24, 2024
I ran into this problem when an old version (0.4.1) of
bash-preexechad been loaded by another package (WezTerm) and then the newer version (0.5.0) was loaded, but the that version implements the double-include guard in a way that doesn't actually work with old versions if they are loaded first.WezTerm has updated their bundled version of
bash-preexec, and this pull request againstbash-preexecwould at least avoid the double-loading even though it would leave the older version in place.cohml commentedon Jan 24, 2024on Jan 24, 2024
Brancd new Atuin user, also experiencing this problem. However I use Zsh, so much of the later discussion (e.g.,
.bash-preexec.sh) is irrelevant for me, I think.I followed the recommended instructions to install Atuin:
bash -c "<(curl https://raw.githubusercontent.com/atuinsh/atuin/main/install.sh)"Then, I registered and ran
atuin login, followed by runningI now see Atuin, loaded with all of my old history, and the keybindings work as desired.
However, when I execute new commands, they don't show up in Atuin. I do see them in
history | tail, and when I disable Atuin's up arrow keybinding, I can scroll up to access those new commands. But Atuin seems completely oblivious to their existence. Basically all I see are the old commands that I synced in.I have attempted some light debugging, consisting mostly of deactivating plugins to avoid muddying the waters. But the problem persists.
Can @ellie or any fellow Zsh users assist? Absolutely beautiful project btw :)
cohml commentedon Jan 24, 2024on Jan 24, 2024
Following up on my earlier comment...
So I think I figured it out. Pre-Atuin, my
.zshrchadsetopt SHARE_HISTORY. When I remove that one line, new commands start showing up in Atuin and persisting across sessions.Not sure if this is a known bug or something I was just doing wrong, but anyway, I seem to have resolved my issues for now!
Edit: Since Atuin is a radical new way of tracking history, I'd be curious to know the extent to which zsh's typical history options still have an impact. For example,
HIST_FIND_NO_DUPS,HIST_IGNORE_ALL_DUPS,HIST_REDUCE_BLANKS, ... Does Atuin utilize those at all?ellie commentedon Jan 24, 2024on Jan 24, 2024
Oh interesting! Definitely a bug. Would you be able to open a new issue for this specific problem please? I'm going to lock this issue now, as this is getting quite difficult to follow
It shouldn't impact us at all. Atuin uses shell hooks to record history, and doesn't interact with the actual shell history mechanism