WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Xlibs install script causes very slow boot  (Read 2472 times)

Offline NinjaCowboy

  • Newbie
  • *
  • Posts: 36
Xlibs install script causes very slow boot
« on: January 21, 2019, 06:34:21 PM »
I've accumulated a lot of files in my (persistent) home directory, and I noticed that my system is taking a really long time to boot (over 2 minutes). I investigated this by editing the tce-load script, adding 'sh -x' where it executes an extension's tce.installed script (so I can see every command as it is being executed). I found that the main culprit of slowness is the /usr/local/tce.installed/Xlibs script:
Code: [Select]
#!/bin/sh
read USER < /etc/sysconfig/tcuser
[ -f /home/"$USER"/.xsession ] || cp /etc/skel/.xsession /home/"$USER"/.
[ -f /home/"$USER"/.setbackground ] || cp /etc/skel/.setbackground /home/"$USER"/.
[ -f /home/"$USER"/.Xdefaults ] || cp /etc/skel/.Xdefaults /home/"$USER"/.
[ -d /opt/backgrounds ] || mkdir /opt/backgrounds
chown -R "$USER".staff /home/"$USER" 2>/dev/null
chmod g+w /opt/backgrounds 2>/dev/null
sudo chown -R root.staff /usr/local/tce.installed 2>/dev/null
sudo chmod -R 775 /usr/local/tce.installed 2>/dev/null
In particular, this line
Code: [Select]
chown -R "$USER".staff /home/"$USER" 2>/dev/nullwhich takes about a minute to recursively change the ownership of every single file in my home directory to tc.staff (which it should already be set to, anyway). So yeah, that's a whole MINUTE of boot time (plus thousands of flash write cycles) wasted on a POINTLESS operation. I'm using piCore 9.0, but I'd expect this to affect anybody using a persistent home directory with X installed.
« Last Edit: January 21, 2019, 06:37:46 PM by NinjaCowboy »

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: Xlibs install script causes very slow boot
« Reply #1 on: January 22, 2019, 08:48:36 AM »
Hello NinjaCowboy

Code: [Select]
chown -R "$USER".staff /home/"$USER" 2>/dev/null
chmod g+w /opt/backgrounds 2>/dev/null

Neither of these commands exist in Xlibs startup scripts for  tc-9x, tc-10x, in x86 or x86_64 versions.  So I have to wonder what version of TC you're using?

It looks like a modification that someone made in troubleshooting, then forgot...?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: Xlibs install script causes very slow boot
« Reply #2 on: January 22, 2019, 09:14:33 AM »
Hi coreplayer2
... It looks like a modification that someone made in troubleshooting, then forgot...?
I just checked a TC4 machine and those commands are present in the startup script. I think the  chown  line in question was
an overly broad way of insuring correct ownership for these 3 lines:
Code: [Select]
[ -f /home/"$USER"/.xsession ] || cp /etc/skel/.xsession /home/"$USER"/.
[ -f /home/"$USER"/.setbackground ] || cp /etc/skel/.setbackground /home/"$USER"/.
[ -f /home/"$USER"/.Xdefaults ] || cp /etc/skel/.Xdefaults /home/"$USER"/.
If you look at those 3 lines in the TC9 version you'll note they have  chown  commands appended to them.

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: Xlibs install script causes very slow boot
« Reply #3 on: January 22, 2019, 09:31:11 AM »
Hi coreplayer2
I just checked a TC4 machine and those commands are present in the startup script. I think the  chown  line in question was
an overly broad way of insuring correct ownership for these 3 lines:
Code: [Select]
[ -f /home/"$USER"/.xsession ] || cp /etc/skel/.xsession /home/"$USER"/.
[ -f /home/"$USER"/.setbackground ] || cp /etc/skel/.setbackground /home/"$USER"/.
[ -f /home/"$USER"/.Xdefaults ] || cp /etc/skel/.Xdefaults /home/"$USER"/.
If you look at those 3 lines in the TC9 version you'll note they have  chown  commands appended to them.
Indeed I saw that, more importantly I noted that chown appended to these commands were targeted at specific files, not recursive.
I hear you, was used many years ago and has been corrected/updated at some point.  So, how is it a new TC user has this old version of  Xlibs?

Is the quick answer here to update his system?  Maybe this issue is not applicable in TC-9 and above?
« Last Edit: January 22, 2019, 09:40:19 AM by coreplayer2 »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: Xlibs install script causes very slow boot
« Reply #4 on: January 22, 2019, 09:47:41 AM »
Hi coreplayer2
... Is the quick answer here to update his system? 
The OP is running piCore 9.0 so it appears the change never made it to piCore. I don't know when it changed in Tinycore. I only
looked at versions 4 and 9.

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: Xlibs install script causes very slow boot
« Reply #5 on: January 22, 2019, 10:25:19 AM »
Hi coreplayer2
The OP is running piCore 9.0 so it appears the change never made it to piCore. I don't know when it changed in Tinycore. I only
looked at versions 4 and 9.
Is this tc-4 system the one which hasn't been rebooted in 10 years by chance??


Anyhow, since I was curious because of this
Quote
I'd expect this to affect anybody using a persistent home directory with X installed.
I checked further..   The change occurred during 2013 in TC-5x

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: Xlibs install script causes very slow boot
« Reply #6 on: January 22, 2019, 10:36:33 AM »
Hi coreplayer2
... Is this tc-4 system the one which hasn't been rebooted in 10 years by chance?? ...
Close. It's the system that gets rebooted every 1.5 to 2 years. :)

Offline NinjaCowboy

  • Newbie
  • *
  • Posts: 36
Re: Xlibs install script causes very slow boot
« Reply #7 on: January 23, 2019, 07:21:52 AM »
Oh sorry I didn't realize that it only affects piCore. Feel free to move this topic to the Raspberry Pi section if it makes sense. It seems a recurring issue that versions of extensions in piCore aren't kept in sync with the x86 and x86-64 versions.