Some situations require a modified system configuration of your computer. 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. At any rate, restoring the original system configuration should be easy and the modification of the system configuration can be reproduced.
Up to the present, this problem had only been solved for PCMCIA hardware for which various configurations could be stored in distinct profiles. This approach has been further refined with the development of SCPM (System Configuration Profile Management), obsoleting the restriction to PCMCIA hardware. With SCPM, any desired part of the system configuration can be kept in a customized profile. This is like taking a snapshot of the system then being able to restore it at any point in time.
SCPM's main field of application 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 separate X server configuration for the video beamer at conferences, special power-saving settings for the road, or the differing time zone in the agency abroad.
Increasing use of this tool leads to the continuous discovery of new requirements. Feel free to contact us and share your thoughts and ideas about SCPM. SCPM is based on a flexible framework in an effort to allow even server-based profile management. Send your wishes, inspirations, and error descriptions via our web front-end at http://www.suse.de/feedback/.
The following are some terms used in SCPM documentation and in the YaST module.
The term system configuration refers to the complete configuration of the computer. It covers all fundamental settings, like use of partitions, network settings, time zone selection, and keyboard mappings.
A profile, also called configuration profile, is a state that has been preserved and can be restored at any time.
Active profile refers to the profile last selected. This does not mean that the current system configuration corresponds exactly to this profile, because the configuration can be customized at any time.
A resource in the SCPM context is an element that contributes to the system configuration. This can be a file or a softlink including its metadata, like user, permissions, or access time. This can also be a system service that runs in this profile, but is deactivated in another one.
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 about the configuration files of the desired service. SCPM ships with a selection of preconfigured resource groups that should be sufficient for most scenarios.
A YaST module (package yast2-profile-manager) is a graphical front-end to SCPM that provides an alternative to the command line front-end. Because the functionality of both front-ends is substantially the same and the knowledge of the command line front-end is useful in many cases, only the latter is described here. Differences between the YaST front-end and the command line tool are mentioned wherever appropriate.
Refer to the info pages of SCPM for the most recent documentation. Read these with tools like Konqueror (with the command konqueror info:scpm) or emacs. On the console, use info or pinfo. Technical information is provided at /usr/share/doc/package/scpm. Running scpm without any arguments returns a command option summary.
SCPM must be activated before use. By default, SCPM handles network and printer settings as well as the XFree86 configuration. If you need to manage special services or configuration files, activate appropriate 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. Activate or deactivate a group with scpm activate_group NAME or scpm deactivate_group NAME. Replace NAME with the relevant group name. All the resource groups can also be configured with the YaST profile manager.
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.
A profile named default already exists after SCPM has been activated. Get a list of all available profiles with scpm list. This only 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. These modifications are then stored in the active profile with scpm reload. The profile default can be used, renamed, or deleted.
There are two possibilities 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. Sometimes the system configuration was modified for special purposes that should be kept in 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 x. For example, to rename work to project use scpm rename work project. Delete project with scpm delete project. The active profile cannot be deleted.
The YaST module only offers anbutton. Pressing it opens a dialog in which to select whether an existing profile should be copied or the current system configuration should be saved. Use for renaming.
The command scpm switch work switches to another profile (the profile work, in this case). Switch to the active profile to save modified settings of the system configuration. Alternatively, use scpm reload to do this.
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 the switch command with the -r parameter: scpm switch -r work.
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 (e.g., configuration files) are written, and the system services are restarted.
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 instance, 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:
prior to stopping services when leaving the profile
after stopping services when leaving the profile
prior to starting services when activating the profile
after starting services when activating the profiles
Switching from profile work to profile home thus proceeds as follows:
The prestop action of the profile work is executed.
The services are stopped.
The poststop action of the profile work is executed.
The system configuration is changed.
The prestart action of the profile home is executed.
The services are started.
The poststart action of the profile home is executed.
Attach 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 call must be made to an executable — scripts must refer to the correct interpreter and must be executable at least for the superuser.
Query all additional settings entered with set with get. The command scpm get poststart, for instance, returns the name of the poststart call or simply nothing if nothing has been attached.
Reset such settings by overwriting with "". This means that 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.
These scripts or programs should not be modifiable by any user because they are executed with the rights of the superuser. It is recommended to make scripts only readable to the superuser because they can contain sensitive information. It is best to provide these programs with the permissions -rwx------ root root with the commands chmod 700 variablefilename and chown root.root <filename>.
It is possible to select a profile during the boot process by providing the boot parameter PROFILE=<name-of-the-profile> at the boot prompt. In the boot loader configuration (/boot/grub/menu.lst), the option title reflects the name of the profile. For example:
Example 8.1. The File /boot/grub/menu.lst
gfxmenu (hd0,5)/boot/message color white/green black/light-gray default 0 timeout 8 title work kernel (hd0,5)/boot/vmlinuz root=/dev/hda6 PROFILE=work initrd (hd0,5)/boot/initrd title home kernel (hd0,5)/boot/vmlinuz root=/dev/hda6 PROFILE=home initrd (hd0,5)/boot/initrd title road kernel (hd0,5)/boot/vmlinuz root=/dev/hda6 PROFILE=road initrd (hd0,5)/boot/initrd
For systems that use LILO as the boot loader, refer to File 8.2. “File /etc/lilo.conf” as an example. Then you can select the desired profile at the boot prompt.
Example 8.2. File /etc/lilo.conf
boot = /dev/hda change-rules reset read-only menu-scheme = Wg:kw:Wg:Wg prompt timeout = 80 message = /boot/message image = /boot/vmlinuz label = home root = /dev/hda6 initrd = /boot/initrd append = "vga=0x317 hde=ide-scsi PROFILE=home" image = /boot/vmlinuz label = work root = /dev/hda6 initrd = /boot/initrd append = "vga=0x317 hde=ide-scsi PROFILE=work" image = /boot/vmlinuz label = road root = /dev/hda6 initrd = /boot/initrd append = "vga=0x317 hde=ide-scsi PROFILE=road"
In most cases, SCPM should function smoothly. There are, however, some pitfalls, which are described here.
SCPM is currently not able to survive a system update. The difficulty lies in the fact that, with a system update, the data stored in the profiles is not cleanly updated by the automatic mechanisms. SCPM then detects a system update and refuses to work. In this situation, you should get an error message from SCPM that contains your operating system installation changed/is unknown, read man page! In this case, reinitialize SCPM with scpm -f enbale. Your profiles, however, will be lost and you must reconfigure them.
It can also sometimes occur that SCPM stops working during a switch procedure. This may be caused by some outside effect, such as a user abort, a power fault, another similar problem, or even an error in SCPM itself. In this case, an error message saying 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 solve this issue, delete the lock file with rm /var/lib/scpm/#LOCK then update your database with scpm -s reload. After this procedure, proceed as usual.
There is no real problem with changing the resource group configuration of an already initialized SCPM. However, you must run scpm rebuild after adding or deleting groups. This adds new resources to all profiles and removes the deleted ones. The deleted ones are then lost to the system. If there are different configurations for the same resource in different profiles, the deletion of resources might cause serious problems. The current profile, which is not touched by SCPM, will not be affected. If you reconfigure your system with YaST, the rebuild is handled by YaST.