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?

4
  • 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. Jan 12, 2018 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, 2018 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. Jan 13, 2018 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, 2018 at 10:37

2 Answers 2

2

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

1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .