[TUTORIAL] How to convert Raspberry Pi OS images and import to Proxmox

primetechguides

New Member
May 11, 2024
1
0
1
I have Proxmox installed on a Raspberry Pi 5.

I wanted to have the VMs use the official Raspbian OS images. These are the steps to do it, looks more than it actually is. It was also based off my previous guide to do this on ESXI.

ESXI instructions similar

On a Linux computer:

Code:
apt-get install qemu-utils

Download a Raspberry Pi Image
Code:
xz -d 2024-03-15-raspios-bookworm-arm64-lite.img.xz

qemu-img convert -f raw 2024-03-15-raspios-bookworm-arm64-lite.img -O qcow2 2024-03-15-raspios-bookworm-arm64-lite.qcow2
qemu-img resize 2024-03-15-raspios-bookworm-arm64-lite.qcow2 20G

Copy the qcow2 image to Proxmox running server. I use WinSCP to /var/lib/vz/template/qcow

------------------------------------------
If Proxmox is running on a Raspberry Pi. Set below to enable SSH.
Code:
raspi-config
Interface Options > SSH > Enable

nano /etc/ssh/sshd_config

Set the below line
Code:
PermitRootLogin yes
CTRL+S > CTRL+X to save and quit.

Code:
service sshd restart
------------------------------------------

I use WinSCP to connect to Raspbbery Pi to transfer files
Create a new folder /var/lib/vz/template/qcow
Copy qcow2 file made earlier.

Download debian-12.5.0-arm64-netinst.iso [ Ensure it is the arm64 version ]
https://cdimage.debian.org/debian-cd/current/arm64/iso-cd/debian-12.5.0-arm64-netinst.iso

In Proxmox Web Interface.
Click the Proxmox Storage example local
Click ISO Images
Upload the Debian Netinst image.

Create a new VM in Proxmox
OS > Use CD/DVD - Storage Local > ISO Image - select the Debian Netinst iso.
System > BIOS - Select OVMF (UEFI)
EFI Storage > Local
Disks > Remove the scsi0 which it adds automatically.
So you have no Disks.
Finish the VM Creation.

Back to SSH on the Proxmox server.
Code:
cd /var/lib/vz/template/qcow

This is where you uploaded the .qcow2 image.

Code:
qm importdisk 100 2024-03-15-raspios-bookworm-arm64-lite.qcow2 local
Import disk where [local] is the name of your Proxmox storage and [100] is the VM ID

Click the VM in Proxmox and select Hardware.
You should now have 'Unused Disk 0' listed at the bottom
Double Click 'Unused Disk 0'
Ensure Bus/Device is SCSI and click Add.

Start the VM and it should boot the Debian Netinst.
Click Advanced Options > Rescue Mode
Enter through the options UNTIL you see 'Device to use as root file system' > Select '/dev/sda2'.
Click 'Execute a shell in /dev/sda2' > Click Continue

Code:
raspi-config --expand-rootfs

*** Reset the VM immediately after this command. ***
Go back through 'Advanced Options' > 'Rescue Mode' > 'Excecute a shell in /dev/sda2'

Code:
resize2fs /dev/sda2
nano /etc/fstab

Enter the below line at the end of the file. Then CTRL+S , CTRL+X to save.
Code:
none /sys/firmware/efi/efivars efivarfs defaults

Code:
mount /boot/firmware
touch /boot/firmware/ssh
mount /sys/firmware/efi/efivars
ls /sys/firmware/efi/efivars/


apt update
apt -y install grub-efi-arm64
apt -y install linux-image-arm64
apt-get -y purge linux-image.*rpi.*


grub-install --efi-directory=/boot/firmware
update-grub2

If you are using Raspberry OS Full and not Lite, Debian Bookworm Wayland does not seem to work, you would need to switch back to X11 desktop environment.

Code:
raspi-config
Advanced Options - Wayland - X11

Stop VM.
Click Proxmox > VM > Options > Boot Order
Enable the scsi0 hard drive and move this to the top of the list.
Click OK
Click Hardware > Double Click CD/DVD Drive.
Click 'Do not use any media'.

Start the VM and keep tapping ESC key to get into the BIOS.
Click Boot Manager.

If debian is not listed in the options we need to add a Boot Entry:
* Back to main menu of BIOS.
* Click Boot Options
* Add Boot Option
* Click bootfs.
* Click EFI > Debian
* Click grubbaa64.efi
* Type debianboot
* Click Commit.
* Change order and make sure debian is at the top.

Restart and Raspbian should start.
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!