lnav icon indicating copy to clipboard operation
lnav copied to clipboard

Can't stat file - no such file or directory

Open ryanjarvis opened this issue 5 years ago • 6 comments

I have two Ubuntu 16.04 boxes. Both of them installed lnav via snap. Both running 0.8.4-dirty. On one box, lnav works as expected, on the other I can't seem to open any files.

When I run lnav /var/log/test.log I get the error:

Cannot stat file /var/log/test.log -- No such file or directory
error: no log files given/found.

I can however successfully run stat /var/log/test.log and less /var/log/test.log

Is there a verbose mode or something I can run to see how it is arriving at the decision that it cannot stat the file so I can try and figure out what the differences may be?

ryanjarvis avatar Jun 27 '19 13:06 ryanjarvis

I think snaps are sandboxed in some way, maybe that's getting in the way?

tstack avatar Jun 27 '19 13:06 tstack

Both installations were done with snap and one seems to be working but I will do a little research into how snap works.

lnav will open some files on the problem box like /var/log/boostrap.log but not others like the ones my program are creating. So I was wondering if it might be more file related.

ryanjarvis avatar Jun 27 '19 14:06 ryanjarvis

I compiled 0.8.5 from source and lnav appears to open every file I need it to on every box I have so far.

I looked a little into snap but was unable to find any architectural clues. Since I have it working now I will not be looking into this further.

ryanjarvis avatar Jun 27 '19 19:06 ryanjarvis

I have had exactly the same issue (Cannot stat file ...) with lnav-0.8.4-dirty from snap. Installation of default version from Ubuntu 18.04 repository (0.8.2) worked well. I have also downloaded latest deb package (0.8.5) from web and install. It also woks great.

Therefore it has to be something related to snap.

ales77 avatar Feb 14 '20 13:02 ales77

I seem to have a similar issue on my Raspberry Pi, when trying to read Homebridge logs:

> lnav /var/lib/homebridge/homebridge.log
Cannot stat file: /var/lib/homebridge/homebridge.log -- No such file or directory

but this command (as the same user) does show the content of that file:

cat /var/lib/homebridge/homebridge.log

Version: lnav 0.9.0 (via snap; apt-get does not give a newer version than 0.8.4)

Workaround: hb-service logs | lnav (this does work)

pro-sumer avatar Feb 11 '21 10:02 pro-sumer

Same problem here.

By definition a tool like lnav should be able to access the whole filestystem, but snaps are designed to sandbox an app. A snap can be installed in "classic" mode that removes all sandboxing, and hence all security, BUT is only possible if the snap has been prepared for that.

@tstack any plans to make this possible ?

pagaille avatar Sep 15 '23 10:09 pagaille