LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   shutting down after init=/bin/bash (https://www.linuxquestions.org/questions/linux-general-1/shutting-down-after-init%3D-bin-bash-440509/)

michapma 05-01-2006 07:34 AM

shutting down after init=/bin/bash
 
Hi all,

Today I decided to upgrade my Testing version of Debian, which I haven't used in a while. I haven't figured out how to give sudo rights for APT to non-root members yet (irrelevant), and I forgot the root password. It's written down somewhere I don't have easy access to today, so I decided to try something I'd never done before and change it. I followed Google here:
http://aplawrence.com/Linux/lostlinuxpassword.html

I used init=/bin/bash with GRUB and mounted / and also /usr (to get passwd). When I wanted to shut down I also found I needed to mount /var. No problem, but I finally got an error message I couldn't get past:
Code:

# shutdown -h now
shutdown: timeout opening/writing control channel /dev/initctl
init: timeout opening/writing control channel /dev/initctl

I got the same error whether I used "init 0" or "init 6".

I also tried mounting more partitions, but nothing worked. I consulted a printed Linux manual and looked at my /etc/inittab, which was fairly opaque, and finally just used CtlAltDel, which worked.

After searching for a bit on Google the discussions I find on initctl are not very clear to me. I understand that init starts all other processes and I understand from the linked article that by specifying init=/bin/bash to the kernel argument it "dumps me to a bash prompt much earlier than single user mode." I'm not sure, however, what the /dev/initctl is about.

According to this LQ post, I need to init(ialize) init, but that still doesn't tell me what initctl is. Does anyone have a reasonably dumbed-down article for me to read, or care to quickly explain it?

Thanks,
Mike

bulliver 05-01-2006 10:18 AM

This bit:
Quote:

init/telinit always assumes it is already running on root filesystem. /dev/initctl is a FIFO that init listens to. When you ask init/telinit to let's say switch runlevels for example, it is fed to init via this FIFO. So if init isnt already running using the *same* root filesystem, nobody is at the other end of the pipe to pickup this information. Hope that explains the timeout.
from this thread:
http://www.linuxquestions.org/questi...ad.php?t=39056

seems to be germain to your situation.

ioerror 05-02-2006 04:15 AM

By the way, when you do init=/bin/sh (or bash), it isn't strictly necessary to reboot afterwards (well, depending on what you change I suppose), you can just do an 'exec /sbin/init' to continue the boot process. Make sure the state of the system is as it would normally be though (e.g. umount /usr, make / readonly again etc).

bts145 12-21-2015 05:13 AM

First you must activate the magic SysRq option:

echo 1 > /proc/sys/kernel/sysrq

When you are ready to reboot the machine simply run the following:

echo b > /proc/sysrq-trigger


http://www.linuxjournal.com/content/rebooting-magic-way

Habitual 12-21-2015 08:56 AM

Quote:

Originally Posted by bts145 (Post 5467092)
First you must activate the magic SysRq option:

echo 1 > /proc/sys/kernel/sysrq

When you are ready to reboot the machine simply run the following:

echo b > /proc/sysrq-trigger


http://www.linuxjournal.com/content/rebooting-magic-way

09 year old necropost. ;(

Double-Secret Probation!

jovanmal 10-28-2017 07:16 PM

Quote:

Originally Posted by ioerror (Post 2226991)
By the way, when you do init=/bin/sh (or bash), it isn't strictly necessary to reboot afterwards (well, depending on what you change I suppose), you can just do an 'exec /sbin/init' to continue the boot process. Make sure the state of the system is as it would normally be though (e.g. umount /usr, make / readonly again etc).

I had exactly same problem and your tip worked for me

Thank you ioerror


Quote:

Originally Posted by Habitual (Post 5467169)
09 year old necropost. ;(

This is still current command on most Linux distros. I dont see the problem with posting after so many years, if problematics is actual. I recently had the same problem

Cheers


All times are GMT -5. The time now is 03:21 AM.