Re: [systemd-devel] no installed machine-id vs systemd-in-initramfs

2013-07-11 Thread Harald Hoyer
On 07/10/2013 05:26 PM, Colin Walters wrote:
 The gnome-ostree build system generates disk images that can be
 downloaded directly; there is no installer.
 
 In the old model of dracut shell script + systemd, systemd's main.c
 has:
 if (arg_running_as == SYSTEMD_SYSTEM ...) {
   ...
   machine_id_setup();
   ...
 }
 
 So after mounting the rootfs, we'd end up writing one to /etc (at least
 in gnome-ostree which comes with a writable copy of /etc), and it would
 persist across reboots, and all would be well with the world.
 
 In the new systemd-in-initramfs model, journald is now launched in the
 initramfs.  Dracut will copy the host's machine id into the initramfs
 if it exists, but in the gnome-ostree case (or more generally
 pre-canned OS case), there isn't one.  journald will attempt to start,
 and fail.
 
 One thought I had is to say:  If there's no /etc/machine-id in the
 initramfs, write one to /run/machine-id.  After mounting the rootfs,
 persist that to /etc.

Err, if there is no machine-id in the initramfs, systemd and journald should do
just fine.

It was this way in F18, F17.

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] no installed machine-id vs systemd-in-initramfs

2013-07-11 Thread Kay Sievers
On Thu, Jul 11, 2013 at 11:55 AM, Harald Hoyer harald.ho...@gmail.com wrote:
 On 07/10/2013 05:26 PM, Colin Walters wrote:
 The gnome-ostree build system generates disk images that can be
 downloaded directly; there is no installer.

 In the old model of dracut shell script + systemd, systemd's main.c
 has:
 if (arg_running_as == SYSTEMD_SYSTEM ...) {
   ...
   machine_id_setup();
   ...
 }

 So after mounting the rootfs, we'd end up writing one to /etc (at least
 in gnome-ostree which comes with a writable copy of /etc), and it would
 persist across reboots, and all would be well with the world.

 In the new systemd-in-initramfs model, journald is now launched in the
 initramfs.  Dracut will copy the host's machine id into the initramfs
 if it exists, but in the gnome-ostree case (or more generally
 pre-canned OS case), there isn't one.  journald will attempt to start,
 and fail.

 One thought I had is to say:  If there's no /etc/machine-id in the
 initramfs, write one to /run/machine-id.  After mounting the rootfs,
 persist that to /etc.

 Err, if there is no machine-id in the initramfs, systemd and journald should 
 do
 just fine.

 It was this way in F18, F17.

Didn't it always need an empty file to over-mount it with a temporary
and randomly created one?

Kay
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] no installed machine-id vs systemd-in-initramfs

2013-07-11 Thread Harald Hoyer
On 07/11/2013 12:04 PM, Kay Sievers wrote:
 On Thu, Jul 11, 2013 at 11:55 AM, Harald Hoyer harald.ho...@gmail.com wrote:
 On 07/10/2013 05:26 PM, Colin Walters wrote:
 The gnome-ostree build system generates disk images that can be
 downloaded directly; there is no installer.

 In the old model of dracut shell script + systemd, systemd's main.c
 has:
 if (arg_running_as == SYSTEMD_SYSTEM ...) {
   ...
   machine_id_setup();
   ...
 }

 So after mounting the rootfs, we'd end up writing one to /etc (at least
 in gnome-ostree which comes with a writable copy of /etc), and it would
 persist across reboots, and all would be well with the world.

 In the new systemd-in-initramfs model, journald is now launched in the
 initramfs.  Dracut will copy the host's machine id into the initramfs
 if it exists, but in the gnome-ostree case (or more generally
 pre-canned OS case), there isn't one.  journald will attempt to start,
 and fail.

 One thought I had is to say:  If there's no /etc/machine-id in the
 initramfs, write one to /run/machine-id.  After mounting the rootfs,
 persist that to /etc.

 Err, if there is no machine-id in the initramfs, systemd and journald should 
 do
 just fine.

 It was this way in F18, F17.
 
 Didn't it always need an empty file to over-mount it with a temporary
 and randomly created one?
 
 Kay
 

To quote from the dracut install script:

if [[ $hostonly ]]; then
dracut_install -o \
/etc/machine-id
else
if ! [[ -e $initdir/etc/machine-id ]]; then
 $initdir/etc/machine-id
fi
fi

Yes, you are right. In the hostonly case, there is no empty machine-id created,
if it is missing on the running machine.


Will fix.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] no installed machine-id vs systemd-in-initramfs

2013-07-11 Thread Lennart Poettering
On Wed, 10.07.13 11:26, Colin Walters (walt...@verbum.org) wrote:

 The gnome-ostree build system generates disk images that can be
 downloaded directly; there is no installer.
 
 In the old model of dracut shell script + systemd, systemd's main.c
 has:
 if (arg_running_as == SYSTEMD_SYSTEM ...) {
   ...
   machine_id_setup();
   ...
 }

machine_id_setup() will:

a) do nothing if /etc/machine-id is already valid

b) if it doesn't exist or is empty and the disk is writable, it will
   create a new randomized one

c) if it exists but is empty and the disk is read-only it will mount the
   file over with a randomized one from /run.

d) otherwise it will whine.

 So after mounting the rootfs, we'd end up writing one to /etc (at least
 in gnome-ostree which comes with a writable copy of /etc), and it would
 persist across reboots, and all would be well with the world.
 
 In the new systemd-in-initramfs model, journald is now launched in the
 initramfs.  Dracut will copy the host's machine id into the initramfs
 if it exists, but in the gnome-ostree case (or more generally
 pre-canned OS case), there isn't one.  journald will attempt to start,
 and fail.

I am pretty sure you should make use of c), i.e. create an empty stub
file in your initrd image and let systemd do its thing.

 One thought I had is to say:  If there's no /etc/machine-id in the
 initramfs, write one to /run/machine-id.  After mounting the rootfs,
 persist that to /etc.

there's no need to use the same one really. It's good to use the same,
but we are OK if they aren't, after all they are sufficiently distinct
systems with a different file system tree and so on.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] no installed machine-id vs systemd-in-initramfs

2013-07-10 Thread Colin Walters
The gnome-ostree build system generates disk images that can be
downloaded directly; there is no installer.

In the old model of dracut shell script + systemd, systemd's main.c
has:
if (arg_running_as == SYSTEMD_SYSTEM ...) {
  ...
  machine_id_setup();
  ...
}

So after mounting the rootfs, we'd end up writing one to /etc (at least
in gnome-ostree which comes with a writable copy of /etc), and it would
persist across reboots, and all would be well with the world.

In the new systemd-in-initramfs model, journald is now launched in the
initramfs.  Dracut will copy the host's machine id into the initramfs
if it exists, but in the gnome-ostree case (or more generally
pre-canned OS case), there isn't one.  journald will attempt to start,
and fail.

One thought I had is to say:  If there's no /etc/machine-id in the
initramfs, write one to /run/machine-id.  After mounting the rootfs,
persist that to /etc.

Except to really make that work, we'd need to regenerate the initramfs
client side after doing this.  I'd really like to avoid rebuilding the
initramfs on the client.

My instinct at this point is to just generate a new
default /etc/machine-id for each build.  That would have the unfortunate
consequence of not being globally unique.  But...I could just overwrite
that default machine ID with a new one in an installer type program.
Which would be mostly OK, but still feels like a hack.

Any other thoughts on this?


___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel