[Bug 220769] Encrypted swap: rc.sysinit mkswap may clobber a filesystem

bugzilla at redhat.com bugzilla at redhat.com
Fri Apr 4 06:55:30 UTC 2008


Please do not reply directly to this email. All additional
comments should be made in the comments box of this bug report.

Summary: Encrypted swap: rc.sysinit mkswap may clobber a filesystem


https://bugzilla.redhat.com/show_bug.cgi?id=220769


bugzilla at mbreen.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Status Whiteboard| bzcl34nup                  |bzcl34nup




------- Additional Comments From bugzilla at mbreen.com  2008-04-04 02:55 EST -------
This is still relevant. Here's what I did for F8 (note that I don't use a 
graphical boot up, I'm not sure if other changes are required):

$ rcsdiff -u -r1.1 -r1.2 /etc/rc.d/rc.sysinit
===================================================================
RCS file: /etc/rc.d/RCS/rc.sysinit,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /etc/rc.d/rc.sysinit        2008/01/15 12:29:57     1.1
+++ /etc/rc.d/rc.sysinit        2008/01/15 12:55:14     1.2
@@ -179,7 +179,39 @@
                params="$params -y"
            ;;
            swap)
-               makeswap=yes
+               # If the partition numbers have changed without /etc/crypttab
+               # being updated then 'mkswap' runs the risk of clobbering a
+               # filesystem.
+               if blkid -t TYPE="swap" $src >/dev/null; then
+                   makeswap=yes
+               elif blkid $src >/dev/null; then
+                   echo $"$dst: $src does not appear to be swap, skipping"
+                   echo $"(for safety, need to 'mkswap $src' before 
encrypting)"
+                   skip="yes"
+               else
+                   if [ -x /usr/bin/rhgb-client ] && \
+                       /usr/bin/rhgb-client --ping ; then
+                       chvt 1
+                   fi
+                   echo -n $"$dst: $src does not appear to be swap. "
+                   echo -n $"Is it safe to overwrite the contents of "
+                   echo -n $"$src and use it for swap (y/N)? "
+                   read makeswap <&1
+                   case "$makeswap" in
+                       y|Y|yes|Yes|YES)
+                           makeswap=yes
+                           ;;
+                       *)
+                           echo $"$dst: skipping"
+                           skip="yes"
+                           makeswap=""
+                           ;;
+                   esac
+                   if [ -x /usr/bin/rhgb-client ] && \
+                       /usr/bin/rhgb-client --ping ; then
+                       chvt 8
+                   fi
+               fi
                ;;
            tmp)
                mke2fs=yes


-- 
Configure bugmail: https://bugzilla.redhat.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




More information about the fedora-triage-list mailing list