LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware > Slackware - Installation
User Name
Password
Slackware - Installation This forum is for the discussion of installation issues with Slackware.

Notices


Reply
  Search this Thread
Old 04-27-2015, 06:07 PM   #1
slack_please
LQ Newbie
 
Registered: Apr 2015
Posts: 2

Rep: Reputation: Disabled
SW 14.1 headless install using pxe & ssh


Before I go into what I'm planning, here's a little background on me since this is my first post. I consider myself an intermediate level linux user. I used Ubuntu desktop exclusively for about 5 years before the introduction of Unity. In that time period, I also flirted with other distros, mainly lightweight ones (dsl, slax, puppy, mint, lbuntu, etc etc). I'll also admit that (unfortunately) the last few years have been spent mainly in front of Windows thanks to work and personal projects requiring Adobe products. So forgive me if I'm a bit rusty.

About 2 years ago, I re-purposed an HP laptop with a horribly busted up screen into a nice, headless Ubuntu media server. And it worked great! I won't go into all the specifics, but as a local network server it fulfilled it's purpose very well.

Well, now after much deliberation, I've decided it's time to upgrade to make the server more useful. Ubuntu server is just too bloated. Also, I want to add some internet-facing features, like linking the server to dyndns or no-ip for external access. I may also use it as a test webserver for a few personal projects. Since security will be a concern, Slackware came to mind. But mainly I want to do this because I like the challenge of building a completely custom server without all the fluff and Slackware seems like a good candidate.

Now the real issue:
Since this laptop is essentially headless (screen isn't particularly useful in it's current state and I have NO plans of spending ~$170 for a replacement lcd) my options for install are limited.
When I installed the Ubuntu server, I used the (very outdated) JEOSS distro to control the install over ssh from another computer. I then used APT to upgrade until it was at the current release for the time. I can only imagine the amount of bloat this added to the OS. I would like to avoid a similarly ham-handed method if possible.
I can use a vga cable to plug the laptop up to another monitor (on boot, Fn+F7 I think) to access the BIOS, but this isn't feasible as a permanent solution for installation due to the external monitor being huge and very far away from the router (the server's final home).

So, here's what I would like to attempt:
1)Plug server-laptop to external monitor, access server-laptop's BIOS, set boot order - #1 Network boot
2)Disconnect server-laptop from external monitor, move to permanent home near router and connect ethernet.
3)On my other PC, boot Slackware 14.1 installation, use "pxesetup" option, configure and activate PXE server.
4)Back at the server-laptop, boot it up, it detects my PXE server and the bootstrapping process begins.
5)The server-laptop bootstraps using a modified pxelinux.cfg_default with the keyboard layout and network interface questions already appended. This allows the installer to skip those questions and start the dropbear ssh server.
6)Back at the other computer, I ssh to the laptop-server and control the install. :)

Steps 1-4, no problem. Where I'm foggy is steps 5 & 6. I'm not sure exactly WHERE to append the "kbd=us nic=auto:eth0:dhcp" into the pxelinux.cfg_default. Does it matter which line? Also, I would like to run the PXE server on the same computer that I'll be using ssh to access the installation. Is it possible to run the PXE server inside, say VirtualBox, so that I can still use Putty simultaneously to ssh into the installation process? Using 3 computers (1 for the actual server to be installed, 1 for the pxe server, and 1 to ssh and actually control the installation) seems incredibly wasteful and tedious.

If anyone could review my process here and make sure I'm thinking about this correctly that would extremely helpful. Any advice, suggestions, insights on making this process smooth(er) are greatly appreciated!

Also, I've been using these as references:
http://docs.slackware.com/slackware:pxe_install
http://alien.slackbook.org/blog/remo...are-using-ssh/
 
Old 04-27-2015, 09:44 PM   #2
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,063

Rep: Reputation: Disabled
Hi and welcome to this forum.

Actually I think that step #5 and 6 are unnecessary now (in recent Slackware versions).

It has been a long time since I made the last PXE install but here is what I remember:

Once your PXE server is running on the machine with a display, connected via an Ethernet cable to the headless one (with the fimware set up for PXE booting): boot the headless machine and you will see the messages on the other one as if you were installing on it.

Then proceed to installation. This don't have to be automated as you will answer the questions from the machine with a display. So you can set the keyboard layout and network as usual. Assuming that your headless machine will be allocated an IP by the DHCP server of the other machine, when asked how you want to set up you connection just choose DHCP.


Then, still during the CONFIGURE step when asked which service you want to run at startup, of course you'll need SSH so you can remotely control the machine: It is up by default so just accept that.

Of course you'll need to set up SSH in the headless system before rebooting so that it accepts connections from the network: I have no experience doing that so you'll have to rely on other people's answers for that.

EDIT sorry it seems that I was full wrong. I'll try to gather the accurate information and provide it, unless someone gives you the right procedure before I do that.

Last edited by Didier Spaier; 04-28-2015 at 01:21 AM. Reason: EDIT added.
 
1 members found this post helpful.
Old 04-28-2015, 02:46 AM   #3
slack_please
LQ Newbie
 
Registered: Apr 2015
Posts: 2

Original Poster
Rep: Reputation: Disabled
Didier,

Thanks for the response. Even if it's wrong, I appreciate the effort.

Today was mostly research day. Tomorrow, I'll actually attempt the install. I'll be sure to post the results of my attempt: running the PXE server inside VirtualBox on my Windows 7 laptop, getting server to boot through said PXE, then (hopefully) accessing the install with ssh (Putty) on the same Win7 laptop. I can't find a good reason why it wouldn't work in theory, other than possibly some networking-related catch involving running the Slackware ISO on a VM.

If the install is successful, I'll do a detailed write up for those who might be interested. Headless installs are tricky.
 
Old 04-28-2015, 05:31 AM   #4
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,063

Rep: Reputation: Disabled
OK, I think that I understand now how it's expected to work.

Shame on me, although I feel at home in Slackware's installer (I obviously needed that to start the Slint project) I never knew what dropbear was for, neither actually noticed that a drobear daemon was started at boot by /etc/rc.d/rc.S...

But as we say here "à quelque chose malheur est bon" I learned something today thanks to your question.

So a few explanations first.

When the installer starts, usually it launches /etc/rc.d/rc.S (a specific startup script only used in the installer, aka /isolinux/initrd.img) that initializes the system in RAM, then through a dialog asks the user if she wants to load an alternate keyboard map, but only if it can't find "kbd=" in the command line.

Of course at that point in time you won't be able to see the question let alone answer, that's why you are advised to append "kbd=us" to the command line *before* starting the installer. This can simply be done editing the file /isolinux/isolinux.cfg in the Slackware tree.

But in addition it seems that now, although the "options.h" file from drobear be patched to accept an empty password, that doesn't suffice in Slackware 14.1

For that reason you'll have to unpack the installer, then edit the file /etc/shadow in it as explained in this post (see the last code snippet) by Stuart Winter aka drmozes.

So here are the steps needed to prepare the installer. I assume that you'll do that running Slackware 14.1:
  • Get a local copy of the Slackware file tree of Slackware 14.1. Either use rsync for instance, or just mount the ISO to copy its content somehwere, say as /tmp/slackware-14.1
  • Edit /tmp/slackware-14.1/isolinux/isolinx.cfg the file whose location is indicated in my next post to append "kbd=us nic=auto:eth0:dhcp" to the line for hugesmp.s.
  • Unpack the initrd as root, edit /etc/shadow then re-pack the initrd as advised in drmozes'post, sligthly modified below:
    Code:
    cd /tmp/slackware-14.1/isolinux
    mkdir q; cd q
    zcat ../initrd.img | cpio -di
    sed -i 's?^root:.*?root:joFWnPF2bJhPc:0:0:::::?g' etc/shadow
    find . | cpio -o -H newc | gzip -9fv > ../initrd.img
    cd ..
    rm -r q
  • Make an ISO image with the modified tree. For instance:
    Code:
    cd /tmp/slackware-14.1
    mkisofs -o /tmp/slackware-14.1-modified.iso \
    -R -J -A "Slackware Install" \
    -hide-rr-moved \
    -v -d -N \
    -no-emul-boot -boot-load-size 4 -boot-info-table \
    -sort isolinux/iso.sort \
    -b isolinux/isolinux.bin \
    -c isolinux/isolinux.boot \
    -m 'source' \
    -V "SlackDVD" .
    cd /tmp
    # Then if you want to want to put the ISO image on an USB stick using the dd command 
    isohybrid -s 63 -h 80 /tmp/slackware-14.1-modified.iso
  • You should then be able to use the ISO image to install Slackware through PXE and ssh. You should be able to get to the installer through ssh as soon as /etc/rc.d/rc.S has ended. I didn't try, tell us if that works and feel free to ask if anything is unclear.
I append /etc/rc.d/rc.S taken from Slackware 14.1's installer (in /isolinux/initrd.img) for your information, renamed as necessary to upload it here.

PS I think that the installer will get connected without any specific setting of the network card, as long as your DHCP server grants a lease to the installer.

PPS
Quote:
I'm not sure exactly WHERE to append the "kbd=us nic=auto:eth0:dhcp" into the pxelinux.cfg_default.
As you can see above you'll have to do that in /tmp/slackware-14.1/syslinux/isolinux.cfg, not in pxelinux.cfg_default See which file to edit in my next post. I chose to do that in the stanza for hugesmp.s as that's the kernel that is loaded by default after a delay of 2 min. Of course that assumes that you have a DHCP server running in your local network.

PPPS If I am still wrong, blame me. Else thank Eric Hameleers aka AlienBOB for his post, and having provided the PXE stuff in the installer.
Attached Files
File Type: txt rc.S.txt (7.4 KB, 20 views)

Last edited by Didier Spaier; 04-28-2015 at 05:00 PM. Reason: Location of the file is in my next post.
 
Old 04-28-2015, 04:51 PM   #5
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,063

Rep: Reputation: Disabled
Re-reading what you wrote I am afraid I don't really understand what you plan to do.

Basically, and usage of a VM put aside for simplicity, here's the typical use case for PXE + SSH as I understand it:
Code:
-----------------------                   -----------------------------
| Machine A           |                   | Machine B (headless)      |
| PXE server          |                   |                           |
| Slackware installer |                   | Transmitted installer     |
| DHCP server         |<=================>| SSH server (dropbear)     |
| TFTP server         |  Ethernet cable   | Target hard disk          |
-----------------------                   -----------------------------
    keyboard
     screen

 Boot the installer
 Operator runs "pxesetup"
 => DHCP starts
 => TFTP starts
 => PXE starts
                                           Switch on (net boot)
 Machine A boots machine B                          
                                           Installer starts after 2 min
                                           Machine B gets a DHCP lease from machine A
                                           SSH daemon starts
 SSH login to machine B as root          
 Operator runs ". /etc/profile"           
 Operator runs "setup"                   
 Operator controls installation            Installation
This is assuming that you use the PXE server built in the installer.

In that case the pxelinux configuration file that you will have to edit is written during execution of pxesetup and will be /var/lib/tftpboot/pxelinux.cfg/default.

If instead you use the stuff in /usb-and-pxe-installers, modify the file pxe.cfg_default in that directory then follow instructions in README_PXE.TXT, still in the same directory.

Last edited by Didier Spaier; 05-11-2015 at 11:17 AM. Reason: minor changes
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to open Java application on headless server through SSH -X. What do I need? martdj Linux - Server 6 03-02-2015 11:31 AM
[SOLVED] Need help with install by pxe on a headless machine mago Slackware 6 03-25-2011 11:59 PM
How to SSH into initramfs on headless SliTaz server penyuan Linux - Server 2 03-14-2011 06:19 AM
vwware esx 4 pxe installation on headless sever Bhagyesh Linux - Virtualization and Cloud 3 01-02-2011 01:33 PM
ssh into headless server Trio3b Linux - Server 5 01-24-2010 10:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware > Slackware - Installation

All times are GMT -5. The time now is 01:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration