[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#283303: Analysis and possible workaround



Hello,

I am pretty sure that the problem lies with the call to the CREATE_FILE_SYSTEM function of parted_server in commit.d/format_swap of partman-basicfilesystems. Before running partman I've inserted some extra statements into this script so that it looks like this:

--modified part of /lib/partman/commit.d/45format_swap----------------------
echo "before: device=${dev} id=${id}" > /partman.log
/sbin/parted /dev/discs/disc1/disc print >> /partman.log 2>&1
open_dialog CREATE_FILE_SYSTEM $id linux-swap
read_line status
close_dialog
sync
echo " after: status=${status}" >> /partman.log 2>&1
/sbin/parted /dev/discs/disc1/disc print >> /partman.log 2>&1
----------------------------------------------------------------------------

After that I used partman to create two partitions on /dev/sdb, one 256 MB for swap and the rest (1.9 GB) for home. Initially disk had a freshly created disklabel, so all the space was shown as FREE. After the changes were committed, the file /partman.log contents read:

--debugging output in /partman.log------------------------------------------
before: device=/var/lib/partman/devices/=dev=scsi=host0=bus0=target1=lun0=disc id=0-255221759
Disk geometry for /dev/scsi/host0/bus0/target1/lun0/disc: 0.000-2063.830 megabytes
Disk label type: sun
Minor    Start       End     Filesystem  Flags
1          0.000    243.398
2        243.398   2062.801  ext3
 after: status=OK
Disk geometry for /dev/scsi/host0/bus0/target1/lun0/disc: 0.000-2063.830 megabytes
Disk label type: loop
Minor    Start       End     Filesystem  Flags
1          0.000   2063.830  linux-swap
----------------------------------------------------------------------------

So, even though CREATE_FILE_SYSTEM call to parted_server returns status OK, it really screws the partition table up. The relevant pieces of log from /var/log/partman are (some blank lines removed):

--output in /var/log/partman------------------------------------------------
parted_server: Closing infifo and outfifo
parted_server: main_loop: iteration 100
parted_server: Opening infifo
/lib/partman/commit.d/45format_swap: IN: CREATE_FILE_SYSTEM =dev=scsi=host0=bus0=target1=lun0=disc 0-255221759 linux-swap
parted_server: Read command: CREATE_FILE_SYSTEM
parted_server: Note =dev=scsi=host0=bus0=target1=lun0=disc as changed
parted_server: Opening outfifo
parted_server: command_create_file_system(0-255221759,linux-swap)
parted_server: partition_with_id(0-255221759)
parted_server: OUT: Timer
parted_server: OUT: 0 (null)
/lib/partman/commit.d/45format_swap: error_handler: exception with type Timer
parted_server: OUT: ready
parted_server: OUT: OK
parted_server: OUT: OK
parted_server: Closing infifo and outfifo
----------------------------------------------------------------------------

This also does not look too good. Hopefully, someone with more experience in parted_server and/or libparted can put this information to good use. To tell the truth, I do not quite understand, why parted_server is used for formatting swap partitions when there is the mkswap utility available in d-i. There is even a piece of (questionable) logic in format_swap, which calls mkswap if the CREATE_FILE_SYSTEM call fails! I have tried to implement a simple workaround by completely removing the CREATE_FILE_SYSTEM call and using mkswap instead, patch follows:

--cut here----------------------------------------------------------------
diff -aur partman-basicfilesystems-36_orig/commit.d/format_swap partman-basicfilesystems-36/commit.d/format_swap
--- partman-basicfilesystems-36_orig/commit.d/format_swap	2004-09-24 03:30:32.000000000 -0400
+++ partman-basicfilesystems-36/commit.d/format_swap	2004-12-11 02:08:01.000000000 -0500
@@ -32,24 +32,19 @@
 	    db_subst $template PARTITION "$num"
 	    db_subst $template DEVICE $(humandev $(cat device))
 	    name_progress_bar $template
-	    open_dialog CREATE_FILE_SYSTEM $id linux-swap
-	    read_line status
-	    close_dialog
-	    sync
-	    if [ "$status" != OK ]; then
-		db_progress START 0 3 partman/text/formatting
-		db_progress INFO $template
-		db_progress SET 1
-		if
-		    mkswap $device >/dev/null 2>>/var/log/messages
-		then
-		    sync
-		    status=OK
-		else
-		    status=failed
-		fi
-		db_progress STOP
+
+	    db_progress START 0 3 partman/text/formatting
+	    db_progress INFO $template
+	    db_progress SET 1
+	    if
+		mkswap $device >/dev/null 2>>/var/log/messages
+	    then
+		sync
+		status=OK
+	    else
+		status=failed
 	    fi
+	    db_progress STOP

 	    if [ "$status" != OK ]; then
 		db_subst partman-basicfilesystems/create_swap_failed TYPE linux-swap
--cut here------------------------------------------------------------------

With this patch applied everything seems to work as expected, after formatting parted displays correct partition information:

--output of parted /dev/discs/disc1/disc print------------------------------ Disk geometry for /dev/scsi/host0/bus0/target1/lun0/disc: 0.000-2063.830 megabytes
Disk label type: sun
Minor    Start       End     Filesystem  Flags
1 0.000 243.398 linux-swap 2 243.398 2062.801 ext3 ----------------------------------------------------------------------------

Best regards,

Jurij Smakov                                        jurij@wooyd.org
Key: http://www.wooyd.org/pgpkey/                   KeyID: C99E03CC



Reply to: