Cleaning up the Live Upgrade environment

In this article I will show how to cleanup the LU current and alternative boot environments without impacting the system. For an introduction to the LU process, review my post Introduction to Solaris Live Upgrade.

For the purpose of this exercise, we will use a Solarise Zone named s10 with LiveUpgrade boot environments named solenv1 and solenv2.

# lustatus
Boot Environment           Is       Active Active    Can    Copy
Name                       Complete Now    On Reboot Delete Status
-------------------------- -------- ------ --------- ------ ----------
solenv1                    yes      yes    no        no     -
solenv2                    yes      no     yes       no

From the above we see that our current active boot environment is solenv1 and the alternative boot environment solenv2. To delete the alternative boot environment, we use the ludelete command. For example:

# ludelete solenv2
System has findroot enabled GRUB
Checking if last BE on any disk...
ERROR: unable to mount zones:
/.alt.solenv2/zones/s10-solenv2 must not be group readable.
/.alt.solenv2/zones/s10-solenv2 must not be group executable.
/.alt.solenv2/zones/s10-solenv2 must not be world readable.
/.alt.solenv2/zones/s10-solenv2 must not be world executable.
could not verify zonepath /.alt.solenv2/zones/s10-solenv2 because of the above errors.
zoneadm: zone s10 failed to verify
ERROR: unable to mount zone  in 
ERROR: unmounting partially mounted boot environment file systems
ERROR: No such file or directory: error unmounting 
ERROR: cannot mount boot environment by name 
ERROR: Failed to mount BE .
ERROR: Failed to mount BE .
cat: cannot open /tmp/.lulib.luclb.dsk.13727.solenv2   
ERROR: This boot environment  is the last BE on the above disk.
ERROR: Deleting this BE may make it impossible to boot from this disk.
ERROR: However you may still boot solaris if you have BE(s) on other disks.
ERROR: You *may* have to change boot-device order in the BIOS to accomplish this.
ERROR: If you still want to delete this BE , please use the force option (-f).
Unable to delete boot environment.
# lustatus
Boot Environment           Is       Active Active    Can    Copy
Name                       Complete Now    On Reboot Delete Status
-------------------------- -------- ------ --------- ------ ----------
solenv1                    yes      yes    yes       no     -
solenv2                    yes      no     no        yes    -

If for any reason the ludelete fails, we can delete by forcing the ludelete with the -f. For example:

# ludelete -f solenv2   
System has findroot enabled GRUB
No entry for BE  in GRUB menu
Determining the devices to be marked free.
Updating boot environment configuration database.
Updating boot environment description database on all BEs.
Updating all boot environment configuration databases.
Boot environment  deleted.
# lustatus
Boot Environment           Is       Active Active    Can    Copy
Name                       Complete Now    On Reboot Delete Status
-------------------------- -------- ------ --------- ------ ----------
solenv1                    yes      yes    yes       no     -

If the above steps also fail, we can remove the configuration files with force and cleanup the LiveUpgrade environment:

# rm /etc/lu/ICF.*
# rm /etc/lu/INODE.*
/etc/lu/INODE.*: No such file or directory
# rm /etc/lu/vtoc.*
# rm /etc/lu/.??*
# rm /etc/lu/tmp/*
# rm /.alt.*
/.alt.*: No such file or directory
# rm /etc/lutab

If we now check the status, you will notice that no LU boot environments exist:

# lustatus
ERROR: No boot environments are configured on this system
ERROR: cannot determine list of all boot environment names

To recreate the solenv1 boot environment, we must create an alternate boot environment as there is no direct method of creating just a LU solenv1 environment.

# lucreate -c solenv1 -n solenv2
Checking GRUB menu...
Analyzing system configuration.
No name for solenv1 boot environment.
Current boot environment is named -solenv1-.
Creating initial configuration for primary boot environment -solenv1-.
The device -/dev/dsk/c1t0d0s0- is not a root device for any boot environment; cannot get BE ID.
PBE configuration successful: PBE name -solenv1- PBE Boot Device -/dev/dsk/c1t0d0s0-.
Comparing source boot environment -solenv1- file systems with the file
system(s) you specified for the new boot environment. Determining which
file systems should be in the new boot environment.
Updating boot environment description database on all BEs.
Updating system configuration files.
Creating configuration for boot environment -solenv2-.
Source boot environment is -solenv1-.
Creating boot environment -solenv2-.
Cloning file systems from boot environment -solenv1- to create boot environment -solenv2-.
Creating snapshot for -rpool/ROOT/root- on -rpool/ROOT/root@solenv2-.
Creating clone for -rpool/ROOT/root@solenv2- on -rpool/ROOT/solenv2-.
Setting canmount=noauto for -/- in zone -global- on -rpool/ROOT/solenv2-.
Creating snapshot for -rpool/zones/s10- on -rpool/zones/s10@solenv2-.
Creating clone for -rpool/zones/s10@solenv2- on -rpool/zones/s10-solenv2-.
WARNING: split filesystem -/- file system type -zfs- cannot inherit
mount point options --- from parent filesystem -/- file
type --- because the two file systems have different types.
Saving existing file -/boot/grub/menu.lst- in top level dataset for BE -solenv2- as -mount-point-//boot/grub/menu.lst.prev.
File -/boot/grub/menu.lst- propagation successful
Copied GRUB menu from PBE to ABE
No entry for BE -solenv2- in GRUB menu
Population of boot environment -solenv2- successful.
Creation of boot environment -solenv2- successful.

Issuing the lustatus reveals that both the solenv1 and alternative boot environments have been created:

# lustatus
Boot Environment           Is       Active Active    Can    Copy
Name                       Complete Now    On Reboot Delete Status
-------------------------- -------- ------ --------- ------ ----------
solenv1                    yes      yes    yes       no     -
solenv2                    yes      no     no        yes    -

For a complete list of maintenance tasks, see the Solaris 10 10/08 Installation Guide: Solaris Live Upgrade and Upgrade Planning. It contains step-by-step instructions on how to complete each step of the Solaris Live Upgrade process.