[Solved] Creating a headless/monitorless install/live usb image with sshd enabled

Ask for help with issues regarding the Installations of the Debian O/S.
Post Reply
Message
Author
syntern
Posts: 9
Joined: 2025-01-12 11:04

[Solved] Creating a headless/monitorless install/live usb image with sshd enabled

#1 Post by syntern »

I have a machine without any VGA card with it, so I cannot install anything on it that relies on monitor feedback.
I want to create a Debian USB image that I can use to boot the machine and I can ssh into it to install the system through there. I don't want to have any automated setup, only an SSH connection I can use to run the installer.

What are my options and how can I achieve it?

:linked:

arzgi
Posts: 1779
Joined: 2008-02-21 17:03
Location: Finland
Has thanked: 1 time
Been thanked: 103 times

Re: Creating a headless/monitorless install/live usb image with sshd enabled

#2 Post by arzgi »

Search the forum for preseed. Installing Debian without display can be quite hard. You need openssh-server.

syntern
Posts: 9
Joined: 2025-01-12 11:04

Re: Creating a headless/monitorless install/live usb image with sshd enabled

#3 Post by syntern »

arzgi wrote: 2025-01-12 13:07 Search the forum for preseed. Installing Debian without display can be quite hard. You need openssh-server.
Preseed would help, if I wanted to automate the installation, but in fact I don't want to do that. So the question is: how to create a live/setup usb drive that has the openssh-server enabled by default (with a pre-known password or key).

arzgi
Posts: 1779
Joined: 2008-02-21 17:03
Location: Finland
Has thanked: 1 time
Been thanked: 103 times

Re: Creating a headless/monitorless install/live usb image with sshd enabled

#4 Post by arzgi »

I don't know any other working method, does the server have any display connector, would make the job some gazillion times easier. Just for the installation time, after that you could run it blindly.

You could make your own setup disk, but that is not a newbie task. Searh the net.

arzgi
Posts: 1779
Joined: 2008-02-21 17:03
Location: Finland
Has thanked: 1 time
Been thanked: 103 times

Re: Creating a headless/monitorless install/live usb image with sshd enabled

#5 Post by arzgi »

If the server is not a Rasberry Pi, you could take the hd/sd out of the server, connect it your pc, install there the ssh-server and keys. Test it, if it works, connect back to the server, try ssh connection. If does not work, start over.

But there are some caveats, if your net devices differ, then the server might not get online.

Aki
Global Moderator
Global Moderator
Posts: 4276
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 125 times
Been thanked: 576 times

Re: Creating a headless/monitorless install/live usb image with sshd enabled

#6 Post by Aki »

Hello,
syntern wrote: 2025-01-12 13:16
arzgi wrote: 2025-01-12 13:07 Search the forum for preseed. Installing Debian without display can be quite hard. You need openssh-server.
Preseed would help, if I wanted to automate the installation, but in fact I don't want to do that. So the question is: how to create a live/setup usb drive that has the openssh-server enabled by default (with a pre-known password or key).
What exactly are you looking for?

These are two different topic:
  • As @arzgi already wrote, if you need a Debian Installer that can be reached via ssh, you will need to modify the Debian Installer ISO to use preseed to let the installer configure language, region, network adapter, connection (otherwise you cannot connect to the network) and install/start the network-console and openssh-server-udeb installer udeb packages.
  • If you need a Debian Live that can be reached via ssh after booting, you will need to modify the Debian Live of your choice to allow the ssh server to be started.
By the way, connecting using ssh requires you to know the IP address of the Debian booted machine anyway, and it may require some extra effort if DHCP is used (as it always is) with Debian ISO.

This topic has been already discussed some time ago in this forum (search the forum) and in Debian mailing list (i.e. [1]).

Hope this helps.

--
[1] Is there a way to ssh into the debian installation process?
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

syntern
Posts: 9
Joined: 2025-01-12 11:04

Re: Creating a headless/monitorless install/live usb image with sshd enabled

#7 Post by syntern »

Aki wrote: 2025-01-12 17:22 What exactly are you looking for?
Again, to summarize it:
- I have a machine without any VGA output / not able to attach any monitor, I want Debian on it.
- I cannot automate the install procedure, because I don't know all the things about the devices and their ids upfront.
- I can boot an USB live image or installer, but they don't enable remote ssh by default (some distros enable it - they print the root password to the console, and I cannot see it either).

I thought that it should be easy to take either the live image or an installer image and enable remote ssh into it, but apparently this is not a use-case people care about or made easy to do.

Note: getting the IP is a non-issue, I will get it from my router. The decade-old mail list thread you've linked to may help, but it seems to involve way more custom build on components that I don't have the faintest idea about, and I wouldn't consider it accessible or easy. At that point I'd rather drop the project (return the device) and consider it lame that we cannot do such setups.

arzgi
Posts: 1779
Joined: 2008-02-21 17:03
Location: Finland
Has thanked: 1 time
Been thanked: 103 times

Re: Creating a headless/monitorless install/live usb image with sshd enabled

#8 Post by arzgi »

Just out of interest, can you tell what kind your server is? For me it is hard to believe that any would try to sell a comptuter without display connectors.

syntern
Posts: 9
Joined: 2025-01-12 11:04

Re: Creating a headless/monitorless install/live usb image with sshd enabled

#9 Post by syntern »

arzgi wrote: 2025-01-12 18:16 Just out of interest, can you tell what kind your server is? For me it is hard to believe that any would try to sell a comptuter without display connectors.
It is an Asustor NAS, but other NAS manufacturers have similar devices too.

Aki
Global Moderator
Global Moderator
Posts: 4276
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 125 times
Been thanked: 576 times

Re: Creating a headless/monitorless install/live usb image with sshd enabled

#10 Post by Aki »

Hello,
syntern wrote: 2025-01-12 17:49 I thought that it should be easy to take either the live image or an installer image and enable remote ssh into it, but apparently this is not a use-case people care about or made easy to do.
The use case exists (I.e. for the Debian Installer) and is documented, but it requires preseeding the installer, as already pointed out; see:
syntern wrote: 2025-01-12 17:49 Note: getting the IP is a non-issue, I will get it from my router.
Yes, getting the IP is not a problem, knowing what the assigned lease is might be more difficult. :wink:
syntern wrote: 2025-01-12 17:49 At that point I'd rather drop the project (return the device) and consider it lame that we cannot do such setups.
As you wish! Bye :wink:
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

syntern
Posts: 9
Joined: 2025-01-12 11:04

Re: Creating a headless/monitorless install/live usb image with sshd enabled

#11 Post by syntern »

https://fai-project.org/FAIme/live/ gives me a live image that I can ssh into. Unfortunately debian-installer-launcher does not work as expected, it gives the following errors depending on running without or with the live plugin:

Code: Select all

ERROR: 'kexec' is not a valid plugin. Check and try again.
umount: /run/live/installer: no mount point specified.
or

Code: Select all

no suitable d-i initrd image found, aborting.
umount: /run/live/installer: no mount point specified.
Do I need to install further packages? Is there any alternative text-based installer?
Last edited by syntern on 2025-01-12 23:36, edited 1 time in total.

syntern
Posts: 9
Joined: 2025-01-12 11:04

Re: Creating a headless/monitorless install/live usb image with sshd enabled

#12 Post by syntern »

The following repository provided an easy to run solution that created the USB image I wanted:
https://github.com/philpagel/debian-headless

arzgi
Posts: 1779
Joined: 2008-02-21 17:03
Location: Finland
Has thanked: 1 time
Been thanked: 103 times

Re: Creating a headless/monitorless install/live usb image with sshd enabled

#13 Post by arzgi »

Nice! Could you please edit the header of your first post in the thread, and prepend with [SOLVED]. So anyone browsing the forum sees it does need further activities, and if someone has a problem close to what you had, sees a possible solution.

EDIT: Perhaps you overlooked this, but Asustor has this https://www.asustor.com/admv2?type=3&sub=134

Aki
Global Moderator
Global Moderator
Posts: 4276
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 125 times
Been thanked: 576 times

Re: Creating a headless/monitorless install/live usb image with sshd enabled

#14 Post by Aki »

Hello,
syntern wrote: 2025-01-13 10:45 The following repository provided an easy to run solution that created the USB image I wanted:
https://github.com/philpagel/debian-headless
I'm glad you sorted it out and thanks for the feedback.

I'm attaching the current version of the git repository you sent to this post for future reference. It's very small.

As advised by @arzgi in the previous post, please, mark the discussion as "solved" manually adding the text tag "[Solved]" at the beginning of the subject of the first message.
Attachments
debian-headless-2025.01.14.tar.gz
(84.83 KiB) Downloaded 18 times
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

User avatar
mcdaniels
Posts: 82
Joined: 2024-05-14 13:34
Has thanked: 16 times
Been thanked: 5 times

Re: Creating a headless/monitorless install/live usb image with sshd enabled

#15 Post by mcdaniels »

as it is not marked solved (although it is solved) the TO may also have used the Debian Live Project to build his own ISO and e.g. use hooks (minimal scripts) during iso-building to install and activate the ssh-server etc.

https://www.debian.org/devel/debian-live/

Aki
Global Moderator
Global Moderator
Posts: 4276
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 125 times
Been thanked: 576 times

Re: Creating a headless/monitorless install/live usb image with sshd enabled

#16 Post by Aki »

Marked as "Solved".
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

syntern
Posts: 9
Joined: 2025-01-12 11:04

Re: Creating a headless/monitorless install/live usb image with sshd enabled

#17 Post by syntern »

mcdaniels wrote: 2025-01-15 10:40 as it is not marked solved (although it is solved) the TO may also have used the Debian Live Project to build his own ISO and e.g. use hooks (minimal scripts) during iso-building to install and activate the ssh-server etc.

https://www.debian.org/devel/debian-live/
Is there any further pointer into those hooks and minimal scripts?

eamanu
Debian Developer
Debian Developer
Posts: 38
Joined: 2020-07-12 21:37
Has thanked: 2 times
Been thanked: 3 times
Contact:

Re: [Solved] Creating a headless/monitorless install/live usb image with sshd enabled

#18 Post by eamanu »

@Best_Threads

User avatar
mcdaniels
Posts: 82
Joined: 2024-05-14 13:34
Has thanked: 16 times
Been thanked: 5 times

Re: Creating a headless/monitorless install/live usb image with sshd enabled

#19 Post by mcdaniels »

syntern wrote: 2025-01-18 21:29
mcdaniels wrote: 2025-01-15 10:40 as it is not marked solved (although it is solved) the TO may also have used the Debian Live Project to build his own ISO and e.g. use hooks (minimal scripts) during iso-building to install and activate the ssh-server etc.

https://www.debian.org/devel/debian-live/
Is there any further pointer into those hooks and minimal scripts?
You may open a separate Thread. ;-)

Post Reply