Skip to contentSkip to conversation

initscripts/urandom: change random-seed directory

PATCH In review Ming Liu 2 participants 3 messages Nov 30, 2012 – Dec 4, 2012

lore
Share & tools
lore

Ming Liu

author
#0 lore raw

PATCH 1/1 initscripts/urandom: change random-seed directory

/etc/init.d/urandom fails to start/stop because it tries to save random-seed into /var/lib/urandom folder which does not exist in the file system.

Fixed by using /var/lib/misc instead of /var/lib/urandom.

---
 meta/recipes-core/initscripts/initscripts-1.0/urandom | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
meta/recipes-core/initscripts/initscripts-1.0/urandom +6 -5
index eb3a7c3..1cf7c5c 100755
@@ -14,18 +14,19 @@
 test -c /dev/urandom || exit 0
 . /etc/default/rcS
 
+SAVEDFILE=/var/lib/misc/random-seed
 case "$1" in
 	start|"")
 		test "$VERBOSE" != no && echo "Initializing random number generator..."
 		# Load and then save 512 bytes,
 		# which is the size of the entropy pool
-		if test -f /var/lib/urandom/random-seed
+		if test -f $SAVEDFILE
 		then
-			cat /var/lib/urandom/random-seed >/dev/urandom
+			cat $SAVEDFILE >/dev/urandom
 		fi
-		rm -f /var/lib/urandom/random-seed
+		rm -f $SAVEDFILE
 		umask 077
-		dd if=/dev/urandom of=/var/lib/urandom/random-seed count=1 \
+		dd if=/dev/urandom of=$SAVEDFILE count=1 \
 			>/dev/null 2>&1 || echo "urandom start: failed."
 		umask 022
 		;;
@@ -34,7 +35,7 @@ case "$1" in
 		# see documentation in linux/drivers/char/random.c
 		test "$VERBOSE" != no && echo "Saving random seed..."
 		umask 077
-		dd if=/dev/urandom of=/var/lib/urandom/random-seed count=1 \
+		dd if=/dev/urandom of=$SAVEDFILE count=1 \
 			>/dev/null 2>&1 || echo "urandom stop: failed."
 		;;
 	*)
Signature · 1 line
1.7.11
#1 lore raw
Quoted 4 lines · Ming Liu

/etc/init.d/urandom fails to start/stop because it tries to save random-seed into /var/lib/urandom folder which does not exist in the file system.

Why not create it in the recipe's do_install? Or possibly add it to volatiles file.

Also talk with Qi Chen about the readonly FS stuff to make sure this will work.

Sau!

Quoted 45 lines

Fixed by using /var/lib/misc instead of /var/lib/urandom.

---
  meta/recipes-core/initscripts/initscripts-1.0/urandom | 11 ++++++-----
  1 file changed, 6 insertions(+), 5 deletions(-)
meta/recipes-core/initscripts/initscripts-1.0/urandom +6 -5
index eb3a7c3..1cf7c5c 100755
@@ -14,18 +14,19 @@
  test -c /dev/urandom || exit 0
  . /etc/default/rcS
 
+SAVEDFILE=/var/lib/misc/random-seed
  case "$1" in
  	start|"")
  		test "$VERBOSE" != no && echo "Initializing random number generator..."
  		# Load and then save 512 bytes,
  		# which is the size of the entropy pool
-		if test -f /var/lib/urandom/random-seed
+		if test -f $SAVEDFILE
  		then
-			cat /var/lib/urandom/random-seed >/dev/urandom
+			cat $SAVEDFILE >/dev/urandom
  		fi
-		rm -f /var/lib/urandom/random-seed
+		rm -f $SAVEDFILE
  		umask 077
-		dd if=/dev/urandom of=/var/lib/urandom/random-seed count=1 \
+		dd if=/dev/urandom of=$SAVEDFILE count=1 \
  			>/dev/null 2>&1 || echo "urandom start: failed."
  		umask 022
  		;;
@@ -34,7 +35,7 @@ case "$1" in
  		# see documentation in linux/drivers/char/random.c
  		test "$VERBOSE" != no && echo "Saving random seed..."
  		umask 077
-		dd if=/dev/urandom of=/var/lib/urandom/random-seed count=1 \
+		dd if=/dev/urandom of=$SAVEDFILE count=1 \
  			>/dev/null 2>&1 || echo "urandom stop: failed."
  		;;
  	*)
author
#2 lore raw
Quoted 6 lines · Saul Wold
Quoted 4 lines · Ming Liu

/etc/init.d/urandom fails to start/stop because it tries to save random-seed into /var/lib/urandom folder which does not exist in the file system.

Why not create it in the recipe's do_install? Or possibly add it to volatiles file.

OK, It may be a more reasonable solution creating it in do_install, I will send the V1 patch.

Quoted 3 lines

Also talk with Qi Chen about the readonly FS stuff to make sure this will work.

OK, I will talk to Qi.

Quoted 50 lines

Sau!

Quoted 46 lines

Fixed by using /var/lib/misc instead of /var/lib/urandom.

---
  meta/recipes-core/initscripts/initscripts-1.0/urandom | 11 ++++++-----
  1 file changed, 6 insertions(+), 5 deletions(-)
meta/recipes-core/initscripts/initscripts-1.0/urandom +1 -0
index eb3a7c3..1cf7c5c 100755
@@ -14,18 +14,19 @@
  test -c /dev/urandom || exit 0
  . /etc/default/rcS
 
+SAVEDFILE=/var/lib/misc/random-seed
  case "$1" in
      start|"")
          test "$VERBOSE" != no && echo "Initializing random number 

generator..."
# Load and then save 512 bytes,
# which is the size of the entropy pool

meta/recipes-core/initscripts/initscripts-1.0/urandom +5 -5
-        if test -f /var/lib/urandom/random-seed
+        if test -f $SAVEDFILE
          then
-            cat /var/lib/urandom/random-seed >/dev/urandom
+            cat $SAVEDFILE >/dev/urandom
          fi
-        rm -f /var/lib/urandom/random-seed
+        rm -f $SAVEDFILE
          umask 077
-        dd if=/dev/urandom of=/var/lib/urandom/random-seed count=1 \
+        dd if=/dev/urandom of=$SAVEDFILE count=1 \
              >/dev/null 2>&1 || echo "urandom start: failed."
          umask 022
          ;;
@@ -34,7 +35,7 @@ case "$1" in
          # see documentation in linux/drivers/char/random.c
          test "$VERBOSE" != no && echo "Saving random seed..."
          umask 077
-        dd if=/dev/urandom of=/var/lib/urandom/random-seed count=1 \
+        dd if=/dev/urandom of=$SAVEDFILE count=1 \
              >/dev/null 2>&1 || echo "urandom stop: failed."
          ;;
      *)