Running the command 'shutdown -y -g 0 -i 6' in RHEL6 resulting the system to boot to single user mode.

Solution Unverified - Updated -

Environment

  • Red Hat Enterprise Linux 6

Issue

Running the command 'shutdown -y -g 0 -i 6' in RHEL6 resulting the system to boot to single user mode

Telling INIT to go to single user mode.
init: rc main process (4483) killed by TERM signal.

Resolution

Use following command to restart the system.

# shutdown -r now

Root Cause

'shutdown -y -g 0 -i 6' is mostly used in Solaris. The command is not supposed to be run on RHEL.

What is happening to the system when it is running the command?

RHEL6 supports switch "g" for compatibility purposes. From the source code,

  /* Compatibility option for specifying time */
        { 'g', NULL, NULL, NULL, "TIME", &when, NULL },

Rest of the switches are ignored.

        /* Compatibility options, all ignored */
        { 'a', NULL, NULL, NULL, NULL, NULL, NULL },
        { 'n', NULL, NULL, NULL, NULL, NULL, NULL },
        { 'f', NULL, NULL, NULL, NULL, NULL, NULL },
        { 'F', NULL, NULL, NULL, NULL, NULL, NULL },
        { 'i', NULL, NULL, NULL, "LEVEL", NULL, NULL },
        { 't', NULL, NULL, NULL, "SECS", NULL, NULL },
        { 'y', NULL, NULL, NULL, NULL, NULL, NULL },

So the system is in effect executing following command.

# shutdown -g 0

Also if the run level is not specified, the shutdown would consider it as runlevel 1.

        /* If the runlevel wasn't given explicitly, set it to 1 so we go
         * down into single-user mode.
         */
        if (! runlevel) {
                runlevel = '1';
                init_halt = NULL;
        }

That is why the system is going to single user mode.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments