if (u->cgroup_inotify_wd >= 0) {
if (inotify_rm_watch(u->manager->cgroup_inotify_fd, u->cgroup_inotify_wd) < 0)
- log_unit_debug_errno(u, errno, "Failed to remove cgroup inotify watch %i for %s, ignoring", u->cgroup_inotify_wd, u->id);
+ log_unit_debug_errno(u, errno, "Failed to remove cgroup inotify watch %i for %s, ignoring: %m", u->cgroup_inotify_wd, u->id);
(void) hashmap_remove(u->manager->cgroup_inotify_wd_unit, INT_TO_PTR(u->cgroup_inotify_wd));
u->cgroup_inotify_wd = -1;
} else if (streq(key, "found")) {
r = device_found_from_string_many(value, &d->deserialized_found);
if (r < 0)
- log_unit_debug_errno(u, r, "Failed to parse found value, ignoring: %s", value);
+ log_unit_debug_errno(u, r, "Failed to parse found value '%s', ignoring: %m", value);
} else
log_unit_debug(u, "Unknown serialization key: %s", key);
/* If that didn't work, generate a random machine id */
r = sd_id128_randomize(ret);
if (r < 0)
- return log_error_errno(r, "Failed to generate randomized : %m");
+ return log_error_errno(r, "Failed to generate randomized machine ID: %m");
log_info("Initializing machine ID from random generator.");
return 0;
"2) /etc/machine-id exists and is empty.\n"
"3) /etc/machine-id is missing and /etc is writable.\n");
else
- return log_error_errno(errno,
- "Cannot open %s: %m", etc_machine_id);
+ return log_error_errno(errno, "Cannot open %s: %m", etc_machine_id);
}
writable = false;
r = id128_read_fd(fd, ID128_PLAIN, &id);
if (r < 0)
- return log_error_errno(r, "We didn't find a valid machine ID in %s.", etc_machine_id);
+ return log_error_errno(r, "We didn't find a valid machine ID in %s: %m", etc_machine_id);
fd = safe_close(fd);
r = value ? parse_boolean(value) : true;
if (r < 0)
- log_warning("Failed to parse dump core switch %s. Ignoring.", value);
+ log_warning_errno(r, "Failed to parse dump core switch %s, ignoring: %m", value);
else
arg_dump_core = r;
if (!value)
arg_crash_chvt = 0; /* turn on */
- else if (parse_crash_chvt(value) < 0)
- log_warning("Failed to parse crash chvt switch %s. Ignoring.", value);
+ else {
+ r = parse_crash_chvt(value);
+ if (r < 0)
+ log_warning_errno(r, "Failed to parse crash chvt switch %s, ignoring: %m", value);
+ }
} else if (proc_cmdline_key_streq(key, "systemd.crash_shell")) {
r = value ? parse_boolean(value) : true;
if (r < 0)
- log_warning("Failed to parse crash shell switch %s. Ignoring.", value);
+ log_warning_errno(r, "Failed to parse crash shell switch %s, ignoring: %m", value);
else
arg_crash_shell = r;
r = value ? parse_boolean(value) : true;
if (r < 0)
- log_warning("Failed to parse crash reboot switch %s. Ignoring.", value);
+ log_warning_errno(r, "Failed to parse crash reboot switch %s, ignoring: %m", value);
else
arg_crash_reboot = r;
r = parse_confirm_spawn(value, &s);
if (r < 0)
- log_warning_errno(r, "Failed to parse confirm_spawn switch %s. Ignoring.", value);
- else {
- free(arg_confirm_spawn);
- arg_confirm_spawn = s;
- }
+ log_warning_errno(r, "Failed to parse confirm_spawn switch %s, ignoring: %m", value);
+ else
+ free_and_replace(arg_confirm_spawn, s);
} else if (proc_cmdline_key_streq(key, "systemd.service_watchdogs")) {
r = value ? parse_boolean(value) : true;
if (r < 0)
- log_warning("Failed to parse service watchdog switch %s. Ignoring.", value);
+ log_warning_errno(r, "Failed to parse service watchdog switch %s, ignoring: %m", value);
else
arg_service_watchdogs = r;
if (value) {
r = parse_show_status(value, &arg_show_status);
if (r < 0)
- log_warning("Failed to parse show status switch %s. Ignoring.", value);
+ log_warning_errno(r, "Failed to parse show status switch %s, ignoring: %m", value);
} else
arg_show_status = SHOW_STATUS_YES;
r = exec_output_from_string(value);
if (r < 0)
- log_warning("Failed to parse default standard output switch %s. Ignoring.", value);
+ log_warning_errno(r, "Failed to parse default standard output switch %s, ignoring: %m", value);
else
arg_default_std_output = r;
r = exec_output_from_string(value);
if (r < 0)
- log_warning("Failed to parse default standard error switch %s. Ignoring.", value);
+ log_warning_errno(r, "Failed to parse default standard error switch %s, ignoring: %m", value);
else
arg_default_std_error = r;
r = set_machine_id(value);
if (r < 0)
- log_warning("MachineID '%s' is not valid. Ignoring.", value);
+ log_warning_errno(r, "MachineID '%s' is not valid, ignoring: %m", value);
} else if (proc_cmdline_key_streq(key, "systemd.default_timeout_start_sec")) {
r = parse_sec(value, &arg_default_timeout_start_usec);
if (r < 0)
- log_warning_errno(r, "Failed to parse default start timeout: %s, ignoring.", value);
+ log_warning_errno(r, "Failed to parse default start timeout '%s', ignoring: %m", value);
if (arg_default_timeout_start_usec <= 0)
arg_default_timeout_start_usec = USEC_INFINITY;
if (r == 0)
rescan = true;
else if (r < 0)
- return log_error_errno(r, "Failed to drain libmount events");
+ return log_error_errno(r, "Failed to drain libmount events: %m");
} while (r == 0);
log_debug("libmount event [rescan: %s]", yes_no(rescan));
r = cunescape(value, 0, &t);
if (r < 0)
- log_unit_debug_errno(u, r, "Failed to unescape status text: %s", value);
+ log_unit_debug_errno(u, r, "Failed to unescape status text '%s': %m", value);
else
free_and_replace(s->status_text, t);
r = manager_load_unit(u->manager, value, NULL, NULL, &socket);
if (r < 0)
- log_unit_debug_errno(u, r, "Failed to load accept-socket unit: %s", value);
+ log_unit_debug_errno(u, r, "Failed to load accept-socket unit '%s': %m", value);
else {
unit_ref_set(&s->accept_socket, u, socket);
SOCKET(socket)->n_connections++;
status_errno = parse_errno(e);
if (status_errno < 0)
log_unit_warning_errno(u, status_errno,
- "Failed to parse ERRNO= field in notification message: %s", e);
+ "Failed to parse ERRNO= field value '%s' in notification message: %m", e);
else if (s->status_errno != status_errno) {
s->status_errno = status_errno;
notify_dbus = true;
case ARG_LOG_LEVEL:
r = log_set_max_level_from_string(optarg);
if (r < 0)
- log_error_errno(r, "Failed to parse log level %s, ignoring.", optarg);
+ log_error_errno(r, "Failed to parse log level %s, ignoring: %m", optarg);
break;
case ARG_LOG_TARGET:
r = log_set_target_from_string(optarg);
if (r < 0)
- log_error_errno(r, "Failed to parse log target %s, ignoring", optarg);
+ log_error_errno(r, "Failed to parse log target %s, ignoring: %m", optarg);
break;
if (optarg) {
r = log_show_color_from_string(optarg);
if (r < 0)
- log_error_errno(r, "Failed to parse log color setting %s, ignoring", optarg);
+ log_error_errno(r, "Failed to parse log color setting %s, ignoring: %m", optarg);
} else
log_show_color(true);
if (optarg) {
r = log_show_location_from_string(optarg);
if (r < 0)
- log_error_errno(r, "Failed to parse log location setting %s, ignoring", optarg);
+ log_error_errno(r, "Failed to parse log location setting %s, ignoring: %m", optarg);
} else
log_show_location(true);
case ARG_EXIT_CODE:
r = safe_atou8(optarg, &arg_exit_code);
if (r < 0)
- log_error_errno(r, "Failed to parse exit code %s, ignoring", optarg);
+ log_error_errno(r, "Failed to parse exit code %s, ignoring: %m", optarg);
break;
case ARG_TIMEOUT:
r = parse_sec(optarg, &arg_timeout);
if (r < 0)
- log_error_errno(r, "Failed to parse shutdown timeout %s, ignoring", optarg);
+ log_error_errno(r, "Failed to parse shutdown timeout %s, ignoring: %m", optarg);
break;
if (write(isempty(acc2) ? load2_fd : change_fd, buf, strlen(buf)) < 0) {
if (r == 0)
r = -errno;
- log_error_errno(errno, "Failed to write '%s' to '%s' in '%s'",
+ log_error_errno(errno, "Failed to write '%s' to '%s' in '%s': %m",
buf, isempty(acc2) ? "/sys/fs/smackfs/load2" : "/sys/fs/smackfs/change-rule", entry->d_name);
}
}
if (write(cipso2_fd, buf, strlen(buf)) < 0) {
if (r == 0)
r = -errno;
- log_error_errno(errno, "Failed to write '%s' to '/sys/fs/smackfs/cipso2' in '%s'",
+ log_error_errno(errno, "Failed to write '%s' to '/sys/fs/smackfs/cipso2' in '%s': %m",
buf, entry->d_name);
break;
}
if (!fputs(buf, dst)) {
if (r == 0)
r = -EINVAL;
- log_error_errno(errno, "Failed to write line to /sys/fs/smackfs/netlabel");
+ log_error_errno(errno, "Failed to write line to /sys/fs/smackfs/netlabel: %m");
break;
}
q = fflush_and_check(dst);
log_info("Successfully wrote Smack onlycap list.");
break;
default:
- log_emergency_errno(r, "Failed to write Smack onlycap list.");
+ log_emergency_errno(r, "Failed to write Smack onlycap list: %m");
return r;
}