LibreOffice Slow to Launch

For some months I have been plagued with LibreOffice launching slow. Launching at about 15 seconds or more. Over time the issue festered like an embedded wood splinter.

Launching from a terminal window produced an odd message Warning: failed to read path from javaldx. On a hunch, in the user preferences I enabled a Java runtime environment. The warning disappeared but not the slow launch.

After a first launch LibreOffice would launch in about one second. The slow launch returned after flushing the disk cache. Because of the way disk caching works, eventually during the day LibreOffice launched slowly.

The LibreOffice QuickStart option was removed some versions ago and only helped with the first launch.

The havege daemon is running on all home systems.

Using a fresh LibreOffice profile did not help. I deleted $HOME/.cache files. I tried a new user account. I launched in Safe Mode.

I did not experience the delay on my Lenovo T400 laptop. The laptop has a SATA II SSD. LibreOffice launched in about four to five seconds — even after flushing the disk cache. Yet SSDs work differently than spinners and not a fair comparison.

The office system has SATA III Western Digital Black 7200 rpm spinners.

Running hdparm -tT provided acceptable results. Likewise with running dd if=/dev/zero of=testfile conv=fdatasync bs=64k count=16k.

The laptop uses the deadline I/O scheduler. I changed the office I/O scheduler from cfq to deadline. The entire system suffered and did not eliminate the slow launch.

I used a different spare SATA III 7200 rpm disk. Same delay.

I wondered if the LibreOffice version played a role. I tested versions 6.0.6 to 6.4.1. No change.

Launching through strace revealed nothing helpful.

I have a modest /usr/local/share/fonts directory, full of fonts collected through the years. I removed that directory from /etc/fonts/local.conf and rebuilt the font caches. Launch time improved by about two seconds. Notable but not the primary cause.

For a baseline I created a Slackware 14.2 virtual machine (VM). LibreOffice launched in about six seconds. Manually flushing the disk cache resulted in a launch time of about 10 seconds — well below the 15 or more seconds of the office machine.

I converted the virtual disk image to physical (V2P) using a spare SATA III disk. LibreOffice launched in about five to six seconds.

I tinkered with the new disk. Eventually the disk looked much like the original office disk and LibreOffice exhibited the familiar slow launch.

Eventually the proverbial light bulb began glowing.

In the Slackware rc.M script are house keeping tasks launched in the background. Some months ago I reported that during my office system boot the rc.cups script would take several long seconds to execute. I traced the delay to those background tasks.

Much like the LibreOffice launch, rc.cups was not affected on my laptop SSD.

To eliminate the rc.cups delay, in the rc.M script I disabled those background tasks. Thereafter rc.cups executed within a second or so.

I restored those tasks in rc.M and rebooted.

LibreOffice launched in about five and a half seconds.

Great, but restoring those background tasks resurrected the rc.cups boot delay.

Further exploration revealed the slow LibreOffice launch was caused by disabling the font index (fc-cache) rebuilds during boot. Those rebuilds are unnecessary unless adding new fonts, but the benefit was those rebuilds affecting the disk cache. Executing rc.cups at boot was delayed because rebuilding those font caches is disk intensive but helped launch LibreOffice faster.

I noticed the Slackware Current rc.M was different from 14.2 with a rearranged boot order. I matched the new boot order and left the background tasks enabled.

Minor improvement. While launching LibreOffice was fine, rc.cups still had a noticeable delay. About half the time as previous but annoying.

I disabled all background tasks in rc.M and copied those tasks to a shell script that was launched in rc.local. The system booted normally with no delays. On first launch LibreOffice opened within five to six seconds.

The problem was not yet resolved because the root cause remained a mystery. Flushing the disk cache triggered the slow LibreOffice launch with a harsh penalty.

The symptoms were related to disk and font caching. I repeated the previous routine with the VM. This time with snapshots and careful observation.

Some hours later I found the culprit.

The slackbuilds.org noto-fonts package.

Removing the package improved launch time by several seconds.

As an additional test, I restored a VM snapshot to a basic system and installed only the noto-font package. Launch time increased by about eight seconds.

I removed the package from the laptop. Launching LibreOffice improved by two seconds.

I don’t need the package. I have no memory why I installed.

Removing the package resolved another “slow launch” issue. For some time the Xfce panel menu on first access opened only after several seconds. With the noto-fonts package removed the menu opened immediately. I do not know why the package adversely affected the Xfce menu opening but a guess is the menu code parses font caches.

I do not remember, but the two slow launch issues probably started about the same time.

I have no benchmarks, but my office system and laptop are snappier.

Splinter removed.

Posted: Category: Usability Tagged: General

Next: Writing for Hire

Previous: Copying Password Hashes