The original patch I have submitted works as expected by overriding the hostname but ...
I noticed after more testing that if LVM is used partman rely on "/etc/hostname" to name the VG[1] for instance : <hostname>--vg-root.
Unfortunately, the current patch does the hostname overriden after that the Volume Group is created which make the vg name and hostname inconsistent.
The re-work of the patch will consist on making sure the hostname override happens before the vgcreate to keep things consistent and not having a vg group that display the hostname before it has been overriden.
[1] - lib/auto-lvm.sh
278 auto_lvm_perform() {
279 # Use hostname as default vg name (if available)
280 local defvgname pv vg_file vg_name
281 # $pv_devices will be overridden with content from $VG_MAP_DIR
282 local pv_devices
283
284 db_get partman-auto-lvm/new_vg_name
285 if [ -z "$RET" ]; then
286 if [ -s /etc/hostname ]; then
287 defvgname=$(cat /etc/hostname | head -n 1 | tr -d " ")
288 fi
289 if [ "$defvgname" ]; then
290 db_set partman-auto-lvm/new_vg_name $defvgname-vg
291 else
292 db_set partman-auto-lvm/new_vg_name Ubuntu
293 fi
294 fi
Additional note about the re-work.
The original patch I have submitted works as expected by overriding the hostname but ...
I noticed after more testing that if LVM is used partman rely on "/etc/hostname" to name the VG[1] for instance : <hostname> --vg-root.
Unfortunately, the current patch does the hostname overriden after that the Volume Group is created which make the vg name and hostname inconsistent.
The re-work of the patch will consist on making sure the hostname override happens before the vgcreate to keep things consistent and not having a vg group that display the hostname before it has been overriden.
[1] - lib/auto-lvm.sh auto-lvm/ new_vg_ name auto-lvm/ new_vg_ name $defvgname-vg auto-lvm/ new_vg_ name Ubuntu
278 auto_lvm_perform() {
279 # Use hostname as default vg name (if available)
280 local defvgname pv vg_file vg_name
281 # $pv_devices will be overridden with content from $VG_MAP_DIR
282 local pv_devices
283
284 db_get partman-
285 if [ -z "$RET" ]; then
286 if [ -s /etc/hostname ]; then
287 defvgname=$(cat /etc/hostname | head -n 1 | tr -d " ")
288 fi
289 if [ "$defvgname" ]; then
290 db_set partman-
291 else
292 db_set partman-
293 fi
294 fi