elogind-257.16

#### Beyond Linux® From Scratch (System V Edition) - Version r13.0-1090

### Chapter 12. System Utilities

- Prev

  dbus-1.16.2

- Next

  blocaled-0.7

- Up
- Home

# elogind-257.16

## Introduction to elogind

elogind is the systemd project's "logind", extracted to be a standalone daemon. It integrates with Linux-PAM-1.7.2 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.

### Note

Development versions of BLFS may not build or run some packages properly if LFS or dependencies have been updated since the most recent stable versions of the books.

### Package Information

- Download (HTTP): https://github.com/elogind/elogind/archive/v257.16/elogind-257.16.tar.gz

- Download MD5 sum: d3b4ee9288ea4a3826706f2b1495000e

- Download size: 2.6 MB

- Estimated disk space required: 67 MB (with tests)

- Estimated build time: 0.3 SBU (with parallelism=4; with tests)

### elogind Dependencies

#### Recommended

dbus-1.16.2 (runtime), Linux-PAM-1.7.2 (required for Xorg), Polkit-127 (runtime), docbook-xml-4.5, docbook-xsl-nons-1.79.2, and libxslt-1.1.45 (all three to build the man pages)

#### Optional

lxml-6.1.1, zsh-5.9.2, Valgrind-3.27.1 (needed for tests), audit-userspace, bash-completion, kexec, and SELinux

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

## Kernel Configuration

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]

## Installation of elogind

Install elogind by running the following commands:

    mkdir build &&
    cd    build &&

    meson setup ..                               \
          --prefix=/usr                          \
          --buildtype=release                    \
          -D man=auto                            \
          -D docdir=/usr/share/doc/elogind-257.16 \
          -D cgroup-controller=elogind           \
          -D dev-kvm-mode=0660                   \
          -D dbuspolicydir=/etc/dbus-1/system.d &&
    ninja

To test the results, issue: ninja test. A few tests are skipped if not run with `root` privileges. Three tests, `test-login`, `dbus-docs-fresh`, and `check-version-history`, are known to fail.

Now, as the `root` user:

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

## Command Explanations

`-D docdir=/usr/share/doc/elogind-257.16`: This is needed to install documentation in a versioned directory.

`-D cgroup-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.

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

`-D dev-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.

`-D man=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.

`-D html=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.

`-D default-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.

## Configuring elogind

### Config File

`/etc/elogind/logind.conf`

### Configuration Information

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

This package provides a Name Service Switch (NSS) module. Previously, a Systemd-less system didn't have a dedicated NSS module used for better name resolution, while Systemd systems have one that is tightly ingrained with that software suite. Now, such a module is provided. In order to use it, the `/etc/nsswitch.conf` file that was installed in LFS must be altered. Overwrite the file as the `root` user:

    cat > /etc/nsswitch.conf << "EOF" &&
    # Begin /etc/nsswitch.conf

    passwd: files elogind
    group: files elogind
    shadow: files elogind

    hosts: files dns
    networks: files

    protocols: files
    services: files
    ethers: files
    rpc: files

    # End /etc/nsswitch.conf
    EOF

### Note

The `myhostname`, `mymachines`, and `resolve` NSS modules are still not provided (they come from Systemd). The installed file cannot use them yet.

### Note

After completion of elogind, you should check that it functions properly. First ensure that dbus is running. It may be easiest to do this by rebooting the system. After logging in again, run the command loginctl. The result should indicate that a SESSION and a SEAT have been created.

## Contents

Installed Programs: busctl, elogind-inhibit, loginctl, userdbctl, and varlinkctl
Installed Library: libelogind.so and libnss_elogind.so
Installed Directories: /usr/lib/elogind, /etc/elogind, /usr/include/elogind, and /usr/share/doc/elogind-257.16

### Short Descriptions

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
userdbctl | is used to inspect users, groups, and group memberships
varlinkctl | is used to interact with and invoke Varlink services
`libelogind.so` | is the main elogind utility library
`libnss_elogind.so` | is the Name Service Switch (NSS) module for elogind

- Prev

  dbus-1.16.2

- Next

  blocaled-0.7

- Up
- Home