Monday, March 18, 2019

fix vmware converter disk fubar with kali

 I decided to used VMWare Converter to convert a live Kali system to a VMWare VM. No joy.  
   
 My environment:  
   
 [system-to-convert]  
 # uname -a  
 # Linux kali2 4.14.0-kali3-amd64 #1 SMP Debian 4.14.12-2kali1 (2018-01-08) x86_64 GNU/Linux  
 # less /etc/lsb-releases  
   
  DISTRIB_ID=Kali  
  DISTRIB_RELEASE=kali-rolling  
  DISTRIB_CODENAME=kali-rolling  
  DISTRIB_DESCRIPTION="Kali GNU/Linux Rolling"  
   
 [vmware vcenter converter standalone]  
 rev 6.2.0 build-8466193   
   
   
 After running a couple conversions, I consistently failure at 97% of the process completed, 
 and this error:  
   
  FAILED: An error occurred during the conversion: 'GrubInstaller::InstallGrub:   
  /usr/lib/vmware-converter/installGrub.sh failed with return code: 127, and message:   
  FATAL: kernel too old Error running vmware-updateGrub.sh through chroot into /mnt/p2v-src-root Command:  
  chroot "/mnt/p2v-src-root" /vmware-updateGrub.sh "GRUB2" "(hd0)" "(hd0,1)" /vmware-device.map 
  "grub2-install" '  
   
   
 This means the grub2-install portion of the conversion was having difficulty running.   
 Apparently the Kali system is using lv groups for its various disk partitions and   
 not a simpler /dev/sda1 &c. structure.  
   
 To repair the process I booted off of a Kali LiveCD (really any modern Ubuntu ISO would've 
 done the trick, too):  
   
 # apt-get install lvm2  
 # vgchange -a y  
 # lvscan  
   
  ACTIVE      '/dev/kali2-vg/root' [510.64 GiB] inherit  
  ACTIVE      '/dev/kali2-vg/swap_1' [47.99 GiB] inherit  
    
 # mount /dev/kali2-vg/root /mnt  
   
 # cat /mnt/etc/fstab  
   
  # /boot was on /dev/sda1 during installation  
  /dev/sda1 /boot      ext2  defaults    0    2  
  #UUID=c7c0cf46-3c64-4ceb-92d8-69d3906ab399 /boot      ext2  defaults    0    2  
   
  /dev/mapper/kali2--vg-root /        ext4  errors=remount-ro 0    1  
  /dev/mapper/kali2--vg-swap_1 none      swap  sw       0    0  
  /dev/sr0    /media/cdrom0  udf,iso9660 user,noauto   0    0  
   
 # mount /dev/sda1/boot /mnt/boot  
 # mount --bind /dev /mnt/dev  
 # mount --bind /proc /mnt/proc  
 # mount --bind /sys /mnt/sys  
 # chroot /mnt  
   
 # apt-get remove --purge grub-pc grub-common  
 # apt-get install grub-pc  
 # grub-mkconfig  
 # update-grub  
 # grub-install /dev/sda  
   
 # exit  
 # umount /mnt/sys  
 # sudo umount /mnt/dev  
 # sudo umount /mnt/proc  
 # sudo umount /mnt/boot  
 # sudo umount /mnt  

No comments: