Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "André Erdmann" <dywi@mailerd.de>
To: buildroot@busybox.net
Subject: [Buildroot] systemd: write-up and packaging questions
Date: Sun, 12 Oct 2014 19:59:08 +0200	[thread overview]
Message-ID: <543AC16C.7000100@mailerd.de> (raw)

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?

             reply	other threads:[~2014-10-12 17:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-12 17:59 André Erdmann [this message]
2014-10-12 19:12 ` [Buildroot] systemd: write-up and packaging questions 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=543AC16C.7000100@mailerd.de \
    --to=dywi@mailerd.de \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox