Single User mode, SSH & Networking

Hi all,

I was wondering if there was a way to make FreeBSD automatically start SSH and network service when it enters single user mode. Some of my remote servers will go into single user mode after a improper shutdown by a user or some sort of hardware failure. When it goes into single user mode i must travel to the location instead of being able to remote in.

I would like for SSH and network to work automatically in single user mode without any intervention by me or another user. Is this possible?
 
Sounds like you need to enable out-of-band management of the servers.

The "simplest" setup is to enable serial console support on the servers, and connect the serial port to another system vial null modem cable. I used to do this using old laptops. You SSH into the laptop, run tip(1) or cu(1) to open the serial connection to the server, and it's like your sitting in front of it. Everything from the loader, to the kernel, to the console (including single-user mode) works. The only thing you don't get is access to the BIOS/POST.

Depending on the motherboard in the servers, you may have access to the serial console via IPMI. Or have access to "console redirection". Both of these allow you full access to the system, including the BIOS/POST. Some motherboards (mostly Tyan?) include the option to install a daughtercard that enables IPMI support. This solution is the best, as it also enables monitoring of various services on the motherboard (temp, fans, power control, etc). Depending on the server manufacturer, this goes by various names (HP calls it ilo aka integrated lights out).

Single-user mode, by definition, exludes network support as that would allow multiple users to login. :)
 
okay

I made a simple shell script
Code:
#startup.sh
/sbin/mount -a
/sbin/fsck -y &
/etc/rc.d/netif start
/etc/rc.d/sshd start
csh
Now my issue is, someone still needs to physically start that script before I can still remote in... So how can I get single user mode and FreeBSD to automatically execute this script only when booting into single user mode?
 
Thanks for the reply Phoenix, I will take a look into that. I don't think I have enough spare computers to hook up to each location though. I made a simple script but I don't know how I can get it to just work and start automatically in single user mode. Basically, I want to be able to remote into it to view logs to see what the issue is before I go to the location and if possible get the server up if it has no issues that need a visit.



phoenix said:
Sounds like you need to enable out-of-band management of the servers.

The "simplest" setup is to enable serial console support on the servers, and connect the serial port to another system vial null modem cable. I used to do this using old laptops. You SSH into the laptop, run tip(1) or cu(1) to open the serial connection to the server, and it's like your sitting in front of it. Everything from the loader, to the kernel, to the console (including single-user mode) works. The only thing you don't get is access to the BIOS/POST.

Depending on the motherboard in the servers, you may have access to the serial console via IPMI. Or have access to "console redirection". Both of these allow you full access to the system, including the BIOS/POST. Some motherboards (mostly Tyan?) include the option to install a daughtercard that enables IPMI support. This solution is the best, as it also enables monitoring of various services on the motherboard (temp, fans, power control, etc). Depending on the server manufacturer, this goes by various names (HP calls it ilo aka integrated lights out).

Single-user mode, by definition, excludes network support as that would allow multiple users to login. :)
 
You're really looking for out of band management.

The entire point of single user mode is to get the machine to boot the absolute minimum of things for in-person diagnostics.

I guess the more pertinent question is this:
If there's nothing really wrong with your machine, why is it regularly booting up in single user mode? This is the real problem you need to fix, IMHO.

You could perhaps add the option to run fsck automatically (fsck_y_enable in rc.conf) and/or fix your power problems (in addition to LARTing the end users who are touching the box improperly)?
 
Back
Top