Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 288272

Summary: sys-fs/cryptsetup init script should use mkswap -f
Product: Gentoo Linux Reporter: Tim Weber <scy-bugs-gentoo>
Component: New packagesAssignee: Gentoo Linux bug wranglers <bug-wranglers>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Tim Weber 2009-10-09 09:21:03 UTC
mkswap lives in sys-apps/util-linux. From util-linux>=2.15.1 on, mkswap will issue a warning when the parameter is a “whole disk”:

  mkswap: /dev/mapper/swap: warning: don't erase bootbits sectors
          on whole disk. Use -f to force.

This issue is mainly cosmetic: swap areas don’t use the first block on the disk or partition they’re on. Nevertheless, to keep people and bootloaders from trying to boot a swap partition, mkswap usually deletes the first block (or “clears” or “zaps” it, since you can’t delete blocks), but only if there is no disk label or partition table or the like on it.

However, if the parameter is not a partition, but a whole disk, mkswap issues the warning above. Since a dmcrypt volume apparently is handled like being a whole disk, the warning occurs there as well.

/lib/rcscripts/addons/dm-crypt-start.sh should use “mkswap -f” to create swap volumes. Currently, line 34 says:

   : ${pre_mount:='mkswap ${dev}'}

Insert a -f there, and everything should be fine.

Oh, and while you’re at it: Please show some love for bug #257556 as well. It’s a small patch that will make multi-dmcrypt-volumes users happy.

Workaround for users: Add

   pre_mount='mkswap -f ${dev}'

after the “source” line of your swap definition in /etc/conf.d/dmcrypt.
Comment 1 Tim Weber 2009-10-09 09:24:16 UTC
Sorry, duplicate because of a Big Red Bugzilla Warning when sending mails which led me to believe the bug was not filed.

*** This bug has been marked as a duplicate of bug 288270 ***
Comment 2 Sebastian Luther (few) 2009-10-09 09:31:23 UTC
(In reply to comment #1)
> Sorry, duplicate because of a Big Red Bugzilla Warning when sending mails which
> led me to believe the bug was not filed.
> 
> *** This bug has been marked as a duplicate of bug 288270 ***
> 

Just a test to see this error message...