nhi does not work on Archlinux
Closed this issue · 14 comments
Hi,
This appears to be a fantastic utility.
However, following the readme, I installed nhi
on ArchLinux, but it does not seem to work correctly, as the echo nhi test
failed (no output).
Also, nih.bash
seems to conflict with the merged_history.bash
script published in http://ptspts.blogspot.com/2011/03/how-to-automatically-synchronize-shell.html to get a persistent command history, which does not work anymore if nhi.bash
is sourced in .bashrc
.
What happens if you comment out content of your .bashrc
and left only source /etc/nhi/nhi.bash
uncommented (and obviously restart your terminal/bash)?
does nhi works in that situation?
Same result : no output from nhi fetch {-1}
I tried something else:
Clone your repository
- Compile
nhi
with make - delete
/var/nhi/db
- and rerun
sudo -E bash ./install
Now I get
$ echo nhi test
nhi test
$ nhi fetch {-1}
no such shell session: 0
$
Before running install file again, you need to manually reverse changes made by install.
What you basically need to do is:
- stop and disable service by:
sudo systemctl stop nhid && sudo systemctl disable nhid
- delete all files created by install
- and remove
source /etc/nhi/nhi.bash
lines from.bashrc
(or/and.zshrc
)
(https://github.com/strang1ato/nhi/blob/main/install#L17)
Now rerun sudo -E bash ./install
(after following #16 (comment)) and restart you machine
Same error message : no such shell session: 0
(started from scratch, with ~/.bashrc
only containing the source /etc/nhi/nhi.bash
line)
Can you show me the content of /tmp/nhi.log
file (this file is created if error occurs, if it doesn't exist that's okay. You need root access to access that file).
and can you run this command and send me the output:
getent group tty
Hi, here is the output :
$ getent group tty
tty:x:5:brltty
$ echo nhi test
nhi test
$ nhi fetch {-1}
no such shell session: 0
$ getent group tty
tty:x:5:brltty
$ sudo ls -l /tmp/nhi.log
-rw----r-T 1 root root 424 19 déc. 22:15 /tmp/nhi.log
sudo cat /tmp/nhi.log
2021-12-19 22:14:55 | process_vm_readv failed at get_shell_environ
2021-12-19 22:14:55 | no such table: 0
2021-12-19 22:15:13 | process_vm_readv failed at get_shell_environ
2021-12-19 22:15:13 | no such table: 0
2021-12-19 22:15:24 | process_vm_readv failed at get_shell_environ
2021-12-19 22:15:24 | no such table: 0
2021-12-19 22:15:27 | process_vm_readv failed at get_shell_environ
2021-12-19 22:15:27 | no such table: 0
2021-12-19 22:15:57 | process_vm_readv failed at get_shell_environ
2021-12-19 22:15:57 | no such table: 0
$
I ran these command inside the Kitty terminal I currently use, but got same output when run inside a gnome-terminal.
Also I ran these commands with a ~/.bashrc
containing only the nhi.bash
line, and after removing/reinstalling nhi
and rebooting.
Can you run this command and send here the output:
objdump -T $(which bash) | awk -v sym=environ ' $NF == sym && $4 == ".bss" { print $1; exit }'
Sure, here it is :
$ objdump -T $(which bash) | awk -v sym=environ ' $NF == sym && $4 == ".bss" { print $1; exit }'
00000000000e92e0
$
What's your kernel version? and are you sure that all deps are installed?
Hmm, some additional infos from my system, which I maintain uptodate very frequently (every week or so)
$ cat /proc/version
Linux version 5.15.10-arch1-1 (linux@archlinux) (gcc (GCC) 11.1.0, GNU ld (GNU Binutils) 2.36.1) #1 SMP PREEMPT Fri, 17 Dec 2021 11:17:37 +0000
$
Is there any dependency I could check which is not listed below ?
(Arch packages may be different than those of Debian family).
$ LANG=C sudo pacman -Q binutils gawk sqlite3 libsqlite3-dev libbpf libbpf-dev
binutils 2.36.1-3
gawk 5.1.1-1
sqlite 3.37.0-1
error: package 'libsqlite3-dev' was not found
libbpf 0.6.0-1
error: package 'libbpf-dev' was not found
$
binutils
containsobjdump
- According to ROS,
sqlite
package contains dev version
As for libbpf-dev
, I don't know, could it be the culprit ?
@hutou
On my arch device nhi works fine without any issues, I think that I might need to install nhi on fresh and mininimal arch install.
I will let you know whether I can replicate your issue.
@hutou
Can you follow these steps: #13 (comment), and check whether nhi works after reboot
Finally, nhi
works on my computer, but ... I could not identify the precise reason why it did not work after the first installation, because I made many manipulations, installations and reinstallations without results before suddenly noticing that it worked!
Maybe the result of a system update?
In any case, I found that the installation of the lib32-sqlite package is not necessary for an Archlinux install.
Moreover, to answer my need for command history management (see post 1), in the /etc/nhi/nhi.bash
file, I modified the line
declare PROMPT_COMMAND="prompter"
by
declare PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND}; prompter"
(and also to keep other programs using PROMPT_COMMAND
working, like autojump
.
Another suggestion : add "current" after the session Id when appropriate for nhi log
command
Thanks for this very usefull utility.
Moreover, to answer my need for command history management (see post 1), in the /etc/nhi/nhi.bash file, I modified the line
declare PROMPT_COMMAND="prompter"
by
declare PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND}; prompter"
(and also to keep other programs using PROMPT_COMMAND working, like autojump .
I will try to add it in the next release
Another suggestion : add "current" after the session Id when appropriate for nhi log command
Thanks for suggestion, I will try to address that as well (although probably in some other time)