← Back to team overview

curtin-dev team mailing list archive

Re: [Merge] ~ogayot/curtin:nvmeotcp-poc-blacklist-initramfs-tools into curtin:master

 


Diff comments:

> diff --git a/curtin/commands/curthooks.py b/curtin/commands/curthooks.py
> index 25568b0..edf868d 100644
> --- a/curtin/commands/curthooks.py
> +++ b/curtin/commands/curthooks.py
> @@ -866,6 +866,19 @@ def update_initramfs(target=None, all_kernels=False):
>      if update_initramfs_is_disabled(target):
>          return
>  
> +    # Ensure target is resolved even if it's None
> +    target = paths.target_path(target)
> +
> +    if (pathlib.Path(target) / 'usr/bin/dracut').exists():

Today `update_initramfs()` would fail in a chroot that has no means to generate an initramfs, and I think it should continue to do so. So checking if `initramfs-tools` is present and silently returning otherwise feels wrong to me.

That said, maybe I can do something like:

```
if utils.which('update-initramfs', target=target):
    # run update-initramfs
    return
elif utils.which('dracut', target=target):
    # Do nothing. Later we can explicitly invoke dracut if we diverted it.
    return

raise RuntimeError(f"cannot update the initramfs: neither update-initramfs or dracut found in target {target}")
```
Does it work for you?

> +        # This check is specifically intended for the Ubuntu NVMe/TCP POC.
> +        # When running the POC, we install dracut and remove initramfs-tools
> +        # (the packages are mutually exclusive). Therefore, trying to call
> +        # update-initramfs would fail.
> +        # If we were using a dpkg-divert to disable dracut (we don't do that
> +        # currently), we would need to explicitly invoke dracut here instead of
> +        # just returning.
> +        return
> +
>      # We keep the all_kernels flag for callers, the implementation
>      # now will operate correctly on all kernels present in the image
>      # which is almost always exactly one.


-- 
https://code.launchpad.net/~ogayot/curtin/+git/curtin/+merge/473058
Your team curtin developers is subscribed to branch curtin:master.



References