[Pkg-sysvinit-devel] Bug#587950: initscripts: /etc/init.d/urandom fails because $PATH is wrong (doesnt include /usr/bin)

Jean-Luc Coulon (f5ibh) jean-luc.coulon at wanadoo.fr
Sat Jul 3 07:17:38 UTC 2010


Package: initscripts
Version: 2.88dsf-10
Severity: important

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

/et/init.d/urandom has a $PATH which doesnt include /usr/bin
but the find command (called without the full path) is in /usr/bin
So, the pool size value is not processed:

/etc/init.d/urandom: 1: find: not found

/etc/init.d/urandom: 76: find: not found
[: 76: Illegal number: 

Adding /usr/bin to $PATH fixes the problem (or maybe calling find with its
full path)

Regards

Jean-Luc

- -- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (900, 'unstable'), (700, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.34-k8-2 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages initscripts depends on:
ii  coreutils                     8.5-1      GNU core utilities
ii  debianutils                   3.3        Miscellaneous utilities specific t
ii  libc6                         2.11.2-2   Embedded GNU C Library: Shared lib
ii  lsb-base                      3.2-23.1   Linux Standard Base 3.2 init scrip
ii  mount                         2.17.2-3.1 Tools for mounting and manipulatin
ii  sysv-rc                       2.88dsf-10 System-V-like runlevel change mech
ii  sysvinit-utils                2.88dsf-10 System-V-like utilities

Versions of packages initscripts recommends:
ii  e2fsprogs                     1.41.12-2  ext2/ext3/ext4 file system utiliti
ii  psmisc                        22.11-1    utilities that use the proc file s

initscripts suggests no packages.

- -- Configuration Files:
/etc/default/bootlogd changed:
BOOTLOGD_ENABLE=Yes

/etc/init.d/urandom changed:
set -x
[ -c /dev/urandom ] || exit 0
PATH=/sbin:/bin:/usr/bin
SAVEDFILE=/var/lib/urandom/random-seed
POOLSIZE=512
[ -f /proc/sys/kernel/random/poolsize ] && POOLSIZE="$(cat /proc/sys/kernel/random/poolsize)"
.. /lib/init/vars.sh
.. /lib/lsb/init-functions
do_status () {
	if [ -f $SAVEDFILE ] ; then
		return 0
	else
		return 4
	fi
}
case "$1" in
  start|"")
	[ "$VERBOSE" = no ] || log_action_begin_msg "Initializing random number generator"
	# Load and then save $POOLSIZE bytes,
	# which is the size of the entropy pool
	if [ -f "$SAVEDFILE" ]
	then
		# Handle locally increased pool size
		SAVEDSIZE="$(find "$SAVEDFILE" -printf "%s")"
		if [ "$SAVEDSIZE" -gt "$POOLSIZE" ]
		then
			[ -w /proc/sys/kernel/random/poolsize ] && echo $POOLSIZE > /proc/sys/kernel/random/poolsize
			POOLSIZE=$SAVEDSIZE
		fi
		cat "$SAVEDFILE" >/dev/urandom
	fi
	rm -f $SAVEDFILE
	# Hm, why is the saved pool re-created at boot? [pere 2009-09-03]
	umask 077
	dd if=/dev/urandom of=$SAVEDFILE bs=$POOLSIZE count=1 >/dev/null 2>&1
	ES=$?
	umask 022
	[ "$VERBOSE" = no ] || log_action_end_msg $ES
	;;
  stop)
	# Carry a random seed from shut-down to start-up;
	# see documentation in linux/drivers/char/random.c
	[ "$VERBOSE" = no ] || log_action_begin_msg "Saving random seed"
	umask 077
	dd if=/dev/urandom of=$SAVEDFILE bs=$POOLSIZE count=1 >/dev/null 2>&1
	ES=$?
	[ "$VERBOSE" = no ] || log_action_end_msg $ES
	;;
  status)
	do_status
	exit $?
	;;
  restart|reload|force-reload)
	echo "Error: argument '$1' not supported" >&2
	exit 3
	;;
  *)
	echo "Usage: urandom start|stop" >&2
	exit 3
	;;
esac
:


- -- no debconf information

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iD8DBQFMLuQOUdGGXzzGnNARAsLDAKCBXU+yggdHgFGBsZICbPZ1oj4cPwCaAsdM
+uaoQuIf/QbMQ/m3/TyIuTw=
=LMCg
-----END PGP SIGNATURE-----







More information about the Pkg-sysvinit-devel mailing list