My thoughts on Slackware, life and everything

Remote installation of Slackware using ssh

When you are installing Slackware, you have several options of using the network. Your packages can be on a NFS, HTTP, FTP or SaMBa server. But it still requires you do be physically present behind the keyboard of the computer you are installing Slackware on.

Or does it?

There is a way to make the installer launch an embedded SSH server automatically. Once that SSH server is running,  you can do a remote login to this machine and install Slackware.

I hear you say, “why would I want to install Slackware over a ssh session at all”? Well, this feature is particularly important for people who need to install Slackware on a headless server – think of a server in a data center. You still need to boot the Slackware installer of course, but you do not need a DVD for that. If you have a PXE server, you can boot the installer over the network and never have to visit your computer “in the flesh”.

If you are familiar with Slackware’s installation, you know that you have to answer a few questions before you can start with a network installation. At a minimum, you need to

  • configure your keyboard layout, and
  • the configuration of your network card.

For these to be configured automatically, you must provide the installer with the answers. If both answers are known, then the installer can configure your network card with an IP address and start the embedded SSH server (Slackware uses dropbear as the SSH server). You can then do a remote login as root (no password will be asked! Be sure that your network is secure before you attempt this).

After you have logged on to the dropbear SSH server (you must know what IP address your to-be-installed computer has been configured with of course) you can remotely start Slackware’s “setup” (but first you have to run the command “. /etc/profile” – watch the dot! – which initializes the environment so that the setup utilities become available).

Burning question: how do you tell the installer the answers to the above two questions?

I am assuming you are booting the installer from the network, using a PXE server. Now, let’s assume your keyboard layout is “us“, your network interface is called “eth0” and you have a DHCP server in your network. Then, you need to change the “pxelinux.cfg/default” file like this:  add the following string to the “append” line for your boot kernel:

kbd=us nic=auto:eth0:dhcp

If instead, you want to use a static IP address of “192.168.0.11/255.255.255.0” (i.e. a netmask of 24 bits) the appended string becomes:

kbd=us nic=auto:eth0:static:192.168.0.11:24

Slackware’s installer uses udev for automatic hardware initialization and configuration. If you don’t want to use udev but want to determine yourself what module to load then this would be the appended string (I also added a default gateway of “192.168.0.254” to the mix):

noudev kbd=us nic=e1000:eth0:static:192.168.0.11:24:192.168.0.254

The generic notation for the kbd= and nic= parameters is:

kbd=<keyboard_layout>
nic=<driver>:<interface>:<dhcp|static>[:ipaddr:netmask[:gateway]
]

If your installer uses udev (the installer of Slackware 13.0 and later uses udev by default, earlier versions of Slackware did not have udev in the installer) then the “<driver>” string can be “auto”. Without the use of udev, the “<driver>” must be an actual kernel module for your card, like “e1000” in my example above.

I’d like to hear if you ever used or wanted to use this somewhat hidden feature of the installer!

Eric

Note: If you do a “normal” Slackware installation and want to start the dropbear SSH server manually after configuring the network card, you can do this. Just run:

/etc/rc.d/rc.dropbear start


8 Comments

  1. slava_dp

    Thanks so much for this information. This is truly a hidden (deeply hidden!) gem of the slackware installer. I’ve asked in ##slackware a couple of times in the past but was told that i had to rebuild the installer with ssh support or never got a clear answer at all. now what you wrote is really beatiful and simple. So thank you 🙂

  2. delebru

    This is great! I was thinking about doing this with a PC on a data center but is there some way to change remotely the BIOS boot sequence? Because it has network boot disabled…

  3. seb

    Thanks for these great tips! I have had to install Slackware 13.37 on an headless machine, and they have been very useful.

    The only little problem I encountered was the fact the machine was not accessible through PXE. So, I’ve had to hack the Slackware default installer in order to start automatically the SSH daemon.

    To do that, I’ve put my script in a custom ramdisk archive I’ve then appended to the “initrd” one in isolinux.cfg. This way allows to not really hack the initrd, so it can be easily reproduced from install to install.

    Sadly, the Slackware installer does not look for potential custom init scripts, so the only room to put it is in /etc/profile.d, which implies to make it unexecutable after its first execution (otherwise “. /etc/profile” break the SSH session). It would be cool to have a proper room to do that (rc.local or rc.custom, created according to the will of the user) 🙂

  4. seb

    Oops… sorry for the multi-post. The capchka reported me errors and I didn’t see my message has been properly posted…

  5. Tim

    http://www.linuxquestions.org/questions/slackware-installation-40/remote-installation-of-a-slackware-linux-453953/#post4667070

    Thanks. Applied your post to the above process, installing now.

    Cheers,

  6. jjthomas

    Although the computers are on top of each other, installing via the command line lets me copy and past from the README_CRYPT.TXT. Makes for an easier installation.

  7. Abdullah ÜLKER

    Slackware 13.0 pxe install Dokument.
    Türkçe 🙂

    http://www.slackware.org.tr/index.php?option=com_content&task=view&id=93&Itemid=10

    Enjoy 🙂

  8. marcin z

    If you are doing this for slackware 14.1 then you should change /etc/shadow form within inside of initrd.img and change the password for root. Without this you cannot login as root as empty password is not supported in newest shell

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

© 2024 Alien Pastures

Theme by Anders NorenUp ↑