Closed xangma closed 1 year ago
Heyo,
what is \/home\/user\/MoonDeckStream
exactly? AppImage, symlink?
I assume it's AppImage. Have you tried this:
./MoonDeckBuddy-1.5.4-x86_64.AppImage --appimage-extract-and-run --exec MoonDeckStream
?
It's a symlink.
Ah it's cause FUSE and therefore appimages can't easily run in Docker containers.
Yeah my current commands look like this: /home/user/MoonDeckBuddy --appimage-extract && squashfs-root/usr/bin/MoonDeckBuddy
Then in steam the shortcut says it's running, but nothing opens, then cause Buddy doesn't detect it's running, the stream is terminated. The game I'm trying to run does have its own launch options though ... I hope that's ok. Looking at the shortcut created by MoonDeck on the deck there are MOONDECK_STEAM_APP_ID and MOONDECK_AUTO_RES launch options there, but not on the host machine. I don't think that would make a difference though?
The problem with symlinks is that I've implemented what they have recommended:
$ ln -s <some_path>/MoonDeckBuddy.AppImage ./MoonDeckStream
$ ./MoonDeckStream # This will invoke MoonDeckStream binary
In short, symlink will directly execute the binary and might not work as expected.
Can you try calling the AppImage directly, like I've posted above? No symlink or anything in between.
The logic for this magic is in here: https://github.com/FrogTheFrog/moondeck-buddy/blob/main/resources/linux/AppRun
Thanks for replying by the way :-)
The --extract-and-run
argument removes the files after exiting, which would be fine for Buddy, but not fine if Stream closes. There's the NO_CLEANUP=1
environment variable which will only extract them which could work?
Anyway, forgetting this for a second, it's the same behaviour with the commands above :-( It connects all fine, I see the desktop, see steam is running the shortcut, then the stream is killed and Moonlight closes.
Here's the moondeck-runner.log:
2023-08-17 18:32:48,570 INFO Resetting runner result
2023-08-17 18:32:48,570 INFO Getting app id
2023-08-17 18:32:48,570 INFO Getting current host settings
2023-08-17 18:32:48,571 INFO Auto resolution from MoonDeck: {'width': 1280, 'height': 800}
2023-08-17 18:32:48,571 INFO Will try to apply 1280x800 resolution on host.
2023-08-17 18:32:48,571 INFO Trying to run the game using the app MoonDeckStream
2023-08-17 18:32:48,573 INFO Establishing connection to Buddy
2023-08-17 18:32:49,111 INFO Checking if GameStream service is running
2023-08-17 18:32:49,214 INFO Waiting for a initial stream conditions to be satisfied
2023-08-17 18:32:49,316 INFO Notifying Buddy to change resolution
2023-08-17 18:32:49,629 INFO Checking if Moonlight flatpak is installed
2023-08-17 18:32:49,691 INFO Terminating all Moonlight instances if any
2023-08-17 18:32:49,743 INFO Starting Moonlight
2023-08-17 18:32:49,745 INFO Waiting for Steam to be ready to launch games
2023-08-17 18:32:49,746 INFO Starting to save Moonlight output.
2023-08-17 18:33:20,556 ERROR Stream failed to start!
What is the output of MoonDeckStream's Sunshine log thingy, if you use <some_path>/MoonDeckBuddy-1.5.4-x86_64.AppImage --appimage-extract-and-run --exec MoonDeckStream
as the command?
File exists and file size matches, skipping
File exists and file size matches, skipping
File exists and file size matches, skipping
File exists and file size matches, skipping
File exists and file size matches, skipping
<..>
[18:43:56.020] INFO buddy.utils: Log location: "/tmp/moondeckstream.log"
[18:43:56.020] INFO buddy.stream: startup. Version: 1.5.4
[18:43:56.020] INFO buddy.stream: startup finished.
Seemingly not much going on :-(
Well, it's all it is supposed to log :thinking: So it is working at least.
What about Buddy's logs? Can you enable debug logs for it and paste them after you have started streaming?
Here's it running in my processes using ps aux | grep Mo
:
user 15176 0.0 0.0 2972 1024 ? S 18:43 0:00 /home/user/MoonDeckBuddy-1.5.4-x86_64.AppImage --appimage-extract-and-run --exec MoonDeckStream
user 15177 0.0 0.0 81964 17408 ? S 18:43 0:00 /tmp/appimage_extracted_1a008707231a5994a403594d12f6aed5/usr/bin/MoonDeckStream
Ooops, didn't mean to close.
Here's the Buddy logs (can remove and upload file if unwieldy):
[18:42:20.757] INFO buddy.utils: Log location: "/tmp/moondeckbuddy.log"
[18:42:20.757] INFO buddy.main: startup. Version: 1.5.4
[18:42:20.764] WARNING buddy.os: logind bus is invalid!
[18:42:20.781] INFO buddy.server: Server started listening at port 59999
[18:42:20.781] INFO buddy.main: startup finished.
[18:42:20.781] DEBUG buddy.shared: getAppName() >> "MoonDeckBuddy"
[18:42:20.781] DEBUG buddy.shared: getLogDir() >> "/tmp"
[18:42:20.781] DEBUG buddy.shared: getLogName() >> "moondeckbuddy.log"
[18:42:20.781] DEBUG buddy.shared: getLogPath() >> "/tmp/moondeckbuddy.log"
[18:42:20.781] DEBUG buddy.shared: getSettingsDir() >> "/home/user/.config/moondeckbuddy"
[18:42:20.781] DEBUG buddy.shared: getSettingsName() >> "settings.json"
[18:42:20.781] DEBUG buddy.shared: getSettingsPath() >> "/home/user/.config/moondeckbuddy/settings.json"
[18:42:20.781] DEBUG buddy.shared: getAutoStartDir() >> "/home/user/.config/autostart"
[18:42:20.781] DEBUG buddy.shared: getAutoStartPath() >> "/home/user/.config/autostart/moondeckbuddy.desktop"
[18:42:20.781] DEBUG buddy.shared: getAutoStartExec() >> "/home/user/MoonDeckBuddy-1.5.4-x86_64.AppImage"
[18:42:20.781] DEBUG buddy.utils: Mapped "SecureProtocols" to 4
[18:42:21.737] DEBUG buddy.os: Steam is running!
[18:42:21.742] DEBUG buddy.os: Handling Steam start.
[18:42:39.506] DEBUG buddy.main:
Request: QHttpServerRequest((Url: QUrl("https://<my_host_ip>:59999/apiVersion"))(Headers: ("Host": "<my_host_ip>:59999"), ("authorization": "basic <redacted>"), ("Accept": "*/*"), ("Accept-Encoding": "gzip, deflate"), ("User-Agent": "Python/3.10 aiohttp/3.8.3"))(RemoteHost: QHostAddress("::ffff:<my_remote_ip>"))(BodySize: 0)) | ""
Response: QHttpServerResponder::StatusCode::Ok | "{\"version\":3}"
[18:42:39.813] DEBUG buddy.main:
Request: QHttpServerRequest((Url: QUrl("https://<my_host_ip>:59999/pairingState/<redacted>"))(Headers: ("Host": "<my_host_ip>:59999"), ("authorization": "basic <redacted>"), ("Accept": "*/*"), ("Accept-Encoding": "gzip, deflate"), ("User-Agent": "Python/3.10 aiohttp/3.8.3"))(RemoteHost: QHostAddress("::ffff:<my_remote_ip>"))(BodySize: 0)) | ""
Response: QHttpServerResponder::StatusCode::Ok | "{\"state\":\"Paired\"}"
[18:42:39.916] DEBUG buddy.main:
Request: QHttpServerRequest((Url: QUrl("https://<my_host_ip>:59999/pcState"))(Headers: ("Host": "<my_host_ip>:59999"), ("authorization": "basic <redacted>"), ("Accept": "*/*"), ("Accept-Encoding": "gzip, deflate"), ("User-Agent": "Python/3.10 aiohttp/3.8.3"))(RemoteHost: QHostAddress("::ffff:<my_remote_ip>"))(BodySize: 0)) | ""
Response: QHttpServerResponder::StatusCode::Ok | "{\"state\":\"Normal\"}"
[18:42:40.134] DEBUG buddy.main:
Request: QHttpServerRequest((Url: QUrl("https://<my_host_ip>:59999/hostInfo"))(Headers: ("Host": "<my_host_ip>:59999"), ("authorization": "basic <redacted>"), ("Accept": "*/*"), ("Accept-Encoding": "gzip, deflate"), ("User-Agent": "Python/3.10 aiohttp/3.8.3"))(RemoteHost: QHostAddress("::ffff:<my_remote_ip>"))(BodySize: 0)) | ""
Response: QHttpServerResponder::StatusCode::Ok | "{\"steamIsRunning\":true,\"steamRunningAppId\":0,\"steamTrackedUpdatingAppId\":null,\"streamState\":\"NotStreaming\"}"
[18:42:40.164] DEBUG buddy.os: Trying to change resolution.
[18:42:40.164] DEBUG buddy.os: XDG_SESSION_TYPE not present in the ENV. Checking for WAYLAND_DISPLAY!
[18:42:40.165] WARNING buddy.os: No ENV found to determine session type, assuming X11 session.
[18:42:40.175] DEBUG buddy.os: Screen "0" already has the requested resolution - skipping.
[18:42:40.175] DEBUG buddy.main:
Request: QHttpServerRequest((Url: QUrl("https://<my_host_ip>:59999/changeResolution"))(Headers: ("Host": "<my_host_ip>:59999"), ("authorization": "basic <redacted>"), ("Accept": "*/*"), ("Accept-Encoding": "gzip, deflate"), ("User-Agent": "Python/3.10 aiohttp/3.8.3"), ("Content-Length": "30"), ("Content-Type": "application/json"))(RemoteHost: QHostAddress("::ffff:<my_remote_ip>"))(BodySize: 30)) | "{\"width\": 1280, \"height\": 800}"
Response: QHttpServerResponder::StatusCode::Ok | "{\"result\":true}"
[18:42:40.332] DEBUG buddy.main:
Request: QHttpServerRequest((Url: QUrl("https://<my_host_ip>:59999/hostInfo"))(Headers: ("Host": "<my_host_ip>:59999"), ("authorization": "basic <redacted>"), ("Accept": "*/*"), ("Accept-Encoding": "gzip, deflate"), ("User-Agent": "Python/3.10 aiohttp/3.8.3"))(RemoteHost: QHostAddress("::ffff:<my_remote_ip>"))(BodySize: 0)) | ""
Response: QHttpServerResponder::StatusCode::Ok | "{\"steamIsRunning\":true,\"steamRunningAppId\":0,\"steamTrackedUpdatingAppId\":null,\"streamState\":\"NotStreaming\"}"
[18:42:41.368] DEBUG buddy.main:
Request: QHttpServerRequest((Url: QUrl("https://<my_host_ip>:59999/hostInfo"))(Headers: ("Host": "<my_host_ip>:59999"), ("authorization": "basic <redacted>"), ("Accept": "*/*"), ("Accept-Encoding": "gzip, deflate"), ("User-Agent": "Python/3.10 aiohttp/3.8.3"))(RemoteHost: QHostAddress("::ffff:<my_remote_ip>"))(BodySize: 0)) | ""
Response: QHttpServerResponder::StatusCode::Ok | "{\"steamIsRunning\":true,\"steamRunningAppId\":0,\"steamTrackedUpdatingAppId\":null,\"streamState\":\"NotStreaming\"}"
etc ...
The logind bus failure is because the Docker image is running its own dbus and has permissions against org.freedesktop.login1.
This etc is rather important :D
Apologies, I put etc. because it just repeats that last message.
Can you just start the MoonDeckStream app via Moonlight?
The Buddy should contain these logs:
DEBUG buddy.os: Stream started.
...
DEBUG buddy.os: Stream has ended.
MoonDeckStream has a "heartbeat" that Buddy listens to via shared memory. Maybe it cannot get access to it for whatever reason?
Ugh, that seems not to be the case, because if MoonDeckStream is started as sudo, Buddy fatals:
FATAL Failed to lock shared memory 5733e87023cd3876e67e90798d97990e1761b9c8
Aha! I didn't know about this and have never seen it in the logs. I just started Stream through Moonlight and can't see anything about a heartbeat in the Buddy logs. I'm assuming the lock or whatever is stored in /tmp too?
There is no lock, Qt Framework takes care of it https://doc.qt.io/qt-6/qsharedmemory.html
.
I have created PR with more logs: https://github.com/FrogTheFrog/moondeck-buddy/pull/53
once it's green please, download the new appimage and check the heartbeat
Aha! Thanks for this. I've gotten a bit further through actually reading the documentation haha!
I'm running sunshine using flatpak and now Buddy can see Stream. After changing my sunshine command to include the flatpak-spawn --host
Buddy logs is now saying this:
[20:04:49.495] DEBUG buddy.os: Trying to hide cursor.
[20:04:49.495] WARNING buddy.os: Steam EXEC path is not available yet!
This is your next issue:
Most of the paths were hardcoded for Linux, since by Valve's own words "they didn't want to break compatibility". However, they broke it anyway a few months ago, so this is the only hardcoded path remaining.
What I'm saying is to symlink it.
This is your next issue:
You are correct:
$ which steam
/usr/games/steam
That is a great idea and I'm glad you said it because I probably would have rebuilt your code cause my brain is frazzled.
Yep, symlinking and restarting has fixed it.
Just for reference, this is my flatpak sunshine command now:
/usr/bin/flatpak-spawn --host /home/user/MoonDeckBuddy-1.5.4-x86_64.AppImage --appimage-extract-and-run --exec MoonDeckStream
The NO_CLEANUP=1
env var might be needed to not ruin things. I'll do some testing later. Thanks so much for your help. I might put a PR in with some docs on this :-)
I might put a PR in with some docs on this :-)
Please do, if you figure out how to do this :D. I have no idea how to create PR for wikis
If you can't, just post the changes here so I can copy it
Haha! Didn't even think about that. I'll see what I can do :-) Thanks again!
@xangma I have created a repo for wiki: https://github.com/FrogTheFrog/moondeck-wiki
Please feel free to create a PR if you want ;)
That aside, it seems that the issue is resolved, so I'm closing it.
Hi,
Firstly, I love the program, so thanks for creating it. I've been trying to debug MoonDeckStream for a while now and I have finally figured out the issue. I'm using MoonDeckBuddy in a docker container (modified version of SteamHeadless), and it wouldn't run MoonDeckStream through Sunshine for some reason ... I could run it myself in a terminal fine. Both Sunshine and MoonDeckStream were being run as the same user.
The only way I managed to get any useful debugging logs out was by setting the "output" section of
sunshine/apps.json
which produced this:I then changed the MoonDeckStream command in
sunshine/apps.json
to this:And now I can at least see the desktop, but steam still isn't opening anything :-(