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

Electron shows white screen during the MM start #1919

Closed
sergge1 opened this issue Feb 5, 2020 · 21 comments · Fixed by #3001
Closed

Electron shows white screen during the MM start #1919

sergge1 opened this issue Feb 5, 2020 · 21 comments · Fixed by #3001

Comments

@sergge1
Copy link
Contributor

sergge1 commented Feb 5, 2020

Do not know whether this is a bug or new electron's behavior.

I just tested MM's dev branch 2.11.0 and have found that now the electron's white screen appears just after MM start for 0.5-1.0 seconds and then reverts to black one.

See video how it looks like: https://youtu.be/Uhb5BjEy-dA - on this video white screen starts at 10th second and lasts until the beginning of the 12th second.

I have never seen such behavior before during the previous installs.

Looks not good with the mirror while everything should be black for good reflection.

@khassel
Copy link
Collaborator

khassel commented Feb 6, 2020

electron/electron#20357

@sergge1
Copy link
Contributor Author

sergge1 commented Feb 7, 2020

Just rolled back to 2.10.1 - and everything works fine, without white screen at electron during the start.
https://youtu.be/uKVyykPQ4kY

So the same machine, the same environment but different behavior in different versions e.g. in 2.11.0 and in 2.10.1

Environment:

OS

pi@raspberrypi:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian

Linux Core

pi@raspberrypi:~ $ uname -a
Linux raspberrypi 4.19.75-v7+ #1270 SMP Tue Sep 24 18:45:11 BST 2019 armv7l GNU/Linux

Hardware

pi@raspberrypi:~ $ cat /proc/device-tree/model
Raspberry Pi 3 Model B Plus Rev 1.3

Node and NPM versions

pi@raspberrypi:~ $ node -v    v10.18.1
pi@raspberrypi:~ $ npm -v     6.13.4

Electron

pi@raspberrypi:~/MagicMirror $ node_modules/.bin/electron -v
v3.1.13

@khassel
Copy link
Collaborator

khassel commented Feb 7, 2020

the problem seems to affect all electron versions >=4.

So if you use the master branch (v2.10.x, electron v3.x) everything works fine.

On the develop branch electron was upgraded to 6.x so we have to live with the white screen until this is fixed by electron (or another workaround).

@sergge1
Copy link
Contributor Author

sergge1 commented Feb 8, 2020

so may be it would better to use electron v3.x fi the electron white-screen issue will not be resolved till the MM 2.11.0 release date?
This white screen is really annoying and I expect what we will not lose any specific functionality while using older electron for some time?

@MichMich
Copy link
Collaborator

MichMich commented Feb 8, 2020

Buster isn’t supported by the old electron. And if I understand correctly. This is only a issue during startup? Just curious: why would you restart your mirror that often that it is a problem?

@sergge1
Copy link
Contributor Author

sergge1 commented Feb 9, 2020

Yes, issue appears only at startup.

Buster isn’t supported by the old electron. And if I understand correctly.

But 2.10.1 works perfect with older Electron version (or am I missing something?).
Generally, it is not a problem, I am just perfectionist. If something works visibly wrong, why not to use right/correct one?

My MM restarts few times per day (just to fresh up everything) and I have completely black screen during restart (no 4 raspberries at start, no rainbow screen at start, no splash screen, no colored desktop; so such white blink looks not so good for me.
But it is not crucial. Just raised issue because tested DEV branch and pointed out this issue.

@MichMich
Copy link
Collaborator

MichMich commented Feb 9, 2020

Just curious: Why do you need to restart/refresh your mirror? My mirror restarts once every 3 months: when I run the update. Never have any issues.

@stale
Copy link

stale bot commented Apr 9, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@dfanica
Copy link

dfanica commented Jan 3, 2023

I would like to see if there's a potential fix for this issue as well.
As @sergge1 said, it's not an actual issue, just an annoying behaviour. I also have a small piece of tape I've put in the corner of my mirror that is visible with the white background :)) just reminds me of my sloppy work!

If someone figures out how to change that to a black color instead of white that would be awesome ;)

UPDATE:

I've discovered that the white screen is due to this error:

[03.01.2023 12:43.02.115] [LOG]   Launching application.
MESA-LOADER: failed to retrieve device information
MESA-LOADER: failed to retrieve device information
MESA-LOADER: failed to retrieve device information
MESA-LOADER: failed to open kms_swrast: /usr/lib/dri/kms_swrast_dri.so: cannot open shared object file: Permission denied (search paths /usr/lib/arm-linux-gnueabihf/dri:\$${ORIGIN}/dri:/usr/lib/dri)
failed to load driver: kms_swrast
MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: Permission denied (search paths /usr/lib/arm-linux-gnueabihf/dri:\$${ORIGIN}/dri:/usr/lib/dri)
failed to load swrast driver

After some tinkering I found that the libraries in question are located in libgles1-mesa-dev so a sudo apt install libgles1-mesa-dev would make the search location /usr/lib/arm-linux-gnueabihf/dri contain them. But the same error appears even after messing with the permissions... Getting closer though ;)

UPDATE:

After some more debugging the above is not causing this issue but the electron option fullscreen: true.
Some messing around with the option I've found a solution that should work well. I'll post it in another comment bellow.

@rejas
Copy link
Collaborator

rejas commented Jan 3, 2023

Are you running on the latest MM version with all packages updated?

@dfanica
Copy link

dfanica commented Jan 3, 2023

Are you running on the latest MM version with all packages updated?

yes, I just updated to 2.22 right before looking into this issue... which was present before the update as well

@sdetweil
Copy link
Collaborator

sdetweil commented Jan 3, 2023

i've been trying to get rid of the white flash for years.. without success.. depends on system speed really..

@dfanica
Copy link

dfanica commented Jan 3, 2023

i've been trying to get rid of the white flash for years.. without success.. depends on system speed really..

I'm determined to get rid of this TODAY!

UPDATE: @sdetweil check your logs and see if you're seeing the same error as posted above please. This might give me a hint that I'm on the right or wrong track.

@sdetweil
Copy link
Collaborator

sdetweil commented Jan 3, 2023

i do not see that error..

I have tried adding code to force the initial background, minimize and then restore after ready, ...
nothing has helped.. I have seen it on every mirror system I have ever built..
pi, 0w, 02w, pi3, pi4, odroid xu4, jetson nano, mac vm, mac mini, linux x86, gallium, ubuntu

see this, https://www.christianengvall.se/electron-white-screen-app-startup/
which does not work..
one of the issues I posted to , from 2016
electron/electron#20357

@dfanica
Copy link

dfanica commented Jan 3, 2023

i do not see that error..

I have tried adding code to force the initial background, minimize and then restore after ready, ... nothing has helped.. I have seen it on every mirror system I have ever built.. pi, 0w, 02w, pi3, pi4, odroid xu4, jetson nano, mac vm, mac mini, linux x86, gallium, ubuntu

see this, https://www.christianengvall.se/electron-white-screen-app-startup/ which does not work.. one of the issues I posted to , from 2016 electron/electron#20357

I have messed with the config options and nothing worked for me. The background color is not affecting this initial boot glitch. I was thinking the error above is the one causing this as it's right when the createWindow function is called in electron.js.

@dfanica
Copy link

dfanica commented Jan 3, 2023

The final solution to make this works on Raspberry Pi4, where I've been testing and have installed MagicMirror.

The issue is caused by the electron option fullscreen: true.
Following the article posted by @sdetweil, https://www.christianengvall.se/electron-white-screen-app-startup/, I'm using a similar approach.
The idea is to avoid using the fullscreen option which flashed the white screen upon load.

First step would be to comment out the fullscreen option being set. Look for the line below in the /js/electron.js file and comment it out.

//electronOptionsDefaults.fullscreen = true;

Second step would be to add the following extra options, potentially replacing the fullscreen one from step one.

electronOptionsDefaults.show = false;
electronOptionsDefaults.frame = false;

Adding the following at the end of the createWindow method is the third and final step:

	mainWindow.once('ready-to-show', () => {
		mainWindow.maximize();
		mainWindow.show();
 	});

This essentially removes the fullscreen option, waits for the app to be ready to render and then displays the content while maximizing the window. As long as frame: false is set you will not see a title bar and everything should look smooth.

I will be looking into creating a PR to fix this issue in this way but I need to test more to make sure this approach doesn't break other implementations.

UPDATE:

I think in some cases you might see a flashing white square, depending on the size of the original window, which you can get rid of by adding electronOptionsDefaults.transparent = true; in step 2.

@sdetweil
Copy link
Collaborator

sdetweil commented Jan 3, 2023

cool.. that never worked before!!

@dfanica
Copy link

dfanica commented Jan 3, 2023

cool.. that never worked before!!

I told you I'm determined to find a workaround for this issue TODAY! I hope it works for you as well... and maybe other platforms.

@rejas
Copy link
Collaborator

rejas commented Jan 4, 2023

Might this be something worth adding to the documentation :
https://docs.magicmirror.builders/configuration/raspberry.html
?

@sdetweil
Copy link
Collaborator

sdetweil commented Jan 4, 2023

it happens on other platforms too.. maybe his fix works

@khassel
Copy link
Collaborator

khassel commented Jan 4, 2023

tested this on my rpi4, the only thing I needed to avoid the white screen is to add electronOptionsDefaults.transparent = true;

@rejas @sdetweil can you test this with your setup?

@khassel khassel linked a pull request Jan 13, 2023 that will close this issue
@khassel khassel changed the title [Develop branch] - Electron's white screen during the MM start Electron shows white screen during the MM start Jan 15, 2023
khassel added a commit to khassel/MagicMirror that referenced this issue Jan 24, 2023
rejas pushed a commit that referenced this issue Jan 26, 2023
see #1919

thanks @dfanica for providing the solution in [this
comment](#1919 (comment))

tested this on a pi4 with bullseye 32-bit and 64-bit
@rejas rejas added this to the 2.23 milestone Feb 18, 2023
MichMich added a commit that referenced this issue Apr 4, 2023
## [2.23.0] - 2023-04-04

Thanks to: @angeldeejay, @buxxi, @CarJem, @dariom, @DaveChild, @dWoolridge, @grenagit, @Hirschberger, @KristjanESPERANTO, @MagMar94, @naveensrinivasan, @nfogal, @psieg, @rajniszp, @retroflex, @SkySails and @tomzt.

Special thanks to @khassel, @rejas and @sdetweil for taking over most (if not all) of the work on this release as project collaborators. This version would not be there without their effort. Thank you guys! You are awesome!

### Added

- Added increments for hourly forecasts in weather module (#2996)
- Added tests for hourly weather forecast
- Added possibility to ignore MagicMirror repo in updatenotification module
- Added Pirate Weather as new weather provider (#3005)
- Added possibility to use your own templates in Alert module
- Added error message if `<modulename>.js` file is missing in module folder to get a hint in the logs (#2403)
- Added possibility to use environment variables in `config.js` (#1756)
- Added option `pastDaysCount` to default calendar module to control of how many days past events should be displayed
- Added thai language to alert module
- Added option `sendNotifications` in clock module (#3056)

### Removed

- Removed darksky weather provider
- Removed unneeded (and unwanted) '.' after the year in calendar repeatingCountTitle (#2896)

### Updated

- Use develop as target branch for dependabot
- Update issue template, contributing doc and sample config
- The weather modules clearly separates precipitation amount and probability (risk of rain/snow)
  - This requires all providers that only supports probability to change the config from `showPrecipitationAmount` to `showPrecipitationProbability`.
- Update tests for weather and calendar module
- Changed updatenotification module for MagicMirror repo only: Send only notifications for `master` if there is a tag on a newer commit
- Update dates in Calendar widgets every minute
- Cleanup jest coverage for patches
- Update `stylelint` dependencies, switch to `stylelint-config-standard` and handle `stylelint` issues, update `main.css` matching new rules
- Update Eslint config, add new rule and handle issue
- Convert lots of callbacks to async/await
- Revise require imports (#3071 and #3072)

### Fixed

- Fix wrong day labels in envcanada forecast (#2987)
- Fix for missing default class name prefix for customEvents in calendar
- Fix electron flashing white screen on startup (#1919)
- Fix weathergov provider hourly forecast (#3008)
- Fix message display with HTML code into alert module (#2828)
- Fix typo in french translation
- Yr wind direction is no longer inverted
- Fix async node_helper stopping electron start (#2487)
- The wind direction arrow now points in the direction the wind is flowing, not into the wind (#3019)
- Fix precipitation css styles and rounding value
- Fix wrong vertical alignment of calendar title column when wrapEvents is true (#3053)
- Fix empty news feed stopping the reload forever
- Fix e2e tests (failed after async changes) by running calendar and newsfeed tests last
- Lint: Use template literals instead of string concatenation
- Fix default alert module to render HTML for title and message
- Fix Open-Meteo wind speed units
@khassel khassel closed this as completed Apr 4, 2023
rejas pushed a commit that referenced this issue Aug 12, 2023
This PR uses `electron.screen.getPrimaryDisplay().workAreaSize` under
electron to get the screen size.

If this fails the current defaults (800x600) are used.

This solves some problems with xrandr under bullseye where the sreen
comes up with 800x600 instead of fullscreen, e.g. described
[here](https://khassel.gitlab.io/magicmirror/pi-modules/).

Tested this on my pi setup.

By the way, the Issue #1919 is back on my side (not related to this PR)
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants