Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Rebooting without rebooting System
I was experiencing a number of problems one morning. Mostly applications not responding. This included the Finder and Terminal. Oddly enough, Classic still worked fine. I became fearful that my whole system was on its way down, so I thought I would try something.

I learned that the shutdown ('sudo shutdown now') command in Mac OS X does not actually bring the system down as it does in certain Linux systems I have used. Rather, it brings the system down to "single user mode." As I understand this, most everything is stopped and the system is in essence stripped down to its bare bones. To verify this, I ran top while in this state, and counted only about four (4) processes running.

Now, I just typed "exit" and the machine exitted from single user mode and the Window Server started back up. If you try this for whatever reason, you may notice that the network and other items are started back up. It seemed to fix my troubles and my system was never taken totally down. This was evident from running uptime from the terminal to see the total running time of the system has been preserved. This is also a much faster fix than a full restart.

I am not a guru in the area of the guts of this system yet, so I can't be sure of what damage I am creating or not really fixing, but so far this seems to be a more favorable fix than a full restart.

[Editor's note: Anyone have any input on the safety of this versus a full reboot into single-user mode? I believe I read somewhere that if you use "shutdown" to get into single-user mode, you should still finish with a reboot and not just an exit back to Aqua, but I can't find the reference now.]
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)

Rebooting without rebooting | 20 comments | Create New Account
Click here to return to the 'Rebooting without rebooting' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Authored by: babbage on Feb 10, '02 03:54:22PM
I'm not sure what you did, exactly, but "sudo shutdown now" does exactly that for me -- it shuts the system down now. The only variation I ever use is "sudo shutdown -r now", which reboots automatically. The closest flag I see is -k, which:
Kick every body off. The -k option does not actually halt the system, but leaves the system multi-user with logins disabled (for all but super-user).

This sounds vaguely like single-user mode, but the term isn't actually used so I'm not sure if it counts. So tell us, is this really what you executed, or was there some flag applied? Because, when doing exactly what you describe, I get the book behavior, not this single user mode you talk about...

[ Reply to This | # ]

Not here...
Authored by: robg on Feb 10, '02 04:21:27PM

On both our G4/733 and iBook 500, "sudo shutdown now" winds up at the "localhost#" single-user prompt; the machine does NOT power off.

Typing "exit" from that point launches "multi-user startup" and returns to the Aqua environment.


[ Reply to This | # ]
Not here...
Authored by: babbage on Feb 10, '02 09:04:03PM

Brainfart & apologies -- I was thinking of "shutdown -h now", which does as I described, because the -h Halts. Omitting it, which I've basically never needed to do (not that that means all that much), would drop into a kind of single user mode. My apologies for the confusion/error.

[ Reply to This | # ]
shutdown does shutdown.
Authored by: uurf on Feb 11, '02 10:16:17PM
my experience on two different machines:
sudo shutdown now 
shuts down the machine. It only drops into single user mode if the machine was placed in single user mode on startup (cmd-s on bootup).

[ Reply to This | # ]
Shutdown vs Halt
Authored by: _merlin on Feb 10, '02 05:28:14PM

Under Mac OS X, the shut down command shuts down the window server and all the daemons. The halt command shuts the system down completely. Unless you have modified your system radically, "sudo shutdown now" will in fact drop you down to single-user mode.

The reason people discourage the use of this command is that it rather rudely kills GUI applications. They don't get a chance to clean up, save preferences, etc. It's perfectly OK to execute it if you're logged in on the console (>console with no password at the login prompt).

And there's no harm in using exit to return to multi-user mode. It's almost as good as a reboot. The only difference is your VM files won't be deleted and re-created.

[ Reply to This | # ]
Shutdown vs Halt
Authored by: thatch on Feb 10, '02 06:21:41PM

sudo shutdown now has always worked for me and does give me single user mode. But one observation recently is that after exit, the system really stalls at initializing network from roughly 10 to 30 seconds. My normal startup doesn't do that but slightly stalls at configuring network, getting network time and starting firewall. Maybe that's just on my machine, G4 867, 896 Ram, OS 10.1.2.

[ Reply to This | # ]
Different on Linux?
Authored by: macmike42 on Feb 10, '02 06:58:45PM

On both of my Linux boxes, this behaviour is basically the same as the described behaviour of OS X. "shutdown" will "shut down" all the processes running on the machine, leaving me with a root password prompt for single user mode. "halt" will "halt" the machine, effectively shutting down the hardware. Finally, "reboot" does just what it says.

In Linux however, (not sure about OS X, read yer man pages!) the safe way to do this is always with the shutdown command. "shutdown -h <time>" for halt, "shutdown -r <time>" for reboot, and just plain "shutdown <time>" for single user mode.

Incidentally, on my beige G3, "shutdown" results in the computer nearly instantly powering off. Forget fsck on HFS+, I'll stick with using my DiskWarrior startup CD thanks very much ;-)

[ Reply to This | # ]
Different on Linux?
Authored by: 128K Mac on Feb 11, '02 02:02:25AM

Amen MacMike42. It just happens, by coincidence, that OSX is most commonly found residing on HFS+ for which DiskWarrior was created.

The fact that it (presently) must run in a Classic/OS9 environment does not mean it isn't tricked out to fix what ails OSX when it's on HFS+ volumes. DW just happens to be a little "new" to assorted Linux and Unix geeks (still in the process of migration). ;)

Look for a DW OS X "version" happening in the near future. It will be carbonized and run in the OS X environment but according to Al Whipple, Mac guru and head of Alsoft, it won't otherwise do a thing the present DW 2.1 doesn't do.

[ Reply to This | # ]
run levels
Authored by: forero on Feb 11, '02 09:13:41AM

Most UNIX-like systems utilize the concept of run levels. In my department we use run-level 3 as fully up and 0 as single user mode. In fact, run level 0 is universally single user mode. It's the other levels that change from system to system. There is nothing harmful in putting your system in run level 0.

What can cause damage is 'halting' your system. There is a good chance of file corruption if you halt your system. There are procedures for halting that will help prevent file corruption, but then why not just shutdown properly.

On most UNIX-like systems inittab manages the run levels, telling the system what to run at different run levels. Mac OS X seems to have two run levels and these are controlled by the rc.* files in /etc.
In short, if you want to restart but don’t want it to adversely affect your ‘up-time’, then going to run level 0 is a good option. Almost everything will be shutdown and restarted when you exit back into run level 1.

[ Reply to This | # ]
run levels
Authored by: Anonymous on Feb 11, '02 12:49:47PM

Runlevels are a System V (Sys V, Linux, Solaris, SCO, etc) feature. BSD does not utilize this concept of runlevels.

A little background if you didn't know, there are basically two main lineages of UNIX: System V and BSD. There are actually several major differences between each style.

[ Reply to This | # ]
run levels
Authored by: WillyT on Feb 12, '02 11:32:14AM
Found this in the FreeBSD Handbook p.148 quote 7.5.2 Single-User Mode ... It can Also be reached by calling shutdown without the reboot (-r) or halt (-h) options, from multi-user mode. ... 7.5.3 Multi-User Mode If init finds your filesystems to be in order, or once the user has finished in single-user mode, the system enters multi-user mode, in which it starts the resource configuration of the system. endquote There are also boot levels but these are NOT the same thing. There are hundreds of pages to this manual. The manual is available from The FreeBSD Project

[ Reply to This | # ]
Shutdown triggers sleep mode problem?
Authored by: evancm on Feb 11, '02 01:02:07PM

I have an iBook and tried this trick from Terminal last night, mainly because I was curious about what the display looks like in single user mode.

Logged in as root, I did a "shutdown now", and when I was done playing around in single-user mode, I "exit"ed the shell, and watched most of the bootup process occur.

I logged back in, viewed a couple of web pages, shut the lid to my iBook, and went to bed.

When I got up in the morning, the iBook would not wake (despite an AC connection and a full battery). I also noticed that the sleep light was not pulsating.

I haven't seen this happen before (I've had the iBook since November), so I can only assume that doing this "soft reboot" somehow screwed up the part of the system that handles the iBook's sleep mode.

[ Reply to This | # ]
Re: Shutdown triggers sleep mode problem?
Authored by: beastie on Feb 11, '02 08:08:46PM

Can you please confirm you discoverings by repeating the "shutdown now" trick on your iBook again?

I'm curious to know...

P.S. I hope it cannot cause any hardware damage...

[ Reply to This | # ]
Re: Shutdown triggers sleep mode problem?
Authored by: aranor on Feb 11, '02 10:07:09PM

I've done the shutdown now trick (Before it was posted) on my first gen iBook before with no harmful consequences. It may have been something unrelated that caused this problem.

[ Reply to This | # ]
Shutdown triggers sleep mode problem?
Authored by: Guiyon on Feb 13, '02 08:20:13AM

My iBook has started doing this within the last month or two (never used the shutdown command). Tries to go to sleep and crashes. Can't really get any support for it as it is very random. As for the shutdown command, i tested it on my Sawtooth G4 and it does drop me into Single-User mode. I have not noticed any problems with it.

[ Reply to This | # ]
Shutdown triggers sleep mode problem?-advice for those troubled with the sleep problem.
Authored by: Anonymous on Mar 02, '02 10:46:10PM

I had similar trouble with my TiBook (look under Apple Discussion Forums for "sleep of death". I called Apple support and a very helpful support person talked me through some weird-key combination rebootings and specific typed commands, etc. which fixed it.
He also suggested if it came back to clean up the perferences in:
by moving the folder to the Desktop, rebooting, and adding preferences one by one sort of like debugging extensions in Classic.
I'm guessing that one reason this problem is random is that some sort of preference from some application (3rd party?) doesn't get put in the right state during shutdown procedure, which gives the sleep problem. In the Apple forums, people with USB devices and desktops have also had this trouble.
Good luck.

[ Reply to This | # ]
Authored by: Loren on Feb 15, '02 10:49:08AM

As was mentioned earlier, this is not the cleanest way to reboot your system.

As a last resort, if you are hung, it's great. But, I was dumb and chose to demonstrate to a friend how cool I could be by rebooting my machine remotely.

Well, I guess my computer was in the middle of writing the stickies database when it rebooted, because after coming back up all my sticky notes were gone (about 50 of them) and I just had the default "how to use stickies" ones. :-(


[ Reply to This | # ]
This is very bad (Try this)
Authored by: sungwoo on Feb 16, '02 06:45:06PM

Once you do 'sudo shutdown now' and return to Aqua using 'exit', you will see very funny thing.
Check your vm file with 'ls -al /var/vm'.
There is no swapfile at all, and surely your system going strangely.
Isn't this amazing? I've experienced almost every time when I try 'exit' from 'shutdown'.
What I think is, the 'shutdown' and 'exit' to restart is NOT safe way at all.
Anyone can confirm this is a bug or not?

[ Reply to This | # ]
Rebooting without rebooting
Authored by: uochris on Mar 03, '03 05:49:10PM

How do you shutdown after booting in to single user mode and get the computer to actually shutdown. When I boot in to single user mode and run shutdown now, it starts the process but after some error messages I get put back to the # prompt. I can do a reboot and it restarts the machine but I need to be able to turn the computer off from the command line when booted into single user mode. I'd like to be able to verify that the machine recognizes newly installed RAM without having to go to the whole welcome movie and registration process on new machines.

[ Reply to This | # ]
Rebooting without rebooting
Authored by: ScottSO on Nov 26, '03 09:49:43AM
The '-h' option should tell shutdown to turn the machine off.

prompt% shutdown now -h

It may be "-h now" I can't remember what the order is.

[ Reply to This | # ]