Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux GNOME desktop environment crash / corrupted configuration file issue #97

Open
drojf opened this issue May 14, 2019 · 19 comments
Open

Comments

@drojf
Copy link
Contributor

drojf commented May 14, 2019

Recently a user reported that when they start the game using a GNOME desktop (default for Ubuntu), they would get a window with infinite height, and the game wouldn't startup (black screen)


Working configurations:

  • XFCE
  • bspwm (on Artix linux)
  • Ubuntu 20.04 (I assume GNOME)

Not working configurations:

  • Ubuntu 19.10; GNOME 3.34.x, x in [0..3], depending on component; proprietary nVidia drivers version 440; Steam beta.
  • Ubuntu 18.04 (I assume GNOME)

I only tested Ubuntu using XFCE because GNOME had the same problem reported where the window would be infinitely tall and the game wouldn't startup.

The big problem with the GNOME problem is that it will remain, even if you uninstall the game, presumably because the messed up config file is in your ~.config/unity/... folder which never gets cleared unless you go and delete it

So even if the end user re-installs the un-modded game, it will still be stuck like that on GNOME. This may make it seem like it's not our mod causing the issue, when (I'm....pretty sure?) it is (see end of the discussion on discord below).

GNOME is the default desktop environment for Ubuntu, which I assume will make up many of our linux users.

I'm raising this in the higurashi-patch-compiler section because afaik the writing to the config file is done in the modified .dll. But the actual 'solution' could be just a fix in the installer, the .dll might not need to be modified.

Here was the discussion on discord (names omitted and edit for clarity):

----------------------------
Never had mono throw issue with my previous errors
BTW did you read how I got higurashi working nativly on gnome?
----------------------------
Install xfce?
----------------------------
You had to force it in fullscreen iirc
----------------------------
Launch the game in full screen mode
and mark the config read only
----------------------------
because after the game quits it sets the screenmanager to be windowed again.
----------------------------
That is strange, there's a fullscreen option in the settings
----------------------------
there's 2
<unity_prefs version_major="1" version_minor="1">
1
768
1365
0
1080
1920
768
1
1365
</unity_prefs>
screenmanager gets set to 0 after reboot causes the game to first start in window and then swaps to full
however as you progress to later chapters that also becomes a problem
----------------------------
I think the game has issue with gtk 3 in windowed mode
----------------------------
One of these is a Unity setting (the screenmanager thing), the other one is something MG added but what the hell for?
:thonk:
----------------------------
the height of the window always goes infinite beyond chapter 3
I've seen the config height being set to negative numbers or really high numbers
If I swap to windowed mode right now the game would crash my gnome-shell
oh and the same happens in openbox
that's another desktop
----------------------------
Not just that
if you use proton
the same thing happens
----------------------------
One would assume that this would be the testing configruation, especially since Steam only officially supports Ubuntu
----------------------------
As you know I have used both.

Then later by @TellowKrinkle :
----------------------------
Ugh the reason the full screen works like that was to work around a separate issue involving the game not choosing the right aspect ratio if it started in full screen on my Linux boot
So I made it so the game modifies the unity config on exit so it starts not full screen, then fullscreens itself once the game starts.

@drojf
Copy link
Contributor Author

drojf commented May 14, 2019

A note that I only did some minor tests - the part where I said "the game is initially not broken, but then installing and running the mod will cause the game to break" may have been me messing up something. But it's definitely possible to get into that state. I will do some further investigation later.

@drojf
Copy link
Contributor Author

drojf commented May 14, 2019

I just tested an install of chapter 5 with no mods (chapter 5 has never been installed on this linux machine). It has exactly the same problem, leading me to believe it has nothing to do with our mod, and is just the base game which is broken.

I followed the steps reported by the above user to 'fix' the problem:

  • run the game under xfce to generate a 'good' prefs file in ~.config/unity/?? I forgot the filename . For some reason, in my case the prefs file was empty after it crashes.
  • edit the file to enable fullscreen mode (change a 0 to a 1), and set it to read-only so the game cannot change it
  • launch the game

The game will then run, however I didn't know how to exit fullscreen to test if windowed mode would cause the game to crash (alt-enter didn't work, neither did the 'f' key).

Also to add to my report, GNOME will entirely crash each time you start the game. Sometimes you can see the window go very tall before it crashes, sometimes not.

I'm not sure what to do here besides report it to the devs and add a warning to linux users, unless you can force a specific screen resolution in 'safe' mode or something like that.

drojf referenced this issue in 07th-mod/wiki May 14, 2019
…onwards.

The gnome-crash-warning snippet can be updated if we find a better way to fix it.

https://github.com/07th-mod/higurashi-patch-compiler/issues/58
@DuncanCasteleyn
Copy link

DuncanCasteleyn commented May 15, 2019

As fix for gnome users who don't want to swap their desktop, I have created a script that will enforce the game to run in full screen mode, you can download Higurashi When the Gnome shell cry.zip; It contains a bash script that will install the config files to enforce full screen on all the versions that are effected by the gnome shell problem.

Open a terminal and navigate to the location, where you save the file.

unzip Higurashi\ When\ the\ Gnome\ shell\ cry.zip
chmod 700 Higurashi\ When\ the\ Gnome\ shell\ cry.sh
./Higurashi\ When\ the\ Gnome\ shell\ cry.sh

Please note that trying to go to windowed mode during game run will most likely crash your gnome shell.

@fallenguru
Copy link

fallenguru commented Oct 18, 2020

  1. IMHO this issue should be re-titled. The actual issue seems to be that some Higurashi arcs on some systems crash vital parts of the OS on startup.

This machine has Ubuntu 19.10; GNOME 3.34.x, x in [0..3], depending on component; proprietary nVidia drivers version 440; Steam beta. It took me ~10 months from the start of Onikakushi to the end of Himatsubushi, so package versions may have changed slightly since I've actually played an arc.

  • Onikakushi - no crash
  • Watanagashi - no crash
  • Tatarigoroshi - on first launch only, gnome-shell[?] crashed with a weird mostly white fullscreen error message that I haven't seen before or since, then restarted itself; subsequent launches all normal
  • Himatsubushi - no crash
  • Meakashi - the nVidia driver crashes, resulting in a more or less unresponsive UI, see also below

I do not know whether either of the two types of crashes is in fact the infamous GNOME crash issue, and I do not have the "infinite height" issue mentioned.

  1. The documentation should be updated, since it isn't as simple as GNOME + arc 4-8 = crash.

  2. On the Meakashi crash and workarounds

Launching a freshly downloaded and patched (1.1.63) copy of Meakashi results in the Higurashi window appearing, empty/black and freezing like that, and the UI becoming more or less unresponsive. The mouse pointer can still be moved, sometimes switching to console still works. SSH & friends are unaffected, and logs show that the nVidia driver has crashed. The box must be rebooted remotely, or locally via Alt+SysRq.

Editing ~/.config/unity3d/MangaGamer/Higurashi When They Cry - Ch.5 Meakashi to show <pref name="Screenmanager Is Fullscreen mode" type="int">1</pref> instead of 0 will allow the game to launch.
Funnily enough, it launches in a window.

What then works:

  • switching to fullscreen via the config menu
  • switching to windowed via the config menu
  • launching the game again, as long as it was in fullscreen mode when quit

What then does not work:

  • exiting fullscreen by pressing F (crash as above)
  • launching the game again, if exited while windowed (because this resets the above prefs setting)

In short, as long as Screenmanager Is Fullscreen stays at 1, and you don't touch F, there is no problem, not even when fullscreen isn't actually on.

  1. Suggested workarounds
  • ship prefs with <pref name="Screenmanager Is Fullscreen mode" type="int">1</pref> on Linux
  • document that in order to play in windowed mode, it may be necessary to set the desired windowed mode, exit, edit prefs to put Screenmanager Is Fullscreen back to 1 and write-protect the file
  • document that using F may result in a system freeze/crash

In theory, the installer could offer to generate a suitable prefs by asking Linux users if they want to play fullscreen or windowed, and in which resolution, and write-protect it, or something.

@fallenguru
Copy link

Update on Meakashi [Steam, patch version info at bottom, fresh install]

  • Ubuntu 20.04, X11, nVidia: launches fine most of the time (set to fullscreen, no prefs trickery, I'd forgotten about that), but I've had two or three hangs where the first window that pops up before switching to fullscreen would be absurdly high and narrow. Then, the switch to fullscreen would fail, the main menu screen would be partially cut off, and the whole thing hang, including most of the UI. AFAICT it does not like being expected to run with Steam-synced settings from machines with different screen resolutions (this one is 1920x1080, the others 3840x2160 and 1920x1200). Can't really blame it.
  • Ubuntu 18.04, X11, AMD: launch triggers an X server error, and an ungodly memory leak, 32 GB gone in a flash. But, when OOM killer finally gets it, the box fully recovers. Only tried it the once, because that's my work machine.
{
    "files": [
        {
            "id": "graphics",
            "version": "2.0.0"
        },
        {
            "id": "movie",
            "version": "1.0.0"
        },
        {
            "id": "voices",
            "version": "1.1.0"
        },
        {
            "id": "script",
            "version": "5.1.2"
        },
        {
            "id": "movie-unix",
            "version": "1.0.0"
        },
        {
            "id": "ui-windows-5.5.3p3",
            "version": "1.4.0"
        },
        {
            "id": "ui-windows-5.5.3p1",
            "version": "1.4.0"
        },
        {
            "id": "ui-unix-5.5.3p3",
            "version": "1.4.0"
        },
        {
            "id": "ui-unix-5.5.3p1",
            "version": "1.4.0"
        },
        {
            "id": "og-dll-asset-update",
            "version": "1.0.0"
        }
    ],
    "id": "Meakashi Ch.5/full",
    "lastAttemptedInstallID": "Meakashi Ch.5/full"

@drojf drojf changed the title Linux GNOME corrupted configuration file issue Linux GNOME desktop environment crash / corrupted configuration file issue Mar 26, 2021
@fallenguru
Copy link

fallenguru commented Oct 2, 2021

Just a quick update to say that Tsumihoroboshi (Steam) as of today, installer 1.1.91 is fine even on Ubuntu 18.04.6, which is on GNOME 3.28. AMD card. No problems on the 20.04/nVidia box, either.

@drojf
Copy link
Contributor Author

drojf commented Sep 30, 2022

We had another report of this issue on Manjaro 22.0.0 with Gnome 42.3. See below discussion

Hello! I was hoping to get some help with the base game, specifically Chapter 5, running on manjaro linux. I have reached out to mangagamer for support to see if it's some official issue but I've gotten no response and was hoping someone here would have had the same issue.

I was hoping the fixes provided by the mod would help however it has the same base issue.

The game opens at a massive resolution well beyond the borders of the screen. The only error I can find in the log is RenderTexture.Create failed: requested size is too large.

Sorry if this is the wrong place for this but I'm at the end of my rope and can't find anyone else to help.

Should also note wine/proton works, however I can't alt+tab out so I would rather just run native. It's also specifically chapter 5, or possibly all the answer arcs. 1-4 had no issues.

the behavoir is the same with and without the mod. actually just tried to install the mod to see if that would fix it today, however the behavoir is the same

Do you have the same issue as this person when you tab out? or does something else happen when you alt+tab out?

Preivously reported tab out issue: "IDK if this is a wine problem or just a problem with the Rei patch but I noticed that if I tab out of the app I can't progress text any more. I tried Matsuribayashi and it seems fine in wine (though the keyboard doesn't work)"

Not quite! The exact behavior is, and this applies to everything I run in proton or wine, is if I switch between desktops the game instantly crashes. If I alt+tab some games are stable, but higu in particular outright crashes.

For now, the user will try XFCE to see if it fixes the problem.

I'm not sure whether we should still try to fix this issue, or just recommend using Wine/Proton, given that there are other issues (at least for me), on the Native version of the game (see #78 - assuming you can get Wine/Proton to run at all, it usually works perfectly.


Here is their player.log:
Player.zip

@fallenguru
Copy link

Well, has this person tried the prefs workaround I posted above?

I'm not an anti-Proton crusader by any stretch of the imagination, but the native Linux version is fine, really.

@drojf
Copy link
Contributor Author

drojf commented Oct 1, 2022

Well, has this person tried the prefs workaround I posted above?

No, I forgot about that - they actually tried changing the resolution in the file themselves, but not the fix you stated earlier. I'll let them know, although I think they explicitly wanted to be able to ALT+TAB, and I wasn't sure whether the playerprefs fix works if you do that?

I'm not an anti-Proton crusader by any stretch of the imagination, but the native Linux version is fine, really.

See here: #78

I've had reports (including from myself) of other problems on the Native Linux build.

However, when I wrote the last comment, I kinda forgot about the non-steam versions of the game (GOG and Mangagamer) where you don't have easy access to Steam/Proton, so for those platforms I would definitely want to try to fix the Native version (if I have time).

@drojf
Copy link
Contributor Author

drojf commented Oct 1, 2022

I was looking at this issue yesterday and found the game code runs for a little while before the game crashes.

If that was the case, perhaps I could make the game check/modify the prefs file itself. The only issue would be if the prefs file is overwritten as the game (Unity) exits, as then I don't have the opportunity to overwrite it/make changes to it.

@drojf
Copy link
Contributor Author

drojf commented Oct 1, 2022

hmm, looks like our mod already attempts to set the values, but it sets the fullyscreen mode to 0, not 1:

~GameSystem()
{
    // Fixes an issue where Unity would write garbage values to its saved state on Linux
    // If we do this while the game is running, Unity will overwrite the values
    // So do it in the finalizer, which will run as the game quits and the GameSystem is deallocated
    if (PlayerPrefs.HasKey("width") && PlayerPrefs.HasKey("height"))
    {
        int width = PlayerPrefs.GetInt("width");
        int height = PlayerPrefs.GetInt("height");
        PlayerPrefs.SetInt("Screenmanager Resolution Width", width);
        PlayerPrefs.SetInt("Screenmanager Resolution Height", height);
        PlayerPrefs.SetInt("is_fullscreen", IsFullscreen ? 1 : 0);
        PlayerPrefs.SetInt("Screenmanager Is Fullscreen mode", 0);
    }
}

~GameSystem()
{
// Fixes an issue where Unity would write garbage values to its saved state on Linux
// If we do this while the game is running, Unity will overwrite the values
// So do it in the finalizer, which will run as the game quits and the GameSystem is deallocated
if (PlayerPrefs.HasKey("width") && PlayerPrefs.HasKey("height"))
{
int width = PlayerPrefs.GetInt("width");
int height = PlayerPrefs.GetInt("height");
PlayerPrefs.SetInt("Screenmanager Resolution Width", width);
PlayerPrefs.SetInt("Screenmanager Resolution Height", height);
PlayerPrefs.SetInt("is_fullscreen", IsFullscreen ? 1 : 0);
PlayerPrefs.SetInt("Screenmanager Is Fullscreen mode", 0);
}
}

The Unity forums suggests setting the value in OnApplicationQuit() instead:

 void OnApplicationQuit () {
     PlayerPrefs.SetInt("Screenmanager Resolution Width", 800);
     PlayerPrefs.SetInt("Screenmanager Resolution Height", 600);
     PlayerPrefs.SetInt("Screenmanager Is Fullscreen mode", 0);
 }

https://answers.unity.com/questions/438937/launching-game-in-windowed-mode-by-default-problem.html


To try:

  • If the game starts with "Screenmanager Is Fullscreen mode" set to 0, set it to 1, then restart the game
  • Change "Screenmanager Is Fullscreen mode" to 1 instead of 0 in the existing code
  • Also set "Screenmanager Is Fullscreen mode" in OnApplicationQuit, not just the destructor of GameSystem

@drojf
Copy link
Contributor Author

drojf commented Oct 1, 2022

Well, has this person tried the prefs workaround I posted above?

We tried applying the fix but it only seemed to work once? Even after trying to reset the playerprefs? I'm not exactly sure what happened.

I'll get back to you once I try the fix myself on my own machine (I'll probably install Ubuntu 18.04 which I previously tested to have the same issue)

@fallenguru
Copy link

I think they explicitly wanted to be able to ALT+TAB

Never had any problem with Alt-Tab whatsoever, and I used it a lot.
No lag, either. Not even on a Surface Go 2 with the CPU throttled as low as it would go.

But then the only one that gave me any problems worth mentioning is Meakashi, and those ranged from runs fine, via intermittent crashes on startup (just the game), and needing the prefs fiddling, depending on the machine, distro version, and moon phase. I've had exactly one full gnome-shell crash, and that was in Tatarigoroshi.

My comments here are basically meant as evidence that the native version, while it may well be broken for some, even many people, isn't categorically borked on GNOME nowadays (if it ever was).

@drojf
Copy link
Contributor Author

drojf commented Oct 3, 2022

Just reporting back that the same user uninstalled our mod (they re-installed the vanilla/unmodded game), then tried your forced fullscreen again and it works (albeit with the wrong aspect ratio (the unmodded game should be 4:3 instead of 16:9)):
Honeyview_unknown

Here is their log from it being run that time: Player(1).log

Possibly some of the mod code we have which attempts to fix this issue may be interfering with the external playerprefs fix.

@fallenguru - were your tests with the mod installed? or on the unmodded/vanilla version of the game?

@fallenguru
Copy link

Possibly some of the mod code we have which attempts to fix this issue may be interfering with the external playerprefs fix.

At any rate there seems to be a disconnect in behaviour between how the output is set up at startup and how it is changed at run-time.

@fallenguru - were your tests with the mod installed? or on the unmodded/vanilla version of the game?

Only ever with the mod. I take care to not even run the unmodded version once, so I can be sure I've a clean slate.

@drojf
Copy link
Contributor Author

drojf commented Nov 3, 2022

I should report in on the status of this issue, also to record some things before I forget.

  1. I did some testing on testing on Manjaro Linux (which uses Gnome DE), as another user reported the same issue on this setup. I found the mod itself caused some problems if you wanted to just play in fullscreen mode. I added/changed various things in the mod so that fullscreen would work, and some recovery to fullscreen mode if it was detected that the game crashed. I also added a 'fullscreen lock' which prevents you from entering windowed mode by accident. More details in this PR: Linux gnome crash workaround #91 (not yet merged)
  2. Just after I finished this, @TellowKrinkle found the bug didn't happen on the .x86 binary, but that may have been a red herring
  3. @TellowKrinkle did some more investigation and found the root cause of the issue. See this comment for details: Linux gnome crash workaround #91 (comment) . Patching the binary to fix the issue will stop the game crashing in windowed mode, but will also require a restart before you can change the resolution.
  4. On discord, a user reported that you could solve this issue using gamescope, but I have not tested it yet.

if any yall are having problems running 07th mod (or any game thereof) natively on linux, try running through gamescope which transfers the program into its own minimal window manager although it will only work if you are using wayland (so oof if you are using an nvidia card without driver above version 515.x)

@TellowKrinkle
Copy link
Member

Full fix with live resize support at #93

@nesper8
Copy link

nesper8 commented Nov 4, 2022

i made a simple shell script which launches Higu in gamescope

#!/bin/bash
env INTEL_DEBUG=noccs gamescope ./HigurashiEp01.x86_64 -f -w 1366 -h 768

this launches Higu inside gamescope with -f for full screen -w for width and -h for height
you only need env INTEL_DEBUG=noccs if you are experiencing graphical corruption in gamescope

gamescope is available in arch community repos and is preinstalled in nobara

@drojf
Copy link
Contributor Author

drojf commented Nov 6, 2022

Tellowkrinkle's fix has now been pushed out for all chapters, which I've tested to work on all chapters with this issue.

I'll leave this issue open as it's only just been released, in case there are some issues.

@drojf drojf transferred this issue from 07th-mod/higurashi-patch-compiler Nov 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants