core-base icon indicating copy to clipboard operation
core-base copied to clipboard

Error writing to system log with `logger` on UC24

Open farshidtz opened this issue 1 year ago • 1 comments

The logger command executed from a snap (hook, app) fails on UC24 20240505.5 with the following error:

logger: socket /dev/log: Protocol wrong type for socket

This is accompanied by an AppArmor denial. For example:

= AppArmor =
Time: May 06 13:41:12
Log: apparmor="DENIED" operation="sendmsg" class="file" profile="snap.<snap>.hook.install" name="/systemd/journal/dev-log" pid=2972 comm="logger" requested_mask="w" denied_mask="w" fsuid=0 ouid=0
File: /systemd/journal/dev-log (write)
Suggestion:
* adjust program to write to $SNAP_DATA, $SNAP_COMMON, $SNAP_USER_DATA or $SNAP_USER_COMMON

Snaps on the host:

$ snap list
Name          Version                          Rev    Tracking       Publisher   Notes
console-conf  24.04.1+git45g5f9fae19+gd81a15d  40     24/stable      canonical✓  -
core20        20240227                         2264   latest/stable  canonical✓  base
core22        20240408                         1380   latest/stable  canonical✓  base
core24        20240426                         405    latest/stable  canonical✓  base
pc            24-0.1                           178    24/stable      canonical✓  gadget
pc-kernel     6.8.0-31.31                      1803   24/stable      canonical✓  kernel
snapd         2.62                             21465  latest/stable  canonical✓  snapd

Additional facts:

  • The error appears regardless of the snap's base (tried core20-24).
  • It does not appear on classic Ubuntu 24.04 (6.8.0-31-generic amd64)
  • It does not appear in dev mode

To reproduce, either:

  • Install this snap: https://git.launchpad.net/snap-test-logger-install-hook/tree/
  • Install a snap that uses logger, such as avahi
  • Run logger from a shell of a confined snap that has an app (snap run --shell <snap>.<app>) and execute logger "test"

farshidtz avatar May 06 '24 16:05 farshidtz

Thanks for the report. At this time we are quite confident that the issue is https://bugs.launchpad.net/ubuntu/+source/rsyslog/+bug/2064096

alfonsosanchezbeato avatar May 06 '24 20:05 alfonsosanchezbeato

This is fixed with recent kernel releases

Meulengracht avatar Jun 28 '24 13:06 Meulengracht