无法从SSH启动MonoGame,但可以从GUI启动

时间:2015-04-04 03:16:33

标签: linux ssh mono raspberry-pi monogame

所以我想从我的SSH终端开始游戏。

它真的很奇怪,当我直接从我的linux GUI做它,它的工作原理。但是当我使用SSH客户端从远处连接时,它就会崩溃。好像它与我的显示驱动程序有关。

Unhandled Exception:
System.TypeInitializationException: An exception was thrown by the type initializer for OpenTK.DisplayDevice ---> System.IO.DirectoryNotFoundException: Directory '/dev/dri' not found.
  at System.IO.Directory.ValidateDirectoryListing (System.String path, System.String searchPattern, System.Boolean& stop) [0x00000] in <filename unknown>:0 
  at System.IO.Directory.GetFileSystemEntries (System.String path, System.String searchPattern, FileAttributes mask, FileAttributes attrs) [0x00000] in <filename unknown>:0 
  at System.IO.Directory.GetFiles (System.String path, System.String searchPattern) [0x00000] in <filename unknown>:0 
  at System.IO.Directory.GetFiles (System.String path) [0x00000] in <filename unknown>:0 
  at OpenTK.Platform.Linux.LinuxFactory.CreateDisplay (System.IntPtr& gbm_device, System.IntPtr& egl_display) [0x00000] in <filename unknown>:0 
  at OpenTK.Platform.Linux.LinuxFactory.get_gpu_fd () [0x00000] in <filename unknown>:0 
  at OpenTK.Platform.Linux.LinuxFactory.CreateDisplayDeviceDriver () [0x00000] in <filename unknown>:0 
  at OpenTK.DisplayDevice..cctor () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at OpenTK.NativeWindow..ctor () [0x00000] in <filename unknown>:0 
  at Microsoft.Xna.Framework.OpenTKGameWindow.Initialize (Microsoft.Xna.Framework.Game game) [0x00000] in <filename unknown>:0 
  at Microsoft.Xna.Framework.OpenTKGameWindow..ctor (Microsoft.Xna.Framework.Game game) [0x00000] in <filename unknown>:0 
  at Microsoft.Xna.Framework.OpenTKGamePlatform..ctor (Microsoft.Xna.Framework.Game game) [0x00000] in <filename unknown>:0 
  at Microsoft.Xna.Framework.GamePlatform.Create (Microsoft.Xna.Framework.Game game) [0x00000] in <filename unknown>:0 
  at Microsoft.Xna.Framework.Game..ctor () [0x00000] in <filename unknown>:0 
  at TestGame.Game1..ctor () [0x00000] in <filename unknown>:0 
  at TestGame.Program.RunGame () [0x00000] in <filename unknown>:0 
  at TestGame.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: An exception was thrown by the type initializer for OpenTK.DisplayDevice ---> System.IO.DirectoryNotFoundException: Directory '/dev/dri' not found.
  at System.IO.Directory.ValidateDirectoryListing (System.String path, System.String searchPattern, System.Boolean& stop) [0x00000] in <filename unknown>:0 
  at System.IO.Directory.GetFileSystemEntries (System.String path, System.String searchPattern, FileAttributes mask, FileAttributes attrs) [0x00000] in <filename unknown>:0 
  at System.IO.Directory.GetFiles (System.String path, System.String searchPattern) [0x00000] in <filename unknown>:0 
  at System.IO.Directory.GetFiles (System.String path) [0x00000] in <filename unknown>:0 
  at OpenTK.Platform.Linux.LinuxFactory.CreateDisplay (System.IntPtr& gbm_device, System.IntPtr& egl_display) [0x00000] in <filename unknown>:0 
  at OpenTK.Platform.Linux.LinuxFactory.get_gpu_fd () [0x00000] in <filename unknown>:0 
  at OpenTK.Platform.Linux.LinuxFactory.CreateDisplayDeviceDriver () [0x00000] in <filename unknown>:0 
  at OpenTK.DisplayDevice..cctor () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at OpenTK.NativeWindow..ctor () [0x00000] in <filename unknown>:0 
  at Microsoft.Xna.Framework.OpenTKGameWindow.Initialize (Microsoft.Xna.Framework.Game game) [0x00000] in <filename unknown>:0 
  at Microsoft.Xna.Framework.OpenTKGameWindow..ctor (Microsoft.Xna.Framework.Game game) [0x00000] in <filename unknown>:0 
  at Microsoft.Xna.Framework.OpenTKGamePlatform..ctor (Microsoft.Xna.Framework.Game game) [0x00000] in <filename unknown>:0 
  at Microsoft.Xna.Framework.GamePlatform.Create (Microsoft.Xna.Framework.Game game) [0x00000] in <filename unknown>:0 
  at Microsoft.Xna.Framework.Game..ctor () [0x00000] in <filename unknown>:0 
  at TestGame.Game1..ctor () [0x00000] in <filename unknown>:0 
  at TestGame.Program.RunGame () [0x00000] in <filename unknown>:0 
  at TestGame.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0 

我虽然创建了一个bash脚本,然后调用自己开始游戏的方法就可以完成这项工作,但不幸的是它会做同样的结果。

基本上,当我在我的linux GUI中运行SAME EXACT命令时,游戏开始没有问题,但是当我在SSH中从远处运行SAME EXACT命令时,游戏不会启动它只是卡在那里。

mono /home/pi/.../game/TestGame.exe

我正在使用覆盆子PI运行Linux Raspbian。 我的覆盆子PI连接在我的屏幕上。当我用键盘插上电源时,它会在使用ssh从我的另一台计算机上进行测试时崩溃,这会导致我们在这里看到的错误。

我将不胜感激。

非常感谢! 凯文

1 个答案:

答案 0 :(得分:0)

跟进我的发现,

如果你遇到这个错误,有两件事要看:

  1. 检查您的SSH终端是否已激活X11转发。
  2. 输入这条神奇的线条告诉SSH使用哪个监视器。否则任何图形软件都会在启动时崩溃..

    export DISPLAY =:0

  3. 谢谢, 千电子伏