How To: modifying Chrome .desktop file to put profile and cache on /live/image

a very small Live CD shaped to look and act like Puppy Linux.

Moderator: fredx181

Post Reply
dancytron
Posts: 719
Joined: Fri Dec 13, 2019 6:26 pm
Has thanked: 517 times
Been thanked: 215 times

How To: modifying Chrome .desktop file to put profile and cache on /live/image

Post by dancytron »

Somebody might find this handy.

Modify Fred's Chrome .desktop file which uses ddliveapp to run as user "puppy" to add:

Code: Select all

--user-data-dir=/live/image/ChromeSettings/config --disk-cache-dir=/live/image/ChromeSettings/cache

(or other reasonable path) to the exec lines that have

Code: Select all

--disk-cache-size=10000000 --media-cache-size=10000000

in them. I don't think it needs to be added to the other exec lines but I will test that further.

Then create the /live/image/ChromeSettings directory and set the owner and group to be "puppy" by right clicking and choosing properties (or in the terminal).

The usefulness is to get them out of the main file system and also to more conveniently be able to delete them for security/paranoia purposes.

I attached a sample .desktop file (remove .gz).

Attachments
google-chrome-live-image-profiles.desktop.gz
(8.44 KiB) Downloaded 47 times
User avatar
wizard
Posts: 1969
Joined: Sun Aug 09, 2020 7:50 pm
Has thanked: 2620 times
Been thanked: 680 times

Re: How To: modifying Chrome .desktop file to put profile and cache on /live/image

Post by wizard »

@dancytron
@fredx181

I'm using peebee's chromium sfs and would like to move the cache and download dir to /mnt/home. Would this technique work and does it have to have a ext* partition?

Thanks
wizard

Big pile of OLD computers

dancytron
Posts: 719
Joined: Fri Dec 13, 2019 6:26 pm
Has thanked: 517 times
Been thanked: 215 times

Re: How To: modifying Chrome .desktop file to put profile and cache on /live/image

Post by dancytron »

I don't know if it has to be a linux partition. My first reaction is "no, it should work fine on a Windows partition", but I don't actually know that.

Otherwise, it should work, but you will have to figure out where to put it. It might work in the .desktop file, you may be able to do it with a little script, or you might need to edit a wrapper script.

There are a bunch of different ways to get chrome to run as another user.

This is some version of the script we used in Debian Jessie and Stretch.

Code: Select all

#!/bin/sh
#change user profile to /live/image/ChromeSettings
xhost +local:puppy

su puppy -c "/usr/bin/google-chrome-stable --user-data-dir=/live/image/ChromeSettings/google-chrome/config --disk-cache-dir=/live/image/ChromeSettings/google-chrome/cache --disk-cache-size=10000000 --media-cache-size=10000000 "$@""

#gksu -u puppy "/usr/bin/google-chrome-stable --user-data-dir=/home/puppy/chrome/user --disk-cache-dir=/home/puppy/chrome/cache --disk-cache-size=10000000 --media-cache-size=10000000"

edit: if you don't figure it out right away, give me a link to the sfs. I've got a copy of Fossa Pup up and running and I'll take a look.

User avatar
wizard
Posts: 1969
Joined: Sun Aug 09, 2020 7:50 pm
Has thanked: 2620 times
Been thanked: 680 times

Re: How To: modifying Chrome .desktop file to put profile and cache on /live/image

Post by wizard »

@dancytron

Sorry for my delay, was focused on wrapping up another project. I'm working with chromium64_94.0.4606.54_lx_spot.sfs, which is on Sourceforge. I know how to moves the files and link back, but fat32 and ntfs partitions don't support the Linux permissions that are required for user Spot.

Thanks
wizard

Big pile of OLD computers

dancytron
Posts: 719
Joined: Fri Dec 13, 2019 6:26 pm
Has thanked: 517 times
Been thanked: 215 times

Re: How To: modifying Chrome .desktop file to put profile and cache on /live/image

Post by dancytron »

I didn't test it or anything, but I modified the wrapper script chromium-browser which is in /usr/bin on the .sfs file to add --user-data-dir=/mnt/home/google-chromium/config --disk-cache-dir=/mnt/home/google-chromium/cache when it executes. Open up the script and see what I did.

remove gz from attached, put in /usr/bin, and set as executable. You'll probably need to create /mnt/home/google-chromium/config and .../cache and set spot as the owner or set maybe just set as writable by spot... I'm not exactly sure on that off the top of my head...

Attachments
chromium-browser.gz
(1.79 KiB) Downloaded 42 times
User avatar
wizard
Posts: 1969
Joined: Sun Aug 09, 2020 7:50 pm
Has thanked: 2620 times
Been thanked: 680 times

Re: How To: modifying Chrome .desktop file to put profile and cache on /live/image

Post by wizard »

@dancytron
Hi dan

Running chromium64_94.0.4606.54_lx_spot.sfs. Downloaded chromium-browser.gz. There isn't a chromium-browser file in usr/bin so renamed to chromium. Also noticed that the file specs 32bit. Set everything else up, but it does not run.

Thanks
wizard

Big pile of OLD computers

User avatar
wizard
Posts: 1969
Joined: Sun Aug 09, 2020 7:50 pm
Has thanked: 2620 times
Been thanked: 680 times

Re: How To: modifying Chrome .desktop file to put profile and cache on /live/image

Post by wizard »

@dancytron

Set it up and ran chromium_alt, here is terminal output.

term.jpg
term.jpg (82.36 KiB) Viewed 849 times

Chromium opened to this screen:

tchrom.jpg
tchrom.jpg (77.81 KiB) Viewed 849 times

Since the objective here is get all chromium files out of a save file (to keep it from filling up), the problem I see, even if we can make this work, is it will only work on ext* Linux formats, and not on fat32 because fat32 will not support Linux permissions. If it has to have ext*, then it isn't needed because ext* will support save folders. Catch22

Thanks
wizard

Big pile of OLD computers

dancytron
Posts: 719
Joined: Fri Dec 13, 2019 6:26 pm
Has thanked: 517 times
Been thanked: 215 times

Re: How To: modifying Chrome .desktop file to put profile and cache on /live/image

Post by dancytron »

Did you test it on Fat32 and it wouldn't open or is that a screenshot of the terminal and it did open?

You may be right about the "catch 22". I don't use Fat32. I always format everything to ext3 or ext4, even usb drives.

Ramdisks, etc would add exactly the kind of complexity you are trying to avoid (and I don't know how to do that).

Maybe this is a dead end and you need to concentrate on getting it into pupmode 13, using a big enough save file, and limiting the size of the user profiles and cache.

User avatar
wizard
Posts: 1969
Joined: Sun Aug 09, 2020 7:50 pm
Has thanked: 2620 times
Been thanked: 680 times

Re: How To: modifying Chrome .desktop file to put profile and cache on /live/image

Post by wizard »

My bad, the above test was run on ext3. Have not tested on fat32, but know from previous testing that you cannot give a directory on a fat32 partition Linux permissions. Without that Puppy user Spot cannot write to the directory. Think you are correct about the direction to go. Did solve the sdcard pupmode 13 issue over on Cloudpup topic.

Thanks
wizard

Big pile of OLD computers

trister
Posts: 103
Joined: Mon Sep 28, 2020 6:52 am
Has thanked: 27 times
Been thanked: 17 times

Re: How To: modifying Chrome .desktop file to put profile and cache on /live/image

Post by trister »

This is how I run chrome and other chromium based browsers for MANY years in NTFS in many PCs (I remember they worked with Fat32 in the past)
It is quite similar to the scripts you all posted above.

chown and chmod for chrome-sandbox are used because I had at some point an issue in some updates of chrome.

In ext2,3 filesystems that are also used by another OS you might need to do chown/chmod for the .data and .cache folders.

My main script does this :

Code: Select all

#!/bin/sh
sudo chown root /opt/google/chrome/chrome-sandbox
sudo chmod 4755 /opt/google/chrome/chrome-sandbox
xhost +local:puppy
mkdir -p /mnt/home/downloads_linux/.data/google-chrome-stable
mkdir -p /mnt/home/downloads_linux/.cache/google-chrome-stable
sudo -u puppy google-chrome-stable --user-data-dir=/mnt/home/downloads_linux/.data/google-chrome-stable --disk-cache-dir=/mnt/home/downloads_linux/.cache/google-chrome-stable "$@"

Also ,in case anyone is interested, google_chrome_get_deb_and_make_squashfs.zip contains the scripts that I use to create google-chrome squashfs with the appropriate .desktop/.sh files .
Run init_chrome_extracted2sfs.sh . The EXTERNAL .desktop saves in "=/mnt/home/downloads_linux/...". If you don't like it you can replace it in customizations_deb_extracted.sh .
I also have similar script to create firefox.squashfs that saves in /mnt/home/...

remove .txt extension from the attached files.

Attachments
google_chrome_get_deb_and_make_squashfs.zip
(1.85 KiB) Downloaded 33 times
google-chrome-stable-puppy-home.sh.txt
(434 Bytes) Downloaded 39 times
google-chrome-stable-puppy-home.desktop.txt
(428 Bytes) Downloaded 33 times
Post Reply

Return to “DebianDogs”