Skip to content

Instantly share code, notes, and snippets.

@csirac2
Last active September 7, 2022 06:34
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save csirac2/cf4fb9b60a2874502f24 to your computer and use it in GitHub Desktop.
Save csirac2/cf4fb9b60a2874502f24 to your computer and use it in GitHub Desktop.
disable partman from debian preseed
# Thanks to http://ubuntuforums.org/showthread.php?t=1411273 for inspiration..
# But what a disgusting nasty hack! This prevents partman from running (and
# mounts /target, creates /target/etc/fstab). d-i just can't cope with
# installation to partitionless block device... which is disappointing,
# because partitions are pointless for pvlinux guests.
#
# The hack works by ... wait for it... spawning a little while/sleep 1 script,
# waits for the partman-base.postinst file to appear (the preseed/earl_command
# hook is too early, and the partman/early_command is too late). Once it
# appears we replace this with a bit more script which does what we wanted
# partman to do (or not do) all along.
#
# Okay, so perhaps we should just debootstrap... but preseeds are a bit more
# portable and I happened to have a lot of infra invested in preseed approach.
d-i preseed/early_command string echo 'while [ ! -f /var/lib/dpkg/info/partman-base.postinst ]; do sleep 1; done; cat /tmp/dis_pm > /var/lib/dpkg/info/partman-base.postinst' > /kill-partman.sh && \
echo "sh -c ' \
mkdir -p /target && \
modprobe btrfs && \
mount -t btrfs /dev/xvda /target && \
mkdir /target/etc && \
mount && \
echo \"/dev/xvda / btrfs noatime,nodiratime 0 1\" > /target/etc/fstab && \
echo \"/dev/xvdb none swap sw 0 0\" >> /target/etc/fstab' \
>/tmp/kill-partman-stage2.log 2>&1" > /tmp/dis_pm && \
sh /kill-partman.sh >/tmp/kill-partman.log 2>&1 &
@yarokifor
Copy link

I wish partman had support for partitionless disk. That would make this whole process so much easier, but thanks for your contribution!

@agoree407
Copy link

When I try using this code (on a 16.04 install), I'm running into an error:

"Installation step failed...the failing step is Partition Disks"

From the console I can see "Configuring 'partman-base' failed with error code 225"

How did you get passed this in your case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment