elogind-252.9

elogind の概要

elogind is the systemd project's "logind", extracted to be a standalone daemon. It integrates with Linux-PAM-1.5.3 to track all the users logged in to a system, and whether they are logged in graphically, on the console, or remotely. Elogind exposes this information via the standard org.freedesktop.login1 D-Bus interface, and also through the file system using systemd's standard /run/systemd layout.

[注記]

注記

LFS や依存パッケージが本ブックに示す最新安定バージョンでなかった場合には、BLFS 開発版においては、パッケージのビルドや処理実行が適切に行われないことがあります。

パッケージ情報

elogind の依存パッケージ

推奨

任意

lxml-4.9.4, zsh-5.9, Valgrind-3.22.0 (needed for tests), audit-userspace, bash-completion, kexec, and SELinux

Editor Notes: https://wiki.linuxfromscratch.org/blfs/wiki/Logind

カーネルの設定

Enable the following options in the kernel configuration and recompile the kernel if necessary:

File systems --->
  [*] Inotify support for userspace                               [INOTIFY_USER]
  Pseudo filesystems --->
    [*] Tmpfs virtual memory file system support (former shm fs)         [TMPFS]
    [*]   Tmpfs POSIX Access Control Lists                     [TMPFS_POSIX_ACL]

In addition, some tests need the userspace cryptographic kernel API, which is enabled with:

-*- Cryptographic API --->                                              [CRYPTO]
  Crypto core or helper --->
    <*/M> Userspace cryptographic algorithm configuration          [CRYPTO_USER]
  Userspace interface --->
    <*/M> Hash algorithms                                 [CRYPTO_USER_API_HASH]

elogind のインストール

Install elogind by running the following commands:

mkdir build &&
cd    build &&

meson setup ..                              \
      --prefix=/usr                         \
      --buildtype=release                   \
      -Dman=auto                            \
      -Ddocdir=/usr/share/doc/elogind-252.9 \
      -Dcgroup-controller=elogind           \
      -Ddev-kvm-mode=0660                   \
      -Ddbuspolicydir=/etc/dbus-1/system.d &&
ninja

To test the results, issue: ninja test. A few tests are skipped if not run with root privileges. Two tests named test-fs-util and test-id128 require the /etc/machine-id symlink, so they will fail if this symlink is not created following the instruction in dbus-1.14.10 yet.

Now, as the root user:

ninja install                                           &&
ln -sfv  libelogind.pc /usr/lib/pkgconfig/libsystemd.pc &&
ln -sfvn elogind /usr/include/systemd

コマンド説明

-Ddocdir=/usr/share/doc/elogind-252.9: This is needed to install documentation in a versioned directory.

-Dcgroup-controller=elogind: This switch is necessary to build this package when the kernel is not built with CONFIG_CGROUPS enabled. Note that elogind strictly needs a kernel with CONFIG_CGROUPS enabled at runtime, but this switch will allow building the package first.

-Ddbuspolicydir=/etc/dbus-1/system.d: This switch sets the location of the D-Bus policy directory.

-Ddev-kvm-mode=0660: The LFS udev rule sets the mode of /dev/kvm to 0660. This option ensures the elogind udev rules consistent with the LFS configuration.

-Dman=auto: The default value of this switch is false. Setting it to auto allows building and installing the man pages if the recommended dependencies are installed.

-Dhtml=auto: The default value of this switch is false. Setting it to auto allows building and installing the html documentation if the recommended dependencies are installed.

-Ddefault-kill-user-processes=false: Determines whether the processes of a user should be killed when the user logs out. The default is true, but this defeats the traditional use of screen or tmux. This can also be changed in the configuration file (see below).

ln -s ...: These commands install symlinks so that software packages can find the systemd-compatible library and headers.

elogind の設定

設定ファイル

/etc/elogind/logind.conf

設定情報

The installed file /etc/elogind/logind.conf contains all the possible options with their defaults, commented out. You may wish to disable automatically killing user processes when the user logs out, by running, as the root user:

sed -e '/\[Login\]/a KillUserProcesses=no' \
    -i /etc/elogind/logind.conf

Each user will need to register a user session using Linux-PAM at login. The /etc/pam.d/system-session file needs to be modified and a new file must be created in order for elogind to work correctly. Run the following commands as the root user:

cat >> /etc/pam.d/system-session << "EOF" &&
# Begin elogind addition

session  required    pam_loginuid.so
session  optional    pam_elogind.so

# End elogind addition
EOF
cat > /etc/pam.d/elogind-user << "EOF"
# Begin /etc/pam.d/elogind-user

account  required    pam_access.so
account  include     system-account

session  required    pam_env.so
session  required    pam_limits.so
session  required    pam_unix.so
session  required    pam_loginuid.so
session  optional    pam_keyinit.so force revoke
session  optional    pam_elogind.so

auth     required    pam_deny.so
password required    pam_deny.so

# End /etc/pam.d/elogind-user
EOF

パッケージ構成

インストールプログラム: busctl, elogind-inhibit, loginctl
インストールライブラリ: libelogind.so
インストールディレクトリ: /usr/lib/elogind, /etc/elogind, /usr/include/elogind, /usr/share/doc/elogind-252.9

概略説明

busctl

is used to introspect and monitor the D-Bus bus

elogind-inhibit

is used to execute a program with a shutdown, sleep or idle inhibitor lock taken

loginctl

is used to introspect and control the state of the elogind Login Manager

libelogind.so

is the main elogind utility library