Page 1 of 1

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

Posted: Fri Feb 24, 2023 9:57 pm
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

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

Posted: Wed Mar 15, 2023 6:04 am
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:

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

Posted: Wed Mar 15, 2023 3:20 pm
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.

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

Posted: Sat Mar 18, 2023 2:38 pm
by Jasper

@Burunduk

Thank you once again :thumbup2: