How do I create a Debian image in MAAS? All I found were some ubuntu releases and CentOS, is there any way to create a debian image ? if so how do I do it
3 Answers
More complete answer:
Download a debian cloud image in raw format.
Mount the image
sudo mkdir /mnt/loop
sudo mount -o ro,loop,offset=1048576 <nameofdebianimage.raw> /mnt/loop
Convert to a gzipped tarball
cd /mnt/loop
sudo tar czvf ~/debian.tgz .
sudo umount /mnt/loop
Upload this to maas
cd ~
maas login your.user http://<maasserver>:5240/MAAS 'user:credentials'
maas your.user boot-resources create name=custom/debian title="debian" architecture=amd64/generic content@=debian.tgz
Edit /etc/maas/preseeds/curtin_userdata_custom and add the following at the top after the comment line and before debconf_selections to override the kernel to install:
kernel:
fallback-package: linux-image-amd64
package: linux-image-amd64
-
Ran into this issue after following those instructions bugs.launchpad.net/maas/+bug/1673655– kryoJan 27, 2019 at 3:00
Okay so this is how you do it, for all those who are stuck just the way I was.
wget http://cdimage.debian.org/cdimage/openstack/8.7.1-20170215/debian-8.7.1-20170215-openstack-amd64.raw
maas login your.user http://<maasserver>:5240/MAAS 'user:credentials'
maas your.user boot-resources create name=custom/debian title="debian-8.7.1" architecture=amd64/generic content@=debian-8.7.1-20170215-openstack-amd64.raw
-
-
I'm using your answer to create an Debian image on u20.04 and MAAS but during the deploy I've this issue pasteboard.co/J8HifZ5.png May 16, 2020 at 22:14
Based on the previous answers and on my own research I've made a short guide to make Debian 9 run on MaaS with the UEFI SecureBoot. There are some changes to be made to the source code as well in order to be able to complete the deploy successfully. I will summarize the contents in the following lines.
If you want to boot using UEFI and SecureBoot, the main step is to include the buster debian repos to the image so curtin will be able to install the packages grub-efi-amd64-signed and shim-signed (that are not present on stretch repos).
root@maas:~/custom-oses# mkdir /mnt/custom-os-loop
root@maas:~/custom-oses# mount -o rw,loop,offset=1048576,sync debian-9.7.0-openstack-amd64.raw /mnt/custom-os-loop
root@maas:~/custom-oses# chroot /mnt/custom-os-loop
root@maas:/# echo "deb http://ftp.debian.org/debian buster main contrib non-free" >> /etc/apt/sources.list
root@maas:/# apt update
root@maas:/# exit
root@maas:~/custom-oses# umount /mnt/custom-os-loop
Don't worry about breaking the system, as cloud-init will replace the sources.list file on the first boot.
Beside this in order to not override the sources that the image contains, the behavior of MaaS must be changed. Inspecting the code you will see that it's not possible to modify the value of the cloud-init's directive preserve_sources_list, it's going to be False always. The solution is to modify the function get_archive_config in the file compose_preseed.py.
archives['apt']['preserve_sources_list'] = True if node.osystem == 'custom' else preserve_sources
At this point the Debian OS will be installed successfully, but it will not be able to boot automatically. MaaS doesn't support Debian, so when providing the EFI directives to boot there is something missing. Locate the file config.local.amd64.template under the uefi directory, and add the following lines under the ubuntu ones.
debian/shimx64.efi \
debian/grubx64.efi \
And that's it!
Remember that if you edit the python files that are being run, you must remove the pycache and restart the services before seeing the changes