initscripts-8.45.3-1 At each boot-up of a system with an encrypted swap partition, /etc/rc.d/rc.sysinit runs cryptsetup and then mkswap. If the partition numbers change on a system with encrypted swap but /etc/crypttab is not updated then this mkswap could be executed on the wrong partition at the next boot up. It is not difficult to imagine such a mistake being made, especially on a machine with more than one installed OS. This danger may be avoided by a change to rc.sysinit: # rcsdiff -u /etc/rc.d/rc.sysinit =================================================================== RCS file: /etc/rc.d/RCS/rc.sysinit,v retrieving revision 1.1 diff -u -r1.1 /etc/rc.d/rc.sysinit --- /etc/rc.d/rc.sysinit 2006/12/22 14:44:56 1.1 +++ /etc/rc.d/rc.sysinit 2006/12/23 07:50:25 @@ -174,7 +174,16 @@ 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 + else + echo $"$dst: $src does not appear to be swap, skipping" + echo $"(for safety, need to 'mkswap $src' before encrypting)" + skip="yes" + fi ;; tmp) mke2fs=yes This works because /etc/rc.d/init.d/halt does a mkswap on the unencrypted device at shutdown. (That mkswap seems to be safe: it is run only on devices that were already being used for encrypted swap.) Attached: crypttab.5.patch to update the man page contained in /usr/share/man/man5/crypttab.5.gz An analogous change to make the use of 'tmp' partitions safer (see the crypttab man page) might also be possible but would obviously require a different approach. There are two disadvantages to this fix: (1) After an abnormal shutdown, a manual mkswap will be needed; in the worst case, a power failure could leave many PCs needing a mkswap. - However, reducing the risk of irrecoverable data loss should be worth occasional inconvenience. Moreover, encrypted swap is more likely to be used on an individual basis, particularly for laptops. (2) A mistake with the manual mkswap needed after an unclean shutdown could also clobber a filesystem. - However, one knows to be careful with an explicit 'mkswap'; in an automatically-invoked script, the same command deserves every possible precaution. There is one problem related to this fix: currently, swapon is called in rc.sysinit with the '-e' option (why?) and so Enabling /etc/fstab swaps: [ OK ] will appear at boot even if init_crypto() failed to create the encrypted swap device - and the "need to 'mkswap ..." message above appears only on a non-graphical boot (which I use); with the rhgb boot option none of the messages within init_crypto() appear (except where terminals are switched in order to enter a passphrase). This is a more general issue and someone else might prefer to decide how it should be addressed. As a start, I think the lines if [ -f /etc/crypttab ]; then s=$"Starting disk encryption using the RNG:" echo "$s" init_crypto 1 && success "$s" || failure "$s" echo fi should probably be changed to: if [ -f /etc/crypttab ]; then action $"Starting disk encryption using the RNG: " init_crypto 1 fi
Created attachment 144367 [details] patch for crypttab man page (in /usr/share/man/man5/crypttab.5.gz)
This problem still exists in F7 and development. I suggest that the original bug submitter change the version to "devel" so that this issue isn't lost as development continues.
Based on the date this bug was created, it appears to have been reported against rawhide during the development of a Fedora release that is no longer maintained. In order to refocus our efforts as a project we are flagging all of the open bugs for releases which are no longer maintained. If this bug remains in NEEDINFO thirty (30) days from now, we will automatically close it. If you can reproduce this bug in a maintained Fedora version (7, 8, or rawhide), please change this bug to the respective version and change the status to ASSIGNED. (If you're unable to change the bug's version or status, add a comment to the bug and someone will change it for you.) Thanks for your help, and we apologize again that we haven't handled these issues to this point. The process we're following is outlined here: http://fedoraproject.org/wiki/BugZappers/F9CleanUp We will be following the process here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping to ensure this doesn't happen again.
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
This message is a reminder that Fedora 8 is nearing its end of life. Approximately 30 (thirty) days from now Fedora will stop maintaining and issuing updates for Fedora 8. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as WONTFIX if it remains open with a Fedora 'version' of '8'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version prior to Fedora 8's end of life. Bug Reporter: Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 8 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora please change the 'version' of this bug to the applicable version. If you are unable to change the version, please add a comment here and someone will do it for you. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. The process we are following is described here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping
This message is a reminder that Fedora 10 is nearing its end of life. Approximately 30 (thirty) days from now Fedora will stop maintaining and issuing updates for Fedora 10. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as WONTFIX if it remains open with a Fedora 'version' of '10'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version prior to Fedora 10's end of life. Bug Reporter: Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 10 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora please change the 'version' of this bug to the applicable version. If you are unable to change the version, please add a comment here and someone will do it for you. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. The process we are following is described here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping
This message is a reminder that Fedora 12 is nearing its end of life. Approximately 30 (thirty) days from now Fedora will stop maintaining and issuing updates for Fedora 12. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as WONTFIX if it remains open with a Fedora 'version' of '12'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version prior to Fedora 12's end of life. Bug Reporter: Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 12 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora please change the 'version' of this bug to the applicable version. If you are unable to change the version, please add a comment here and someone will do it for you. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. The process we are following is described here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Fedora 12 changed to end-of-life (EOL) status on 2010-12-02. Fedora 12 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. Thank you for reporting this bug and we are sorry it could not be fixed.