%% Making a GNU/Linux distributino LSB compliant %% Copyright 2001 Wichert Akkerman %% %% Presented at the LinuxWorld Conference & Expo San Francisco, August 2001 %% %% Abstract: %% With the pending release of the LSB people are expecting Linux %% distributions to start complying with the guidelines set by the %% LSB standards document. This talk describes how Debian was and is %% being changed to become fully LSB compliant while still reaming %% fully forward compatible. This process ranges from the development %% of new LSB tools, to modifying the packaging system and moving %% part of the filesystem hierarchy. %% %% %% Define the fonts we will use %% %deffont "standard" tfont "arial.ttf" %deffont "typewriter" tfont "cour.ttf" %deffont "italic" tfont "ariali.ttf" %% %% Default settings for special lines %% %default 1 leftfill, fore "black", back "white", bimage "background.bmp" %default 2 size 7, vgap 10, prefix " ", font "standard" %default 3 size 2, bar "gray70", vgap 10 %default 4 size 5, vgap 30, font "standard" %% %% Default settings for indented lines %% %tab 1 size 5, vgap 40, prefix " ", icon box "green" 50 %tab 2 size 4, vgap 40, prefix " ", icon arc "red" 50 %tab 3 size 3, vgap 40, prefix " ", icon delta3 "blue" 40 %% %%%%%%%%%%%%%%%%%% %page %nodefault, font "standard", fore "black", back "white", bimage "background.bmp" %center Making a GNU/Linux distribution LSB compliant %size 5 Wichert Akkerman %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Overview What is LSB? LSB overview Testing compliancy Moving to LSB %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page LSB mission statement `.. to develop and promote a set of standards that will increase compatibility among Linux distributions and enable software applications to run on any compliant Linux system.' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page LSB Overview The LSB consists of various seperate parts: Object formats Dynamic linking Base libraries Utility libraries Graphics libraries Packages Commands and utilities Standard shell Users and groups Filesystem hierarchy System Initialization %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Testing compliance Building a minimal system Doing a testrun Analyzing the results %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Building a minimal system The first thing we want to do is build a minimal LSB system. To do this we need to map the LSB requirements to Debian packages. This gives us the LSB required packages: at base-files base-passwd bash bc binutils bsdmainutils bsdutils cpio cron debianutils diff dpkg exim file fileutils findutils grep gzip hostname libc6 libc6-dev libncurses5 login lpr lsb-release m4 make man-db mawk mount ncurses-base ncurses-bin ncurses-term passwd patch procps psmisc rpm rsync sed shellutils sysvinit tar textutils util-linux xlibmesa3 xlibs zlib1g %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Building a minimal system In order to make a standard Debian base system a minimal LSB system only a few extra packages need to be installed: alien bzip2 debconf-utils debhelper html2text libbz2-1.0 librpm0 lsb-release rpm rsync xlibmesa3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Doing a testrun The Open Group has a beta version of a LSB testsuite that can be used to test for LSB compliancy. Running the testsuite is tricky and not for the faint at heart! After hours of struggling it will produce a 1007kB large report with all the test results and test summaries. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Analyzing test results The test results fall into 5 categories: Failed Unresolved Unsupported Untested Warning %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Analyzing test results A test failure can have multiple reasons: a bug in the test a problem in the LSB a problem in the distribution a problem in the test environment %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Analyzing test results The report contains a total of 161 tests that generated a failed, warning or unresolved result. Those need to be checked by hand. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Some test results %font "typewriter", size 3 /tset/LSB.usersgroups/usersgroups/names/names-tc 2 "The gid for user name (bin) is NOT equal to one" %font "standard", size 5 This is a bug in the test: the LSB does not specify what the gid of bin should be. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Some test results %font "typewriter", size 3 /tset/PTHR.hdr/misc/pthread_2/T.pthread_2 13 "the use of `pthread_attr_getstackaddr' is deprecated, use `pthread_attr_getstack'" %font "standard", size 5 This is a bug in the LSB, it uses a deprecated function. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Some test results %font "typewriter", size 3 /tset/LSB.fhs/root/etc/etc-tc 29 "/etc/hosts.equiv: file not found" %font "standard", size 5 Bug in testsuite: hosts.equiv is used by rsh-server, which is not required by the LSB. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Moving to LSB Determining what needs to change How to change things %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Determining what needs to change Analyzing the results of the testsuite gives us a list of necessary changes. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page How to change things Now that LSB 1.0 is out we want to have a compliant distribution as soon as possible, but we also want to continue to support in-place upgrades. Debian supports in-place upgrades so any change will have to be done in a way that allows partial upgrades without breaking things. This means we will need to go through a long process to slowly move to a LSB system. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Types of changes needed Adding new LSB tools Moving things around Other changes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Adding new LSB tools LSB packages lsb_release /lib/lsb/init-functions install_initd / remove_initd %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page LSB packages LSB felt it was necessary to support a package format. The chosen format is a subset of rpm v3. This subset was chosen to make it possible to convert packages to another format while still allowing them to install. Debian uses the deb format so we need something to handle lsb packages as well. Options are: use wrappers that convert the package using alien modify dpkg to handle them directly %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page LSB packages Dependencies between lsb packages are arranged via LANANA with the exception of the `lsb' package which the distribution must provide. Once Debian is fully LSB compliant we will need to create a dummy lsb package to indicate full compliancy. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page lsb_release This is a new command similar to uname that shows which Linux distribution is being run and which LSB version it complies to. Debian testing and unstable already include this utility. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page {install,remove}_initd Simple scripts to register and unregister init scripts. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page /lib/lsb/init-functions This is a shell script with helper functions for init scripts. It has to define: start_daemon killproc pidofproc log_success_msg log_failure_msg log_warning_msg %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Moving to FHS The Filesystem Hierarchy Standard contains policies for locations of things on the filesystem. FHS uses a few different locations then the LFSSTD used, for example: /usr/man -> /usr/share/man /usr/doc -> /usr/share/doc /var/spool/mail -> /var/mail %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Moving documentation /usr/man and /usr/info are only accessed via software, so we can do a slow move and have documentation in both places during the transition if we can make sure that the tools will look in both places. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Moving documentation /usr/doc is accessed by users directly and we need to guarantee a single canocical place for them to access documentation, so we need another approach. potato: use /usr/doc woody: use /usr/share/doc and have symlinks in /usr/doc woody+1: use /usr/share/doc exclusively woody+2: drop /usr/doc completely Make sure we deal with: dpkg bug with replacing a directory with a symlink systems where /usr/doc is a symlink to /usr/share/doc %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Moving the mailspool Unfortunately it is not possible to move the mailspool on a live system. As an alternative we combine two approaches: on already installed systems insert a /var/mail symlink on new systems directly use /var/mail %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Other changes System users and groups Runlevels %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page System users and groups LSB requires the following users and groups: %font "typewriter", size 3 root root Administrative user with no restrictions bin bin Administrative user with some restrictions daemon daemon Subprocess special privileges %font "standard", size 5 And adds an optional list: %font "typewriter", size 3 adm adm Administrative special privileges lp lp Printer special privileges sync sync Login to sync the system shutdown shutdown Login to shutdown the system halt halt Login to halt the system mail mail Mail special privileges news news News special privileges uucp uucp UUCP special privileges operator root Operator special privileges man man Man special privileges nobody nobody Used by NFS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page System users and groups The differences with current Debian are: None in required users and groups no adm user sync is in group users no shutdown user & group operator has his own group man is in group users nobody uses group nogroup %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page System users and groups We can become fully LSB compliant by: ignoring the adm user, it's optional remove the sync user, it's optional ignore the shutdown user, optional remote the operator user and group add a man group and use that for user man add a nogroup group There is another catch: two groups with the same gid (nobody and nogroup) are not supported by the current update-passwd. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Init script LSB defines the mandatory arguments for init scripts: start:start the service stop: stop the service restart: stop and restart the service reload: make service reload configuration force-reload: force configuration reload status: print service status %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Init script A set of exit status codes are also defined. Status can return: %font "typewriter", size 3 0 program is running 1 program is dead and pidfile exists 2 program is dead and lockfile exists 3 program is stopped %font "standard", size 5 The others can return: %font "typewriter", size 3 1 generic error 2 invalid argument 3 unimplemented 4 insufficient privilege 5 program is not installed 6 program is not configured 7 program is not running %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page init script dependency magic In order to have some ordering in init scripts init scripts are allow to use magic comments: Provides Required-Start Required-Stop Default-Start Default-Stop %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Predefined init facilities $local_fs: all local filesystems are mounted $network: low level networking $named: dns server is running $remote_fs: remote filesystems are mounted $syslog: system logger is running $netdaemons: all network daemons are running %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Debian init script ordering Debian currently uses a numbered ordering instead of dependencies. This is a simple and flexible system. To support the LSB depencies we can do two things: work out dependencies and calculate order for lsb init scripts make sysvinit do full dependency handling %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Runlevels LSB defines: 0 halt 1 single user mode 2 multiuser with no network services exported 3 normal/full multiuser 4 reserved for local user, default is normal/full multiuser 5 multiuser with xdm or equivalent 6 reboot %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Runlevels Debian uses: 0 halt 1 single user mode 2-5 normal runlevel 6 reboot %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Changing runlevels Changing our runlevels sounds simple, however: update-rc.d does not support per-runlevel differences So we will need to: replace update-rc.d with a new tool update Debian policy convert all packages to use the new tool %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Conclusions At this moment a few things need to happen before anyone can become LSB compliant: running the testsuite needs to be made easier bogus extra tests need to be removed new lsb tests need to be added testsuite results need to be analyzed lsb might need to be updated after this %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Conclusions Becoming LSB compliant is a good goal. However accomplishing this while still supporting in place ugprades means a long process has to be followed. At the current rate of changes woody+1 has a good chance of being the first LSB 1.0 compliant Debian release. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page References http://www.linuxbase.org/ http://people.debian/org/~taggart/lsb/