Home > Articles

This chapter is from the book

System Shutdown

  • Complete a system shutdown.

  • Interrupt a hung system.

  • Given a scenario involving a hung system, troubleshoot problems and deduce resolutions.

Solaris has been designed to run continuously—7 days a week, 24 hours a day. Occasionally, however, you need to shut down the system to carry out administrative tasks. At other times, an application might cause the system to go awry, and the operating system must be stopped to kill off runaway processes, and then be restarted.

CAUTION

Improper Shutdown Can Corrupt Data Shutting down a system improperly can result in loss of data and the risk of corrupting the file systems.

You can shut down the system in a number of ways, using various Unix commands. With Solaris, taking down the operating system in an orderly fashion is important. When the system boots, several processes are started; they must be shut down before you power off the system. In addition, information that has been cached in memory and has not yet been written to disk will be lost if it is not flushed from memory and saved to disk. The process of shutting down Solaris involves shutting down processes, flushing data from memory to the disk, and unmounting file systems.

NOTE

Protecting Against Power Loss To avoid having your system shut down improperly during a power failure, you should use an uninterruptible power supply (UPS) that is capable of shutting down the system cleanly before the power is shut off. Be sure to follow the UPS manufacturer's recommendations for maintenance to eliminate the risk of the UPS becoming the cause of an improper shutdown.

Commands to Shut Down the System

When you're preparing to shut down a system, you need to determine which of the following commands is appropriate for the system and the task at hand:

/usr/sbin/shutdown
/sbin/init
/usr/sbin/halt
/usr/sbin/reboot
/usr/sbin/poweroff
Stop+A or L1+A

The first three commands—/usr/sbin/shutdown, /sbin/init, and /usr/sbin/halt—initiate shutdown procedures, kill all running processes, write data to disk, and shut down the system software to the appropriate run level. The /usr/sbin/reboot command does all these tasks as well, and it then boots the system back to the state defined as initdefault in /etc/inittab. The /usr/sbin/poweroff command is equivalent to init state 5. The last command, which is really a series of keystrokes, stops the system unconditionally.

CAUTION

Aborting the Operating System Using the Stop+A key sequence (or L1+A) abruptly breaks execution of the operating system and should be used only as a last resort to restart the system.

The /usr/sbin/shutdown Command

You use the shutdown command to shut down a system that has multiple users. The shutdown command sends a warning message to all users who are logged in, waits for 60 seconds (by default), and then shuts down the system to single-user state. The command option -g lets you choose a different default wait time. The -i option lets you define the init state to which the system will be shut down. The default is S.

NOTE

Sending a Shutdown Message When using either shutdown or init, you might want to give users advance notice by sending an email message about any scheduled system shutdown.

The shutdown command performs a clean system shutdown, which means that all system processes and services are terminated normally, and file systems are synchronized. You need superuser privileges to use the shutdown command.

When the shutdown command is initiated, all logged-in users and all systems mounting resources receive a warning about the impending shutdown, and then they get a final message. For this reason, the shutdown command is recommended over the init command on a server with multiple users.

The proper sequence of shutting down the system is described in Step by Step 3.3

Step by Step 3.3: Shutting Down a System

  1. As superuser, type the following to find out if users are logged in to the system:

    # who
  2. A list of all logged-in users is displayed. You might want to send an email message or broadcast a message to let users know that the system is being shut down.

  3. Shut down the system by using the shutdown command:

    # shutdown -i<init-state> -g<grace-period> -y

Table 3.25 describes the options available for the shutdown command.

Table 3.25 - Options for the shutdown Command

Option

Description

-i<init-state>

Brings the system to an init state that is different from the default, S. The choices are 0, S, 1, 2, 5, and 6.

-g<grace-period>

Indicates a time (in seconds) before the system is shut down. The default is 60 seconds.

-y

Continues to shut down the system without intervention; otherwise, you are prompted to continue the shutdown process after 60 seconds. If you use the shutdown -y command, you are not prompted to continue; otherwise, you get the message Do you want to continue? (y or n).


The /sbin/init Command

You use the init command to shut down a single-user system or to change its run level. The syntax is as follows:

init <run-level>

<run-level> is any run level described in Table 3.21. In addition, <run-level> can be a, b, or c, which tells the system to process only /etc/inittab entries that have the a, b, or c run level set. These are pseudo-states, which can be defined to run certain commands but which do not cause the current run level to change. <run-level> can also be the keyword Q or q, which tells the system to reexamine the /etc/inittab file.

You can use init to place the system in power-down state (init state 0) or in single-user state (init state 1). For example, to bring the system down to run level 1 from the current run level, you type the following:

init 1

NOTE

The telinit Command The telinit command is the same as the init command. It is simply a link to the /usr/sbin/init command.

The system responds with this:

INIT: New run level: 1
Changing to state 1.
Unmounting remote filesystems: /vol nfs done.
System services are now being stopped.
Mar 14 13:13:22 unknown /usr/sbin/vold[475]: problem unmounting /vol;
Interrupted system call
Mar 14 13:13:22 unknown pseudo: pseudo-device: tod0
Mar 14 13:13:22 unknown genunix: tod0 is /pseudo/tod@0
Mar 14 13:13:22 unknown pseudo: pseudo-device: pm0
Mar 14 13:13:22 unknown genunix: pm0 is /pseudo/pm@0
Print services stopped.
Mar 14 13:13:22 unknown syslogd: going down on signal 15
Killing user processes: done.
Change to state 1 has been completed.
Type control-d to proceed with normal startup,
(or give root password for system maintenance):

As another example, say you made a change to the /etc/inittab file and you want to have the system reread /etc/inittab and implement the change. In this case, you type the following:

init q

No system messages are displayed, and the inittab file is reexamined.

The /usr/sbin/halt Command

You use the halt command when the system must be stopped immediately and it is acceptable not to warn current users. The halt command shuts down the system without delay and does not warn other users on the system of the shutdown.

The /usr/sbin/reboot Command

You use the reboot command to shut down a single-user system and bring it into multiuser state. reboot does not warn other users on the system of the shutdown.

The Solaris reboot and halt commands perform unconditional shutdown of system processes. These commands shut down the system much more quickly than the shutdown command, but they do not do so as gracefully because they do not run the kill scripts located in /etc/rc<n>.d. No messages are sent to users; although reboot and halt do not notify all logged-in users and systems mounting resources of the impending shutdown, they do synchronize file systems.

The speed of such a reboot is useful in certain circumstances, such as when you're rebooting from the single-user run state. Also, the capability to pass arguments to OpenBoot via the reboot command is useful. For example, this command reboots the system into run level s and reconfigures the device tables:

reboot -- -rs

The /usr/sbin/poweroff Command

The poweroff command is equivalent to the init 5 command. The poweroff command immediately shuts down the system, without running rc0 kill scripts. Users are not notified of the shutdown. If the hardware supports it, the poweroff command also turns off power.

NOTE

The init and shutdown Commands Using init and using shutdown are the most reliable ways to shut down a system because these commands use rc scripts to kill running processes and shut down the system with minimal data loss. The halt, poweroff, and reboot commands do not run the rc scripts properly and are not the preferred method of shutting down the system.

Stopping the System for Recovery Purposes

Occasionally, a system might not respond to the init commands described earlier in this chapter. A system that doesn't respond to anything, including reboot or halt, is called a "crashed" or "hung" system. If you try to use the commands discussed in the preceding sections but get no response, you can press Stop+A or L1+A to get back to the boot PROM. (The specific Stop key sequence depends on your keyboard type.) On terminals connected to the serial port, you can press the Break key, as described in the section "Accessing the OpenBoot Environment," earlier in this chapter.

Some OpenBoot systems provide the capability of commanding OpenBoot by means of pressing a combination of keys on the system's keyboard, referred to as a keyboard chord or key combination. These keyboard chords are described in Table 3.26. When issuing any of these commands, you press the keys immediately after turning on the power to your system, and you hold down the keys for a few seconds until the keyboard light-emitting diodes (LEDs) flash.

Table 3.26 - Keyboard Chords

Command

Description

Stop

Bypasses the POST. This command does not depend on the security mode. (Note that some systems bypass the POST as a default; in such cases, you use Stop+D to start the POST.)

Stop+A

Interrupts any program currently running and puts the system at the OpenBoot prompt, ready to accept OpenBoot PROM commands.

Stop+D

Enters diagnostic mode (sets the diag-switch? variable to true).

Stop+F

Enters Forth on the ttya port instead of probing. Uses fexit to continue with the initialization sequence. This chord is useful if hardware is broken.

Stop+N

Resets the contents of NVRAM to the default values.


To change the default abort sequence on the keyboard, you need to edit the /etc/default/kbd file. In that file, you can enable and disable keyboard abort sequences, and change the keyboard abort sequence. After modifying this file, you issue the kbd –i command to update the keyboard defaults.

NOTE

Disabling Keyboard Chords The commands in Table 3.26 are disabled if PROM security is on. Also, if your system has full security enabled, you cannot apply any of these commands unless you have the password to get to the ok prompt.

The process of breaking out of a hung system is described in Step by Step 3.4.

TIP

Interrupting a Hung System Step by Step 3.4 describes an objective that is sure to be on the exam. Make sure that you understand each step and the order in which the steps are executed.

Step by Step 3.4: Breaking Out of a Hung System

  1. Use the abort key sequence for your system (Stop+A or L1+A).

    The monitor displays the ok PROM prompt.

  2. Type the sync command to synchronize the disks:

    ok sync

    The sync procedure synchronizes the file systems and is necessary to prevent corruption to the file system.

  3. When you see the syncing file systems message, press the abort key sequence for your system again.

  4. Type the appropriate reset command to reset the hardware and start the boot process:

    ok reset
  5. After you receive the login: message, log in and type the following to verify that the system is booted to the specified run level:

    # who –r
  6. The system responds with the following:

    run-level 3 Jun 9 09:19 3  0 S

Turning Off the Power to the Hardware

Only after shutting down the file systems should you turn off the power to the hardware. You turn off power to all devices after the system is shut down. If necessary, you should also unplug the power cables. When power can be restored, you use the process described in Step by Step 3.5 to turn on the system and devices.

Step by Step 3.5: Turning Off the Power

  1. Plug in the power cables.

  2. Turn on all peripheral devices, such as disk drives, tape drives, and printers.

  3. Turn on the CPU and monitor.

Pearson IT Certification Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from Pearson IT Certification and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about Pearson IT Certification products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites; develop new products and services; conduct educational research; and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by Adobe Press. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.pearsonitcertification.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020