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

Bug#740271: d-i fails to purge LVM despite preseeding



Hi,


I  recently  stumbled  across  the very same bug while setting up an automated
installation environment.   So far my solution or rather workaround looks like
this:

> # this will DESTROY any VGs and PVs found
> d-i partman/early_command string sh -c 'set -- $(vgs --rows --noheadings | head -n 1); for vg in "$@"; do vgremove -f "$vg"; done; set -- $(pvs --rows --noheadings | head -n 1); for pv in "$@"; do pvremove -f "$pv"; done'

It might not be perfect but will destroy/wipe any recognized volume groups and
physical  volumes.   In contrast to simply 'dd if=/dev/zero'ing the disc it is
much  faster,  but will only solve the LVM specific problem.   E.g.   md-RAIDs
might  still exist.   I'm not sure if d-i will also choke itself in this case,
but it's not topic of this bug.

The expanded and pretty formatted code looks like this [1]:

> d-i partman/early_command string sh -c '
> 	set -- $(vgs --rows --noheadings | head -n 1);
> 	for vg in "$@"; do
> 		vgremove -f "$vg";
> 	done;
> 	
> 	set -- $(pvs --rows --noheadings | head -n 1);
> 	for pv in "$@"; do
> 		pvremove -f "$pv";
> 	done
> '

It  will  obviously  choke on VGs or PVs that contain a whitespace [2],  but I
think  such  a identifier would be invalid as well.   As I stated above,  it's
just a workaround; a proper fix should be done inside d-i.


Cheers,

	Julius



[1] d-i  seems  not to like escaped newlines (\<CR>) in the preseed.cfg in any
    cases, hence the first one is one-line
[2] "set -- $(echo 'a b' c)"   would   create   three  arguments,  thus  three
    invocations of the in-loop code


Reply to: