The ksysv Handbook

The ksysv Handbook

The ksysv Handbook

Peter Putzer

Revision 1.03.06

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".

ksysv is a graphical editor for the SysV style init configuration.


Chapter 1. Introduction

Introduction

Chapter 1. Introduction

Welcome to the KDE System V Init Editor, commonly known (and hereafter referenced) as ksysv. This section introduces a few concepts and explains what you can do with ksysv.

KDE Logo
Chapter 2. A Brief Description of System V Init

A Brief Description of System V Init

Chapter 2. A Brief Description of System V Init

The following explanation is ‘borrowed’ from tksysv (an inspiration for ksysv):

System V init is fast becoming the standard in the Linux® world to control the startup of software at boot time. This is because it is arguably easier to use and more powerful and flexible than the traditional BSD init.

I won't go into the history here (mainly because I don't know it :-).

The init binary is located in /sbin and not /etc. This is important as one might try and upgrade a machine to System V init without re-installing and reformatting. The Linux® kernel looks in /etc for its init first, so you must make sure and delete your old init from there if any.

SysV init also differs from BSD init in that the config files are in a subdirectory of /etc instead of residing directly in /etc. This directory is called rc.d. In there you will find rc.sysinit and the following directories:

  • init.d/

  • rc0.d/

  • rc1.d/

  • rc2.d/

  • rc3.d/

  • rc4.d/

  • rc5.d/

  • rc6.d

init.d contains a bunch of scripts. Basically, you need one script for each service you may need to start at boot time or when entering another runlevel. Services include things like networking, NFS, sendmail®, httpd,etc. Services do not include things like setserial that must only be run once and then exited. Things like that should go in the file rc.local.

rc.local should be in /etc/rc.d if you want one. Most systems include one even though it doesn't do much. You can also include an rc.serial in /etc/rc.d if you need to do serial port specific things at boot time.

The chain of events is as follows:

  1. The kernel looks in several places for init and runs the first one it finds.

  2. init runs /etc/rc.d/rc.sysinit.

  3. rc.sysinit does a bunch of necessary things and then runs rc.serial (if it exists)

  4. init runs rc.local

  5. init runs all the scripts for the default runlevel

The default runlevel is decided in /etc/inittab. You should have a line close to the top like:

id:3:initdefault:

From this, you'd look in the second column and see that the default runlevel is 3, as should be the case for most systems. If you want to change it, you can edit /etc/inittab by hand and change the 3. Be very careful when you are messing with the inittab. If you do mess up, you can get in to fix it by rebooting and doing:

LILO boot: linux single

This should allow you to boot into single user mode so you can fix it.

Now, how does it run all the right scripts? If you do an ls -l on rc3.d, you might see something like:

lrwxrwxrwx 1 root root 13 13:11 S10network -> ../init.d/network 
lrwxrwxrwx 1 root root 16 13:11 S30syslog -> ../init.d/syslog 
lrwxrwxrwx 1 root root 14 13:32 S40cron -> ../init.d/cron
lrwxrwxrwx 1 root root 14 13:11 S50inet -> ../init.d/inet
lrwxrwxrwx 1 root root 13 13:11 S60nfs -> ../init.d/nfs
lrwxrwxrwx 1 root root 15 13:11 S70nfsfs -> ../init.d/nfsfs
lrwxrwxrwx 1 root root 18 13:11 S75keytable -> ../init.d/keytable
lrwxrwxrwx 1 root root 23 13:11 S80sendmail -> ../init.d/sendmail.init
lrwxrwxrwx 1 root root 18 13:11 S90lpd -> ../init.d/lpd.init
lrwxrwxrwx 1 root root 11 13:11 S99local -> ../rc.local

What you'll notice is that there are no real files in the directory. Everything there is a link to one of the scripts in the init.d directory.

The links also have an S and a number at the beginning. The S means to start this particular script and a K would mean to stop it. The number is just there for ordering purposes. Init will start all the services based on the order they appear. You can duplicate numbers, but it will only confuse you somewhat. You just need to use a two digit number only, along with an upper case S or K to start or stop the services you need to.

How does it start and stop services? Simple. Each of the scripts is written to accept an argument which can be start and stop. You can execute those scripts by hand in fact with a command like:

/etc/rc.d/init.d/httpd.init stop

To stop the httpd server. Init just reads the name and if it has a K, it calls the script with the stop argument. If it has an S it calls the script with a start argument.

Why All These Runlevels ?

Some people want an easy way to setup machines to be multi-purpose. I could have a “server” runlevel that just runs httpd, sendmail, networking, etc. Then I could have a “user” runlevel that runs kdm, networking, etc.

KDE Logo
Chapter 3. Onscreen Fundamentals

Onscreen Fundamentals

Chapter 3. Onscreen Fundamentals

Here you learn how to use ksysv, which shouldn't be hard since it was designed to be as user-friendly as possible.

Mouse

Using ksysv with a mouse or other pointing device is easy: just drag an entry from the Available Services area onto one of the six runlevels to start (or resp. stop) it in that runlevel.

You can also move scripts between runlevels, or change the position in a given runlevel, by dragging it around. Doing so removes the entry from its original runlevel (or position). This doesn't happen when you drag an entry from the Available Services area.

Note

Entries are moved when you drag them to a new area. To copy a service to a different runlevel, you have to select Copy from the Edit or context menu and Paste it in the target runlevel.

The “sorting number” of an entry sometimes cannot be calculated. In such a case you have to edit the sorting numbers of surrounding entries before re-trying to insert the service.

Note

Sorting numbers can range from 00 to 99, but no higher.

You can delete entries by dragging them onto the Trash Can area (symbolized by an icon depicting a garbage bin).

Warning

Currently there is no way to recover items dragged onto the Trash Can, so be careful!

Keyboard

Keyboard

Keyboard

You can use the Tab key to switch focus between different panels (Available Services, Runlevel 1 Start, Runlevel 1 Stop, etc.) and the cursor keys to move the selection up and down.

To move an entry to a different runlevel, Cut it to the clipboard (using Ctrl+X and Paste it in the target runlevel (with Ctrl+V).

To manually change an entries sorting number or name, press Enter to open the properties dialog. Use the Tab key to switch between different fields. Close the dialog by pressing Enter to accept the modifications, or press Esc to cancel any changes.

KDE Logo
The Menu Entries

The Menu Entries

The Menu Entries

A one by one description of ksysv's menu.

The File menu

Because of the danger of data loss, all menu entries under File ask for confirmation before doing their work.

File->Revert Configuration...

Forget any changes you have made, and revert to the last saved configuration.

File->Open... (Ctrl+O)

Open a previously saved configuration.

File->Save Configuration (Ctrl+S)

Make your changes permanent. Saving does not generate any backup files, so use with care.

File->Save As...

Save a copy of your new configuration.

File->Save Log... (Ctrl+L)

Save a log

File->Print Log... (Ctrl+P)

Print a copy of the log.

File->Quit (Ctrl+Q)

Quit ksysv.

The Edit menu

Edit->Undo (Ctrl+Z)

Undo the last unsaved change made.

Edit->Redo (Ctrl+Shift+Z)

Redo the last item undone.

Edit->Cut (Ctrl+X)

Cut the currently selected service to the clipboard.

Edit->Copy (Ctrl+C)

Copy the selected entry to the clipboard, without removing it from it's original position.

Edit->Paste (Ctrl+V)

Paste the content of the clipboard at the current cursor position.

Edit->Properties

Open the properties dialog for the selected item.

The Tools menu

Tools->Start Service...

Start the selected service

Tools->Stop Service...

Stop the selected service

Tools->Restart Service...

Restart the selected service.

Tools->Edit Service...

Edit the selected service

The Settings menu

Settings->Show Toolbar

Toggle on and off display of the toolbar.

Settings->Show Statusbar

Toggle on and off display of the statusbar.

Settings->Show Log

Toggle on and off the display of the log window

Settings->Save Settings

Save your current settings.

Settings->Configure Key bindings...

Customize the default keybindings.

Settings->Configure Toolbars...

Customize the toolbar.

Settings->Configure SysV-Init Editor...

Customize the behavior of ksysv

The Help menu

Help->Contents... (F1)

Invokes the KDE Help system starting at the ksysv help pages. (this document).

Help->What's This? (Shift+F1)

Changes the mouse cursor to a combination arrow and question mark. Clicking on items within ksysv will open a help window (if one exists for the particular item) explaining the item's function.

Help->Report Bug...

Opens the Bug report dialog where you can report a bug or request a “wishlist” feature.

Help->About ksysv

This will display version and author information.

Help->About KDE

This displays the KDE version and other basic information.

KDE Logo
KDE Logo
Chapter 4. Configuration

Configuration

Chapter 4. Configuration

All options are saved in $KDEHOME/share/config/ksysvrc. Defaults are taken from the global file ($KDEDIR/share/config/ksysvrc), if available, or else generated within ksysv. Changes to the defaults are stored in your local ksysvrc.

Recognized Sections

Recognized sections and keys plus their default values.

[Path Settings]

Keyword: ScriptPath

Default: /etc/rc.d/init.d

Description: Path to the scripts used for starting and stopping services.

Keyword: RunlevelPath

Default: /etc/rc.d

Description: Path to the runlevel subdirectories.

[Colors]

Keyword: Changed

Default: red

Description: Color used for changed entries

Keyword: New

Default: blue

Description: Color used for new entries

[Geometry]

Keyword: Width

Default:

Description: Width of ksysv's window

Keyword: Height

Default:

Description: Height of ksysv's

[Other Settings]

Keyword: ToolBar

Default: true

Description: If the toolbar is enabled or not

Keyword: StatusBar

Default: true

Description: If the statusbar is enabled or not

Keyword: ShowLog

Default: true

Description: If the log window is shown or not

Keyword: PanningFactor

Default: 80

Description: 100 - PanningFactor = percentage of window reserved for the logfile display

KDE Logo
Chapter 5. Questions and Answers

Questions and Answers

Chapter 5. Questions and Answers

5.1. I played around with the default runlevel, and now my machine reboots all the time. What can I do?
5.2. My Machine halts just after booting
5.3. I scheduled some services to be run in runlevel X using ksysv, so why aren't they working?
5.1.

I played around with the default runlevel, and now my machine reboots all the time. What can I do?

Enter linux single at the LILO prompt, and press Enter to boot into single user mode. Edit the file /etc/inittab and change to the default runlevel to something sane. 3 should normally be safe.

5.2.

My Machine “halts” just after booting

See Question 1, above.

5.3.

I scheduled some services to be run in runlevel X using ksysv, so why aren't they working?

If you're using SuSE or Delix (DLD) distributions, you also have to edit a distribution specific file in /etc. Please have a look at the manual of your distribution for details.

Note

The approach to starting services used by the above mentioned distributions makes configuration of services easy for the proprietary configuration tools these distributions provide, but it is unfortunately non-standard. The ksysv authors plan to write a generic extension for this approach some time in the future, but don't hold your breath.

If you're using a different distribution, please check you have all the config files needed by the service, and whether they are in the correct locations. Some daemons for example Apache, (aka httpd) just die silently if their configuration files are missing or misconfigured.

KDE Logo
Chapter 6. Standard semantics of Runlevels

Standard semantics of Runlevels

Chapter 6. Standard semantics of Runlevels

These vary by distribution, so this is an incomplete list of the most common Linux® distributions. If you have additional distributions, please email the author and have the information added to this manual.

Red Hat®
Runlevel 0:

halt (shuts down the machine)

Runlevel 1:

Single user mode.

Runlevel 2:

Multi user text only, without NFS.

Runlevel 3:

Multi user text-only, with full networking.

Runlevel 4:

Not used.

Runlevel 5:

Multi user X11 with full networking.

Runlevel 6:

Reboot

KDE Logo
Chapter 7. License and Credits

License and Credits

Chapter 7. License and Credits

ksysv Copyright (c) 1997-1998 Peter Putzer

Documentation:

This documentation is licensed under the terms of the GNU Free Documentation License.

This program is licensed under the terms of the GNU General Public License.

KDE Logo
Appendix A. Installation

Installation

Appendix A. Installation

ksysv is part of the KDE project http://www.kde.org/.

ksysv can be found in the kdeadmin package on ftp://ftp.kde.org/pub/kde/, the main FTP site of the KDE project.

In order to compile and install ksysv on your system, type the following in the base directory of the ksysv distribution:

% ./configure
% make
% make install

Since ksysv uses autoconf and automake you should have no trouble compiling it. Should you run into problems please report them to the KDE mailing lists.

KDE Logo
KDE Logo