Sync Sync Halt

Urbana used to work with a guy who routinely shut down GNU/Linux by typing:

sync
sync
halt

That just sounded plain crazy. Why not use shutdown? Well, we just figured he was just a little old-school. The command appeared to work (manpage for sync, manpage for halt).

Now, our robocoop is running a giagd system, based on uClibc to run the chicken cam. It is supposed to be really hot today, so Agatha wanted to shut down the system so it didn’t bake to much. What did she find with the default uClibc development filesystem snapshot?

u-1@srv-1 u-1 $ ssh root@crackers
[root@crackers root]# shutdown -h now
-sh: shutdown: command not found
[root@crackers root]# sync
[root@crackers root]# sync
[root@crackers root]# halt
[root@crackers root]# Connection to crackers closed by remote host.
Connection to crackers closed.
u-1@srv-1 u-1 $

The crazy old UNIX guy wasn’t so crazy after all. There is a lot of chatter about sync sync halt in the news groups. Dennis Ritchie posted:

From: Dennis Ritchie (dmr_AT_bell-labs.com)
Subject: Re: why sync twice?" (was Re: PDP-11 emulation and Unix v7)
Newsgroups: alt.folklore.computers
Date: 1999/05/12
markh_AT_usai.asiainfo.com (and previous askers of the question) wrote:
> 
> Sarr J. Blumson  wrote:
> : Just run "sync" twice and shut if off IIRC.  fsck would run when you rebooted,
> : but it wouldn't find any problems and the disks were small...
> 
> I was always curious why the unix manuals would always recomment
>         "sync; sync; halt"
> 
> My mentor of sorts (this was in 1984) had worked on the Nixdorf
> unix port and said it was unnecessary.  "If you don't trust it
> the first time, what makes you think it's going to work the
> second time?"
> 
> Anything I missed?
If you actually typed "sync; sync; halt" then I can see the possible
timing issue.  However, if you were told to type "sync" and then do it
again, this had to do with giving you a chance to ponder whether
you remembered to do it at all the first time.
Dennis