Il problema non è la compatibilità con i DE maggiori, quanto l'integrazione dei componenti quali logind (sostituto di ConsoleKit e acpid) e udevd, che è richiesto dal kernel Linux.
Poettering ha detto che in futuro si potrebbero rilasciare i componenti in maniera separata, ma un po' tutta la comunità Linux (io compreso) sono scettico su questa possibilità.
Comunque il discorso andrebbe impostato in maniera leggermente differente.
systemd ha dei pro? Sì, ce li ha.
- Niente overhead causato dal caricamento al boot di un interprete per gli script di INIT (la shell)
- Sintassi per i servizi molto semplice ed immediata
- Parallelizzazione automatica dei servizi, a differenza di Upstart che parallellizza sulla base di un ordine prestabilito.
- socket handling
EDIT:
Giusto per completezza, posto la differenza tra la sintassi di uno script INIT e quella di un servizio systemd.
Userò l'init di ZFS che ho creato per Slackware.
Codice: Seleziona tutto
#!/bin/bash
#
# ZFS INIT script for Slackware
# Based on the LSB SysV INIT script.
# Copyright (c) 2013, Luca De Pandis. All rights reserved.
# Contact me at lucadepandis@gmail.com
LOCKFILE=/var/lock/zfs
ZFS="$(which zfs)"
ZPOOL="$(which zpool)"
# Source zfs configuration.
[ -r '/etc/default/zfs' ] && . /etc/default/zfs
[ -x "$ZPOOL" ] || exit 1
[ -x "$ZFS" ] || exit 2
start()
{
if [ -f "$LOCKFILE" ]; then
echo "Service already running"
return 3
fi
# Delay until all required block devices are present.
udevadm settle
# Load the zfs module stack, if it is not already loaded
if [ -z "$(lsmod | grep zfs)" ]; then
/sbin/modprobe zfs
fi
# Ensure / exists in /etc/mtab, if not update mtab accordingly.
# This should be handled by rc.sysinit but lets be paranoid.
awk '$2 == "/" { exit 1 }' /etc/mtab
RETVAL=$?
if [ "$RETVAL" -eq 0 ]; then
/bin/mount -f /
fi
# Import all pools and then mount all filesystems
# based on their properties.
echo -n "Importing ZFS pools... "
"$ZPOOL" import 2>&1 > /dev/null
"$ZPOOL" import -aN 2>&1 > /dev/null
if [ "$?" != "0" ]; then
echo "skipped"
else
echo "done"
fi
echo -n "Mounting ZFS filesystems... "
"$ZFS" mount -a
if [ "$?" != "0" ]; then
echo "failed"
return 15
else
echo "done"
fi
echo -n "Sharing ZFS filesystems... "
"$ZFS" share -a
if [ "$?" != "0" ]; then
echo "failed"
return 20
else
echo "done"
fi
touch "$LOCKFILE"
}
stop()
{
if [ ! -f "$LOCKFILE" ]; then
echo "Service is not running"
return 3
fi
echo -n "Unmounting ZFS filesystems... "
"$ZFS" umount -a
if [ "$?" != "0" ]; then
echo "failed"
return 130
else
echo "done"
fi
rm -f "$LOCKFILE"
}
status()
{
if [ ! -f "$LOCKFILE" ]; then
echo "Service is not running "
return 3
else
"$ZPOOL" status && echo "" && "$ZPOOL" list
fi
}
case "$1" in
start)
start
RETVAL=$?
;;
stop)
stop
RETVAL=$?
;;
status)
status
RETVAL=$?
;;
restart)
if [ -f "$LOCKFILE" ]; then
stop
start
fi
;;
help)
echo $"Usage: $0 {start|stop|status|restart|help}"
;;
*)
echo "Illegal Command: $1"
echo $"Usage: $0 {start|stop|status|restart|help}"
RETVAL=1
;;
esac
exit $RETVAL
E qui la versione systemd
Codice: Seleziona tutto
[Unit]
Description=Zettabyte File System (ZFS)
Documentation=man:zfs(8) man:zpool(8)
DefaultDependencies=no
After=local-fs.target
Before=multi-user.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/sbin/modprobe zfs
ExecStart=/usr/sbin/zpool import -c /etc/zfs/zpool.cache -aN
ExecStart=/usr/sbin/zfs mount -a
ExecStart=/usr/sbin/zfs share -a
ExecStop=/usr/sbin/zfs umount -a
[Install]
WantedBy=multi-user.target
Ha dei contro? Sì, ce li ha.
- È Linux-only, ciò vuol dire che non si possono portare script di INIT su sistemi UNIX alternativi come BSD, e viceversa, ma bisogna riscriverli completamente.
- È difficile da debuggare (problema messo in evidenza da Alan Cox). È molto più facile debuggare uno script INIT, che avviare systemd con strace e/o gdb.
Senza contare che il binario systemd viene strippato, quindi addio ad un debug dettagliato.
- È anti-UNIX perché viola il principio del "un software deve gestire uno e un solo compito e farlo bene". systemd è invasivo e un monolite che gestisce tutto, dai servizi alla sospensione/ibernazione (va, infatti, a sostituire le pm-utils).
L'essere un monolite è un problema anche per la portabilità.
I componenti sono tutti completamente integrati fra loro. Ciò vuol dire, ad esempio, che non si può portare solo una parte di systemd su FreeBSD per far girare GNOME (qualora quest'ultimo lo richiedesse esplicitamente), perché andrebbero portate molte funzioni Linux.
E non è vero ciò che Poettering ha detto, ovvero che basta implementare qualche ifdef e tutto funziona, perché portarlo su BSD senza integrare cgroup, udev ed altre interfacce Linux-only vuol dire riscrivere mezzo systemd.
E proprio sulla questione udev che i dev FreeBSD hanno storto il naso. Questo pezzo di software viene accettato solo nel mondo Linux. Su FreeBSD si usa devd, e loro non hanno alcuna intenzione di sostituirlo, dato che è una delle parti del core di sistema che più vantano.
Inoltre viola pesantemente la hier(7). Non digerisce sistemi con /usr separata, e questo ha portato ai vari merge /-/usr fatti su Fedora, openSUSE e Arch Linux (qui poi la cagata più grande di unire /usr/bin, /usr/sbin, /bin e /sbin in un'unica directory /usr/bin).