How do I use MAAS to create a Debian Image?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















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










share|improve this question





























    0















    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










    share|improve this question

























      0












      0








      0








      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










      share|improve this question














      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







      maas






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 13 '17 at 13:32









      Sarah HSarah H

      268




      268






















          3 Answers
          3






          active

          oldest

          votes


















          1














          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





          share|improve this answer
























          • Ran into this issue after following those instructions bugs.launchpad.net/maas/+bug/1673655

            – kryo
            Jan 27 at 3:00



















          0














          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





          share|improve this answer

































            0














            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






            share|improve this answer
























              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "89"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f882911%2fhow-do-i-use-maas-to-create-a-debian-image%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1














              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





              share|improve this answer
























              • Ran into this issue after following those instructions bugs.launchpad.net/maas/+bug/1673655

                – kryo
                Jan 27 at 3:00
















              1














              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





              share|improve this answer
























              • Ran into this issue after following those instructions bugs.launchpad.net/maas/+bug/1673655

                – kryo
                Jan 27 at 3:00














              1












              1








              1







              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





              share|improve this answer













              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






              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Nov 5 '17 at 16:36









              ShawnShawn

              112




              112













              • Ran into this issue after following those instructions bugs.launchpad.net/maas/+bug/1673655

                – kryo
                Jan 27 at 3:00



















              • Ran into this issue after following those instructions bugs.launchpad.net/maas/+bug/1673655

                – kryo
                Jan 27 at 3:00

















              Ran into this issue after following those instructions bugs.launchpad.net/maas/+bug/1673655

              – kryo
              Jan 27 at 3:00





              Ran into this issue after following those instructions bugs.launchpad.net/maas/+bug/1673655

              – kryo
              Jan 27 at 3:00













              0














              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





              share|improve this answer






























                0














                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





                share|improve this answer




























                  0












                  0








                  0







                  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





                  share|improve this answer















                  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






                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Feb 23 '17 at 13:39







                  user589808

















                  answered Feb 18 '17 at 13:43









                  Sarah HSarah H

                  268




                  268























                      0














                      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






                      share|improve this answer




























                        0














                        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






                        share|improve this answer


























                          0












                          0








                          0







                          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






                          share|improve this answer













                          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







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Feb 18 at 17:14









                          Juan VelaJuan Vela

                          13




                          13






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Ask Ubuntu!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f882911%2fhow-do-i-use-maas-to-create-a-debian-image%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              How to change which sound is reproduced for terminal bell?

                              Can I use Tabulator js library in my java Spring + Thymeleaf project?

                              Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents