Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] systemd: write-up and packaging questions
@ 2014-10-12 17:59 André Erdmann
  2014-10-12 19:12 ` Maxime Hadjinlian
  2014-10-15 18:24 ` Arnout Vandecappelle
  0 siblings, 2 replies; 9+ messages in thread
From: André Erdmann @ 2014-10-12 17:59 UTC (permalink / raw)
  To: buildroot

Hi,

Some of the issues pointed out below may be already known, but I couldn't
find any report on this, so I'd like to share my experience with setting up a
systemd-based system that does a little bit more than bringing up a console ;)
Use case was tvheadend with avahi and nfs (+ dropbear etc.), running on a
DreamPlug. Overall it works great, but requires some post-build actions:

* installation of additional service files
  (I'll propose patches for them sooner or later)
* changes to the default rootfs skeleton
* optional: removal of /etc/init.d etc.


Filesystem Layout
=================

There are some issues with the default rootfs skeleton.
For example, systemd-hostnamed fails to start with the error message
"file exists", likely related to symlinks pointing to /tmp (/run, /var/...).
After some trial-and-error I've figured out that both /run and /var/tmp
symlinks must be replaced with real directories, and that it needs to be done
before booting systemd (at build/image creation time or in initramfs/initrd).

So, the minimum amount of necessary changes seems to be:
* create /run as directory
  and make /var/run->../run, /var/lock->run/lock link to it;
  /run gets automatically mounted on boot
* create /var/tmp as directory;
  needs manual mount setup (fstab or .mount unit)
* /var/lib/dbus is then a dead link pointing to /tmp/dbus,
  not sure if /run/dbus would be the correct link dest


Unit Files
==========

This section is mostly about packaging guidelines,
the manual doesn't answer the questions below.

Installation
------------

systemd's libdir is /lib/system.
Most unit files (.service et al) are installed to /etc/systemd/system,
systemd's own unit files are installed to /lib/systemd/system and some
packages(*) install their files to /usr/lib/systemd/system, which is rather
confusing. Either dir works (search order is /etc > /lib > /usr/lib),
but what's the recommended location?
I'd prefer to have them installed in one dir (systemd's libdir).

(*) grepping yields nginx and connman


Auto-Enabling
-------------

Most packages enable their unit files by default(*), others don't.
Example: lighttpd gets enabled, nginx does not.
Is there any policy for when [not] to enable services?

(*) "ln -s <unit> /etc/systemd/system/<target>.target.wants/<unit>"


Maybe it'd make sense to introduce some SYSTEMD_ variables so that
packages don't have to hardcode/guess systemd file paths, for example:
* SYSTEMD_LIBDIR          (= /lib/systemd)
* SYSTEMD_UNITDIR         (= $(SYSTEMD_LIBDIR)/system)
* SYSTEMD_CONFDIR         (= /etc/systemd)
* SYSTEMD_UNITCONFDIR     (= $(SYSTEMD_CONFDIR)/system)
* relpath from <confdir> to <libdir> (= ../..$(SYSTEMD_LIBDIR))
* relpath from <confdir>/system to <libdir>/system (= ../../$(SYSTEMD_UNITDIR))

Bonus: export these variables to post-build scripts


-- 
Andr?

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-10-21 18:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-12 17:59 [Buildroot] systemd: write-up and packaging questions André Erdmann
2014-10-12 19:12 ` Maxime Hadjinlian
2014-10-17  8:21   ` Paassen, Hiram van
2014-10-17  9:15     ` André Erdmann
2014-10-17 10:07     ` Maxime Hadjinlian
2014-10-21 18:41       ` Arnout Vandecappelle
2014-10-21 18:45         ` Maxime Hadjinlian
2014-10-15 18:24 ` Arnout Vandecappelle
2014-10-17  6:32   ` André Erdmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox