Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm faced with a challenge, hopefully one of you is able to help me with. From time to time, when booting a Linux machine here at work, one of the boot processes hangs leaving the machine inaccessable. A reboot is basically the only option we have then.
What we'd really like is there is a way so we can access the machine in it's hanging state so we can see what's causing it and thus resolving the issue. The hanging process is early in runlevel 3.
For the complete configuration, these are all virtual machines running WindRiver Linux 4.2 on a Red Hat Enterprise Virtualization platform.
doesnt the boot.log have that info? have you checked that?
Well, not real time info on running processes etc. Just to make things more clear, it's typically one of the init scripts that hangs, and just blocks the whole machine from continuing the boot process. The machine in itself is working. We'd like to debug it in the state it's in.
Unofrtunately, there often isn't a good way to get to a shell early in the boot process since the virtual consoles aren't brought up until getty, mingetty, or the like are spawned by init, usually at or near the end. The better option would be to figure out what service is hanging. If possible, you should put a timeout in the init script that starts it that will cause it to exit if the service has not started. This page describes the basics of how to do this within the init script. If the script is hitting some error condition though, it might be best just to test on that directly.
Unofrtunately, there often isn't a good way to get to a shell early in the boot process since the virtual consoles aren't brought up until getty, mingetty, or the like are spawned by init, usually at or near the end. The better option would be to figure out what service is hanging. If possible, you should put a timeout in the init script that starts it that will cause it to exit if the service has not started. This page describes the basics of how to do this within the init script. If the script is hitting some error condition though, it might be best just to test on that directly.
Thanks, I'll have a look at the handling timeouts in the init script. That may be quite useful anyway.
Having said that, would it be possible to make init spawn getty etc as one of the first things? Like that we could have the desired console access.
In theory it should be possible, but I'll admit that I don't know how to do it. On older init systems (pre upstart/systemd/init-flavor-of-the-week) this was controlled by lines in /etc/inittab, so I'd start there. Otherwise, consult the documentation for the init system that you happen to be using.
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233
Rep:
you COULD edit the boot entry to add init=/bin/bash to the kernel options, thiss will dump you to a bare minimum root shell (with the volumes mounted read only), from there you can run
Code:
mount -oremount rw /
to mount the / partition read/write and temporarily disable the buggy init script, or at least read the log files to see what's going wrong with the init script and modify it as necessary
note, doing this will leave the machine in a bare-bones state with no services such as networking running
Last edited by frieza; 07-05-2014 at 12:41 PM.
Reason: minimum, not minimu
you COULD edit the boot entry to add init=/bin/bash to the kernel options, thiss will dump you to a bare minimum root shell (with the volumes mounted read only), from there you can run
Code:
mount -oremount rw /
to mount the / partition read/write and temporarily disable the buggy init script, or at least read the log files to see what's going wrong with the init script and modify it as necessary
note, doing this will leave the machine in a bare-bones state with no services such as networking running
Hi,
Thanks for the tip. I tried it, but I'm afraid this is not what I'm looking for. The machine will drop into a shell straight away. But I'm looking for a possibility to get console access the moment the script is haning. So that's somewhere in runlevel 3.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.