[systemd-devel] systemd unit files for Debian based systems

Paul Menzel paulepanter at users.sourceforge.net
Mon Jun 18 12:56:41 PDT 2012


Dear Lennart,


thank you for you reply.


Am Montag, den 18.06.2012, 17:48 +0200 schrieb Lennart Poettering:
> On Sat, 16.06.12 10:39, Paul Menzel (paulepanter at users.sourceforge.net) wrote:

> > do you know of a repository or location where I can get systemd unit
> > files for Debian based systems? I found Lennart’s `systemd-units`
> > directory [1] but it does not contain units for programs.
> 
> Those files should probably not be used, they are kinda out-of-date. I
> have removed these files now from the web server, to avoid
> confusion. (ok, i renamed them to "/systemd-units.out-of-date/", so that
> they can be used as reference but little else)

If my assumptions that systemd unit files should be distribution
independent than a central place at freedesktop.org to collect these
unit files would be great. Then everybody could try these and improve
them while trying to get these upstream.

> > The best way would be of course that units would be included by upstream
> > but this does not seem to be the case yet.
> > 
> > At least I could not find those for openssh-server [2],

Do you know of a service file for openssh-server?

> > GDM 3 [3], console-common [4] and cpufrequtils [5].

> GDM should not be too hard, and will do this eventually myself if nobody
> beats me to it. The reason why I haven't done this yet is that Fedora
> currently uses "prefdm" for starting the DMs and we need to get rid of
> that in all packages at the same time.

Understood. Thank you for doing that.

> What would console-common do that systemd-vconsole doesn't do anyway?

I have no clue. I just looked at the output of `systemd-analyze blame`
and reported my findings.

`console-common` [6] contains `/etc/init.d/keymap.sh` to set the keymap.

        #!/bin/sh
        ### BEGIN INIT INFO
        # Provides:             keymap
        # Required-Start:       mountdevsubfs
        # Required-Stop:        
        # Default-Start:        S
        # Default-Stop:
        # X-Interactive:	true
        # Short-Description: 	Set keymap
        # Description:		Set the Console keymap
        ### END INIT INFO
        
        # If setupcon is present, then we've been superseded by console-setup.
        if type setupcon >/dev/null 2>&1; then
        	exit 0
        fi
        
        . /lib/lsb/init-functions
        
        #
        # Load the keymaps *as soon as possible*
        #
        
        # Don't fail on error
        CONSOLE_TYPE=`fgconsole 2>/dev/null` || CONSOLE_TYPE="unknown"
        
        # Don't fail on serial consoles
        
        QUIT=0
        # fail silently if loadkeys not present (yet).
        command -v loadkeys >/dev/null 2>&1 || QUIT=1
        
        CONFDIR=/etc/console
        CONFFILEROOT=boottime
        EXT=kmap
        CONFFILE=${CONFDIR}/${CONFFILEROOT}.${EXT}.gz
        
        reset_kernel()
        {
        	# On Mac PPC machines, we may need to set kernel vars first
                # We need to mount /proc to do that; not optimal, as its going to 
                # be mounted in S10checkroot, but we need it set up before sulogin
                # may be run in checkroot, which will need the keyboard to log in...
        	[ -x /sbin/sysctl ] || return
        	[ -r /etc/sysctl.conf ] || return
        	grep -v '^\#' /etc/sysctl.conf | grep -q keycodes 
        	if [ "$?" = "0" ] ; then
        	    grep keycodes /etc/sysctl.conf | grep -v "^#" | while read d ; do
        	        /sbin/sysctl -w $d 2> /dev/null || true
                    done
                fi
        }
        
        unicode_start_stop()
        {
        	# Switch unicode mode by checking the locale.
        	# This will be needed before loading the keymap.
        	[ -x /usr/bin/unicode_start ] || [ -x /bin/unicode_start ] ||  return
        	[ -x /usr/bin/unicode_stop ] || [ -x /bin/unicode_stop ] || return
        
        	ENV_FILE=""
        	[ -r /etc/environment ] && ENV_FILE="/etc/environment"
        	[ -r /etc/default/locale ] && ENV_FILE="/etc/default/locale" 
        	[ "$ENV_FILE" ] && CHARMAP=$(set -a && . "$ENV_FILE" && locale charmap)
        	if [ "$CHARMAP" = "UTF-8" ]; then
        		unicode_start 2> /dev/null || true
        	else
        		unicode_stop 2> /dev/null || true
        	fi
        }
        
        if [ ! $QUIT = '1' ] ; then
        
          case "$1" in
              start | restart | force-reload | reload)
          
              	# Set kernel variables if required
         	reset_kernel
        
                # First mount /proc if necessary...and if it is there (#392798)
                unmount_proc="no"
        	if [ -d /proc ]; then
                	if [ ! -x /proc/$$ ]; then
                		unmount_proc="yes"	
                 		mount -n /proc
                	fi
          
        
                	if [ -f /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes ] ; then
                		linux_keycodes=`cat /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes`
        		else
                		linux_keycodes=1;
                	fi
        	else
               		linux_keycodes=1;
        	fi
        
        	# load new map
        	if [ $linux_keycodes -gt 0 ] ; then 
        	  if [ -r ${CONFFILE} ] ; then
        
        	    # Switch console mode to UTF-8 or ASCII as necessary
        	    unicode_start_stop
        
        	    if [ $CONSOLE_TYPE = "serial" ] ; then 
        		    loadkeys -q ${CONFFILE} 2>&1 > /dev/null
        	    else
        	    	    loadkeys -q ${CONFFILE}
        	    fi
        	    if [ $? -gt 0 ]
        		then
        	    	# if we've a serial console, we may not have a keyboard, so don't
        		# complain if we fail. 
        		   if [ ! $CONSOLE_TYPE = "serial" ]; then 
        			log_warning_msg "Problem when loading ${CONFDIR}/${CONFFILEROOT}.${EXT}.gz, use install-keymap"
        			sleep 10
        		   fi 
        		fi
        	    fi
        	fi
        
        	# unmount /proc if we mounted it
                [ "$unmount_proc" = "no" ] || umount -n /proc
        
        	;;
        
            stop)
        	;;
        
            status)
        	exit 0
        	;;
        
            *)
        	log_warning_msg "Usage: $0 {start|stop|restart|reload|force-reload|status}"
        	;;
          esac
        
        fi

It looks like under systemd the keymap can be configured in
`/etc/vconsole.conf` (`man vconsole.conf`).

> What is cpufrequitls for? Why would anybody fiddle with that? "ondemand"
> is the only CPU scheduler that makes sense, so what is this about? Also,
> you can change the CPU scheduler via simple sysfs writes, right? So why
> would you use a tool like "cpufreq" for this? tmpfiles should be
> entirely sufficient?
> 
> cpufreq stuff really appears to be sugar for -Oit-feels-so-much-faster-now freaks...

In Debian it is a recommendation of the package `gnome-applets`.

        $ LANG=C aptitude why cpufrequtils
        i   gnome         Depends    gnome-applets (>= 2.91)
        i A gnome-applets Recommends cpufrequtils

I guess it is useful to have an abstraction layer because directories
and files under `/sys` might change.

> > Also distribution independent files seem to be difficult since
> > configuration files are located at different places as is the case for
> > cpufrequtils. Arch Linux has the following service file [6].
> > 
> >         $ more /etc/systemd/system/cpufreq.service
> >         [Unit]
> >         Description=CPU frequency scaling daemon
> > 
> >         [Service]
> >         Type=oneshot
> >         RemainAfterExit=yes
> >         EnvironmentFile=/etc/conf.d/cpufreq
> >         ExecStart=/usr/bin/cpufreq-set -r -g $governor -d $min_freq -u $max_freq
> > 
> >         [Install]
> >         WantedBy=multi-user.target
> > 
> > For example in Debian such files are put under
> > `/etc/default/cpufrequtils`.
> 
> This directories should not be used anymore. I'd recommend everybody to
> just stop using them alltogether, and not support them anymore.

What is your recommended way of doing that?


Thanks,

Paul


[6] http://packages.debian.org/sid/console-common
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20120618/dd9c9df7/attachment.pgp>


More information about the systemd-devel mailing list