how to access fsck through serial console

Hi,

I am looking for a solution to administer my remote server running SUSE LINUX 10.1 (X86-64) - Kernel 2.6.16.13-4-smp. I have made changes to server and is able to see the boot process and also able to login to system through serial console.

My question, will I be able to administer the server through serial console incase if my root partition is corrupted and system has gone to maintenance shell(or root shell).

Also is there way to go directly to maintenance shell from grub(not talking about single user mode). I want to go maintenance shell where / partition is not mounted.

Please help me out here.

~Bency

I don’t think it’s possible to administer the server remotely unless it’s connected to the network (and single user mode would disconnect it from the network).
I think if you pass “emergency” (without the quotes) to init on startup it takes you directly to a root shell. I have not tried this however. I think the way to pass arguments to init is via the line at the bottom of the screen on startup.

Never mind about passing emergency to init. It mounts the / partition (and all the other ones) and then takes you to a root shell. It just doesn’t run any startup scripts.
Check the init man page for anything I might have missed.

Camper,

My server is connected to the network,also the serial console from the server is connected to another node in the network.

Here’s the problem. During booting, If say the root filesystem needs a --rebuild-tree that requires manual intervention, the system will drop down to a maintenance shell to permit corrective action. Although I could see this happen in the serial console, I am not able to get keyboard access, because the TTY is not running yet. Is this possible ?

I tried booting with “emergency” option, it logged into a shell with / partition being mounted. I want to go into the maintenance shell where the / partition is not mounted.

~Bency

touch /forcefsck

reboot

Also:
Utility disks exist which can help, handy because all your partitions are unmounted this way

Hi,

Thanks for the suggestion.

I tried ‘/forcefsck’ option, this would force an fsck check once the fsck finishes it boots to the default runlevel. What I need is the option to go to the maintenance shell, where the system would drop down when there is an issue with /root partition. Is this possible ?

~Bency

As you are using a Enterprise product and not openSUSE, have you posted a question here:
SUSE Linux Enterprise Server (SLES) - NOVELL FORUMS

You would need the Install media, which would have a rescue mode, but the same can be done from most live distros or like Parted Magic

OK thanks. I was thinking it was possible to get the maintenance shell from command line, by specifiying somekind of runlevel. thanks for the clarification.

One more question, have you had any experience with running fsck for root partition from serial console

~Bency

Sorry no I haven’t.

OK. Let me know if you come across any sites or threads related to this.

You say: serial console. Can you elaborate on that? When a terminal is connected to a asynchronous (COM) port, it can be made a console. You can the get the GRUB boot menu there and also the whole startup sequence can be dircted there. This also caters for being console when problems arrive and you fall back to recvovery mode.

What do you have over there?

I know I have seen initramfs using ash as an emergency shell that didn’t have the / partition mounted. However, I have only seen this with Ubuntu (it’s the only disto I have ever broken to that degree) and don’t know how to invoke it.
I think it called itself BusyBox

HCW,
I am able to access the serial console and select from grub menu, my requirement is tht I shuld be able to login to the server through serial console in order to do an fsck for root partition(i.e., when the system goes to recovery/emergency shell where the init script is not started)

Bency

I believe that if you have selected serial console in the kernel, then all interaction will be via the serial port so you can do the normal console things on it. This should not be dependent on whether the rootfs is mounted or not. Why not confirm this yourself by testing in a VirtualBox VM?

I think he wants to do this remotely. ie not physically present at the box. Which I don’t think you can do. But not sure I know what he means by Serial console. In order to do this you need to be at run level 1 but there are no network drivers installed at that level. Though I guess you could configure it to load the network and some form of remote.

By serial console I think he means those pre-Ethernet serial ports that you will still find on computers. I assume he’s already set it up for serial console access. If not I suspect he may need a custom kernel to do this, serial console may not be part of the default kernel.

When serial console is in effect, all boot messages go to this serial port, and it’s also the first console. GRUB can also talk to the serial port, and this has to be arranged separately since when GRUB is running, the kernel is not.

Yes I need to do this remotely, based on the below article I have setup my server and I am able to access the console through serial port.
Linux Serial Console HOWTO

My question, with this setup will I be able to access server through serial console(no physical access) to do fsck --rebuildtree on a root partition, I think system drops down to emergency shell inorder to do this

Hope this helps

Thanks in advance

As I have already written, the serial capability is provided by the kernel and the initrd. So it shouldn’t matter that the rootfs isn’t mounted at that point. But as I already wrote you should test it out on a VM or a real machine.

The problem here is that if the file system of root is messed you may not even be able to boot at all. ie the kernel may be unaccessible. Which means you still will need to load a CD or other boot device. Also though fschk will correct the files system there is no guarantee that all the files will get restored. Those that don’t will end up in Lost&Found, usually in pieces. Depending on the files and directories affected you may still have an unusable system after a serious file system misshape on root. And you will need to reinstall or restore from backup. Luckily this does not happen often and usually can be a sign of disk failure or power supply problems.