Managing ZFS File Systems in Oracle® Solaris 11.2

Exit Print View

Updated: December 2014
 
 

Booting For Recovery Purposes in a ZFS Root Environment

Use the following procedure if you need to boot the system so that you can recover from a lost root password or similar problem.

How to Boot the System For Recovery Purposes

Use the procedure below to resolve a corrupt bootloader problem or a root password problem. If you need to replace a disk in root pool, see How to Replace a Disk in a ZFS Root Pool (SPARC or x86/VTOC). If you need to perform complete system (bare metal) recovery, see Using Unified Archives for System Recovery and Cloning in Oracle Solaris 11.2 .

  1. Select the appropriate boot method:
    • x86: Live Media – Boot from the installation media and use a GNOME terminal for the recovery procedure.

    • SPARC: Text installation – Boot from the install media or from the network, and select option 3 Shell from the text installation screen.

    • x86: Text installation – From the GRUB menu, select the Text Installer and command line boot entry, then select the option 3 Shell from the text installation screen.

    • SPARC: Automated installation – Use the following command to boot directly from an installation menu that allows you to exit to a shell.

      ok boot net:dhcp
    • x86: Automated installation – Booting from an install server on the network requires a PXE boot. Select the Text Installer and command line entry from the GRUB menu. Then, select the option 3 Shell from the text installation screen.

    For example, after the system is booted, select option 3 Shell.

            1  Install Oracle Solaris
    2  Install Additional Drivers
    3  Shell
    4  Terminal type (currently xterm)
    5  Reboot
    
    Please enter a number [1]: 3
    To return to the main menu, exit the shell
    #
  2. Select the boot recovery problem:
    • Resolve a bad root shell by booting the system to single-user mode and correcting the shell entry in the /etc/passwd file.

      On an x86 system, edit the selected boot entry and add the –s option.

      For example, on a SPARC system, shut down the system and boot to single-mode. After you log in as root, edit the /etc/passwd file, and fix the root shell entry.

      # init 0
      ok boot -s
      Boot device: /pci@7c0/pci@0/pci@1/pci@0,2/LSILogic,sas@2/disk@0,0:a ...
      SunOS Release 5.11 Version 11.2 64-bit
      Copyright (c) 1983, 2013, Oracle and/or its affiliates. All rights reserved.
      Booting to milestone "milestone/single-user:default".
      Hostname: tardis.central
      Requesting System Maintenance Mode
      SINGLE USER MODE
      
      Enter user name for system maintenance (control-d to bypass): root
      Enter root password (control-d to bypass): xxxx
      single-user privilege assigned to root on /dev/console.
      Entering System Maintenance Mode
      
      Aug  3 15:46:21 su: 'su root' succeeded for root on /dev/console
      Oracle Corporation      SunOS 5.11      11.2    July 2013
      su: No shell /usr/bin/mybash.  Trying fallback shell /sbin/sh.
      root@tardis.central:~# TERM =vt100; export TERM
      root@tardis.central:~# vi /etc/passwd
      root@tardis.central:~# <Press control-d>
      logout
      svc.startd: Returning to milestone all.
    • Resolve a corrupt bootloader problem.

      First, you must boot from media or the network by using one of the boot methods listed in step 1. Then, import the root pool and fix a GRUB entry, for example.

      x86# zpool import -f rpool

      Reinstall the bootloader.

      x86# bootadm install-bootloader -f -P rpool

      where the –f option forces the installation of the boot loader and bypasses any versioning checks for not downgrading the version of the boot loader on the system. The –P option is used to specify the root pool.

      You can the use the bootadm list-menu command to list and modify GRUB2 entries. For more information, see bootadm (1M) .

      Exit and reboot the system.

      x86# exit
      1  Install Oracle Solaris
      2  Install Additional Drivers
      3  Shell
      4  Terminal type (currently sun-color)
      5  Reboot
      
      Please enter a number [1]: 5

      Confirm that the system boots successfully.

    • Resolve an unknown root password that prevents you from logging into the system.

      First, you must boot from media or the network by using one of the boot methods listed in step 1. Then, import the root pool (rpool) and mount the BE to remove the root password entry. This process is identical on SPARC and x86 platforms.

      # zpool import -f rpool
      # beadm list
      be_find_current_be: failed to find current BE name
      be_find_current_be: failed to find current BE name
      BE        Active Mountpoint Space  Policy Created
      --        ------ ---------- -----  ------ -------
      solaris   -      -          46.95M static 2012-07-20 10:25
      solaris-2 R      -          3.81G  static 2012-07-19 13:44
      # mkdir /a
      # beadm mount solaris-2 /a
      # TERM=vt100
      # export TERM
      # cd /a/etc
      # vi shadow
      <Carefully remove the unknown password>
      # cd /
      # beadm umount solaris-2
      # halt

      Go to the next step to set the root password.

  3. Set the root password by booting to single-user mode and setting the password.

    This step assumes that you have removed an unknown root password in the previous step.

    On an x86 based system, edit the selected boot entry and add the –s option.

    On a SPARC based system, boot the system to single-user mode, log in as root, and set the root password. For example:

    ok boot -s
    Boot device: /pci@7c0/pci@0/pci@1/pci@0,2/LSILogic,sas@2/disk@0,0:a ...
    SunOS Release 5.11 Version 11.2 64-bit
    Copyright (c) 1983, 2013, Oracle and/or its affiliates. All rights reserved
    Booting to milestone "milestone/single-user:default".
    
    Enter user name for system maintenance (control-d to bypass): root
    Enter root password (control-d to bypass): <Press return>
    single-user privilege assigned to root on /dev/console.
    Entering System Maintenance Mode
    
    Jul 20 14:09:59 su: 'su root' succeeded for root on /dev/console
    Oracle Corporation      SunOS 5.11      11.2    July 2013
    root@tardis.central:~# passwd -r files root
    New Password: xxxxxx
    Re-enter new Password: xxxxxx
    passwd: password successfully changed for root
    root@tardis.central:~# <Press control-d>
    logout
    svc.startd: Returning to milestone all.