os-prober exits prematurely with "logger: socket /dev/log: Protocol wrong type for socket"
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
AppArmor Profiles |
New
|
Undecided
|
Unassigned | ||
os-prober (Ubuntu) |
Fix Released
|
Critical
|
Unassigned | ||
rsyslog (Ubuntu) |
New
|
Critical
|
Unassigned |
Bug Description
Failure occurs on Ubuntu 16.04 with the apparmor-
Running update-grub will run /usr/bin/os-prober, which spews about a dozen of the following line to stderr:
logger: socket /dev/log: Protocol wrong type for socket
… but fails to report the existence of some installed operating systems as expected.
Furthermore, /var/log/messages contains:
kernel: audit: type=1400 audit(155604306
Here is a stripped-down skeleton of the /usr/bin/os-prober script, which demonstrates the problem:
#!/bin/sh
set -e -x
newns () {
[ "$OS_PROBER_NEWNS" ] || exec /usr/lib/
}
log() {
logger -t "$(basename "$0")" "$@"
}
debug() {
log "debug: $@"
}
ls -l /dev/log
debug "Hello world"
newns "$@"
The expected behavior is that it should write "debug: os-prober-testcase Hello world" to /var/log/messages twice. However, it only succeeds in writing "Hello world" once. After the script respawns itself with /usr/lib/
Since the os-prober Bash script runs with the -e flag, any error, even just a logging error, causes the script to terminate prematurely. (Arguably, the log() function should call `logger -t "$(basename "$0")" "$@" || :` so that logging failures aren't fatal.)
The fix, for me, is to edit /etc/apparmor.
profile syslog-ng /{usr/,
…
}
to
profile syslog-ng /{usr/,
…
}
… then run `aa-complain sbin.syslog-ng` and `service syslog-ng restart`, before running update-grub again. I assume that similar fixes would be required for the other logging daemons.
Related branches
- git-ubuntu import: Pending requested
-
Diff: 52 lines (+9/-3)4 files modifiedcommon.sh (+1/-1)
debian/changelog (+6/-0)
os-probes/init/common/10filesystems (+1/-1)
os-probes/mounted/powerpc/20macosx (+1/-1)
yeah i get apparmor="DENIED" info="Failed name loookup - disconnected path", which breaks os-prober.