Jump to content
Porkie

DietPi Install on KVM

5 posts in this topic Last Reply

Recommended Posts

I only came across DietPi a day or so ago which seems a interesting rpi project that is easy to install using Kvm after a few procedures.

 

First go to https://dietpi.com and download their Vmware vdmk image to your Unraid machine. Then we need to convert the image to a qcow2 image using qemu. To convert the image use the following command and adjust paths and file names accordingly.

 

qemu-img convert /mnt/user/isos/DietPi_VMware-x86_64-Stretch.vmdk -O qcow2 dietpi.qcow2

 

Once the file is converted which should take not to long we need to make a linux vm template using seabios and for the first drive set to manual and point to the qcow2 we just created and set that drive to sata. Set ram and cpus as you require, save and boot. here is a working vm template with instructions from above.

 

fSBo4tP.png

 

Dietpi seems to offer a lot of packages/software from the installer, i was surprised at what was available and also just being able to run a rpi image without any hassle seemed cool.

Share this post


Link to post

somehow it doesn't find the root filesystem with these settings...

 

image.png.203f5f542e0e62a7d221f7b4127807ac.png

 

any ideas?

Share this post


Link to post
Posted (edited)
On 3/14/2019 at 2:36 PM, drdebian said:

somehow it doesn't find the root filesystem with these settings...

 

image.png.203f5f542e0e62a7d221f7b4127807ac.png

 

any ideas?

I had the same problem and tried a bunch of things, none of which worked.  Then I gave up.

 

I was bored this morning after waking up at 2AM and decided to give it another try.  Last time the most success I had was to use the NativePC instead of the VMWare image but still had an issue trying to boot it and gave up on that as well.

 

You will need some linux tools, I had a Debian VM installed already so I used that.

 

Download the DietPi Native PC (BIOS/CSM) image.  If you try to create an Unraid VM with that image you will eventually get into a loop of not being able to download updates because of no available free space (that's the hint).

 

This time, I did some more research and tried a few more things.. and seem to have it working.  I used the info provided here to resize the image https://fatmin.com/2016/12/20/how-to-resize-a-qcow2-image-and-filesystem-with-virt-resize/

 

Use a couple tools to show you info about the image and then to resize it.. 

qemu-img info DietPi_NativePC_BIOS-x86_64-Stretch.img

displays the disk size as 602M.. not enough to be usable.  I don't know what the minimum size should be, I added entirely too much at 30gigs but I'm just testing at this point so I don't care.

 

qemu-img resize DietPi_NativePC_BIOS-x86_64-Stretch.img +30G
cp DietPi_NativePC_BIOS-x86_64-Stretch.img DietPi_NativePC_BIOS-x86_64-Stretch-orig.img
sudo virt-resize -expand /dev/sda1 DietPi_NativePC_BIOS-x86_64-Stretch-orig.img DietPi_NativePC_BIOS-x86_64-Stretch.img

I had to use sudo since I wasn't logged in as root

 

Now you can take that new, resized DietPi img and use it as your unraid vm hard drive and install DietPi.

 

To save you some time and effort, here's a fresh 4GB image that can be used for Unraid.

 

DietPi_NativePC-BIOS-x86_64-Stretch-4GB-UNRAID.7z -  121.7 MB

Edited by Energen

Share this post


Link to post
On 3/15/2019 at 5:36 AM, drdebian said:

somehow it doesn't find the root filesystem with these settings...

 

image.png.203f5f542e0e62a7d221f7b4127807ac.png

 

any ideas?

I had the same trouble, but solved it using testdisk (downloadable via Nerd-Pack) to scan the image file.
 

Testdisk detected an issue with the cylinders number, recommending to change to 64. After doing this and writing the change, it scanned through fine. 
 

DietPi is awesome. Default minimal install uses 64MB ram and boots in seconds. 
 

I’ll add a short guide on getting it all working when I’m at a keyboard again. 

Share this post


Link to post

Okay, I've done this several dozen times now, so here goes.

 

Part 1 -- Getting, Converting and Resizing the Image

 

1. Download the VirtualBox VM from https://dietpi.com -- Make sure it's named: DietPi_VirtualBox-x86_64-Buster.7z

2. Uncompress this into an empty folder. Keep the DietPi_VirtualBox-x86_64-Buster.ova

3. Untar DietPi_VirtualBox-x86_64-Buster.ova -- Resulting in 3 new files. We will focus on the .vmdk file.

tar -xf DietPi_VirtualBox-x86_64-Buster.ova

4. Convert the .vmdk into a qcow2 file.

qemu-img convert -p -f vmdk -O qcow2 DietPi_VirtualBox-x86_64-Buster-disk001.vmdk DietPi_64GB.qcow2

5. Resize the qcow2 file to 64GB, or whatever size you want the final image to be.

qemu-img resize DietPi_64GB.qcow2 64G

6. Convert this 64GB qcow2 file to a raw image.

qemu-img convert -p -f qcow2 -O raw DietPi_64GB.qcow2 DietPi_64GB.img

 

Part 2 -- Adding the Image to unRAID

 

Create a VM using Debian template. 

Change BIOS to SeaBIOS. 

Primary vDisk Location = Manual  -- Add the location of the raw image from Part 1.

Primary vDisk Bus = SATA

Click [Create]

 

When DietPi first starts, it'll automatically resize the partition inside the image.

 

Thats all folks!  Let me know if you come across this and found it helpful, or have any questions.

 

 

Some notes:

I chose to use the VirtualBox image rather than the VMware option, as it doesn't require the need to use 3rd party tools and many times more steps to get the same result 😅

 

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.