durden icon indicating copy to clipboard operation
durden copied to clipboard

Trouble running durden for the first time

Open magiblot opened this issue 4 years ago • 8 comments

Hi there,

I am trying to give durden a try. I cloned the arcan and durden repositories. I made a debug build of arcan and then ran:

./arcan -T ../data/scripts -p ../data/resources /tmp/durden/durden

In the linux console, without any graphical applications running, but nothing good came out of it:

[746596]evdev::1249:platform_event_rescan_idev(): input: couldn't scan /dev/input
746596:egl-dri::3261:setup_cards_basic(): trying [basic/auto] setup on /dev/dri/card0
746643:egl-dri::1750:setup_node_gbm(): gbm, using eglGetPlatformDisplayEXT
746643:egl-dri::1770:setup_node_gbm(): gbm, node in atomic mode: no
746643:egl-dri::1780:setup_node_gbm(): derived render-node: /dev/dri/renderD128
746646:egl-dri::316:allocate_display(): (0) added, force composition? 1
746647:egl-dri::2330:setup_kms(): (0) default connector mode: 1366*768@60Hz
746647:egl-dri::2346:setup_kms(): (0) setup-kms, default-picked 1366*768
746647:egl-dri::2438:setup_kms(): (0) picked crtc (51) from encoder
746647:egl-dri::2461:setup_kms(): (0) trying tty- inherited mode 
746647:egl-dri::391:dpms_set(): dpms_set(6) to 0
746650:egl-dri::888:setup_buffers_gbm(): (gbm) picked output buffer format xRGB 24-bit
746652:egl-dri::3329:platform_video_init(): (0) mapped/default display at 1366*768
746652:egl-dri::2836:platform_video_query_displays(): issuing display requery
746652:egl-dri::2843:platform_video_query_displays(): query_card: 0
746652:egl-dri::2754:query_card(): check resources on 6
746652:egl-dri::2789:query_card(): (0) already known
746658:egl-dri::2796:query_card(): unknown display detected
746658:egl-dri::316:allocate_display(): (1) added, force composition? 1
746658:egl-dri::2811:query_card(): (1) assigned connector id (102)
746663:egl-dri::2769:query_card(): (2) lost, disabled
746663:egl-dri::2769:query_card(): (3) lost, disabled
746668:egl-dri::2769:query_card(): (4) lost, disabled
746668:egl-dri::2843:platform_video_query_displays(): query_card: 1
746668:egl-dri::2843:platform_video_query_displays(): query_card: 2
746668:egl-dri::2843:platform_video_query_displays(): query_card: 3
[747137]evdev::234:lookup_devnode(): 0 => -1
747137:egl-dri::2700:platform_video_query_modes(): (0) issuing mode scan
crashdump requested but (../data/resources//logs/crash_0425_002628.lua) is not accessible.
Lua VM failed with no fallback defined, (see -b arg).
747151:egl-dri::2856:disable_display(): (0) trying to disable
747151:egl-dri::2885:disable_display(): (0) destroying EGL surface
747151:egl-dri::2907:disable_display(): destroy gbm surface
747151:egl-dri::2935:disable_display(): (0) release crtc id (51)
747151:egl-dri::2967:disable_display(): (0) full deallocation requested
747151:egl-dri::2973:disable_display(): (0) freeing display connector
747151:egl-dri::2986:disable_display(): (0) resetting display backlight
747152:egl-dri::3731:platform_video_shutdown(): shutdown (0) took 1 ms
747152:egl-dri::2856:disable_display(): (1) trying to disable
747152:egl-dri::3731:platform_video_shutdown(): shutdown (1) took 0 ms
747152:egl-dri::2852:disable_display(): disable_display called on unused display (0)
747152:egl-dri::3731:platform_video_shutdown(): shutdown (2) took 0 ms
747152:egl-dri::2852:disable_display(): disable_display called on unused display (0)
747152:egl-dri::3731:platform_video_shutdown(): shutdown (3) took 0 ms
747152:egl-dri::2852:disable_display(): disable_display called on unused display (0)
747152:egl-dri::3731:platform_video_shutdown(): shutdown (4) took 0 ms
747152:egl-dri::2852:disable_display(): disable_display called on unused display (0)
747152:egl-dri::3731:platform_video_shutdown(): shutdown (5) took 0 ms
747152:egl-dri::2852:disable_display(): disable_display called on unused display (0)
747152:egl-dri::3731:platform_video_shutdown(): shutdown (6) took 0 ms
747152:egl-dri::2852:disable_display(): disable_display called on unused display (0)
747152:egl-dri::3731:platform_video_shutdown(): shutdown (7) took 0 ms
747152:egl-dri::2852:disable_display(): disable_display called on unused display (0)
747152:egl-dri::3731:platform_video_shutdown(): shutdown (8) took 0 ms
747152:egl-dri::2852:disable_display(): disable_display called on unused display (0)
747152:egl-dri::3731:platform_video_shutdown(): shutdown (9) took 0 ms
747152:egl-dri::2852:disable_display(): disable_display called on unused display (0)
747152:egl-dri::3731:platform_video_shutdown(): shutdown (10) took 0 ms
747152:egl-dri::2852:disable_display(): disable_display called on unused display (0)
747152:egl-dri::3731:platform_video_shutdown(): shutdown (11) took 0 ms
747152:egl-dri::2852:disable_display(): disable_display called on unused display (0)
747152:egl-dri::3731:platform_video_shutdown(): shutdown (12) took 0 ms
747152:egl-dri::2852:disable_display(): disable_display called on unused display (0)
747152:egl-dri::3731:platform_video_shutdown(): shutdown (13) took 0 ms
747152:egl-dri::2852:disable_display(): disable_display called on unused display (0)
747152:egl-dri::3731:platform_video_shutdown(): shutdown (14) took 0 ms
747152:egl-dri::2852:disable_display(): disable_display called on unused display (0)
747152:egl-dri::3731:platform_video_shutdown(): shutdown (15) took 0 ms
747182:egl-dri::460:release_card(): release card (0)
747192:egl-dri::472:release_card(): destroying device/gbm buffers
747192:egl-dri::488:release_card(): terminating card-egl display

[1mImproper API use from Lua script:
	[32m
[1mScript failure:
 [32m error: /tmp/durden/durden//display.lua:900: attempt to index field 'tiler' (a nil value)
last path: /
trace:
stack traceback:
	[string "/tmp/durden/durden//durden.lua"]:900: in function '__index'
	/tmp/durden/durden//display.lua:900: in function 'display_add'
	/tmp/durden/durden//display.lua:635: in function 'display_added'
	/tmp/durden/durden//display.lua:686: in function 'display_event_handler'
	[string "/tmp/durden/durden//durden.lua"]:648: in function <[string "/tmp/durden/durden//durden.lua"]:647>
[39mC-entry point: [32m 4291:display_state:added [39m[0m.

Handing over to recovery script (or shutdown if none present).
[39m

I noticed the application was having trouble creating a log in a non-existing directory (couldn't it be created by default?). After creating the logs directory, I tried again and picked the following log:

 do 
local nan = 0/0;
local inf = math.huge;
local vobj = {};
local props = {};
local restbl = {
	display = {
		width = 1366,
		height = 768,
		conservative = 0,
		ticks = 21,
		default_vitemlim = 1024,
		imageproc = 0,
		scalemode = 0,
		filtermode = 2,
	};
	vcontexts = {};};
restbl.message = "error: /tmp/durden/durden//display.lua:900: attempt to index field 'tiler' (a nil value)\
last path: /\
trace:\
stack traceback:\
	[string \"/tmp/durden/durden//durden.lua\"]:900: in function '__index'\
	/tmp/durden/durden//display.lua:900: in function 'display_add'\
	/tmp/durden/durden//display.lua:635: in function 'display_added'\
	/tmp/durden/durden//display.lua:686: in function 'display_event_handler'\
	[string \"/tmp/durden/durden//durden.lua\"]:648: in function <[string \"/tmp/durden/durden//durden.lua\"]:647>, 4291:display_state:add";
local ctx = {
	vobjs = {},
	rtargets = {}
};ctx.ind = 0;
ctx.alive = 0;
ctx.limit = 1024;
ctx.tickstamp = 0;
table.insert(restbl.vcontexts, ctx);return restbl;
end

Since it's a scripting issue, maybe it's just a recent regression.

Thank you!

magiblot avatar Apr 24 '20 22:04 magiblot

Hi, and thanks for the report.

The extended log directory is soft-disabled as the logs created might leak personal information (such as titlebar text), and it is often possible to diagnose the issue with only the shortform trace.

Eventually we will have a crash reporting tool that uses the extended logs but is able to sanitize them.

As for your particular bug, so another user had this problem as well a few days ago. Does it work with the latest tag of arcan, 0.6,0-pre2 by any chance? This is more insidious than it seems, it presents as a scripting error, but from a path that shouldn't be possible.

The most plausible explanation is that event processing for some early events gets forwarded to the script interpreter prematurely, which fits with initial display discovery.

letoram avatar Apr 25 '20 01:04 letoram

Mhm... I couldn't get it to work. I tried with several different tag releases of arcan and durden, but all of them failed. However, I didn't notice the scripting error using the current last commit of arcan.

arcan_0.5.5.2_durden_6.0-pre1.log arcan_6.0-pre1_durden_6.0pre1.log arcan_6.0-pre2_durden_6.0-pre1.log arcan_276f5502b7e12ac3d75e219f59cead94e591f2a8_durden_0.6-pre1.log

Since this turns out not to be as simple as I thought, I will share some of my system information:

  • ArchLinux, but not using the AUR packages. Simply following the README.
  • linux 5.6.7-arch1-1
  • Intel® Core™ i5-6200U
  • Mesa Intel(R) HD Graphics 520 (SKL GT2)
  • Laptop with the lip closed, connected to an external monitor.
  • USB keyboard and USB mouse connected.
  • Running arcan from tty, with no other graphical environments running (in fact, I had just rebooted the computer).

Please ask for anything else you need.

Thank you!

magiblot avatar Apr 27 '20 20:04 magiblot

Did the recent (9297ec2) commit change anything?

letoram avatar Apr 28 '20 00:04 letoram

Interesting, something gets quite messed up with the Lua VM state - it reaches durden.lua:52 (where the display- management code is loaded), but not the keyboard translation at durden.lua:69.

To make sure we don't run into something really funky, say bugs in the LuaJIT implementation, build with -DDISABLE_JIT=ON

I am also curious if another WM would work or trigger other erradic behavior, take:

./arcan -T ../data/scripts -p ../data/resources ../data/appl/console

which should give you something that looks like a normal console (it doesn't have a way to exit so VT switch + kill, kill from within the terminal that spawns or by ssh:ing into the machine). Then make the logging much more verbose with arcan -g -g -g and rerun durden.

letoram avatar Apr 28 '20 09:04 letoram

oh oh oh .. an easy explanation might just be staring me in the face. Forgot entirely about the side-behavior of return shutdown() actually being asynch, i.e. events may keep firing for a while longer.

It says that it doesn't detect a keyboard, that's basically only if your user can't access /dev/input/* so maybe this is just a permission problem.

letoram avatar Apr 28 '20 15:04 letoram

It says that it doesn't detect a keyboard, that's basically only if your user can't access /dev/input/* so maybe this is just a permission problem.

That's very likely the case. I just assumed it would be handling the keyboard from stdin, given that it's a console file descriptor. But I think that would still not be enough to get mouse events (how do conventional Wayland/X compositors do this?). Is it safe to start arcan with sudo?

magiblot avatar Apr 28 '20 23:04 magiblot

depends on distribution - systemd has a way through logind that we don't support, because < censored > (just look at the code ..). Either add yourself to the proper groups and run like normal, or run arcan sudo (normal make install for egl-dri platform installs arcan suid), the only privileged code is here:

https://github.com/letoram/arcan/blob/master/src/platform/posix/psep_open.c#L38 (up until ~900).

letoram avatar Apr 29 '20 00:04 letoram