Headless boot and install on same usb device












0














situation: I have a PC that I cannot connect a screen to. I know that the PC automatically boots any bootable media that is connected to a certain USB port. The PC has only this one USB port.



requirement: I'd like to have a running debian installation on the PC that I can connect to using SSH.



theory: My idea is that I could create a bootable USB stick that contains a small intermediate OS and the debian installer which are both copied into memory automatically upon boot. The intermediate OS should automatically configure the network with DHCP and start SSH so that I am able to connect to the machine and run the debian installer which I then use to install debian to the USB stick itself (the stick has SLC memory so installing an OS on it shouldn't be an issue).



So much for the theory... Unfortunately I am not sure where to start to get this process going. Did anyone do something similar before or could provide me with some hints how to get started?










share|improve this question






















  • Can you not configure the OS on the stick with a PC that has a monitor, set up DHCP, and enable the sshd service and then plug it into the PC in question.
    – Raman Sailopal
    Jan 12 at 12:41










  • I have a server that has no video connectors, uses SCSI drives, can't boot from USB, and won't boot from CD without manual intervention. How did I install the system on it? I connected a second computer to its serial port. Do you have one of those?
    – Fox
    Jan 12 at 16:30










  • @Fox: if you've already got a running system on that machine, you can boot the installer from your HDD with your boot loader as well.
    – Ferenc Wágner
    Jan 13 at 10:27










  • @FerencWágner Interacting with the bootloader requires being able to see it, or a lot of confidence. Granted, this was an old Sun machine with quite the special serial console. Since the initial install (which was from blank drives) I use netboot from LOM for major upgrades, but I suppose that isn't applicable to OP's case
    – Fox
    Jan 13 at 10:37
















0














situation: I have a PC that I cannot connect a screen to. I know that the PC automatically boots any bootable media that is connected to a certain USB port. The PC has only this one USB port.



requirement: I'd like to have a running debian installation on the PC that I can connect to using SSH.



theory: My idea is that I could create a bootable USB stick that contains a small intermediate OS and the debian installer which are both copied into memory automatically upon boot. The intermediate OS should automatically configure the network with DHCP and start SSH so that I am able to connect to the machine and run the debian installer which I then use to install debian to the USB stick itself (the stick has SLC memory so installing an OS on it shouldn't be an issue).



So much for the theory... Unfortunately I am not sure where to start to get this process going. Did anyone do something similar before or could provide me with some hints how to get started?










share|improve this question






















  • Can you not configure the OS on the stick with a PC that has a monitor, set up DHCP, and enable the sshd service and then plug it into the PC in question.
    – Raman Sailopal
    Jan 12 at 12:41










  • I have a server that has no video connectors, uses SCSI drives, can't boot from USB, and won't boot from CD without manual intervention. How did I install the system on it? I connected a second computer to its serial port. Do you have one of those?
    – Fox
    Jan 12 at 16:30










  • @Fox: if you've already got a running system on that machine, you can boot the installer from your HDD with your boot loader as well.
    – Ferenc Wágner
    Jan 13 at 10:27










  • @FerencWágner Interacting with the bootloader requires being able to see it, or a lot of confidence. Granted, this was an old Sun machine with quite the special serial console. Since the initial install (which was from blank drives) I use netboot from LOM for major upgrades, but I suppose that isn't applicable to OP's case
    – Fox
    Jan 13 at 10:37














0












0








0







situation: I have a PC that I cannot connect a screen to. I know that the PC automatically boots any bootable media that is connected to a certain USB port. The PC has only this one USB port.



requirement: I'd like to have a running debian installation on the PC that I can connect to using SSH.



theory: My idea is that I could create a bootable USB stick that contains a small intermediate OS and the debian installer which are both copied into memory automatically upon boot. The intermediate OS should automatically configure the network with DHCP and start SSH so that I am able to connect to the machine and run the debian installer which I then use to install debian to the USB stick itself (the stick has SLC memory so installing an OS on it shouldn't be an issue).



So much for the theory... Unfortunately I am not sure where to start to get this process going. Did anyone do something similar before or could provide me with some hints how to get started?










share|improve this question













situation: I have a PC that I cannot connect a screen to. I know that the PC automatically boots any bootable media that is connected to a certain USB port. The PC has only this one USB port.



requirement: I'd like to have a running debian installation on the PC that I can connect to using SSH.



theory: My idea is that I could create a bootable USB stick that contains a small intermediate OS and the debian installer which are both copied into memory automatically upon boot. The intermediate OS should automatically configure the network with DHCP and start SSH so that I am able to connect to the machine and run the debian installer which I then use to install debian to the USB stick itself (the stick has SLC memory so installing an OS on it shouldn't be an issue).



So much for the theory... Unfortunately I am not sure where to start to get this process going. Did anyone do something similar before or could provide me with some hints how to get started?







debian usb headless






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 12 at 12:29









Tim Keller

111




111












  • Can you not configure the OS on the stick with a PC that has a monitor, set up DHCP, and enable the sshd service and then plug it into the PC in question.
    – Raman Sailopal
    Jan 12 at 12:41










  • I have a server that has no video connectors, uses SCSI drives, can't boot from USB, and won't boot from CD without manual intervention. How did I install the system on it? I connected a second computer to its serial port. Do you have one of those?
    – Fox
    Jan 12 at 16:30










  • @Fox: if you've already got a running system on that machine, you can boot the installer from your HDD with your boot loader as well.
    – Ferenc Wágner
    Jan 13 at 10:27










  • @FerencWágner Interacting with the bootloader requires being able to see it, or a lot of confidence. Granted, this was an old Sun machine with quite the special serial console. Since the initial install (which was from blank drives) I use netboot from LOM for major upgrades, but I suppose that isn't applicable to OP's case
    – Fox
    Jan 13 at 10:37


















  • Can you not configure the OS on the stick with a PC that has a monitor, set up DHCP, and enable the sshd service and then plug it into the PC in question.
    – Raman Sailopal
    Jan 12 at 12:41










  • I have a server that has no video connectors, uses SCSI drives, can't boot from USB, and won't boot from CD without manual intervention. How did I install the system on it? I connected a second computer to its serial port. Do you have one of those?
    – Fox
    Jan 12 at 16:30










  • @Fox: if you've already got a running system on that machine, you can boot the installer from your HDD with your boot loader as well.
    – Ferenc Wágner
    Jan 13 at 10:27










  • @FerencWágner Interacting with the bootloader requires being able to see it, or a lot of confidence. Granted, this was an old Sun machine with quite the special serial console. Since the initial install (which was from blank drives) I use netboot from LOM for major upgrades, but I suppose that isn't applicable to OP's case
    – Fox
    Jan 13 at 10:37
















Can you not configure the OS on the stick with a PC that has a monitor, set up DHCP, and enable the sshd service and then plug it into the PC in question.
– Raman Sailopal
Jan 12 at 12:41




Can you not configure the OS on the stick with a PC that has a monitor, set up DHCP, and enable the sshd service and then plug it into the PC in question.
– Raman Sailopal
Jan 12 at 12:41












I have a server that has no video connectors, uses SCSI drives, can't boot from USB, and won't boot from CD without manual intervention. How did I install the system on it? I connected a second computer to its serial port. Do you have one of those?
– Fox
Jan 12 at 16:30




I have a server that has no video connectors, uses SCSI drives, can't boot from USB, and won't boot from CD without manual intervention. How did I install the system on it? I connected a second computer to its serial port. Do you have one of those?
– Fox
Jan 12 at 16:30












@Fox: if you've already got a running system on that machine, you can boot the installer from your HDD with your boot loader as well.
– Ferenc Wágner
Jan 13 at 10:27




@Fox: if you've already got a running system on that machine, you can boot the installer from your HDD with your boot loader as well.
– Ferenc Wágner
Jan 13 at 10:27












@FerencWágner Interacting with the bootloader requires being able to see it, or a lot of confidence. Granted, this was an old Sun machine with quite the special serial console. Since the initial install (which was from blank drives) I use netboot from LOM for major upgrades, but I suppose that isn't applicable to OP's case
– Fox
Jan 13 at 10:37




@FerencWágner Interacting with the bootloader requires being able to see it, or a lot of confidence. Granted, this was an old Sun machine with quite the special serial console. Since the initial install (which was from blank drives) I use netboot from LOM for major upgrades, but I suppose that isn't applicable to OP's case
– Fox
Jan 13 at 10:37










2 Answers
2






active

oldest

votes


















0














Debian Installer can do all this alone. You'll have to start the netboot variant (kernel + initrd) with your favorite boot loader, passing answers to some initial questions on the kernel command line. Here is a test setup for illustration:



$ kvm -m 256M -net nic -net user,hostfwd=::2222-:22 
-kernel linux -initrd initrd.gz
-append 'priority=critical language=C country=US keymap=us
hostname=foobar domain=soreny mirror/country=manual
mirror/http/hostname=ftp.us.debian.org
mirror/http/directory=/debian/
anna/choose_modules=network-console
network-console/password=secret
network-console/start='


When it reaches the root password question, you should be able to



ssh -p2222 installer@localhost


with the above password and continue the installation interactively.






share|improve this answer





























    0














    You need to remaster Debian ISO image.



    TL;DR;
    Download ISO from here Ciborski's guide to remote Debian installation over SSH



    Long answer:
    To do this you should read Debian GNU/Linux Installation Guide and modify boot parameters in /iso/isolinux and /iso/boot so it boots with auto parameter.
    This will make the installer skip keyboard configuration, language, etc.



    You also need to include preseed file in the ISO regarding network configuration.



    Example that works for me:



    d-i debian-installer/locale string en_US
    d-i keyboard-configuration/xkb-keymap select us
    d-i netcfg/choose_interface select auto

    d-i netcfg/get_hostname string unassigned-hostname
    d-i netcfg/get_domain string unassigned-domain

    d-i hw-detect/load_firmware boolean true

    d-i anna/choose_modules string network-console
    d-i preseed/early_command string anna-install network-console
    d-i network-console/password password root
    d-i network-console/password-again password root


    However if you need a quick and dirty solution you can just download premade ISO with Debian 9 x86_64 from my website https://tomasz.ciborski.com/debian-installation-over-ssh/



    Result:
    ssh installer console






    share|improve this answer








    New contributor




    pink_pony_404 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.


















      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "106"
      };
      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: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      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%2funix.stackexchange.com%2fquestions%2f416564%2fheadless-boot-and-install-on-same-usb-device%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      Debian Installer can do all this alone. You'll have to start the netboot variant (kernel + initrd) with your favorite boot loader, passing answers to some initial questions on the kernel command line. Here is a test setup for illustration:



      $ kvm -m 256M -net nic -net user,hostfwd=::2222-:22 
      -kernel linux -initrd initrd.gz
      -append 'priority=critical language=C country=US keymap=us
      hostname=foobar domain=soreny mirror/country=manual
      mirror/http/hostname=ftp.us.debian.org
      mirror/http/directory=/debian/
      anna/choose_modules=network-console
      network-console/password=secret
      network-console/start='


      When it reaches the root password question, you should be able to



      ssh -p2222 installer@localhost


      with the above password and continue the installation interactively.






      share|improve this answer


























        0














        Debian Installer can do all this alone. You'll have to start the netboot variant (kernel + initrd) with your favorite boot loader, passing answers to some initial questions on the kernel command line. Here is a test setup for illustration:



        $ kvm -m 256M -net nic -net user,hostfwd=::2222-:22 
        -kernel linux -initrd initrd.gz
        -append 'priority=critical language=C country=US keymap=us
        hostname=foobar domain=soreny mirror/country=manual
        mirror/http/hostname=ftp.us.debian.org
        mirror/http/directory=/debian/
        anna/choose_modules=network-console
        network-console/password=secret
        network-console/start='


        When it reaches the root password question, you should be able to



        ssh -p2222 installer@localhost


        with the above password and continue the installation interactively.






        share|improve this answer
























          0












          0








          0






          Debian Installer can do all this alone. You'll have to start the netboot variant (kernel + initrd) with your favorite boot loader, passing answers to some initial questions on the kernel command line. Here is a test setup for illustration:



          $ kvm -m 256M -net nic -net user,hostfwd=::2222-:22 
          -kernel linux -initrd initrd.gz
          -append 'priority=critical language=C country=US keymap=us
          hostname=foobar domain=soreny mirror/country=manual
          mirror/http/hostname=ftp.us.debian.org
          mirror/http/directory=/debian/
          anna/choose_modules=network-console
          network-console/password=secret
          network-console/start='


          When it reaches the root password question, you should be able to



          ssh -p2222 installer@localhost


          with the above password and continue the installation interactively.






          share|improve this answer












          Debian Installer can do all this alone. You'll have to start the netboot variant (kernel + initrd) with your favorite boot loader, passing answers to some initial questions on the kernel command line. Here is a test setup for illustration:



          $ kvm -m 256M -net nic -net user,hostfwd=::2222-:22 
          -kernel linux -initrd initrd.gz
          -append 'priority=critical language=C country=US keymap=us
          hostname=foobar domain=soreny mirror/country=manual
          mirror/http/hostname=ftp.us.debian.org
          mirror/http/directory=/debian/
          anna/choose_modules=network-console
          network-console/password=secret
          network-console/start='


          When it reaches the root password question, you should be able to



          ssh -p2222 installer@localhost


          with the above password and continue the installation interactively.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 13 at 10:24









          Ferenc Wágner

          2,924920




          2,924920

























              0














              You need to remaster Debian ISO image.



              TL;DR;
              Download ISO from here Ciborski's guide to remote Debian installation over SSH



              Long answer:
              To do this you should read Debian GNU/Linux Installation Guide and modify boot parameters in /iso/isolinux and /iso/boot so it boots with auto parameter.
              This will make the installer skip keyboard configuration, language, etc.



              You also need to include preseed file in the ISO regarding network configuration.



              Example that works for me:



              d-i debian-installer/locale string en_US
              d-i keyboard-configuration/xkb-keymap select us
              d-i netcfg/choose_interface select auto

              d-i netcfg/get_hostname string unassigned-hostname
              d-i netcfg/get_domain string unassigned-domain

              d-i hw-detect/load_firmware boolean true

              d-i anna/choose_modules string network-console
              d-i preseed/early_command string anna-install network-console
              d-i network-console/password password root
              d-i network-console/password-again password root


              However if you need a quick and dirty solution you can just download premade ISO with Debian 9 x86_64 from my website https://tomasz.ciborski.com/debian-installation-over-ssh/



              Result:
              ssh installer console






              share|improve this answer








              New contributor




              pink_pony_404 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.























                0














                You need to remaster Debian ISO image.



                TL;DR;
                Download ISO from here Ciborski's guide to remote Debian installation over SSH



                Long answer:
                To do this you should read Debian GNU/Linux Installation Guide and modify boot parameters in /iso/isolinux and /iso/boot so it boots with auto parameter.
                This will make the installer skip keyboard configuration, language, etc.



                You also need to include preseed file in the ISO regarding network configuration.



                Example that works for me:



                d-i debian-installer/locale string en_US
                d-i keyboard-configuration/xkb-keymap select us
                d-i netcfg/choose_interface select auto

                d-i netcfg/get_hostname string unassigned-hostname
                d-i netcfg/get_domain string unassigned-domain

                d-i hw-detect/load_firmware boolean true

                d-i anna/choose_modules string network-console
                d-i preseed/early_command string anna-install network-console
                d-i network-console/password password root
                d-i network-console/password-again password root


                However if you need a quick and dirty solution you can just download premade ISO with Debian 9 x86_64 from my website https://tomasz.ciborski.com/debian-installation-over-ssh/



                Result:
                ssh installer console






                share|improve this answer








                New contributor




                pink_pony_404 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.





















                  0












                  0








                  0






                  You need to remaster Debian ISO image.



                  TL;DR;
                  Download ISO from here Ciborski's guide to remote Debian installation over SSH



                  Long answer:
                  To do this you should read Debian GNU/Linux Installation Guide and modify boot parameters in /iso/isolinux and /iso/boot so it boots with auto parameter.
                  This will make the installer skip keyboard configuration, language, etc.



                  You also need to include preseed file in the ISO regarding network configuration.



                  Example that works for me:



                  d-i debian-installer/locale string en_US
                  d-i keyboard-configuration/xkb-keymap select us
                  d-i netcfg/choose_interface select auto

                  d-i netcfg/get_hostname string unassigned-hostname
                  d-i netcfg/get_domain string unassigned-domain

                  d-i hw-detect/load_firmware boolean true

                  d-i anna/choose_modules string network-console
                  d-i preseed/early_command string anna-install network-console
                  d-i network-console/password password root
                  d-i network-console/password-again password root


                  However if you need a quick and dirty solution you can just download premade ISO with Debian 9 x86_64 from my website https://tomasz.ciborski.com/debian-installation-over-ssh/



                  Result:
                  ssh installer console






                  share|improve this answer








                  New contributor




                  pink_pony_404 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  You need to remaster Debian ISO image.



                  TL;DR;
                  Download ISO from here Ciborski's guide to remote Debian installation over SSH



                  Long answer:
                  To do this you should read Debian GNU/Linux Installation Guide and modify boot parameters in /iso/isolinux and /iso/boot so it boots with auto parameter.
                  This will make the installer skip keyboard configuration, language, etc.



                  You also need to include preseed file in the ISO regarding network configuration.



                  Example that works for me:



                  d-i debian-installer/locale string en_US
                  d-i keyboard-configuration/xkb-keymap select us
                  d-i netcfg/choose_interface select auto

                  d-i netcfg/get_hostname string unassigned-hostname
                  d-i netcfg/get_domain string unassigned-domain

                  d-i hw-detect/load_firmware boolean true

                  d-i anna/choose_modules string network-console
                  d-i preseed/early_command string anna-install network-console
                  d-i network-console/password password root
                  d-i network-console/password-again password root


                  However if you need a quick and dirty solution you can just download premade ISO with Debian 9 x86_64 from my website https://tomasz.ciborski.com/debian-installation-over-ssh/



                  Result:
                  ssh installer console







                  share|improve this answer








                  New contributor




                  pink_pony_404 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  share|improve this answer



                  share|improve this answer






                  New contributor




                  pink_pony_404 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  answered 24 mins ago









                  pink_pony_404

                  1




                  1




                  New contributor




                  pink_pony_404 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.





                  New contributor





                  pink_pony_404 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.






                  pink_pony_404 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Unix & Linux Stack Exchange!


                      • 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.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • 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%2funix.stackexchange.com%2fquestions%2f416564%2fheadless-boot-and-install-on-same-usb-device%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

                      Accessing regular linux commands in Huawei's Dopra Linux

                      Can't connect RFCOMM socket: Host is down

                      Kernel panic - not syncing: Fatal Exception in Interrupt