Skip to content
This repository has been archived by the owner on Aug 25, 2021. It is now read-only.

firstboot-complete: tell zipl to run #117

Merged
merged 1 commit into from
Nov 6, 2019

Conversation

tuan-hoang1
Copy link
Contributor

zipl records need to be updated, because ignition.firstboot is burned
into target disk during coreos-installer

As a short-term solution for:
#84

Depends on:
ibm-s390-linux/s390-tools#71
ibm-s390-linux/s390-tools#74

Related:
coreos/coreos-installer#61
coreos/coreos-assembler#780

@tuan-hoang1
Copy link
Contributor Author

cc @cgwalters for early review until the dependencies are ready

# The retval code is still respected with having this if-else block.
ExecStart=/bin/sh -c \
'mount -o remount,rw /boot && rm /boot/ignition.firstboot && \
if [[ $(uname -m) = s390x ]]; then zipl; fi'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could ship this and be totally fine but...the perfectionist in me is bothered by the potential case here where the system is interrupted between rm /boot/ignition.firstboot and running zipl - we'd be in a situation where Ignition would rerun every boot until an upgrade (or something else ran zipl). (Actually wait, have we even patched libostree to run zipl?)
Anyways so I think we shoudl remove the stamp file after running zipl, i.e.:

ExecStart=/bin/sh -c 'mount -o remount,rw /boot && if [[ $(uname -m) = s390x ]]; then zipl; fi && rm /boot/ignition.firstboot '

or so?

Copy link
Contributor Author

@tuan-hoang1 tuan-hoang1 Oct 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Actually wait, have we even patched libostree to run zipl?) : The only attempt I made to patch libostree for zipl support is to generate the config file - similar to this https://github.com/ostreedev/ostree/blob/master/src/libostree/ostree-bootloader-syslinux.c for boot/syslinux/syslinux.cfg - which I think we don't need. Because zipl understands BLS and we would also ship a minimal zipl.conf (soon to be merged and backported). For other means outside generating the config, I'm not sure if we need to patch libostree for zipl. Please some light on it (either here or on IRC).
And agree with you about moving the rm after the if block, didn't really consider that details. Good point

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zipl understands BLS, but the command still needs to be rerun after updating the BLS files, right? (Unlike grub2)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And if I'm not wrong, s390x/zipl doesn't care if /boot/ignition.firstboot exists or not - at least for now when we don't have grub-emu yet (as described in#84). AFAIU, /boot/ignition.firstboot only makes sense for grub.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zipl understands BLS, but the command still needs to be rerun after updating the BLS files, right? (Unlike grub2) : Ah right, now I remember we once talked about the hook/trigger mechanism to invoke zipl after ostree updates new commits.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't be better, working on it, quite urgent tbh. Many thanks, Colin.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok @cgwalters @tuan-hoang1 the zipl backend works well on rhcos with cosa master. The other question i had is - would this work for rhcos-4.2 with cosa-4.2 (basically using anaconda) and how do we deal with setting the backend to zipl like we do in create_disk.sh?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Prashanth684 I think of 2 ways:

  1. Add ostree config set bootloader to anaconda patch at https://bugzilla.redhat.com/show_bug.cgi?id=1741908 and generate new updates.img.
  2. Execute ostree config set bootloader in gf-anaconda-cleanup.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But that's another issue. Let's not hijack this PR :P

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Execute ostree config set bootloader in gf-anaconda-cleanup

I like doing this fix in cosa - changing Anaconda is much harder. It might also work to do it in a %post --nochroot in image-base.ks.

@tuan-hoang1
Copy link
Contributor Author

cc @barthy1

@tuan-hoang1
Copy link
Contributor Author

Friendly ping @ashcrow.

Copy link
Member

@jlebon jlebon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor typo, LGTM otherwise!

@@ -18,7 +18,13 @@ RemainAfterExit=yes
# detected this file. Fail if we are unable to remove it, rather than risking
# rerunning Ignition at next boot.
MountFlags=slave
ExecStart=/bin/sh -c 'mount -o remount,rw /boot && rm /boot/ignition.firstboot'
# It is better to have a separate script to do this but it might be polutting
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

polluting

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked, thanks.

zipl records need to be updated, because ignition.firstboot is burned
into target disk during coreos-installer

As a short-term solution for:
coreos#84

Depends on:
ibm-s390-linux/s390-tools#71
ibm-s390-linux/s390-tools#74

Related:
coreos/coreos-installer#61
coreos/coreos-assembler#780
@jlebon jlebon merged commit 38af701 into coreos:master Nov 6, 2019
tuan-hoang1 added a commit to tuan-hoang1/coreos-assembler that referenced this pull request Nov 6, 2019
cgwalters pushed a commit to coreos/coreos-assembler that referenced this pull request Nov 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants