First command after opening a new terminal session is not being saved

For example, I open a terminal, run ls, check history, its not saved. Then I run another command, say cd build, check history, its saved.

I can reproduce this 100% of the time. For now I press enter after starting terminal/new tab after which commands are saved but its still very annoying when I forget to do so.

Fedora 41, bash 5.2.32, ptyxis-47.6-1

Thanks

Hm, network communication issue with the socket?

1 Like

I think you are saying it could be an issue with connecting to the internet? I haven’t setup sync yet so Im not sure how that could be an issue but im new to Linux, I dont really know.

Any idea how to debug this? does atuin have logs or something like that? Thanks

No, I meant the socket connection to the atuin systemd service (if you are using that).

Usually I got an error message directly in the terminal when accessing the history failed. Can you access the history on that first attempt?

1 Like

Could you share the output of atuin doctor please?

If you haven’t already, try blesh - GitHub - akinomyoga/ble.sh: Bash Line Editor―a line editor written in pure Bash with syntax highlighting, auto suggestions, vim modes, etc. for Bash interactive sessions.

Bash has no native support for shell hooks, so what we have to do is a bit of a hack. Blesh works better, all other shells work even better

1 Like

Thanks! ble.sh thing did the trick, now it works and it seems I also got some new features which is really cool. Thanks again for the help (and for making atuin too!)

1 Like

I’m having the same issue, with a similar setup. Bazzite (so a Fedora 41 spin), bash 5.2.37, ptyxis 47.10.

I never get an error message, it’s just that the first command in a new shell never shows up in my atuin history.

My atuin doctor:

{
  "atuin": {
    "version": "18.4.0",
    "sync": null,
    "sqlite_version": "3.46.0"
  },
  "shell": {
    "name": "bash",
    "default": "bash",
    "plugins": [
      "atuin",
      "bash-preexec"
    ],
    "preexec": "bash-preexec"
  },
  "system": {
    "os": "Bazzite",
    "arch": "x86_64",
    "version": "41",
    "disks": [
      {
...
      }
    ]
  }
}

I snipped the disks because I didn’t think it was really relevant, but I’m using btrfs if it matters.

I got atuin by running “ujust bazzite-cli” which installed atuin and a few other toys, possibly including bash-preexec. I mention bash-preexec because the discussion mentioned bash hooks, and bash-preexec seems to be hook-related.

I’m not sure quite where to find the source of the “bling.sh” script it runs every boot, but
the atuin-relevant part of the “bling.sh” script is:

if [ "$(basename "$SHELL")" = "bash" ]; then
    #shellcheck disable=SC1091
    . /usr/share/bash-prexec
    [ "$(command -v atuin)" ] && eval "$(atuin init bash)"
    [ "$(command -v zoxide)" ] && eval "$(zoxide init bash)"
elif [ "$(basename "$SHELL")" = "zsh" ]; then
    [ "$(command -v atuin)" ] && eval "$(atuin init zsh)"
    [ "$(command -v zoxide)" ] && eval "$(zoxide init zsh)"
fi

(and yes, the path is /usr/share/bash-prexec not bash-preexec, but it is the script from rcaloras/bash-preexec)

Thanks, and I hope this is useful.