Thank you for your investigation.

After further analysis, I found what appears to be the root cause.
It now seems that the issue is specific to my environment rather than a bug.

### Environment

I built the system on an OpenZFS pool using `debootstrap`.

The datasets are configured as follows:

```
NAME               MOUNTPOINT  MOUNTED
tank               none        no
tank/home          /home       yes
tank/host          none        no
tank/host/ROOT     /           yes
tank/host/var      /var        yes
tank/host/var/log  /var/log    yes
```

### Observed boot sequence

From the system journal and the status of `var-log.mount`, I confirmed
the following sequence:

```
19:54:32  systemd-journald started.
19:54:32  systemd-journald opened the persistent journal at /var/log/journal/...
19:54:35  var-log.mount became active (tank/host/var/log).
```

### Investigation

Before `tank/host/var/log` is mounted, `systemd-journald` opens
`/var/log/journal/...` on the root dataset (`tank/host/ROOT`).

When `tank/host/var/log` is later mounted, `systemd-journald` continues
writing to the already-open file descriptors, which still point to the
journal files on `tank/host/ROOT`.

As a result, new log entries are written to
`tank/host/ROOT/var/log/journal` instead of the mounted
`tank/host/var/log` dataset.

I confirmed this by finding the missing journal entries in
`tank/host/ROOT/var/log/journal`.

### Question

Is this the expected behavior when `/var/log` is provided by a ZFS
dataset that is mounted after `systemd-journald` starts?

If so, what is the recommended way to avoid this problem?

Should the ZFS dataset be mounted earlier (for example, from the
initramfs), or is there another recommended configuration?

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2160529

Title:
  systemd services with StandardOutput=journal produce no journal
  entries while syslog logging still works

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2160529/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to