A fix for a slow update-mime-database in sfs_load

Moderators: 666philb, Forum moderators

Post Reply
Burunduk
Posts: 250
Joined: Thu Jun 16, 2022 6:16 pm
Has thanked: 7 times
Been thanked: 126 times

A fix for a slow update-mime-database in sfs_load

Post by Burunduk »

Loading/unloading some sfs files (e.g. LibreOffice) takes more than a minute on my system. The update-mime-database command generates a lot of disk activity. I've found a fix for this on linuxquestions.org. This is the command to patch the sfs_load on Fossapup64-9.5:

Code: Select all

sed -i 's/update-mime-database/PKGSYSTEM_ENABLE_FSYNC=0 &/' /usr/sbin/sfs_load
User avatar
Jasper
Posts: 2067
Joined: Wed Sep 07, 2022 1:20 pm
Has thanked: 854 times
Been thanked: 480 times

Re: A fix for a slow update-mime-database in sfs_load

Post by Jasper »

@Burunduk

Thanks for sharing this.

There is a process "Cleanup" which I see running and it takes a few minutes to work and sometimes I get an error message informing me that it fails to unload the SFS and it will be removed at the next boot up.

Does the command simply need to be entered in terminal? :oops: ........... just wanted to make sure :thumbup:
Burunduk
Posts: 250
Joined: Thu Jun 16, 2022 6:16 pm
Has thanked: 7 times
Been thanked: 126 times

Re: A fix for a slow update-mime-database in sfs_load

Post by Burunduk »

Yes. Just run it in the terminal. The command edits the /usr/sbin/sfs_load file. Alternatively, open /usr/sbin/sfs_load in the text editor, find update-mime-database and insert PKGSYSTEM_ENABLE_FSYNC=0 before it. The resulting line reads:

Code: Select all

	  PKGSYSTEM_ENABLE_FSYNC=0 update-mime-database $usrfld/share/mime 2>/dev/null
The problem it solves is described here and here. The update-mime-database is very slow, it writes to the disk every single change it makes. The disk led is constantly on.
On my system sfs_loads runs for more than a minute loading/unloading some sfs files. If I forget to unload such a file before reboot and it's not been copied to /mnt/home, the next boot is one minute longer because sfs_load runs update-mime-database. After the fix it takes less than a second to update the database.
This only concerns certain sfs files - the ones that set up new file associations. For example, LibreOffice sets associations for the open document file types. And it's probably only relevant to PUPMODE=12 because synchronized I/O is fast when Puppy is running in RAM.

Code: Select all

root# time update-mime-database /usr/share/mime

real	1m1.350s
user	0m0.150s
sys	0m0.544s
root# time PKGSYSTEM_ENABLE_FSYNC=0 update-mime-database /usr/share/mime

real	0m0.211s
user	0m0.058s
sys	0m0.151s
I think your problem may be different. The "Failed to unload ...sfs" message usually appears if a program from that sfs is still running. You can run the terminal from a rox window showing the content of a sfs and this will prevent the sfs unloading until you close it even if you cd from that directory and use it for something else.
User avatar
Jasper
Posts: 2067
Joined: Wed Sep 07, 2022 1:20 pm
Has thanked: 854 times
Been thanked: 480 times

Re: A fix for a slow update-mime-database in sfs_load

Post by Jasper »

@Burunduk

Thank you once again :thumbup2:

Post Reply

Return to “Fossapup64”