It is currently Tue May 21, 2013 4:01 am

All times are UTC




Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: shutdown / reboot seems slower than previous versions?
PostPosted: Sat Jan 29, 2011 12:56 am 
Regular Zenwalker
Regular Zenwalker

Joined: Wed Mar 04, 2009 4:04 pm
Posts: 34
on reboot or shutdown there seems to be a long list of "theme" caches that are being refreshed before shutdown reboot. Zenwalk has always been fast booting but now it seems slower to shut down. Is all the "theme" refreshing really normal?


 Profile Send private message  
 
 Post subject: Re: shutdown / reboot seems slower than previous versions?
PostPosted: Sat Jan 29, 2011 6:21 am 
Master of the known universe
Master of the known universe
User avatar

Joined: Fri Oct 06, 2006 5:12 am
Posts: 2423
Location: India - Silicon City
i second you.

_________________
Happiness is REAL, when SHARED
Christopher mcCandles

Software is like sex: it's better when it's free.
Linus Torvalds


 Profile Send private message  
 
 Post subject: Re: shutdown / reboot seems slower than previous versions?
PostPosted: Sat Jan 29, 2011 11:56 am 
Community Packager
Community Packager
User avatar

Joined: Thu Aug 14, 2008 8:26 am
Posts: 1373
Location: Paris
Hi,
Yes, I also find the shutdown strangely slow.

_________________
Ejis :)


 Profile Send private message  
 
 Post subject: Re: shutdown / reboot seems slower than previous versions?
PostPosted: Sat Jan 29, 2011 1:33 pm 
Zenwalk Packager
Zenwalk Packager

Joined: Fri Mar 10, 2006 9:09 am
Posts: 2797
Location: Amsterdam
I have a non-graphical boot & shutdown, and -not always- see that -during shutdown- an update of one or more icons-caches slows down the shutdown. I'm not aware that anything is actually changed about the icons themselves, but the cache is 'updated' regardless. I could understand that a packages-install or something similar could require an update of the cache, but this seems to happen more than needed.

'The thing' is part of the shutdown script /etc/rc.d/rc.6:

Code:
# Update any existing icon cache files:
if find /usr/share/icons 2> /dev/null | grep -q icon-theme.cache ; then
  for theme_dir in /usr/share/icons/* ; do
    if [ -r ${theme_dir}/icon-theme.cache ]; then
      echo "Updating icon-theme.cache in ${theme_dir}..."
      /usr/bin/gtk-update-icon-cache -t -f ${theme_dir} 1> /dev/null 2> /dev/null
    fi
  done

  if [ -r /usr/share/icons/icon-theme.cache ]; then
    echo "Updating icon-theme.cache in /usr/share/icons..."
    /usr/bin/gtk-update-icon-cache -t -f /usr/share/icons 1> /dev/null 2> /dev/null
  fi
fi


The '-f' option of '/usr/bin/gtk-update-icon-cache' (lines 98 and 104 of rc.6) means that it will force: 'Overwrite an existing cache file even if it appears to be uptodate'. Perhaps it would be better to leave that option out.

On that same 'note': a similar '-f' (similar meaning) is part of rc.6 for the fonts cache (line 90 of rc.6). As an experiment, i've modified the rc.6 to disable the '-f' for both; Let's see what happens next ::)

[edit]

The machine does -as expected- shutdown normally, and with no apparent (immediate :-X ) harm of removing the '-f' from the cache-updates. Yes, it *is* faster that way, but i'm hard-pressed to speak a verdict about the shutdown speed relative to 'previous' zenwalk-s: This is a relatively new machine for me, and i've not had any older zenwalk installed on it ever. I do wonder if previous zenwalk-s also had a '-f' for this operation (anyone care to confirm/deny/check :) ??) , and why a forced-update would be needed at all.

Perhaps some non-obvious or non-common condition makes the forced-update of the caches a good idea X!! For the moment, i'll leave 'it' without the forced-update, and see if i can find any long-term 'damage'.

[edit II]

It is '/usr/bin/gtk-update-icon-cache'... A gtk-cache... Ah well, and there's me running kde4-only on the machine :D


 Profile Send private message  
 
 Post subject: Re: shutdown / reboot seems slower than previous versions?
PostPosted: Sat Jan 29, 2011 3:13 pm 
Master of the known universe
Master of the known universe
User avatar

Joined: Fri Oct 06, 2006 5:12 am
Posts: 2423
Location: India - Silicon City
Well the default 6.4 ISO when was released did used to update all this icon packages as the some body said. After some where down the line, i did an upgrade of the system. Then it started updating so many icon cache files during shut down.

_________________
Happiness is REAL, when SHARED
Christopher mcCandles

Software is like sex: it's better when it's free.
Linus Torvalds


 Profile Send private message  
 
 Post subject: Re: shutdown / reboot seems slower than previous versions?
PostPosted: Sat Jan 29, 2011 4:09 pm 
Experienced Zenwalker
Experienced Zenwalker
User avatar

Joined: Tue Oct 06, 2009 4:18 pm
Posts: 156
Location: Hungary
There was a similar problem with font-caching, it was fixed in 6.4 by default.
In 6.2(or in previous releases) you had to patch the rc file and it made significantly faster the shutdown.

_________________
Linux is friendly. :)


 Profile Send private message  
 
 Post subject: Re: shutdown / reboot seems slower than previous versions?
PostPosted: Sat Jan 29, 2011 5:04 pm 
Zenwalk Packager
Zenwalk Packager

Joined: Fri Mar 10, 2006 9:09 am
Posts: 2797
Location: Amsterdam
I'm now test-running with a modified rc.6; I've made the icons-cache update non-forced, and made a little 'trick' for checking if the fonts-cache needs update.

When looking in rc.6, i found one other thing that makes me wonder: The order of operations of shutting the network/dhcpcd .... My gut feeling tells me that the dhcp (client..) daemon is better stopped *before* shutting the network, not after.... The dhcp (client..) daemon might want to inform the dhcp server that it wants to release its 'lease' of an IP address. Which will not *really* work if -just before- the networking has been shut down.... doing some reboot tests....

[edit]

Ok, i've got a slightly modified rc.6 script now. I have added some comment/echo statements, swapped the dhcpcd & network shutdown and added 'fast' icons/fons cache update. The 'fast' fonts-update depends upon a file that will be generated in the first time the script is run, so expect no improvement the 'first-time', the fast font-cache check/generator works only at second shutdown (and hopefully ever after that).

I'll attach it in case anyone feels adventurous and want to try this ;D There is one thing that still 'delays': a 'sleep 5' when killing all processes.... I'll leave that for now, though the remark in the script indicates that this is a 'patch' for a problem that migh -by now- be long gone....

Note: any and all damage caused by being foolish enough to run any script of mine is entirely your fault :D
Note-2: the fully rediculous extension .gif is because the forum software allows me to attach neither a file anmed rc.6 nor rc_6.txt, so i've 'cloacked' the script as a gif file... How silly.... just rename the file to rc.6, inspect it carefully and have your fun with it

*&Y(Q@#*&$(*&^@#$

pox on that forum soft.... I'll attach the file in-line I can find *no* way to attach a file... The file-extension is not allowed, the image size can not be determined, what does a person have to do to attach a mall file to a forum post??? never mind, find the result below

*&^(*&($&%^#&$%#&!!!!



Code:
#! /bin/sh
#
# rc.6          This file is executed by init when it goes into runlevel
#               0 (halt) or runlevel 6 (reboot). It kills all processes,
#               unmounts file systems and then either halts or reboots.
#
# Version:      @(#)/etc/rc.d/rc.6      2.47 Sat Jan 13 13:37:26 PST 2001
#
# Author:       Miquel van Smoorenburg <miquels@drinkel.nl.mugnet.org>
# Modified by:  Patrick J. Volkerding, <volkerdi@slackware.com>
# Modified by:  Jean-Philippe Guillemin, <jp.guillemin@free.fr>
#

# Set the path.
PATH=/sbin:/etc:/bin:/usr/bin

. /etc/shell-colors

#### Set the splash screen to verbose mode ####
[[ -x /sbin/splash && -e /proc/splash ]] && echo "verbose" > /proc/splash &

# Set linefeed mode to avoid staircase effect.
stty onlcr

echo -e "${BOLDMAGENTA}Running shutdown script $0${COLOR_RESET}"

# Find out how we were called.
case "$0" in
        *0)
                command="halt"
                ;;
        *6)
                command=reboot
                ;;
        *)                                                                                                                                                   
                echo "$0: call me as \"rc.0\" or \"rc.6\" please!"                                                                                           
                exit 1
                ;;
esac

# Save the system time to the hardware clock using hwclock --systohc.
if [ -x /sbin/hwclock ]; then
  # Check for a broken motherboard RTC clock (where ioports for rtc are
  # unknown) to prevent hwclock causing a hang:
  if ! grep -q -w rtc /proc/ioports ; then
    CLOCK_OPT="--directisa"
  fi
  if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then
    echo "Saving system time to the hardware clock (UTC)"
    /sbin/hwclock $CLOCK_OPT --utc --systohc
  else
    echo "Saving system time to the hardware clock (localtime)"
    /sbin/hwclock  $CLOCK_OPT --localtime --systohc
  fi
fi

# Save the sound settings
if [ -x /usr/sbin/alsactl ]; then
  echo "Saving the Sound Settings"
  /usr/sbin/alsactl store
fi

# Update the shared library links
if [ -x /sbin/ldconfig ]; then
  echo -e "${BOLDWHITE}Updating shared library links${COLOR_RESET}"
  /sbin/ldconfig
fi

# Font caching
du /usr/share/fonts > /tmp/fonts.list
touch /etc/fonts.list

if ! (cmp -s /etc/fonts.list /tmp/fonts.list) ; then
  for fontdir in cyrillic OTF TTF 100dpi 75dpi misc Type1 Speedo util encodings; do
          [ -d /usr/share/fonts/${fontdir} ] && \
          (
                [ -x /usr/bin/mkfontscale ] && ( chroot . /usr/bin/mkfontscale /usr/share/fonts/${fontdir} > /dev/null 2>&1 )
                [ -x /usr/bin/mkfontdir ] && ( chroot . /usr/bin/mkfontdir /usr/share/fonts/${fontdir} > /dev/null 2>&1 )
          )
  done
  du /usr/share/fonts > /etc/fonts.list
fi

#
# Update the X font indexes:
#
echo "Updating X font indexes:  /usr/bin/fc-cache..."
#
if [ -d /var/cache/fontconfig ]; then
        #
        # 'fast' fontsconfig update script
        #
        fontsnow=`ls -lR /usr/share/fonts | md5sum`
        fontsref=`cat /var/cache/fontsref 2>/dev/null`

        if [ "$fontsnow" = "$fontsref" ]; then
                #
                echo "No changes in the fonts"
                #
        else
                #
                echo "Updating the fonts cache"
                #
                rm -rf   /var/cache/fontconfig
                mkdir -p /var/cache/fontconfig
                #
                [ -x /usr/bin/fc-cache ] && /usr/bin/fc-cache -rf >/dev/null 2>&1
                ls -lR /usr/share/fonts | md5sum >/var/cache/fontsref
                #
        fi
        #
        unset fontsnow
        unset fontsref
        #
        # rm -rf /var/cache/fontconfig
        # mkdir -p /var/cache/fontconfig
        #
else
        #
        [ -x /usr/bin/fc-cache ] && /usr/bin/fc-cache -rf > /dev/null 2>&1
        #
fi
#
# Update any existing icon cache files:
#
if find /usr/share/icons 2> /dev/null | grep -q icon-theme.cache ; then
  for theme_dir in /usr/share/icons/* ; do
    if [ -r ${theme_dir}/icon-theme.cache ]; then
      echo "Updating icon-theme.cache in ${theme_dir}..."
      /usr/bin/gtk-update-icon-cache -t ${theme_dir} 1> /dev/null 2> /dev/null
    fi
  done

  if [ -r /usr/share/icons/icon-theme.cache ]; then
    echo "Updating icon-theme.cache in /usr/share/icons..."
    /usr/bin/gtk-update-icon-cache -t /usr/share/icons 1> /dev/null 2> /dev/null
  fi
fi

# Update mime database:
if [ -x /usr/bin/update-mime-database -a -d /usr/share/mime ]; then
  echo "Updating MIME database:  /usr/bin/update-mime-database /usr/share/mime..."
  /usr/bin/update-mime-database /usr/share/mime 1> /dev/null 2> /dev/null &
fi

# Unmount any NFS, SMB, or CIFS filesystems:
echo "Unmounting remote filesystems"
umount -a -r -t nfs,smbfs,cifs

# In case dhcpcd might have been manually started on the command line,
# look for the .pid file, and shut dhcpcd down if it's found:
if /bin/ls /var/run/dhcpcd*.pid 1>/dev/null 2>/dev/null ; then
  echo -n "releasing dhcp IP address leases"
  /sbin/dhcpcd -k 1> /dev/null 2>/dev/null
  echo    " ... done"
fi

# Bring down the networking system, but first make sure that this
# isn't a diskless client with the / partition mounted via NFS:
if ! mount | grep -q 'on / type nfs' ; then
  if [ -x /etc/rc.d/rc.inet1 ]; then
    echo -n -e "${BOLDCYAN}Stopping the network${COLOR_RESET}"
    . /etc/rc.d/rc.inet1 stop
    echo "... done"
  fi
fi

# Turn off process accounting:
if [ -x /sbin/accton -a -r /var/log/pacct ]; then
  echo "Turning off process accounting"
  /sbin/accton
fi

# Kill all processes.
# INIT is supposed to handle this entirely now, but this didn't always
# work correctly without this second pass at killing off the processes.
# Since INIT already notified the user that processes were being killed,
# we'll avoid echoing this info this time around.
#
if [ "$1" != "fast" ]; then # shutdown did not already kill all processes
  echo -n "Killing all processes"
  killall5 -15
  sleep 5
  killall5 -9
  echo    " ... done"
fi

# Try to turn off quota.
if grep -q quota /etc/fstab ; then
  if [ -x /sbin/quotaoff ]; then
    echo -n "Turning off filesystem quotas"
    /sbin/quotaoff -a
    echo    " ... done"
  fi
fi

# Carry a random seed between reboots.
echo "Saving random seed from /dev/urandom in /etc/random-seed."
# Use the pool size from /proc, or 512 bytes:
if [ -r /proc/sys/kernel/random/poolsize ]; then
  dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null
else
  dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null
fi
chmod 600 /etc/random-seed

# Before unmounting file systems write a reboot or halt record to wtmp.
$command -w

# Remove stale locks and junk files
rm -f /var/lock/* /var/spool/uucp/LCK..* /tmp/.X*lock /tmp/core /core 2> /dev/null
if [ -d /var/lock/subsys ]; then
  rm -f /var/lock/subsys/*
fi

# Remove stale hunt sockets
if [ -r /tmp/hunt -o -r /tmp/hunt.stats ]; then
  echo "Removing your stale hunt sockets from /tmp."
  rm -f /tmp/hunt*
fi


# Turn off swap, then unmount local file systems.

echo "Turning off swap"
sync
swapoff -a

echo "Unmounting local file systems"
umount -a -r -t nonfs,noproc,nosysfs
echo "Remounting root filesystem read-only."
mount -n -o remount,ro /


# This never hurts:
sync

# sleep 1 fixes problems with some hard drives that don't
# otherwise finish syncing before reboot or poweroff
sleep 1

# This is to ensure all processes have completed on SMP machines:
wait

# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.
if [ "$command" = "reboot" ]; then
  echo -e "${BOLDMAGENTA}Rebooting...${COLOR_RESET}"
  reboot
else
  echo -e "${BOLDMAGENTA}Shutdown...${COLOR_RESET}"
  poweroff
fi


 Profile Send private message  
 
 Post subject: Re: shutdown / reboot seems slower than previous versions?
PostPosted: Sat Jan 29, 2011 6:02 pm 
Master of the known universe
Master of the known universe
User avatar

Joined: Fri Oct 06, 2006 5:12 am
Posts: 2423
Location: India - Silicon City
Cant v check if those fonts cache has been modified, then update it while shutdown rather than blindly updating it?

_________________
Happiness is REAL, when SHARED
Christopher mcCandles

Software is like sex: it's better when it's free.
Linus Torvalds


 Profile Send private message  
 
 Post subject: Re: shutdown / reboot seems slower than previous versions?
PostPosted: Sat Jan 29, 2011 8:05 pm 
Zenwalk Packager
Zenwalk Packager

Joined: Fri Mar 10, 2006 9:09 am
Posts: 2797
Location: Amsterdam
Unless i've made a mistake: that's what i 'did':

The ls -lR /usr/share/fonts with md5sum makes a list of the fonts-file, computes an md5 of the result of ls-l and stores that in a file. When doing a shutdown, a 2-nd identical check is done, and only when the resulting md5-s are different is an actual update of the fonts-cache 'done'. That should reduce the actual 'work' from blindly performing a fonts-cache update to an ls-lR plus a little overhead (md5, compare, shell-script).


 Profile Send private message  
 
 Post subject: Re: shutdown / reboot seems slower than previous versions?
PostPosted: Sun Jan 30, 2011 1:28 am 
Zenwalk Packager
Zenwalk Packager

Joined: Fri Mar 10, 2006 9:09 am
Posts: 2797
Location: Amsterdam
NB: there is one thing in the rc.6 script that still worries me a bit: In the script there is a

Code:
  /usr/bin/update-mime-database /usr/share/mime 1> /dev/null 2> /dev/null &


and later

Code:
# Kill all processes.
# INIT is supposed to handle this entirely now, but this didn't always


The mime-database update is started 'in the background'. I do not know if the 'kill all processes' -later in time- will not also kill the background mime-database update. I frankly do not know how long that mime-database update takes, but i would not want that process killed while it is busy and -say- 'halfway'. It was started by rc.6, so i'd want it to 'run to its end'.

ok: just checked, as non-background process:

Code:
root[prf]# time  /usr/bin/update-mime-database /usr/share/mime 1>/dev/null 2>/dev/null

real    0m4.454s
user    0m0.458s
sys     0m0.072s


So: on this machine, the mime-database update 'takes' about 4 to 5 seconds... A little bit long to wait for (we wanted to make shutdown faster, not introduce 'extra' delays), and also long enough to be 'at risk' from getting 'hit' by the killall from the shutdown script. The way to address that would to be -my estimate- to move the mime-database update to the front of the shutdown script. If anyone has a suggestion how to 'wait' for it later in the script, i'd welcome suggestions.

If bash is 'the one' running the script, the 'wait' command should be our friend: wait: 'sleep till all background processes have finished'. So 'move to the front of the script', and put a command 'wait' just before the killall part of the script.

[edit] the mime-database process is not 'at risk' from the 'kill all processes' part: the killall5 kills *only* processes that are not 'from here' (meaning 'started from this script'..) See next post however, i've had more fun wih the shutdown script....


 Profile Send private message  
 
 Post subject: Re: shutdown / reboot seems slower than previous versions?
PostPosted: Sun Jan 30, 2011 11:22 am 
Zenwalk Packager
Zenwalk Packager

Joined: Fri Mar 10, 2006 9:09 am
Posts: 2797
Location: Amsterdam
A rather experimental 'state of the art' (my art, my state...) of a file /etc/rc.d/rc.6 can be found 'here':

http://download.zenwalk.org/people/prfa ... nWalk/rc.6

This version *is* experimental. I've had some fun with looking at the shutdown script, and did make a lot of changes. What 'it' mainly comes down to is the following:

- i added a lot of verbosity... I may want to remove that later, but for now, it gives me an indication of 'what's going on'.

- I shifted the stopping of all processes to the front of the file. Reason: there is a 'sleep 5' in that part, and i want to wait as little as possible for sleeps. I've also made the entire process-killing a 'background' action, so the process-killing will run in parallel to the rest of the shutdown script. The 'killall5' 'core' statements of that operation should kill off all processes except those 'in' the shutdown script itself.

- I made many of the activities of the shutdown script 'background operations', and added 'wait' statements at what i thought to be 'strategic' places. The intended result: we have a mutitasking OS here. I intend to use that to let the scheduler run as many as possible of the shutdown operations in parallel. Only where 'i don't know anymore', or where i think that the activities should be sequencial did i add 'wait' statements to 'sync' the parallel activities, and/or let the respective activity run 'in-line'.

On my machine, this results in a rather fast, and 'so to see' correct, shutdown. Mind you, this is a bit of an experiment for me, so -surely- all comments/suggestions are welcome.


 Profile Send private message  
 
 Post subject: Re: shutdown / reboot seems slower than previous versions?
PostPosted: Tue Feb 01, 2011 5:03 am 
Senior Zenwalker
Senior Zenwalker

Joined: Thu Jun 12, 2008 12:30 pm
Posts: 448
Location: Chicago, IL, USA
I like what is being done here, I hope this work is applied to 7.0.

_________________
PC's specs:
Intel i5 3450 3.10GHz CPU
Kingston Hyper X Genesis 4gb DDR3 X2
Nvidia GTX 480 Reference Card
Asus P8Z77-M Pro Mobo
Ultra X4 650w Modular PSU
Zenwalk Linux!


 Profile Send private message  
 
 Post subject: Re: shutdown / reboot seems slower than previous versions?
PostPosted: Tue Feb 01, 2011 4:16 pm 
Zenwalk Packager
Zenwalk Packager

Joined: Fri Mar 10, 2006 9:09 am
Posts: 2797
Location: Amsterdam
@HERO_01: did you try the rc.6 i 'url-ed'?

As far as i know, i'm the sole and only user of this script, and there's no way that it is 'going anywhere' without solid testing. ;D


 Profile Send private message  
 
 Post subject: Re: shutdown / reboot seems slower than previous versions?
PostPosted: Tue Feb 01, 2011 8:54 pm 
Experienced Zenwalker
Experienced Zenwalker
User avatar

Joined: Tue Jan 15, 2008 1:51 pm
Posts: 111
Location: Germany
I have been giving your modified rc.6 a try on my 7.0 install and so far the result seems to be a somewhat faster reboot process. Seems to be stable too. At least I don't see any smoke coming from my machine. ;D

Will watch out for any oddities that may arise in the future but so far it looks good.


 Profile Send private message  
 
 Post subject: Re: shutdown / reboot seems slower than previous versions?
PostPosted: Tue Feb 01, 2011 11:52 pm 
Senior Zenwalker
Senior Zenwalker

Joined: Thu Jun 12, 2008 12:30 pm
Posts: 448
Location: Chicago, IL, USA
I will test it on my desktop's 7.0b install later. This weekend, most likely. I downloaded it, but I don't want to mess with my laptop's shutdown scripts.

_________________
PC's specs:
Intel i5 3450 3.10GHz CPU
Kingston Hyper X Genesis 4gb DDR3 X2
Nvidia GTX 480 Reference Card
Asus P8Z77-M Pro Mobo
Ultra X4 650w Modular PSU
Zenwalk Linux!


 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next

All times are UTC


 Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
 
cron