Managing System Configuration Profiles with SCPM

Jana Jaeger

work in progress

$Revision: 303 $

$Date: 2007-07-09 14:00:04 +0200 (Mo, 09 Jul 2007) $

Abstract

With the help of SCPM (system configuration profile management), adapt the configuration of your computer to different operating environments or hardware configurations. SCPM manages a set of system profiles for the different scenarios. It enables easy switching between system profiles, eliminating the need for manually reconfiguring the system.

Some situations require a modified system configuration. This would mostly be the case for mobile computers that are operated in varying locations. If a desktop system should be operated temporarily using other hardware components than usual, SCPM comes in handy. Restoring the original system configuration should be easy and the modification of the system configuration can be reproduced. With SCPM, any part of the system configuration can be kept in a customized profile.

The main field of application of SCPM is network configuration on laptops. Different network configurations often require different settings of other services, such as e-mail or proxies. Then other elements follow, like different printers at home and at the office, a customized X server configuration for the multimedia projector at conferences, special power-saving settings for the road, or a different time zone at an overseas subsidiary.

Terminology

The following are some terms used in SCPM documentation and in the YaST module.

system configuration

The complete configuration of the computer. It covers all fundamental settings, such as the use of hard disk partitions, network settings, time zone selection, and keyboard mappings.

profile or system profile

A state that has been preserved and can be restored at any time.

active profile

The profile last selected. This does not mean that the current system configuration corresponds exactly to this profile, because the configuration can be modified at any time.

resource

An element that contributes to the system configuration. This can be a file or a softlink including metadata (like the user), permissions, or access time. This can also be a system service that runs in this profile, but is deactivated in another one.

resource group

Every resource belongs to a certain resource group. These groups contain all resources that logically belong together—most groups would contain both a service and its configuration files. It is very easy to assemble resources managed by SCPM because this does not require any knowledge of the configuration files of the desired service. SCPM ships with a selection of preconfigured resource groups that should be sufficient for most scenarios.

Setting Up SCPM

The following sections introduce SCPM configuration by means of a real life example: a mobile computer that is run in several different networks. The major challenges faced in this scenario are:

  • Varying network environments, like wireless LAN at home and an ethernet at work

  • Different printer configuration at home and at work

To get SCPM up and running and have it manage your changing system configuration, proceed as follows:

  1. Add the Profile Chooser applet to your panel and configure it to allow user switching as described in the section called “Configuring the Profile Chooser Panel Applet”.

  2. Configure SCPM using the YaST Profile Manager module as described in the section called “Configuring Basic SCPM Settings”.

  3. Create a profile for each of the different setups using SUMF (SCPM Unified Management Front-End) as described in the section called “Creating a New Profile”.

  4. Switch to the profile appropriate for your current situation as described in the section called “Switching Profiles”.

If you prefer to control SCPM with its command line interface, refer to the section called “Configuring SCPM Using the Command Line” for details.

Configuring SCPM Using a Graphical User Interface

The following sections introduce the graphical tools used for controlling your profile settings.

Configuring the Profile Chooser Panel Applet

Before you can use Profile Chooser to control your system configuration, configure it to be started automatically on login:

  • In GNOME, right-click the panel and select Profile Chooser from the list of available applets.

  • In KDE, select System -> Desktop Applet -> Profile Chooser to add Profile Chooser to your panel.

Configuring Basic SCPM Settings

Configure the basic behavior of SCPM through YaST.

  1. Start YaST from the main menu and select the YaST Profile Manager.

  2. In System Configuration Profile Management, click Options and select Enabled.

  3. Determine how verbose SCPM should be by selecting any or both of Verbose Progress Messages and Log Debug Messages.

  4. Determine the appropriate switch mode for your setup:

    • Should SCPM list any changed resource when switching to another profile and save these changes to the active profile? Select Normal or Save Changes.

    • Should SCPM drop any changed resource configuration when switching? Select Drop Changes.

  5. Set the boot mode and determine whether changes to the current profile should be saved or discarded with profile switching triggered at boot time.

  6. Make sure that all resource groups needed are covered by the active selection, displayed in the Resource Groups section. If you need additional resource groups, adjust the resources with Configure Resources. For details, refer to the section called “Configuring Resource Groups”.

    For the example scenario, you do not need to configure additional resources, because printer and network resources are included by default.

Figure 4.1. YaST: Basic SCPM Configuration

YaST: Basic SCPM Configuration

To allow users other than root to manage profiles, proceed as follows:

  1. Start YaST from the main menu and select the YaST Profile Manager.

  2. Check Permit non-root Users to Manage Profiles. See Figure 4.2, “YaST: Configure SCPM Users”.

  3. Click Configure.

  4. Click Add to add any user who should be able to manage profiles.

  5. For each user, specify whether to grant switch permissions only or whether this user should be allowed to switch, modify, and create profiles.

  6. Click Finish to apply your settings and close YaST.

Figure 4.2. YaST: Configure SCPM Users

YaST: Configure SCPM Users

Creating a New Profile

After you have enabled SCPM, you have a profile named default that contains your current system configuration. Create another profile that matches the requirements of the other setup.

To add a new profile based on the current system configuration, proceed as follows:

  1. Right-click the Profile Chooser and select Run Profile Manager (SUMF).

  2. Select Profiles -> Add.

  3. Enter the name of the new profile and click OK.

  4. Determine whether the new profile should be the active profile.

    If you selected Yes, SCPM switches to the new profile immediately after it has been created.

For this example, do the following:

  1. In your home setup, enable SCPM.

  2. Rename the default profile to a more descriptive name by starting SUMF and selecting Profiles -> Edit and entering the new name.

  3. In your setup at work, start SUMF and create the profile for your system environment at work.

Once you have all desired profiles, you are ready to switch to them whenever a different system setup is required. Switching profiles is described in the section called “Switching Profiles”.

Switching Profiles

There are two ways to switch profiles. You can either select a new profile at boot or switch profiles in the running system.

To select a profile at boot, press F3 in the boot screen to access the list of profiles available and use the arrow keys to select the appropriate profile and hit Enter. The system boots into the configuration selected.

To switch profiles in a running system, proceed as follows:

  1. Make sure that you are allowed to switch profiles as a non-root user. If you are not allowed to do so, refer to the section called “Configuring Basic SCPM Settings”.

  2. Left-click the Profile Chooser panel applet.

  3. Select the desired profile in the menu that opens using the arrow keys and hit Enter. SCPM runs a check for modified resources and prompts you for a confirmation of the switch. If changes have been made to the system configuration before the switch, select whether to keep them or discard them when switching to another profile.

Editing a Profile

To adjust existing profiles to a changed environment, for example, if you want to change the printer configuration of your home network, proceed as follows:

  1. Switch to the profile to adjust as described in the section called “Switching Profiles”. In this example, you would choose the home profile.

  2. Change the resources that need to be adjusted using the appropriate YaST module. In this example, run the YaST printer configuration.

  3. After the configuration changes have been applied and you request a profile switch, SCPM asks whether these changes should be permanently applied to the formerly active profile.

    [Tip]Forcing a Profile Update

    If you want to force an update of the active profile, click the profile in the profile selection menu of the Profile Chooser panel applet. This triggers a reload of your profile and you are asked whether to apply the configuration changes or discard them.

Configuring Resource Groups

SCPM comes with a set of predefined resource groups that are included in any profile by default. However, some scenarios require the inclusion of additional resources and resource groups.

To change the resource configuration, proceed as follows:

  1. Start YaST from the main menu and start the YaST Profile Manager module.

  2. In the System Configuration Profile Management dialog, click Configure in the Resource Groups part of the dialog.

    All resource groups available on your system are listed as shown in Figure 4.3, “Configuring Resource Groups”.

  3. To add or edit a resource group:

    1. Set or edit Resource Group and Description.

    2. Enter the appropriate resources (resources, services, or both) and delete those that are not needed. To reset the status of the selected resources—discard any changes made to them and return to the initial configuration values—choose Reset Group.

    3. Click OK to leave the resource configuration.

  4. Click OK to save your changes to the active profile.

Figure 4.3. Configuring Resource Groups

Configuring Resource Groups

Configuring SCPM Using the Command Line

This section introduces the command line configuration of SCPM. Learn how to start it, configure it, and work with profiles.

Starting SCPM and Defining Resource Groups

SCPM must be activated before use. Activate SCPM with scpm enable. When run for the first time, SCPM is initialized, which takes a few seconds. Deactivate SCPM with scpm disable at any time to prevent the unintentional switching of profiles. A subsequent reactivation simply resumes the initialization.

By default, SCPM handles network and printer settings as well as the X.Org configuration. To manage special services or configuration files, activate the respective resource groups. To list the predefined resource groups, use scpm list_groups. To see only the groups already activated, use scpm list_groups -a. Issue these commands as root on the command line.

scpm list_groups -a

nis                 Network Information Service client
mail                Mail subsystem
ntpd                Network Time Protocol daemon
xf86                X Server settings
autofs              Automounter service
network             Basic network settings
printer             Printer settings

Activate or deactivate a group with scpm activate_group NAME or scpm deactivate_group NAME. Replace NAME with the relevant group name.

Creating and Managing Profiles

A profile named default already exists after SCPM has been activated. Get a list of all available profiles with scpm list. This one existing profile is also the active one, which can be verified with scpm active. The profile default is a basic configuration from which the other profiles are derived. For this reason, all settings that should be identical in all profiles should be made first. Then store these modifications in the active profile with scpm reload. The default profile can be copied and renamed as the basis for new profiles.

There are two ways to add a new profile. If the new profile (named work here) should be based on the profile default, create it with scpm copy default work. The command scpm switch work changes into the new profile, which can then be modified. You may want to modify the system configuration for special purposes and save the changes to a new profile. The command scpm add work creates a new profile by saving the current system configuration in the profile work and marking it as active. Running scpm reload then saves changes to the profile work.

Rename or delete profiles with the commands scpm rename x y and scpm delete z. For example, to rename work to project, enter scpm rename work project. To delete project, enter scpm delete project. The active profile cannot be deleted.

Switching Configuration Profiles

The command scpm switch work switches to another profile (the profile work, in this case). Switch to the active profile to include modified settings of the system configuration in the profile. This corresponds to the command scpm reload.

When switching profiles, SCPM first checks which resources of the active profile have been modified. It then queries whether the modification of each resource should be added to the active profile or dropped. If you prefer a separate listing of the resources (as in former versions of SCPM), use switch with the -r parameter: scpm switch -r work.

scpm switch -r work

Checking for modified resources 
Checking for Resources to be started/shut down 
Checking for dependencies 
Restoring profile default 

SCPM then compares the current system configuration with the profile to which to switch. In this phase, SCPM evaluates which system services need to be stopped or restarted due to mutual dependencies or to reflect the changes in configuration. This is like a partial system reboot that concerns only a small part of the system while the rest continues operating without change. It is only at this point that the system services are stopped, all modified resources, such as configuration files, are written, and the system services are restarted.

Advanced Profile Settings

You can enter a description for every profile that is displayed with scpm list. For the active profile, set it with scpm set description "text". Provide the name of the profile for inactive profiles, for example, scpm set description "text" work. Sometimes it might be desirable to perform additional actions not provided by SCPM while switching profiles. Attach up to four executables for each profile. They are invoked at different stages of the switching process. These stages are referred to as:

prestop

Run prior to stopping services when leaving the profile

poststop

Run after stopping services when leaving the profile

prestart

Run prior to starting services when activating the profile

poststart

Run after starting services when activating the profiles

Insert these actions with the command set by entering scpm set prestop filename, scpm set poststop filename, scpm set prestart filename, or scpm set poststart filename. The scripts must be executable and refer to the correct interpreter.

[Warning]Integrating a Custom Script

Additional scripts to be executed by SCPM must be made readable and executable for the superuser (root). Access to these files must be blocked for all other users. Enter the commands chmod 700 filename and chown root:root filename to give root exclusive permissions to the files.

Query all additional settings entered with set with get. The command scpm get poststart, for example, returns the name of the poststart call or simply nothing if nothing has been attached. Reset such settings by overwriting with "". The command scpm set prestop "" removes the attached prestop program.

All set and get commands can be applied to an arbitrary profile in the same manner as comments are added. For example, scpm get prestop filename work or scpm get prestop work.

Troubleshooting

This section covers frequent problems encountered with SCPM. Learn how they can arise and how you can solve these issues.

SCPM and NetworkManager

NetworkManager and SCPM share functionality. Both integrate a machine into an existing network, hiding this transaction from the user. NetworkManager works dynamically and adapts to any new environment. SCPM is used to restore defined system setups.

Using NetworkManager and SCPM in parallel does not work properly, because NetworkManager does not provide configurations that can be restored by SCPM. SCPM works exceedingly well for anyone who needs reproducible setups. Any private user constantly switching networks should consider using NetworkManager if network setup is the only component that needs to be adjusted. If you want to use SCPM to manage your system configuration but NetworkManager to manage networking, remove the network resource from SCPM. If you want to use SCPM for network configuration management, disable NetworkManager.

Termination During the Switch Process

Sometimes SCPM stops working during a switch procedure. This may be caused by some outside effect, such as a user abort, a power failure, or even an error in SCPM itself. If this happens, an error message stating SCPM is locked appears the next time you start SCPM. This is for system safety, because the data stored in its database may differ from the state of the system. To resolve this issue, run scpm recover. SCPM performs all missing operations of the previous run. You can also run scpm recover -b, which tries to undo all already performed operations of the previous run. If you are using the YaST profile manager, get a recover dialog on start-up that offers to perform the commands described above.

For More Information

The latest documentation is available in the SCPM info pages (info scpm). Information for developers is available in /usr/share/doc/packages/scpm.