Install DietPi on Proxmox BASH script

I made a basic script that installs DietPi on Proxmox as I use it for lots of VM’s. This just helps get it booted up and online quicker.

Git Repo GitHub - dazeb/proxmox-dietpi-installer: A Proxmox Helper Script to install DietPi in Proxmox

The installer just needs to know where to store the VM disk and the storage type. The rest is automatic.

EDIT: The script has now been updated to support more storage pools including BTRFS and ZFS.

2 Likes

Ping @StephanStS @HolgerTB as you both use Proxmox quite heavily :slight_smile:

1 Like

I have tested the script. After make it executable I could run the script.

But the RAM was 512 MB, CPU only 1 core. As far as I can see in the script the variable RAM=$ and CORES=$ are not used when creating the vm.

I added these lines to the script and it worked:

qm set $ID --cores “$CORES”
qm set $ID --memory “$RAM”

Maybe there are some things to add to improve the script:

  • ability to enter the Proxomox VM ID
  • ability to provide a VM Name

And it would be perfect!

Thanks for sharing!!

3 Likes

I have made some templates for my environment:
CPU, RAM, disk size as well as regional settings, disable IPv6 in my VMs etc set. Made all updates and then converted it to a template for further cloning.
Did this for a headless and two GUI based machines.

But your script is a nice starter for using the VMs initially.

I also am working at a LXC DietPi container. I generate them with a script from a VM.

1 Like

thanks, yea its just a starter script really, everything is commented so that it should be easily editable by beginners.

When you run the script it will now ask you for how much RAM and how many cores.

Default values for RAM and CPU set at 2048MB and x2 cores.

Thanks for testing!

2 Likes

Great, but your script is still missing the qm set commands:

qm set $ID --net0 “virtio,bridge=vmbr0”
qm set $ID --scsi0 “$STORAGE:vm-$ID-disk-0”
qm set $ID --boot order=‘scsi0’
qm set $ID --scsihw virtio-scsi-pci

you need to add
qm set $ID --cores “$CORES”
qm set $ID --memory “$RAM”

1 Like

Wow i can’t believe i missed that, i removed it while testing as initially i had the ram and cores set as a variable

RAM=1024
CORES=2

I used a oneliner qm create at first to create the machine but that didn’t work out without errors.

It’s now fixed with the qm set $ID --cores “$CORES” and qm set $ID --memory “$RAM”

Thanks again!

1 Like

The script has been updated with patch 2 with some help from @MichaIng.

Thank you!

2 Likes

Did not work for me on PVE 7.4-3 …

I have to change this line

qm set "$ID" --scsi0 "$STORAGE:vm-$ID-disk-0"

to

qm set "$ID" --scsi0 "$STORAGE:$ID/vm-$ID-disk-0.raw"

Thanks for letting us know, I’ll test and update the script today.

EDIT:
Currently tested for 7.4-16 all working as expected. Pls make sure to type your storage name when asked. eg,

Of course I had typed the correct storage name. With empty or incorrect storage name I got other errors.
Maybe that the underlaying filesystem makes a difference. I’m using BTRFS-Raid-0 for performance reasons on my SSD’s. I would prefer ZFS over BTRFS. But it is very very slow on my hardware. So I decided to use ZFS-Raid with HDD’s only.

1 Like

I get what you’re saying now, I will see if I can add BTRFS. Maybe by asking the user which filesystem type to store as the storage variable. Apologies for the confusion and thanks for letting me know I’ll get on it as soon as possible.

I have added an option to use BTRFS, please could you switch to the testing branch on github and try that version and let me know how it goes as I cannot test BTRFS filesystem right now.

1 Like

@dazeb
Works perfect :slight_smile:

1 Like

Sweet, thanks for getting back to me.

Hopefully ill get the changes moved to the main branch soon.

Does anyone know whether this naming scheme is the same for mdadm RAIDs? And in case of Btrfs it is probably only when using its RAID/volume features but not when just formatting a single drive with a single Btrfs partition, is it?

1 Like

@MichaIng looking into this

1 Like

New to this (dietpi) tried the script and on #proxmox 8.0.4 and it says all ok but when the vm starts, it crashes.


Any ideas?

1 Like

What filesystem are you installing DietPi on? Are you using BTRFS, RAID, Thin Provisioning etc?

To be honest I never even thought of Proxmox 8 yet lol maybe they changed some stuff ill look into it.