[Fai-commit] r5536 - in trunk: bin debian lib lib/setup-storage man
Michael Tautschnig
mt at alioth.debian.org
Fri Oct 16 11:35:28 UTC 2009
Author: mt
Date: 2009-10-16 11:35:28 +0000 (Fri, 16 Oct 2009)
New Revision: 5536
Added:
trunk/lib/fai-vol_id
Modified:
trunk/bin/setup-storage
trunk/debian/changelog
trunk/debian/fai-client.install
trunk/lib/setup-storage/Exec.pm
trunk/lib/setup-storage/Fstab.pm
trunk/lib/setup-storage/Parser.pm
trunk/lib/setup-storage/Sizes.pm
trunk/man/setup-storage.8
Log:
merged several setup-storage related patches from experimental tree
Modified: trunk/bin/setup-storage
===================================================================
--- trunk/bin/setup-storage 2009-10-16 11:29:11 UTC (rev 5535)
+++ trunk/bin/setup-storage 2009-10-16 11:35:28 UTC (rev 5536)
@@ -52,7 +52,7 @@
package FAI;
-my $version = "1.1";
+my $version = "1.1.1";
# command line parameter handling
use Getopt::Std;
@@ -192,11 +192,15 @@
$FAI::udev_settle = "udevadm settle --timeout=10" if (&FAI::in_path("udevadm"));
$FAI::udev_settle = "udevsettle --timeout=10" if (&FAI::in_path("udevsettle"));
defined($FAI::udev_settle) or die "Failed to find determine a proper way to tell udev to settle; is udev installed?";
-&FAI::execute_with_udevsettle($FAI::commands{$_}{cmd}) foreach (&numsort(keys %FAI::commands));
+foreach (&numsort(keys %FAI::commands)) {
+ `$FAI::udev_settle`;
+ next if ($FAI::commands{$_}{cmd} eq "true");
+ &FAI::execute_command($FAI::commands{$_}{cmd});
+}
# generate the proposed fstab contents
# wait for udev to set up all devices
-&FAI::execute_with_udevsettle("true");
+`$FAI::udev_settle`;
my @fstab = &FAI::generate_fstab(\%FAI::configs);
# print fstab
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2009-10-16 11:29:11 UTC (rev 5535)
+++ trunk/debian/changelog 2009-10-16 11:35:28 UTC (rev 5536)
@@ -83,11 +83,10 @@
* dhcpd.conf: change path of pxelinux.0
[ Michael Tautschnig ]
- * setup-storage/Parser.pm: Set the boot flag on partition mounted at /, if
- bootable is not explicitly set.
* setup-storage, setup-storage/Exec.pm: auto-detect a proper way to tell
- udev to settle (udevsettle is used in etch, udevadm settle for sid; thanks
- matrix.systems at matrix.msu.edu for a first patch). (closes: #530656)
+ udev to settle, hide udevsettle call (udevsettle is used in etch, udevadm
+ settle for sid; thanks matrix.systems at matrix.msu.edu for a first patch).
+ (closes: #530656)
* setup-storage/Volumes.pm: Updated mdadm --scan output parser to work with
current mdadm versions.
* setup-storage/Volumes.pm: Ignore another line of output from parted
@@ -95,9 +94,11 @@
* setup-storage, setup-storage/Sizes.pm: Properly handle -h, early check for
unset (but necessary) environment variables, print full device names in
several error/warning messages instead of the partition id only.
+ * fai-vol_id: New wrapper around udev's vol_id or blkid, whichever is
+ available
* setup-storage/Fstab.pm: Be more verbose if obtaining the UUID fails (may
be caused by earlier use in RAID array, tell the user how to solve the
- problem). Ignore exit code 3 of vol_id -l.
+ problem). Ignore exit code 3 of vol_id -l, use fai-vol_id wrapper.
* setup-storage/Parser.pm: RAID device parsing: $2 doesn't refer to the
original expression anymore, store earlier $2 as $opts; don't use options
sub-hash (thanks Andreas Schockenhoff for lots of testing and feedback).
@@ -113,7 +114,10 @@
* setup-storage/Volumes.pm: Fixed perl syntax error, properly handle
existing empty volume groups (thanks Brian Kroth and Cajus Pollmeier for
debugging this). (closes: #532321)
- * Bumped setup-storage version number to 1.1.
+ * man/setup-storage.8: Document possible problems with previous software
+ RAID partitions and missing bootable flags.
+ * setup-storage/Sizes.pm: Secondary GPT only requires 33 sectors.
+ * Bumped setup-storage version number to 1.1.1.
[ Holger Levsen ]
* update to standards version 3.8.2, no changes needed
Modified: trunk/debian/fai-client.install
===================================================================
--- trunk/debian/fai-client.install 2009-10-16 11:29:11 UTC (rev 5535)
+++ trunk/debian/fai-client.install 2009-10-16 11:35:28 UTC (rev 5536)
@@ -10,6 +10,7 @@
usr/lib/fai/prcopyleft
usr/lib/fai/get-config-dir*
usr/lib/fai/fai-divert
+usr/lib/fai/fai-vol_id
usr/bin/device2grub
usr/bin/fai-class
usr/bin/fai-debconf
Added: trunk/lib/fai-vol_id
===================================================================
--- trunk/lib/fai-vol_id (rev 0)
+++ trunk/lib/fai-vol_id 2009-10-16 11:35:28 UTC (rev 5536)
@@ -0,0 +1,48 @@
+#! /bin/bash
+
+# Copyright (c) 2009 by Michael Tautschnig <mt at debian.org>
+
+udev_vol_id="/lib/udev/vol_id"
+udev_blkid="/sbin/blkid"
+
+get_uuid() {
+ if [ -z $udev_vol_id ] ; then
+ $udev_blkid -s UUID -o value $1
+ exit $?
+ fi
+
+ /lib/udev/vol_id -u $1
+ exit $?
+}
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+get_label() {
+ if [ -z $udev_vol_id ] ; then
+ $udev_blkid -s LABEL -o value $1
+ exit $?
+ fi
+
+ /lib/udev/vol_id -l $1
+ exitcode=$?
+ if [ $exitcode -eq 0 -o $exitcode -eq 3 ] ; then
+ exitcode=0
+ fi
+ exit $exitcode
+}
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+# main program
+
+if [ ! -e $udev_vol_id ] ; then
+ udev_vol_id=""
+ if [ ! -e $udev_blkid ] ; then
+ "Neither udev vol_id nor blkid found!"
+ exit 1
+ fi
+fi
+
+while getopts ul opt ; do
+ case "$opt" in
+ u) shift ; get_uuid $1 ;;
+ l) shift ; get_label $1 ;;
+ esac
+done
Property changes on: trunk/lib/fai-vol_id
___________________________________________________________________
Added: svn:executable
+ *
Modified: trunk/lib/setup-storage/Exec.pm
===================================================================
--- trunk/lib/setup-storage/Exec.pm 2009-10-16 11:29:11 UTC (rev 5535)
+++ trunk/lib/setup-storage/Exec.pm 2009-10-16 11:35:28 UTC (rev 5536)
@@ -237,19 +237,6 @@
}
return "";
}
-################################################################################
-#
-# @brief Execute a command as in execute_command, but prefix it with udevsettle
-#
-# @return the identifier of the error
-#
-################################################################################
-sub execute_with_udevsettle {
- my ($command, $stdout, $stderr) = @_;
- defined ($FAI::udev_settle) or &FAI::internal_error("udev settle command not defined");
- return &execute_command("$FAI::udev_settle && $command", $stdout,
- $stderr);
-}
################################################################################
#
Modified: trunk/lib/setup-storage/Fstab.pm
===================================================================
--- trunk/lib/setup-storage/Fstab.pm 2009-10-16 11:29:11 UTC (rev 5535)
+++ trunk/lib/setup-storage/Fstab.pm 2009-10-16 11:35:28 UTC (rev 5536)
@@ -94,7 +94,7 @@
# or labels, use these if available
my @uuid = ();
&FAI::execute_ro_command(
- "/lib/udev/vol_id -u $device_name", \@uuid, 0);
+ "fai-vol_id -u $device_name", \@uuid, 0);
# every device must have a uuid, otherwise this is an error (unless we
# are testing only)
@@ -107,8 +107,7 @@
# ok here
my @label = ();
&FAI::execute_ro_command(
- "( /lib/udev/vol_id -l $device_name ; exc=\$? ; if [ \$exc -eq 3 ] ;" .
- " then exit 0 ; else exit \$exc ; fi )", \@label, 0);
+ "fai-vol_id -l $device_name", \@label, 0);
# using the fstabkey value the desired device entry is defined
if ($key_type eq "uuid") {
Modified: trunk/lib/setup-storage/Parser.pm
===================================================================
--- trunk/lib/setup-storage/Parser.pm 2009-10-16 11:29:11 UTC (rev 5535)
+++ trunk/lib/setup-storage/Parser.pm 2009-10-16 11:35:28 UTC (rev 5536)
@@ -529,12 +529,6 @@
} else {
$FAI::partition_pointer->{encrypt} = 0;
}
- if ($FAI::device =~ /^PHY_(.+)$/ &&
- -1 == $FAI::configs{$FAI::device}{bootable} &&
- $FAI::partition_pointer->{mountpoint} eq "/") {
- $FAI::configs{$FAI::device}{bootable} =
- $FAI::partition_pointer->{number};
- }
}
name: m{^([^/,\s\-]+)}
Modified: trunk/lib/setup-storage/Sizes.pm
===================================================================
--- trunk/lib/setup-storage/Sizes.pm 2009-10-16 11:29:11 UTC (rev 5535)
+++ trunk/lib/setup-storage/Sizes.pm 2009-10-16 11:35:28 UTC (rev 5536)
@@ -655,14 +655,14 @@
$current_disk->{sector_size};
} elsif ($FAI::configs{$config}{disklabel} eq "gpt") {
- # on GPT-EFI disk labels the first 34 and last 34 sectors must be left alone
+ # on GPT-EFI disk labels the first 34 and last 33 sectors must be left alone
$next_start = 34 * $current_disk->{sector_size};
# modify the disk to claim the space for the second partition table
- $current_disk->{end_byte} -= 34 * $current_disk->{sector_size};
+ $current_disk->{end_byte} -= 33 * $current_disk->{sector_size};
# the space required by the GPTs
- $min_req_total_space += 2 * 34 * $current_disk->{sector_size};
+ $min_req_total_space += (34 + 33) * $current_disk->{sector_size};
} elsif ($FAI::configs{$config}{disklabel} eq "gpt-bios") {
# on BIOS-style disk labels, the first partitions starts at head #1
@@ -675,10 +675,10 @@
# apparently parted insists in having some space left at the end too
# modify the disk to claim the space for the second partition table
- $current_disk->{end_byte} -= 34 * $current_disk->{sector_size};
+ $current_disk->{end_byte} -= 33 * $current_disk->{sector_size};
# the space required by the GPTs
- $min_req_total_space += 34 * $current_disk->{sector_size};
+ $min_req_total_space += 33 * $current_disk->{sector_size};
# on gpt-bios we'll need an additional partition to store what doesn't fit
# in the MBR
Modified: trunk/man/setup-storage.8
===================================================================
--- trunk/man/setup-storage.8 2009-10-16 11:29:11 UTC (rev 5535)
+++ trunk/man/setup-storage.8 2009-10-16 11:35:28 UTC (rev 5536)
@@ -416,6 +416,22 @@
.sp
.fi
.PP
+.SH CAVEATS
+.IP \(bu
+Partition UUID cannot be obtained: In case a partition was previously used as
+part of a software RAID volume and now is intended as swap space, udev fails
+when asked for a UUID. This happens because mkswap does not overwrite the
+previous RAID superblock. You can remove it using mdadm --zero-superblock
+<device>.
+.IP \(bu
+Machine does not boot because not partition is marked as bootable: If the
+bootable option is not specified, not partition will be marked as such. Modern
+BIOSes don't seem to require such markers anymore, but for some systems it may
+still be necessary. Previous versions of setup-storage by default marked the
+partition mounting / as bootable, but this is not a sane default for all cases.
+If you want to be sure not boot failures happen because of a missing bootable
+marker, explicitly set the bootable option. Of course, there are lots of other
+reasons why a system may fail to boot.
.SH SEE ALSO
This program is part of FAI (Fully Automatic Installation).
The FAI homepage is http://www.informatik.uni-koeln.de/fai.
More information about the Fai-commit
mailing list