Installing Proxmox on eMMC Devices
Recently I have been learning about servers and other general Linux-related topics.
I came across with Proxmox and have been blown away by its features as a virtualization environment hub. Being a popular choice the community and the resources around it are great.
After some experiments with virtual machines I decided to run those studies on a physical device, as a test ground of sorts before investing on proper server hardware. So I got a cheap Intel mini-pc, an Beelink T4 Pro.
However, attempting to install a disc image of Proxmox on it, the process failed right before the installation proper. A quick search showed that installing on storage devices using eMMCs as the storage interface(in other words, not a proper HD or SDD, same as memory card) is “not supported” by Proxmox. Bummer, right? But for a good reason: That storage interface is not meant to be used on servers, as it would wear out if left powered on continuously. So, should I throw the towel and repurpose the recently acquired mini-pc for something else? Not without a fight.
It turns out the “unsupported” part of the story is merely a list of valid formats inside the pearl script that manages the install, literally inside a chain of “if/elses” of all things. The infrastructure of the world be like that sometimes.
So you have to edit that file before the installation process itself. To do this, select “Install Proxmox VE (Debug Mode)”.
When prompted a command after being sent to the terminal, type:
exit
Then navigate to the directory of the script file:
cd /usr/share/perl5/Proxmox/Sys
The file we are looking for is Block.pm. Before editing it you can check its contents with:
cat Block.pm
Next use a text editor to edit some lines. Either Nano or Vi is fine (if you never used vim bindings before, make sure you know how to exit the program. The UX for beginners is that abysmal, look up the memes.).
vi Block.pm
The code part we will edit is the following:
sub get_partition_dev { my ($dev, $partnum) = @_; if ($dev =~ m|^/dev/sd([a-h]?[a-z]\|i[a-v])$|) { return "${dev}$partnum"; } elsif ($dev =~ m|^/dev/xvd[a-z]$|) { # Citrix Hypervisor blockdev return "${dev}$partnum"; } elsif ($dev =~ m|^/dev/[hxev]d[a-z]$|) { return "${dev}$partnum"; } elsif ($dev =~ m|^/dev/[^/]+/c\d+d\d+$|) { return "${dev}p$partnum"; } elsif ($dev =~ m|^/dev/[^/]+/d\d+$|) { return "${dev}p$partnum"; } elsif ($dev =~ m|^/dev/[^/]+/hd[a-z]$|) { return "${dev}$partnum"; } elsif ($dev =~ m|^/dev/nvme\d+n\d+$|) { return "${dev}p$partnum"; } else { die "unable to get device for partition $partnum on device $dev\n"; } }
As you can see, this function uses RegExes to check what kind of devices you are attempting to install. Invalid interfaces will display the message at the end of block. That was the same message I got during my first attempts. So we have to include a similar line as the others before that last “else” statement. insert the following:
elsif ($dev =~ m|^/dev/mmcblk\d+$|) { return "${dev}p$partnum"; }
The final function will look like this:
sub get_partition_dev { my ($dev, $partnum) = @_; if ($dev =~ m|^/dev/sd([a-h]?[a-z]\|i[a-v])$|) { return "${dev}$partnum"; } elsif ($dev =~ m|^/dev/xvd[a-z]$|) { # Citrix Hypervisor blockdev return "${dev}$partnum"; } elsif ($dev =~ m|^/dev/[hxev]d[a-z]$|) { return "${dev}$partnum"; } elsif ($dev =~ m|^/dev/[^/]+/c\d+d\d+$|) { return "${dev}p$partnum"; } elsif ($dev =~ m|^/dev/[^/]+/d\d+$|) { return "${dev}p$partnum"; } elsif ($dev =~ m|^/dev/[^/]+/hd[a-z]$|) { return "${dev}$partnum"; } elsif ($dev =~ m|^/dev/nvme\d+n\d+$|) { return "${dev}p$partnum"; } elsif ($dev =~ m|^/dev/mmcblk\d+$|) { return "${dev}p$partnum"; } else { die "unable to get device for partition $partnum on device $dev\n"; } }
Save your changes and exit. Return to the installation screen(by rebooting, for example). Now the installation should succeed. Once again, the big caveat is that this storage type is not recommended for servers, but since I will be quite constrained spec-wise and only run light experiments and non-critical operations, it will serve my needs for now. In fact, this is a good motivation for looking up and testing Proxmox backup tools. More posts on the subject are likely.
See you next mission.