[Clfs-dev] Moving to systemd part 2

Martin Ward macros_the_black at ntlworld.com
Tue Jan 7 07:24:37 PST 2014


Hi prompted by William, here is how i did it

part 2

2. systemd alterations

section 9 testsuite tools
i put check here as it seems logical, but no difference otherwise

section 10 installing basic system software

10.4 -10.16 tool chain

however i do remove /cross-tools from the setup by renaming it to 
/cross-tools.old, so no libraries do get pulled in
and ajdust  /tools/bin/ldd so i can check any linking problems in the 
toolchain

10.7 eglibc

i do turn off ssp in the eglibc build
cat > config.cache << "EOF"
libc_cv_ssp=no
EOF
and install the name service files

cp -v nscd/nscd.conf /etc/nscd.conf
mkdir -pv /var/cache/nscd

the timezone should be a symlink to the relevant file
ln -sv /usr/share/zoneinfo/[xxx] /etc/localtime

for the rest of the build
i use a slightly different order than the book and use pkgconf rather 
than pkg-config-lite but the results are the same

10.21 util linux
add --enable-wall  --enable-mesg  --disable-nologin 
--enable-socket-activation --with-systemdsystemunitdir=/lib/systemd/system
10.22 use procps-ng instead of procps
touch /etc/sysctl.conf
10.47 use inetutils rather than iputils
10.51 man-db rather than man (needs lipipeline)
10.55-10.57 remove as use journald from systemd
10.58 systemvinit most programs are not needed just the following
make -C src fstab-decode
make -C src killall5
make -C src last

cp -v src/{fstab-decode,killall5} /sbin
cp -v src/last /usr/bin
ln -sv ../sbin/killall5 /bin/pidof
ln -sv last /usr/bin/lastb
cp -v man/{last,lastb}.1 /usr/share/man/man1
cp -v man/{fstab-decode,killall5,pidof}.8 /usr/share/man/man8

possibly replace some of these with stuff from util-linux ?

10.61 eudev not needed


so we finally get to systemd bits

I decided quite early on to build the absolute minimum i could get away 
with,as I would be rebuilding later when I install PAM,glib,python,xlib 
etc,etc

attr-2.4.47 // needed for altering privileges
sed -i -e 's|/@pkg_name@|&- at pkg_version@|' include/builddefs.in
./configure --prefix=/usr --libdir=/lib --libexecdir=/usr/lib 
--disable-rpath
make install install-dev install-lib, chmod -v 0755 /lib/libattr.so.1.1.0

libcap-0.22 //needed for altering privileges
make
make RAISE_SETFCAP=no install
chmod -v 0755 /lib/libcap.so.2.22

expat-2.10 // needed to parse dbus xml configuration files
standard cmmi
XML-Parser-2.42_01 //needed to parse dbus xml configuration file
intltool-0.50.2 // Utility scripts for internationalizing XML
gperf-3.0.4 //  hash function for dbus and systemd
dbus-1.6.18 // IPC mechanism needed for systemd
groupadd -g 27 messagebus,
useradd -c "D-BUS Message Daemon User" -d /dev/null \
         -u 27 -g messagebus -s /bin/false messagebus

./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var 
--libexecdir=/usr/lib/dbus-1.0 --docdir=/usr/share/doc/dbus-1.6.18 
--with-console-auth-dir=/run/console/ 
--with-systemdsystemunitdir=/lib/systemd/system

create session-local.conf/system-local.conf // make changes here for 
dbus configuration

cat > /etc/dbus-1/session-local.conf << "EOF"
<!DOCTYPE busconfig PUBLIC
  "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
  "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>

   <!-- Search for .service files in /usr/local -->
   <servicedir>/usr/local/share/dbus-1/services</servicedir>

</busconfig>
EOF

dbus-uuidgen --ensure // add a unique system id, systemd will use this 
if its available

systemd installation

tidy up some and remove some symlinks

ln -sf /proc/self/mounts /etc/mtab
mv /etc/inittab /etc/inittab.old
mv /etc/rc.d /etc/rc.old
remove symlinks for udevd,udevadm

configure systemd
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var 
--libexecdir=/usr/lib --docdir=/usr/share/doc/systemd-206 
--with-rootprefix=  --with-rootlibdir=/lib 
--with-kbd-loadkeys=/bin/loadkeys --with-kbd-setfont=/bin/setfont 
--enable-split-usr --disable-gudev --without-python --disable-rpath
make, make install

systemd-machine-id-setup // ensure the machine has a unique id

make systemd our PID1

for tool in runlevel reboot shutdown poweroff halt telinit; do
      ln -sfv ../bin/systemctl /sbin/$tool
done
ln -sfv ../lib/systemd/systemd /sbin/init


tidy up

mkdir -pv /var/log/journal //make sure other logging programs can use 
the logging journal
sed -i "s at 0775 root lock at 0755 root root at g" 
/usr/lib/tmpfiles.d/legacy.conf // we don't have a lock group
printf "d /run/console 0755 root root\n" > 
/usr/lib/tmpfiles.d/console.conf // make sure  this gets created on boot 
up for programs that need it
ln -sv /bin/udevadm /sbin/udevadm // compatibility link

set your hostname
echo "xxxx" > /etc/hostname //systemd can set this using hostnamectl
set up console,input and locale
/etc/vconsole.conf  // sets keyboard mapping and console font
KEYMAP=uk
FONT=Lat2-Terminus16
FONT_MAP=8859-1_to_uni

/etc/inputrc //no change
/etc/locale.conf // sets up locale encoding, systemd can use localectl 
can change this
LANG=en_GB.UTF-8
G_FILENAME_ENCODING=@locale
INPUTRC=/etc/inputrc

/etc/fstab
only needs user filesystems i.e /, /home etc
/proc /dev etc, get automatically mounted
sed /TTYVTDisallocate=/s/yes/no/ -i 
/etc/systemd/system/getty.target.wants/getty\@tty1.service // enables 
you to see the boot mesgs same as --noclear for sysvinit

kernel configuartion

systemd  needs a few bits for it to work correctly out of the box
taken from gentoo

General setup  --->
	[*] Control Group support // essential
	[ ] Enable deprecated sysfs features to support old userspace tools 
//essential
	[*] open by fhandle syscalls // optional
Networking support --->
	Networking options --->
		<*> The IPv6 protocol //optional
Device Drivers  --->
	Generic Driver Options  --->
		[*] Maintain a devtmpfs filesystem to mount at /dev //essential
		()  path to uevent helper	//optional
File systems  --->
	[*] Inotify support for userspace //essential
	[*] Filesystem wide access notification //essential
Processor type and features  --->
	[*] Enable seccomp to safely compute untrusted bytecode //optional
Firmware Drivers  --->
	[*] Export DMI identification via sysfs to userspace //optional
File systems --->
	<*> Kernel automounter version 4 support (also supports v3) //optional
	Pseudo filesystems --->
		[*] Tmpfs virtual memory file system support (former shm fs) //essential
		[*]   Tmpfs POSIX Access Control Lists //essential
		[*]   Tmpfs extended attributes //essential

a nice summary is on the gentoo wiki
http://wiki.gentoo.org/wiki/Systemd


cheers

Martin



More information about the Clfs-dev mailing list