automated installations (2)

I signed up for the debian-boot mailinglist and asked my question. No answer yet.
In a futile attempt to find more answers I tried google and found the Partman Recipe Calculator (PRC). It doesn't work out of the box for python 2.3.5 but if you change line 114 from

pie = gdchart.Pie()

to

pie = gdchart.Pie3D()


It will work nicely.
Since my recipe generated a nice piechart without any funny complications, I can only assume that my recipe is correct. This also implies that there is a bug in partman-auto...

Since I'm dumb enough to try and find this bug, here is my progress so far:

I believed (falsely) that partman-auto only used (ba)sh to create the partitions and speculated that it was using some type of kernel interface to create them.
After closer inspection, it seems that partman-auto makes use of the partman udeb. This last udeb has a "parted_server" daemon written in C, that seems to take of care of most of the lowlevel stuff.

I tracked the code as follows:

There exists a function add_primary_partition() which gets called by command_new_partition() if the first passed word is "primary". command_new_partition() is called by main_loop() when it receives a "NEW_PARTITION" command. Since "NEW_PARTITION" is nowhere else in the Partman udeb, I looked inside Partman-auto and found that it gets used in the "perform_recipe" script.

This last script has 4 references to "NEW_PARTITION":

106: open_dialog NEW_PARTITION primary $4 $free_space beginning ${1}000001
125: open_dialog NEW_PARTITION primary $4 $free_space end ${1}000001
180: open_dialog NEW_PARTITION $type $4 $free_space full ${1}000001
182: open_dialog NEW_PARTITION $type $4 $free_space beginning ${1}000001


The first 2 make a call with the "primary" argument hardcoded. So I assume they are not what I should look at. The interesting lines are 180 and 182.

The "$type" variable is set as follows:

case "$free_type" in
primary|logical)
type="$free_type"
;;
pri/log)
type=logical
;;
unusable)
db_progress STOP
autopartitioning_failed
;;
esac


...
After looking for the answer long and hard, I've come to the conclusion that I'm on the outer edge of Debian knowledge. This means noone seems to know the answer, or noone wants to answer me. I prefer to believe the former because that makes noone an asshole.

Partman-auto as it is, might do well for Debian installations aimed at newbies, but it sucks when you have to use it with preseed. I've tried about every recipe I think could work. In the end I even tried creating a 4th partition with the idea that I could delete it afterwards. No such luck.

While I was looking around in the booted debian installer during the failed installation, I noticed that sfdisk is installed.
I might drop the entire partman thing and just create partitions myself with sfdisk and some wrapper.
With sfdisk you just say:

(echo ",2048,82"; echo ",64,83"; echo ",,83") | sfdisk -uM /dev/discs/disc0/disc


Where ",2048,82" denotes: 2048 MB type 82 (swap), ",64,83": 64MB type 83 (ext2) and ",,83": the rest type 83 (ext2)
(In case you are wondering, -uM means: interpret sizes as MB)

So, all I need now is a handy way to get the amount of RAM and I'm set :)
And seeing as the "free" command exists, I can't see further obstacles!