2005-10-15 01:46:50

by Marc Perkel

[permalink] [raw]
Subject: Forcing an immediate reboot

Is there any way to force an immediate reboot as if to push the reset
button in software? Got a remote server that i need to reboot and
shutdown isn't working.


2005-10-15 01:51:09

by Lee Revell

[permalink] [raw]
Subject: Re: Forcing an immediate reboot

On Fri, 2005-10-14 at 18:46 -0700, Marc Perkel wrote:
> Is there any way to force an immediate reboot as if to push the reset
> button in software? Got a remote server that i need to reboot and
> shutdown isn't working.

If it has Oopsed, and the "reboot" command does not work, then all bets
are off - kernel memory has probably been corrupted.

Get one of those powerstrips that you can telnet into and power cycle
things remotely.

Lee

2005-10-15 01:55:43

by Randy Dunlap

[permalink] [raw]
Subject: Re: Forcing an immediate reboot

On Fri, 14 Oct 2005 18:46:46 -0700 Marc Perkel wrote:

> Is there any way to force an immediate reboot as if to push the reset
> button in software? Got a remote server that i need to reboot and
> shutdown isn't working.

What kernel version?
Does it have sysrq enabled?

If 2.6.x and Yes, then you should be able to do:
echo b > /proc/sysrq-trigger

to cause a reboot.

---
~Randy

2005-10-15 02:24:56

by Danny ter Haar

[permalink] [raw]
Subject: Re: Forcing an immediate reboot

Marc Perkel <[email protected]> wrote:
>Is there any way to force an immediate reboot as if to push the reset
>button in software? Got a remote server that i need to reboot and
>shutdown isn't working.

reboot -nf

Doesn't sync
just plain reboot


Danny

2005-10-15 06:23:22

by Willy Tarreau

[permalink] [raw]
Subject: Re: Forcing an immediate reboot

On Fri, Oct 14, 2005 at 06:46:46PM -0700, Marc Perkel wrote:
> Is there any way to force an immediate reboot as if to push the reset
> button in software? Got a remote server that i need to reboot and
> shutdown isn't working.

If you can telnet it, simply use this :

# echo 1 >/proc/sys/kernel/sysrq
# echo b >/proc/sysrq-trigger

It's dirty and you'll have an fsck. But it will nearly always work.
I use it a lot in local on distros on which the shutdown process is
as long as the boot process (you know, the ones which display lots
of 'OK' or wait indefinitely for some dead services to stop, when
you really want them to reboot quickly).

Cheers,
Willy

2005-10-15 06:47:08

by Coywolf Qi Hunt

[permalink] [raw]
Subject: Re: Forcing an immediate reboot

On 10/15/05, Lee Revell <[email protected]> wrote:
> On Fri, 2005-10-14 at 18:46 -0700, Marc Perkel wrote:
> > Is there any way to force an immediate reboot as if to push the reset
> > button in software? Got a remote server that i need to reboot and
> > shutdown isn't working.
>
> If it has Oopsed, and the "reboot" command does not work, then all bets
> are off - kernel memory has probably been corrupted.
>
> Get one of those powerstrips that you can telnet into and power cycle
> things remotely.
>

use reboot on panic.
--
Coywolf Qi Hunt
http://sosdg.org/~coywolf/

2005-10-15 06:50:34

by Coywolf Qi Hunt

[permalink] [raw]
Subject: Re: Forcing an immediate reboot

On 10/15/05, Willy Tarreau <[email protected]> wrote:
> On Fri, Oct 14, 2005 at 06:46:46PM -0700, Marc Perkel wrote:
> > Is there any way to force an immediate reboot as if to push the reset
> > button in software? Got a remote server that i need to reboot and
> > shutdown isn't working.
>
> If you can telnet it, simply use this :
>
> # echo 1 >/proc/sys/kernel/sysrq
> # echo b >/proc/sysrq-trigger
>
> It's dirty and you'll have an fsck. But it will nearly always work.

You may avoid the fsck by:

# echo s >/proc/sysrq-trigger
# echo u >/proc/sysrq-trigger

> I use it a lot in local on distros on which the shutdown process is
> as long as the boot process (you know, the ones which display lots
> of 'OK' or wait indefinitely for some dead services to stop, when
> you really want them to reboot quickly).
--
Coywolf Qi Hunt
http://sosdg.org/~coywolf/

2005-10-15 06:51:08

by Marc Perkel

[permalink] [raw]
Subject: Re: Forcing an immediate reboot



Coywolf Qi Hunt wrote:

>On 10/15/05, Lee Revell <[email protected]> wrote:
>
>
>>On Fri, 2005-10-14 at 18:46 -0700, Marc Perkel wrote:
>>
>>
>>>Is there any way to force an immediate reboot as if to push the reset
>>>button in software? Got a remote server that i need to reboot and
>>>shutdown isn't working.
>>>
>>>
>>If it has Oopsed, and the "reboot" command does not work, then all bets
>>are off - kernel memory has probably been corrupted.
>>
>>Get one of those powerstrips that you can telnet into and power cycle
>>things remotely.
>>
>>
>>
>
>use reboot on panic.
>
>

But it didn't panic. It was still running - filtering spam. But reboot
wouldn't work and I couldn't kill anything that was running. So it never
paniced.

2005-10-15 07:48:17

by Anton Altaparmakov

[permalink] [raw]
Subject: Re: Forcing an immediate reboot

On Fri, 14 Oct 2005, Lee Revell wrote:
> On Fri, 2005-10-14 at 18:46 -0700, Marc Perkel wrote:
> > Is there any way to force an immediate reboot as if to push the reset
> > button in software? Got a remote server that i need to reboot and
> > shutdown isn't working.
>
> If it has Oopsed, and the "reboot" command does not work, then all bets
> are off - kernel memory has probably been corrupted.
>
> Get one of those powerstrips that you can telnet into and power cycle
> things remotely.

If it has sysrq compiled in as root just do:

echo s > /proc/sysrq-trigger
echo u > /proc/sysre-trigger
echo s > /proc/sysrq-trigger
echo b > /proc/sysrq-trigger

This will "sync", "umount/remount read-only", "sync", "immediate hardware
reboot". Should always work...

Best regards,

Anton
--
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net
WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/

2005-10-15 07:56:32

by Coywolf Qi Hunt

[permalink] [raw]
Subject: Re: Forcing an immediate reboot

On 10/15/05, Anton Altaparmakov <[email protected]> wrote:
> On Fri, 14 Oct 2005, Lee Revell wrote:
> > On Fri, 2005-10-14 at 18:46 -0700, Marc Perkel wrote:
> > > Is there any way to force an immediate reboot as if to push the reset
> > > button in software? Got a remote server that i need to reboot and
> > > shutdown isn't working.
> >
> > If it has Oopsed, and the "reboot" command does not work, then all bets
> > are off - kernel memory has probably been corrupted.
> >
> > Get one of those powerstrips that you can telnet into and power cycle
> > things remotely.
>
> If it has sysrq compiled in as root just do:
>
> echo s > /proc/sysrq-trigger
> echo u > /proc/sysre-trigger
> echo s > /proc/sysrq-trigger

What the purpose of the second sync?

> echo b > /proc/sysrq-trigger
>
> This will "sync", "umount/remount read-only", "sync", "immediate hardware
> reboot". Should always work...
--
Coywolf Qi Hunt
http://sosdg.org/~coywolf/

2005-10-15 08:17:05

by Anton Altaparmakov

[permalink] [raw]
Subject: Re: Forcing an immediate reboot

On Sat, 15 Oct 2005, Coywolf Qi Hunt wrote:
> On 10/15/05, Anton Altaparmakov <[email protected]> wrote:
> > On Fri, 14 Oct 2005, Lee Revell wrote:
> > > On Fri, 2005-10-14 at 18:46 -0700, Marc Perkel wrote:
> > > > Is there any way to force an immediate reboot as if to push the reset
> > > > button in software? Got a remote server that i need to reboot and
> > > > shutdown isn't working.
> > >
> > > If it has Oopsed, and the "reboot" command does not work, then all bets
> > > are off - kernel memory has probably been corrupted.
> > >
> > > Get one of those powerstrips that you can telnet into and power cycle
> > > things remotely.
> >
> > If it has sysrq compiled in as root just do:
> >
> > echo s > /proc/sysrq-trigger
> > echo u > /proc/sysre-trigger
> > echo s > /proc/sysrq-trigger
>
> What the purpose of the second sync?

Allows any i/o initiated between the first sync and the remount r/o to
complete. Remember that r/o mounting doesn't stop i/o. It only stops you
from writing to the fs at the vfs layer. Once a write/modification has
entered the fs driver it will get written no matter what, unless the
"reboot" sysrq is triggered in which case the kernel just reboots
immediately.

Maybe it is just paranoia on my part but I have gotten used to hitting
Alt+PrtScr+S, +U, +S, +B so I do it automatically.

Best regards,

Anton
--
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net
WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/

2005-10-15 10:25:14

by Denis Vlasenko

[permalink] [raw]
Subject: Re: Forcing an immediate reboot

On Saturday 15 October 2005 04:46, Marc Perkel wrote:
> Is there any way to force an immediate reboot as if to push the reset
> button in software? Got a remote server that i need to reboot and
> shutdown isn't working.

See atttached
--
vda


Attachments:
(No filename) (244.00 B)
hardshutdown.c (2.55 kB)
linux_reboot.h (932.00 B)
mkdiet.sh (72.00 B)
Download all attachments

2005-10-15 13:24:13

by Damir Perisa

[permalink] [raw]
Subject: documentation? (i learned something today ;-) )

hi all,

Le Saturday 15 October 2005 09:48, Anton Altaparmakov a ?crit?:
| If it has sysrq compiled in as root just do:
|
| echo s > /proc/sysrq-trigger
| echo u > /proc/sysre-trigger
| echo s > /proc/sysrq-trigger
| echo b > /proc/sysrq-trigger
|
| This will "sync", "umount/remount read-only", "sync", "immediate
| hardware reboot". ?Should always work...

i'm impressed that i see that sysrq also works from procfs.... the
"PrintScreen/SysRq" button on my keyboard from time to time does not work
(old keyboard) and then it's pain hitting this key if you have to.

great news that you can also pass sysrq requests using proc - i've learned
something today... is this documented somewhere? maybe i'm bad in
reading/finding docs but i think i'm not the only one here. can somebody
point me to the links of docs where all this magic is specified? if not,
i will try to start my own docs on how to use the linux kernel magic.
mainly a collection of tricks like this and similar ones.

thank you in advance + greetings,
Damir

--
Customer: (angrily) "You said I would get 98 windows with this computer.
Where are they?"


Attachments:
(No filename) (1.11 kB)
(No filename) (189.00 B)
Download all attachments

2005-10-15 13:40:11

by Benoit Boissinot

[permalink] [raw]
Subject: Re: documentation? (i learned something today ;-) )

On 10/15/05, Damir Perisa <[email protected]> wrote:
> hi all,
>
> Le Saturday 15 October 2005 09:48, Anton Altaparmakov a ?crit:
> | If it has sysrq compiled in as root just do:
> |
> | echo s > /proc/sysrq-trigger
> | echo u > /proc/sysre-trigger
> | echo s > /proc/sysrq-trigger
> | echo b > /proc/sysrq-trigger
> |
> | This will "sync", "umount/remount read-only", "sync", "immediate
> | hardware reboot". Should always work...
>
> i'm impressed that i see that sysrq also works from procfs.... the
> "PrintScreen/SysRq" button on my keyboard from time to time does not work
> (old keyboard) and then it's pain hitting this key if you have to.
>
> great news that you can also pass sysrq requests using proc - i've learned
> something today... is this documented somewhere? maybe i'm bad in
> reading/finding docs but i think i'm not the only one here. can somebody
> point me to the links of docs where all this magic is specified? if not,
> i will try to start my own docs on how to use the linux kernel magic.
> mainly a collection of tricks like this and similar ones.
>
> thank you in advance + greetings,
> Damir

it is mentionned in Documentation/sysrq.txt

On all - write a character to /proc/sysrq-trigger. eg:

echo t > /proc/sysrq-trigger

regards,

Benoit

2005-10-15 14:30:37

by Marc Perkel

[permalink] [raw]
Subject: Re: Forcing an immediate reboot



Anton Altaparmakov wrote:

>On Fri, 14 Oct 2005, Lee Revell wrote:
>
>
>>On Fri, 2005-10-14 at 18:46 -0700, Marc Perkel wrote:
>>
>>
>>>Is there any way to force an immediate reboot as if to push the reset
>>>button in software? Got a remote server that i need to reboot and
>>>shutdown isn't working.
>>>
>>>
>>If it has Oopsed, and the "reboot" command does not work, then all bets
>>are off - kernel memory has probably been corrupted.
>>
>>Get one of those powerstrips that you can telnet into and power cycle
>>things remotely.
>>
>>
>
>If it has sysrq compiled in as root just do:
>
>echo s > /proc/sysrq-trigger
>echo u > /proc/sysre-trigger
>echo s > /proc/sysrq-trigger
>echo b > /proc/sysrq-trigger
>
>This will "sync", "umount/remount read-only", "sync", "immediate hardware
>reboot". Should always work...
>
>
>
>
This worked great. If I had this last night it would probably have saved
me a trip to San Jose. I especially like that it does the file system
syncs. I've put it in a script I call "coldboot" and it is now one of my
tools.

Very useful.

2005-10-15 14:53:14

by Damir Perisa

[permalink] [raw]
Subject: Documentation/files somewhere online?

thank you for the quick reply, Benoit,

Le Saturday 15 October 2005 15:40, Benoit Boissinot a ?crit?:
| On 10/15/05, Damir Perisa <[email protected]> wrote:
| > Le Saturday 15 October 2005 09:48, Anton Altaparmakov a ?crit:
| > | echo s > /proc/sysrq-trigger
| > i'm impressed that i see that sysrq also works from procfs....
|
| it is mentionned in Documentation/sysrq.txt

oh ... i definitely have to read the Documentation/files more often for
updates... last time i did, i didn't remember seeing proc magic in this
one.

is somebody keeping a online version of the kernel source docs (i mean the
Documentation/* files) somewhere for surfing? i want to point people to
pages with links without forcing them to download the sources to read
what i tell them to.

often i'm asked questions about linux in general. an updated docs pages on
the net would be helpful. of course if it does not exist, i can create
one, but why re-inventing the wheel if it is easier to give credits to
the first person who invented it and use it? ;-)

thanx + greetings,
Damir

--
The bureaucracy is expanding to meet the needs of an expanding
bureaucracy.


Attachments:
(No filename) (1.13 kB)
(No filename) (189.00 B)
Download all attachments

2005-10-15 15:02:44

by Denis Vlasenko

[permalink] [raw]
Subject: Re: Documentation/files somewhere online?

On Saturday 15 October 2005 17:52, Damir Perisa wrote:
> thank you for the quick reply, Benoit,
>
> Le Saturday 15 October 2005 15:40, Benoit Boissinot a ?crit?:
> | On 10/15/05, Damir Perisa <[email protected]> wrote:
> | > Le Saturday 15 October 2005 09:48, Anton Altaparmakov a ?crit:
> | > | echo s > /proc/sysrq-trigger
> | > i'm impressed that i see that sysrq also works from procfs....
> |
> | it is mentionned in Documentation/sysrq.txt
>
> oh ... i definitely have to read the Documentation/files more often for
> updates... last time i did, i didn't remember seeing proc magic in this
> one.
>
> is somebody keeping a online version of the kernel source docs (i mean the
> Documentation/* files) somewhere for surfing? i want to point people to
> pages with links without forcing them to download the sources to read
> what i tell them to.

http://lxr.linux.no/source/Documentation/

> often i'm asked questions about linux in general. an updated docs pages on
> the net would be helpful. of course if it does not exist, i can create
> one, but why re-inventing the wheel if it is easier to give credits to
> the first person who invented it and use it? ;-)
--
vda

2005-10-15 15:13:58

by Michael Krufky

[permalink] [raw]
Subject: Re: Documentation/files somewhere online?

Denis Vlasenko wrote:

>On Saturday 15 October 2005 17:52, Damir Perisa wrote:
>
>
>>is somebody keeping a online version of the kernel source docs (i mean the
>>Documentation/* files) somewhere for surfing? i want to point people to
>>pages with links without forcing them to download the sources to read
>>what i tell them to.
>>
>>
>http://lxr.linux.no/source/Documentation/
>
>
I think that using the -git web interface to Linus' tree on kernel.org
is even better.

The following is a link to the top-level of the kernel source tree:

http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=tree

You will notice a Documentation tree link (3rd file object link from the
top).

This will get you the most current Documentation at the moment from
Linus' tree, and it also gives you the ability to see the history of
changes.

Hope this helps.

--
Michael Krufky

2005-10-15 23:18:29

by Damir Perisa

[permalink] [raw]
Subject: Documentation/files online: available at git in webinterface

Le Saturday 15 October 2005 17:13, Michael Krufky a ?crit?:
| I think that using the -git web interface to Linus' tree on kernel.org
| is even better.

great idea...

| The following is a link to the top-level of the kernel source tree:
|
|
http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=tree

i totally forgot that git has a webinterface. how very useful! :D

| Hope this helps.

it is even better: it's the solution. thank you!

greetings,
Damir

--
Everything bows to success, even grammar.


Attachments:
(No filename) (528.00 B)
(No filename) (189.00 B)
Download all attachments

2005-10-16 00:10:40

by Petr Vandrovec

[permalink] [raw]
Subject: Re: Forcing an immediate reboot

Anton Altaparmakov wrote:
> On Sat, 15 Oct 2005, Coywolf Qi Hunt wrote:
>
>>On 10/15/05, Anton Altaparmakov <[email protected]> wrote:
>>
>>>echo s > /proc/sysrq-trigger
>>>echo u > /proc/sysre-trigger
>>>echo s > /proc/sysrq-trigger
>>
>>What the purpose of the second sync?
>
>
> Allows any i/o initiated between the first sync and the remount r/o to
> complete. Remember that r/o mounting doesn't stop i/o. It only stops you
> from writing to the fs at the vfs layer. Once a write/modification has
> entered the fs driver it will get written no matter what, unless the
> "reboot" sysrq is triggered in which case the kernel just reboots
> immediately.
>
> Maybe it is just paranoia on my part but I have gotten used to hitting
> Alt+PrtScr+S, +U, +S, +B so I do it automatically.

Second sync is a must, otherwise remounting read-only is not written to
the filesystem (at least in my case) so no fsck is saved. But you can
save first sync (before remount), and then you get nice sequence which
even admins comming from Windows can remember - they have to use USB to
safely reboot their Linux systems ;-) (alt-sysrq-U, S, B)
Petr