lnav icon indicating copy to clipboard operation
lnav copied to clipboard

Unable to tail remote files - Remote files tailer.bin.xxxxx permission denied

Open nelox opened this issue 2 years ago • 4 comments

lnav version

v0.10.1

Describe the bug

I am unable to tail remote files.

To Reproduce

I can confirm the following:

  • SSH into a remote host without any interaction
  • SCP a file on the remote host

Steps to reproduce the behavior:

  • lnav myuser@host:/path/to/logfile.log
  • lnav shows bash: ./tailer.bin.XXXXX: Permission denied
  • tailer.bin.XXXXX is created in my home directory myuser.myuser:775
  • After quitting lnav, the file tailer.bin.XXXXX is not deleted.

Is this expected behaviour and what steps should I take to resolve it please?

nelox avatar Jun 24 '22 04:06 nelox

Can you run lnav with -d /tmp/lnav-debug.log and attach the generated debug file.

Can you mention what OS you are using locally and what is on the remote? It kind of sounds like there is some sort of sandboxing preventing the tailer executable from running.

tstack avatar Jun 24 '22 06:06 tstack

Hello, I have the same problem.

I really don't know if bumping this issue is good or if I should create a new issue.

Host os: Arch lnav version: 0.11.1 Destination os: debian ssh keys work normally. Also, I have several debian vm's and the problem only happens in 1 (I tested 4 vm's) those vm's are almost identical, cloned base and then purposed differently. Googling the problem there is only mono (.NET) related threads. and the vm that fails has mono installed this maybe is a clue? Anyway: I can provide the debug log ran with lnav -N -d lnav-debug.log

lnav-debug.log

EDIT: this is the output of mono -v tailer.number.bin

mono tailer.bin debug.txt

stseifer avatar Dec 05 '22 03:12 stseifer

I have the same problem. In the debug log there are these lines just before the permission denied error:

2023-11-02T15:41:55.800 D t4 tailer.looper.cc:94 tailer[remote-server:] tailer(remote-server:): executing -- ssh -oBatchMode=yes -oConnectTimeout=10 remote-server cat > tailer.bin.68127 && chmod ugo+rx ./tailer.bin.68127
2023-11-02T15:41:55.904 D t3 tailer.looper.cc:378   wrote 147456
2023-11-02T15:41:55.944 D t4 tailer.looper.cc:94 tailer[remote-server:] Could not chdir to home directory /home/remoteuser: No such file or directory
2023-11-02T15:41:55.944 D t4 tailer.looper.cc:94 tailer[remote-server:] bash: line 1: tailer.bin.68127: Permission denied
2023-11-02T15:41:55.944 E t3 tailer.looper.cc:1150 reporting error: remote-server: -- failed to ssh to host: bash: line 1: tailer.bin.68127: Permission denied

The server I'm SSH:ing doesn't have a home directory for the current user. Perhaps that is the problems? Does the tailer require a working home directory by any chance? Or at least assume because $HOME is set that the folder actually exists?

I noticed this on a server where $HOME is set to /home/remoteuser even though that folder doesn't exist. If I try lnav remotely towards another identical server that has the folder cerated, it works.

eproxus avatar Nov 02 '23 14:11 eproxus

The server I'm SSH:ing doesn't have a home directory for the current user. Perhaps that is the problems? Does the tailer require a working home directory by any chance? Or at least assume because $HOME is set that the folder actually exists?

I haven't tested something like this, so not sure at the moment. The commands that are run to transfer/start the tailer are configurable, though, so maybe you can make it work. The default values are defined here:

https://github.com/tstack/lnav/blob/e1b8e163ad2113a916d6500448fb320945ac0bef/src/root-config.json#L37-L38

So, the tailer is copied to the current directory (the binary is fed in over stdin) and then kicked off from there as well. You can change their values with the :config command. Maybe try copying to /tmp:

:config /tuning/remote/ssh/transfer-command cat > /tmp/{0:} && chmod ugo+rx /tmp/{0:}

And, then the start command will need to be tweaked as well:

:config /tuning/remote/ssh/start-command bash -c /tmp/{0:}

tstack avatar Nov 02 '23 15:11 tstack