Lines Matching refs:etc_machine_id

200         const char *etc_machine_id, *run_machine_id;
207 etc_machine_id = "/etc/machine-id";
213 etc_machine_id = path_kill_slashes(x);
225 mkdir_parents(etc_machine_id, 0755);
226 fd = open(etc_machine_id, O_RDWR|O_CREAT|O_CLOEXEC|O_NOCTTY, 0444);
230 fd = open(etc_machine_id, O_RDONLY|O_CLOEXEC|O_NOCTTY);
240 log_error_errno(errno, "Cannot open %s: %m", etc_machine_id);
284 if (mount(run_machine_id, etc_machine_id, NULL, MS_BIND, NULL) < 0) {
286 return log_error_errno(errno, "Failed to mount %s: %m", etc_machine_id);
289 log_info("Installed transient %s file.", etc_machine_id);
292 if (mount(NULL, etc_machine_id, NULL, MS_BIND|MS_RDONLY|MS_REMOUNT, NULL) < 0)
293 log_warning_errno(errno, "Failed to make transient %s read-only: %m", etc_machine_id);
300 const char *etc_machine_id;
305 etc_machine_id = "/etc/machine-id";
310 etc_machine_id = path_kill_slashes(x);
313 r = path_is_mount_point(etc_machine_id, 0);
315 return log_error_errno(r, "Failed to determine whether %s is a mount point: %m", etc_machine_id);
317 log_debug("%s is is not a mount point. Nothing to do.", etc_machine_id);
322 fd = open(etc_machine_id, O_RDONLY|O_CLOEXEC|O_NOCTTY);
324 return log_error_errno(errno, "Cannot open %s: %m", etc_machine_id);
328 return log_error_errno(r, "We didn't find a valid machine ID in %s.", etc_machine_id);
332 return log_error_errno(r, "Failed to determine whether %s is on a temporary file system: %m", etc_machine_id);
334 log_error("%s is not on a temporary file system.", etc_machine_id);
345 /* Switch to a new mount namespace, isolate ourself and unmount etc_machine_id in our new namespace */
352 if (umount(etc_machine_id) < 0)
353 return log_error_errno(errno, "Failed to unmount transient %s file in our private namespace: %m", etc_machine_id);
355 /* Update a persistent version of etc_machine_id */
356 fd = open(etc_machine_id, O_RDWR|O_CREAT|O_CLOEXEC|O_NOCTTY, 0444);
358 return log_error_errno(errno, "Cannot open for writing %s. This is mandatory to get a persistent machine-id: %m", etc_machine_id);
362 return log_error_errno(r, "Cannot write %s: %m", etc_machine_id);
369 return log_warning_errno(r, "Failed to switch back to initial mount namespace: %m.\nWe'll keep transient %s file until next reboot.", etc_machine_id);
371 if (umount2(etc_machine_id, MNT_DETACH) < 0)
372 return log_warning_errno(errno, "Failed to unmount transient %s file: %m.\nWe keep that mount until next reboot.", etc_machine_id);