On Fri, Oct 31, 2014 at 10:16:45AM +0100, Jan Synacek wrote:
> ---
> Changes in v3:
> - check correct errno
> Changes in v2:
> - show long explanation only when errno == EROFS
>
> src/core/machine-id-setup.c | 12 +++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/src/core/machine-id-setup.c b/src/core/machine-id-setup.c
> index efb074f..e54b879 100644
> --- a/src/core/machine-id-setup.c
> +++ b/src/core/machine-id-setup.c
> @@ -184,14 +184,24 @@ int machine_id_setup(const char *root) {
> * will be owned by root it doesn't matter much, but maybe
> * people look. */
>
> +int old_errno;
> +
> mkdir_parents(etc_machine_id, 0755);
> fd = open(etc_machine_id, O_RDWR|O_CREAT|O_CLOEXEC|O_NOCTTY,
> 0444);
> +old_errno = errno;
> if (fd >= 0)
> writable = true;
> else {
> fd = open(etc_machine_id,
> O_RDONLY|O_CLOEXEC|O_NOCTTY);
> if (fd < 0) {
> -log_error("Cannot open %s: %m",
> etc_machine_id);
> +if (old_errno == EROFS)
Hi,
patch is applied, but I changed it to be even more conservative before printing
the long
message.
Zbyszek
> +log_error("System cannot boot:
> Missing /etc/machine-id and /etc is mounted read-only.\n"
> + "Booting up is supported
> only when:\n"
> + "1) /etc/machine-id exists
> and is populated.\n"
> + "2) /etc/machine-id exists
> and is empty.\n"
> + "3) /etc/machine-id is
> missing and /etc is writable.\n");
> +else
> +log_error("Cannot open %s: %m",
> etc_machine_id);
> return -errno;
> }
>
> --
> 1.9.3
>
> ___
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel