Converting VirtualBox VM to FreeNAS 11 VM

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Anything interesting when you enter these into your EFI shell?
Code:
fs0:
dir
 

bignellrp

Dabbler
Joined
Mar 12, 2020
Messages
18
Screenshot 2020-03-16 at 13.35.43.png
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
There is no EFI partition on that disk image so you cannot boot it. Install Ubuntu with EFI boot ...
Or try what I outlined above - add a second disk with rEFInd on it.
 

bignellrp

Dabbler
Joined
Mar 12, 2020
Messages
18
Thanks. That worked.

Just in case this helps anyone else with this issue here are the steps i followed;

  • Follow steps from this guide to create the raw file of your VM.
  • Create the zvol slightly larger that the raw image.
  • DD the raw into the zvol.
  • Create a VM with the zvol as the disk and Ubuntu Desktop live cd as the cdrom.
  • Boot into Ubuntu Desktop
  • Open a search and type "disks" or you can open a terminal and use gparted instead.
  • Create a 200Mb fat32 partition and label it boot. Luckily ubuntu leaves some free space by default at the end to save you having to resize the other data partition.
  • I deleted my other Grub boot partition from the start although i think the next step would have done this for me.
  • Install boot-repair
  • sudo add-apt-repository ppa:yannubuntu/boot-repair
  • sudo apt-get update
  • sudo apt-get install -y boot-repair && boot-repair
  • Click advanced and check the new fat32 partition is showing "Separate EFI boot" under grub location.
  • Click apply and follow the steps.
  • One guide also said mount the data partition from disks and check the /etc/fstab to see if it has a different mount point for /boot but i didnt
  • Shutdown the VM and delete the cdrom from devices
  • Start the VM and check the nic has an IP. I had to edit my netplan config as the adaptor had changed from enpos3 to 4
I wish i had tried this before messing with trying to copy data the hard way. This in the end was a pretty straightforward job.

One last niggle to tidy is that apt upgrade is complaining about grub as its now changed to uefi. I guess i just have to remove it.

Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ...

Could not find /boot/grub/menu.lst file. Would you like /boot/grub/menu.lst generated for you? (y/N) /usr/sbin/update-grub-legacy-ec2: line 1101: read: read error: 0: Bad file descriptor
run-parts: /etc/kernel/postrm.d/x-grub-legacy-ec2 exited with return code 1
dpkg: error processing package linux-image-4.15.0-76-generic (--remove):
installed linux-image-4.15.0-76-generic package post-removal script subprocess returned error exit status 1
Removing linux-modules-4.15.0-76-generic (4.15.0-76.86) ...
Errors were encountered while processing:
linux-image-4.15.0-76-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)



Reference: Ubuntu UEFI
 

bignellrp

Dabbler
Joined
Mar 12, 2020
Messages
18
It seems i forgot a step. If boot-repair says about installing grub but not about efi on a separate partition then you need to reopen disks and make sure the partition type is EFI boot. I also had to open gparted first as it didnt let me create a new partition until gparted had applied a "fix".
 

bignellrp

Dabbler
Joined
Mar 12, 2020
Messages
18
Thanks. That worked.

Just in case this helps anyone else with this issue here are the steps i followed;

  • Follow steps from this guide to create the raw file of your VM.
  • Create the zvol slightly larger that the raw image.
  • DD the raw into the zvol.
  • Create a VM with the zvol as the disk and Ubuntu Desktop live cd as the cdrom.
  • Boot into Ubuntu Desktop
  • Open a search and type "disks" or you can open a terminal and use gparted instead.
  • Create a 200Mb fat32 partition and label it boot. Luckily ubuntu leaves some free space by default at the end to save you having to resize the other data partition.
  • I deleted my other Grub boot partition from the start although i think the next step would have done this for me.
  • Install boot-repair
  • sudo add-apt-repository ppa:yannubuntu/boot-repair
  • sudo apt-get update
  • sudo apt-get install -y boot-repair && boot-repair
  • Click advanced and check the new fat32 partition is showing "Separate EFI boot" under grub location.
  • Click apply and follow the steps.
  • One guide also said mount the data partition from disks and check the /etc/fstab to see if it has a different mount point for /boot but i didnt
  • Shutdown the VM and delete the cdrom from devices
  • Start the VM and check the nic has an IP. I had to edit my netplan config as the adaptor had changed from enpos3 to 4
I wish i had tried this before messing with trying to copy data the hard way. This in the end was a pretty straightforward job.

One last niggle to tidy is that apt upgrade is complaining about grub as its now changed to uefi. I guess i just have to remove it.

Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ...

Could not find /boot/grub/menu.lst file. Would you like /boot/grub/menu.lst generated for you? (y/N) /usr/sbin/update-grub-legacy-ec2: line 1101: read: read error: 0: Bad file descriptor
run-parts: /etc/kernel/postrm.d/x-grub-legacy-ec2 exited with return code 1
dpkg: error processing package linux-image-4.15.0-76-generic (--remove):
installed linux-image-4.15.0-76-generic package post-removal script subprocess returned error exit status 1
Removing linux-modules-4.15.0-76-generic (4.15.0-76.86) ...
Errors were encountered while processing:
linux-image-4.15.0-76-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)



Reference: Ubuntu UEFI



Found a fix for the broken grub:

sudo touch /boot/grub/menu.lst
sudo update-grub2


 

ete

Cadet
Joined
Jan 5, 2019
Messages
6
hey all
not sure this thread is still alive, but i need some help too plz with this topic ::smile:

when i run the DD command (in FreeNAS-11.3-U4), it creates a new file with the name of the zvol i mentioned in the command, but it does not actually deploying the image to the zvol i had created.
i can run the command even without creating a zvol in the GUI beforehand, and it will still create a file with the name i specified in the DD command, at the pool/dataset/volume i specified.
any ideas?
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Please give us the complete command you are trying.
 

ete

Cadet
Joined
Jan 5, 2019
Messages
6
hey!
thank you for the quick reply
thats the command:

‘dd if=/mnt/RaidZ2/DataSet_I/hassos.img of=/mnt/CrucialVM/CrucialVM/hassOs’

all pics in same frame below
a pic from the gui, as to where i keep my zvols of vms
SSH image after the command finishes:
and the file that was created on that dataset - just a little less than 6.5 GB



1.jpg

as i said - it create this file regardless if there is a zvol with this name or not

how abnormal is this??? should i call mulder and scully, or ghostbusters??
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
The destination is plain wrong. See:
Code:
root@freenas[~]# zfs create -V 1G hdd/testvol           
root@freenas[~]# dd if=/dev/zero of=/dev/zvol/hdd/testvol bs=1m
dd: /dev/zvol/hdd/testvol: end of device
1025+0 records in
1024+0 records out
1073741824 bytes transferred in 0.765429 secs (1402796906 bytes/sec)
root@freenas[~]# zfs destroy hdd/testvol                  


A zvol is a block device, not a file.
 

ete

Cadet
Joined
Jan 5, 2019
Messages
6
hey Patrick

thank you for taking the time to help, i appreciate it.
i think i understood what you said, but not sure what to do to fix it.
should i create a zvol with a line command, and not in the gui - was that my problem?
and if so, what sould be the command for a proper creation?

zfs create -V 32G /mnt/CrucialVM/CrucialVM/hassOs

will that do the trick of rectifying it?
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
If your pool is named "CrucialVM" the command is:
zfs create -V 32G CrucialVM/hassOs
without the "/mnt". But you can use the GUI, no problem with that.

Your mistake is that you try to use something like /mnt/CrucialVM/hassOs in your dd command.
Of course this creates a file, because that is a file path. You need to use a device for the "of=" part of dd.
In your case above the device is /dev/zvol/CrucialVM/hassOs like in my example.
 

ete

Cadet
Joined
Jan 5, 2019
Messages
6
gotcha! thanks

or at least got right the part of the destination being all wrong

now, after pointing in the right direction - /dev/zvol/CrucialVM/CrucialVM/HAssOs (where i have already created the zvol)

i get an error of:
dd: /dev/zvol/CrucialVM/CrucialVM/HAssOs: Operation not supported

after running this command:
dd if=/mnt/RaidZ2/DataSet_I/hassos.img of=/dev/zvol/CrucialVM/CrucialVM/HAssOs

more thoughts?
 

Attachments

  • not supp.jpg
    not supp.jpg
    167.9 KB · Views: 280

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Does /dev/zvol/CrucialVM/CrucialVM/HAssOs exist? Check with ls. Apart from that no idea - works here ;)

Edit: one more idea, please post the output of
zfs get volmode CrucialVM/CrucialVM/HAssOs
 

ete

Cadet
Joined
Jan 5, 2019
Messages
6
it appears on 'LS' command, so my guess would be - yes
ill keep digging
thank you so much for your help so far.
was worth it just for that zvol location lesson
so i appreciate it a lot
cheers
:)
if anything comes to mind... just let me know
 

Attachments

  • hassos.jpg
    hassos.jpg
    256.6 KB · Views: 280
Top