ungoogled-software / ungoogled-chromium

Google Chromium, sans integration with Google
BSD 3-Clause "New" or "Revised" License
20.32k stars 821 forks source link

Save hard disk SSD HDD by disabling session restore ou increase session store intervals #2032

Open trimechee opened 2 years ago

trimechee commented 2 years ago

Description

disabling session restore

Who's implementing?

The problem

Hello, i discover this article of 2016, this problems seems to affect also chromium browsers, it wil be great to save our hard disk and battery to add an option to disable session restore or increase session store intervals, we can do that with firefox but we can't do this with chrome browser, i have made search, i found solution but is complicated , may be it can help, please add option to disable completely session restore, many don't need this feature, we just use browser to watch some videos.....

Thank you in advance !

"Firefox (& Chrome) are eating our SSD's?!" "Chrome writing to disk every 15 secs" "Heavy SSD Writes Firefox is eating your SSD"

"Firefox and Chrome can shorten SSD lifetime September 26, 2016

Firefox and Chrome have been found to continuously write so much data that it might affect the durability of SSDs. Both browsers write an incredible amount of data to disk, even when idle.

firefox-with-32gb-written-in-a-single-day

This was discovered by researcher Sergei Bobik who used the software SSDLife to monitor how much data was read and written on his system. He found both browsers write a lot of data as they continuously make a backup of themselves"

https://myce.wiki/news/firefox-chrome-can-shorten-ssd-lifetime-80534/

https://forums.linuxmint.com/viewtopic.php?t=235651

https://www.servethehome.com/firefox-is-eating-your-ssd-here-is-how-to-fix-it/

"reduced to using Chrome, below is what is going on inside Firefox, it says Chrome does the same thing. I dont need this garbage of Chrome writing the whole page to my micro SD every 15 seconds. Has anybody found, useing a work around for Chrome, when I looked on the net I could not find anything about Chrome, it was all FF."

"by Nominal Animal Before switching to a laptop with a really, really fast SSD, I used to keep my active browser profiles on a ram disk (tmpfs).

Essentially, when inactive, your Firefox profile can be stored in a tarball (~/.mozilla/firefox/profilename.default.tar). When active, the contents of the tarball are extracted to a temporary directory on a tmpfs mount (ramdisk), with the ~/.mozilla/firefox/profilename.default pointing to that directory. The only real limitation of this approach is that you'll want to set the maximum cache size to something small; I happily used 0, 32 and 64 megabytes for years. (The no-cache one I used on a 2009 Acer Aspire One A110L minilaptop. It still works fine for casual web browsing.)

There are two approaches to maintaining such Firefox profiles.

First approach is to construct it at login, and deconstruct/repack it at logout. This is managed via a session manager script, and varies slightly between session managers. (I tried to get the necessary hooks for doing this in a transparent, safe manner to GDM, but got fed up with the lack of interest, and switched to LightDM.) The downside is that the profile is in memory even when you don't have a browser open, and if you keep yourself logged in all the time, the tarball version of the profile never gets updated.

Second approach is to customize or interpose /usr/bin/firefox (or /usr/bin/firefox-esr). It is a launcher shell script for Firefox. In it, the exec $MOZ_LIBDIR/$MOZ_APP_NAME "$@" causes the script to replace itself with the actual Firefox binary. If you edit the script, or use your own copy of the script, with the exec removed, the shell will remain in memory while the browser is still running. (In this case, I recommend using dash as the shell, if possible, for minimal resource use.) Before running the browser binary proper, the scriptlet checks if the session symlink points to a valid directory. If not, it sets it up. After the browser binary exits, the script tests if there are no more instances left (ps -o pid= -C firefox or ps -o pid= -C firefox-esr), and if not, re-tars the profile, and removes the temporary profile directory. (I preferred to use sync to ensure the data hits the disk, and notify-send to pop up a notification whenever the profile was safely stored on disk. That way, after making a number of new bookmarks or such, all I needed to do was to close and reopen the browser windows, to be sure they were safely stored on disk.)

For further information, search for firefox profile tmpfs and/or firefox profile ram with your preferred web search engine. Top

Gee wiss nominal animal, thats a long answer. I was asking about chrome. Go to 'firefox 55 crashing' to see what the experts say to do if you are using a solid drive.

oldchap wrote:
I was asking about chrome.

The approach I used with Firefox years ago works fine for chrome, too."

https://forum.odroid.com/viewtopic.php?t=29810

Possible solutions

Disable restore

Alternatives

No response

Additional context

No response

trimechee commented 2 years ago

It says

"Chrome seems to generate the same operations as well

Early experiments show a similar behavior for Chrome, which also generates around 1GB per hour, rounding up to around 24GB per day."

"Those [SSD] drives can be rated for about 20GB of writes per day and Firefox [or Chrome] alone might be using more than half of that," Bobik warns users using SSD drives.

"Adjust This Setting Before Firefox Wears Down Your SSD Drive Google Chrome seems to exhibit the same behavior"

https://news.softpedia.com/news/adjust-this-setting-before-firefox-wears-off-your-ssd-drive-508665.shtml

https://forums.servethehome.com/index.php?threads/firefox-is-chewing-through-your-nand.11346/page-2#post-108407

Solution :

take inspiration from brave browser which is open source and apparently doesn't have this kind of disk ssd problem

https://community.brave.com/t/a-geeky-noob-tells-you-why-he-uses-brave-browser/102876 " "It might seem stupid. But this browser doesn’t scan my whole hard drive right? Chrome’s “Software Reporter Tool” does that. It scans and tests every .exe file.

And, this browser doesn’t keep writing data onto my hard drive when idle, right? Firefox does that all the time. Keep Firefox open for 24 hrs and it will write more than 10GB of data. And I don’t know how to stop Firefox from doing that. And I love to keep browsers open all the time. So these two problems are really annoying. My last cheap SSD broke sooner because of this?"

trimechee commented 2 years ago

May it can help developers of our beloved Ungooled Chromium, here what i found, some people said this not operational and bug, some said it works.....

"Someone has suggested just running Chrome in Incognito mode to get around the problem If you are running in full screen mode and redirecting to a specific page that shouldn't be noticeable. I know that's a bit of a work around.

Open chrome \ Default \ Preference, and change the value to

"exit_type": "none",

"exited_cleanly": true,

Save the file, and put him to attribute "read only". Tested on various versions of the Chrome browser

--disable-session-crashed-bubble

chrome.exe --kiosk --disable-session-crashed-bubble "http://example.com"

https://superuser.com/questions/461035/disable-google-chrome-session-restore-functionality

https://bugs.chromium.org/p/chromium/issues/detail?id=445256#c17

https://superuser.com/questions/33548/starting-google-chrome-in-application-mode

https://superuser.com/questions/1640618/how-to-disable-permanently-the-chromium-popup-after-crash-or-hard-boot/1643107#1643107

https://superuser.com/questions/237608/how-to-hide-chrome-warning-after-crash

"I see some inconveniences in the solutions provided:

--incognito switch removes cache, what is pretty bad in most circumstances.

(Copy-pasting chrome help )

Google Chrome has hundreds of undocumented command-line flags that are added and removed at the whim of the developers.

--disable-session-crashed-bubble depends of which version of chrome are you using, the most actual version v39 doesn't have this setting allowed.

The solution I did was to alter the user profile and overwrite the crash status to a normal close status, It's a simple hack that works perfect.

This is the script I run in kiosk-mode in a chrome-only session under Ubuntu 12.04 and 14.04

!/bin/sh

sed -i 's/"exited_cleanly": false/"exited_cleanly": true/' ~/.config/google-chrome/Default/Preferences sed -i 's/"exit_type": "Crashed"/"exit_type": "None"/' ~/.config/google-chrome/Default/Preferences google-chrome --kiosk "http://some_url" It simply finds and replace the string

"exited_cleanly":false exit_type": "Crashed" with

"exited_cleanly": true "exit_type": "None" So, no matter how chrome has closed. It will always think it has closed gracefully. (Tested in many chrome versions)

quote : "This finally worked for me, and it's pretty simple:

Shut down Chromium gracefully Change the "Change content" permissions of ~/.config/chromium/Default/Preferences to "Nobody" That will lock the state of two variables, regardless of how Chromium was shut down:

"exit_type": "Normal" "exited_cleanly": true Of course, only do that after you're done setting preferences"

"Finally something that seems to work and ignore the crash (caused by powering the pi instead of a shutdown/restart).

The --app= seems to do the trick from the pi autostart file.

chromium-browser --start-fullscreen --kiosk --app=http://mumti.org/?ch=MUMTI&cat=SLOWTV --app mentioned here Starting Google Chrome in application mode

One of my previous failed attempts was using sed from the autostart to modify Preferences and "Local State". I have no idea why it did not work on /home/pi/

The last successful solution was https://superuser.com/a/1643107/690627 although this brute force worked I hated it because "

https://superuser.com/questions/237608/how-to-hide-chrome-warning-after-crash

https://superuser.com/questions/1640618/how-to-disable-permanently-the-chromium-popup-after-crash-or-hard-boot/1643107#1643107