diff mbox series

xen: Create EFI_VENDOR directory

Message ID 20210322133301.11308-1-jandryuk@gmail.com (mailing list archive)
State New, archived
Headers show
Series xen: Create EFI_VENDOR directory | expand

Commit Message

Jason Andryuk March 22, 2021, 1:33 p.m. UTC
make install-xen fails when EFI_VENDOR is set (=fedora) with:
install: cannot create regular file '/home/user/xen/dist/install/boot/efi/efi/fedora/xen-4.15.0-rc.efi': No such file or directory

Create the EFI_VENDOR directory so xen.efi can be installed within.

This removes the need for Fedora and Qubes xen.spec files to manually
create the directory in advance.

Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
---
 xen/Makefile | 1 +
 1 file changed, 1 insertion(+)

Comments

Andrew Cooper March 22, 2021, 1:38 p.m. UTC | #1
On 22/03/2021 13:33, Jason Andryuk wrote:
> make install-xen fails when EFI_VENDOR is set (=fedora) with:
> install: cannot create regular file '/home/user/xen/dist/install/boot/efi/efi/fedora/xen-4.15.0-rc.efi': No such file or directory
>
> Create the EFI_VENDOR directory so xen.efi can be installed within.
>
> This removes the need for Fedora and Qubes xen.spec files to manually
> create the directory in advance.
>
> Signed-off-by: Jason Andryuk <jandryuk@gmail.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>

This wants backporting, and should be considered for 4.15 at this point.
Ian Jackson March 22, 2021, 2:01 p.m. UTC | #2
Jason Andryuk writes ("[PATCH] xen: Create EFI_VENDOR directory"):
> make install-xen fails when EFI_VENDOR is set (=fedora) with:
> install: cannot create regular file '/home/user/xen/dist/install/boot/efi/efi/fedora/xen-4.15.0-rc.efi': No such file or directory
> 
> Create the EFI_VENDOR directory so xen.efi can be installed within.
> 
> This removes the need for Fedora and Qubes xen.spec files to manually
> create the directory in advance.

I reviewed this.

Release-Acked-by: Ian Jackson <iwj@xenproject.org>

Presuming someone else also reviews it.  Andy, was your Acked-by a
Reviewed-by ?

Ian.
Jan Beulich March 22, 2021, 2:52 p.m. UTC | #3
On 22.03.2021 14:33, Jason Andryuk wrote:
> make install-xen fails when EFI_VENDOR is set (=fedora) with:
> install: cannot create regular file '/home/user/xen/dist/install/boot/efi/efi/fedora/xen-4.15.0-rc.efi': No such file or directory
> 
> Create the EFI_VENDOR directory so xen.efi can be installed within.
> 
> This removes the need for Fedora and Qubes xen.spec files to manually
> create the directory in advance.

While I'm not strictly against, I'd like to point out that it was
deliberate to not create this directory here. I also didn't expect
anyone's xen.spec to do so. Instead I'd expect the distro to create
it during OS installation. If this was a bad assumption, I'd prefer
if the commit message here could point out why such an expectation
won't hold in general.

Jan
Andrew Cooper March 22, 2021, 2:59 p.m. UTC | #4
On 22/03/2021 14:52, Jan Beulich wrote:
> On 22.03.2021 14:33, Jason Andryuk wrote:
>> make install-xen fails when EFI_VENDOR is set (=fedora) with:
>> install: cannot create regular file '/home/user/xen/dist/install/boot/efi/efi/fedora/xen-4.15.0-rc.efi': No such file or directory
>>
>> Create the EFI_VENDOR directory so xen.efi can be installed within.
>>
>> This removes the need for Fedora and Qubes xen.spec files to manually
>> create the directory in advance.
> While I'm not strictly against, I'd like to point out that it was
> deliberate to not create this directory here. I also didn't expect
> anyone's xen.spec to do so. Instead I'd expect the distro to create
> it during OS installation. If this was a bad assumption, I'd prefer
> if the commit message here could point out why such an expectation
> won't hold in general.

This reasoning is broken for anything other `make install DESTDIR=/` on
a live system.

It is incompatible with how RPM, deb, etc packages work.

~Andrew
Jan Beulich March 22, 2021, 3:15 p.m. UTC | #5
On 22.03.2021 15:59, Andrew Cooper wrote:
> On 22/03/2021 14:52, Jan Beulich wrote:
>> On 22.03.2021 14:33, Jason Andryuk wrote:
>>> make install-xen fails when EFI_VENDOR is set (=fedora) with:
>>> install: cannot create regular file '/home/user/xen/dist/install/boot/efi/efi/fedora/xen-4.15.0-rc.efi': No such file or directory
>>>
>>> Create the EFI_VENDOR directory so xen.efi can be installed within.
>>>
>>> This removes the need for Fedora and Qubes xen.spec files to manually
>>> create the directory in advance.
>> While I'm not strictly against, I'd like to point out that it was
>> deliberate to not create this directory here. I also didn't expect
>> anyone's xen.spec to do so. Instead I'd expect the distro to create
>> it during OS installation. If this was a bad assumption, I'd prefer
>> if the commit message here could point out why such an expectation
>> won't hold in general.
> 
> This reasoning is broken for anything other `make install DESTDIR=/` on
> a live system.
> 
> It is incompatible with how RPM, deb, etc packages work.

I'm afraid I don't understand, for both of your statements. If distro
installation put in place the designated directory, there wouldn't be
any live system lacking it, and there wouldn't be any concern in the
packaging of any software.

To take a perhaps too extreme example - packages typically expect e.g.
/usr to exist as well, don't they?

Jan
Jason Andryuk March 22, 2021, 3:36 p.m. UTC | #6
On Mon, Mar 22, 2021 at 11:15 AM Jan Beulich <jbeulich@suse.com> wrote:
>
> On 22.03.2021 15:59, Andrew Cooper wrote:
> > On 22/03/2021 14:52, Jan Beulich wrote:
> >> On 22.03.2021 14:33, Jason Andryuk wrote:
> >>> make install-xen fails when EFI_VENDOR is set (=fedora) with:
> >>> install: cannot create regular file '/home/user/xen/dist/install/boot/efi/efi/fedora/xen-4.15.0-rc.efi': No such file or directory
> >>>
> >>> Create the EFI_VENDOR directory so xen.efi can be installed within.
> >>>
> >>> This removes the need for Fedora and Qubes xen.spec files to manually
> >>> create the directory in advance.
> >> While I'm not strictly against, I'd like to point out that it was
> >> deliberate to not create this directory here. I also didn't expect
> >> anyone's xen.spec to do so. Instead I'd expect the distro to create
> >> it during OS installation. If this was a bad assumption, I'd prefer
> >> if the commit message here could point out why such an expectation
> >> won't hold in general.

I didn't write this for an rpm xen.spec - I just cross referenced out
of curiosity.

> > This reasoning is broken for anything other `make install DESTDIR=/` on
> > a live system.
> >
> > It is incompatible with how RPM, deb, etc packages work.
>
> I'm afraid I don't understand, for both of your statements. If distro
> installation put in place the designated directory, there wouldn't be
> any live system lacking it, and there wouldn't be any concern in the
> packaging of any software.
>
> To take a perhaps too extreme example - packages typically expect e.g.
> /usr to exist as well, don't they?

But you have to install -d ${D}/usr before install ${D}/usr/file, right?

It's a surprising sequence to:
1) see 'EFI installation only partially done (EFI_VENDOR not set)'
2) set EFI_VENDOR
3) see xen.efi installation fail

I was working on a fedora system, and I was using `make && sh
install.sh` to install (but be sure to `rm -r dist/install/var/run`
since otherwise that'll break booting).  I wanted xen.efi to end up in
/boot/efi/EFI/fedora after running `sh install.sh`, and EFI_VENDOR
appeared to be the way to do it.  Again, it was surprising to enable
an option and then have it break.

Regards,
Jason
Jan Beulich March 22, 2021, 4:53 p.m. UTC | #7
On 22.03.2021 16:36, Jason Andryuk wrote:
> On Mon, Mar 22, 2021 at 11:15 AM Jan Beulich <jbeulich@suse.com> wrote:
>>
>> On 22.03.2021 15:59, Andrew Cooper wrote:
>>> On 22/03/2021 14:52, Jan Beulich wrote:
>>>> On 22.03.2021 14:33, Jason Andryuk wrote:
>>>>> make install-xen fails when EFI_VENDOR is set (=fedora) with:
>>>>> install: cannot create regular file '/home/user/xen/dist/install/boot/efi/efi/fedora/xen-4.15.0-rc.efi': No such file or directory
>>>>>
>>>>> Create the EFI_VENDOR directory so xen.efi can be installed within.
>>>>>
>>>>> This removes the need for Fedora and Qubes xen.spec files to manually
>>>>> create the directory in advance.
>>>> While I'm not strictly against, I'd like to point out that it was
>>>> deliberate to not create this directory here. I also didn't expect
>>>> anyone's xen.spec to do so. Instead I'd expect the distro to create
>>>> it during OS installation. If this was a bad assumption, I'd prefer
>>>> if the commit message here could point out why such an expectation
>>>> won't hold in general.
> 
> I didn't write this for an rpm xen.spec - I just cross referenced out
> of curiosity.
> 
>>> This reasoning is broken for anything other `make install DESTDIR=/` on
>>> a live system.
>>>
>>> It is incompatible with how RPM, deb, etc packages work.
>>
>> I'm afraid I don't understand, for both of your statements. If distro
>> installation put in place the designated directory, there wouldn't be
>> any live system lacking it, and there wouldn't be any concern in the
>> packaging of any software.
>>
>> To take a perhaps too extreme example - packages typically expect e.g.
>> /usr to exist as well, don't they?
> 
> But you have to install -d ${D}/usr before install ${D}/usr/file, right?

Sure, but I take it that about every package can rely on it to be
there, and not have to take care of creating it. There ought to
be an "owning" package for that directory, and that's the package
responsible for creating it. The same would then go for wherever
you want xen.efi to go.

> It's a surprising sequence to:
> 1) see 'EFI installation only partially done (EFI_VENDOR not set)'
> 2) set EFI_VENDOR
> 3) see xen.efi installation fail
> 
> I was working on a fedora system, and I was using `make && sh
> install.sh` to install (but be sure to `rm -r dist/install/var/run`
> since otherwise that'll break booting).  I wanted xen.efi to end up in
> /boot/efi/EFI/fedora after running `sh install.sh`, and EFI_VENDOR
> appeared to be the way to do it.  Again, it was surprising to enable
> an option and then have it break.

Well - the thing is that according to my understanding you don't simply
pick a directory name of your liking, but you use the one your distro
uses. Otherwise I consider it quite likely that upon next re-building
of the EFI partition your binary won't be put back.

Jan
Andrew Cooper March 22, 2021, 5:08 p.m. UTC | #8
On 22/03/2021 15:15, Jan Beulich wrote:
> On 22.03.2021 15:59, Andrew Cooper wrote:
>> On 22/03/2021 14:52, Jan Beulich wrote:
>>> On 22.03.2021 14:33, Jason Andryuk wrote:
>>>> make install-xen fails when EFI_VENDOR is set (=fedora) with:
>>>> install: cannot create regular file '/home/user/xen/dist/install/boot/efi/efi/fedora/xen-4.15.0-rc.efi': No such file or directory
>>>>
>>>> Create the EFI_VENDOR directory so xen.efi can be installed within.
>>>>
>>>> This removes the need for Fedora and Qubes xen.spec files to manually
>>>> create the directory in advance.
>>> While I'm not strictly against, I'd like to point out that it was
>>> deliberate to not create this directory here. I also didn't expect
>>> anyone's xen.spec to do so. Instead I'd expect the distro to create
>>> it during OS installation. If this was a bad assumption, I'd prefer
>>> if the commit message here could point out why such an expectation
>>> won't hold in general.
>> This reasoning is broken for anything other `make install DESTDIR=/` on
>> a live system.
>>
>> It is incompatible with how RPM, deb, etc packages work.
> I'm afraid I don't understand, for both of your statements. If distro
> installation put in place the designated directory, there wouldn't be
> any live system lacking it, and there wouldn't be any concern in the
> packaging of any software.
>
> To take a perhaps too extreme example - packages typically expect e.g.
> /usr to exist as well, don't they?

No.  A buildroot starts out fully empty, by design.

The packaging environment (usually a chroot) invokes `make install
DESTDIR=/path/to/staging/root` so you don't interfere with any of the
tools inside the environment, and the resulting tar/cpio has the
buildroot stripped out of paths.

The failure being discussed here is the build within the packaging
environment, not the metadata which forms the final package.  Installing
a deb/rpm/etc will make directories as applicable.

~Andrew
Jan Beulich March 23, 2021, 7:23 a.m. UTC | #9
On 22.03.2021 18:08, Andrew Cooper wrote:
> On 22/03/2021 15:15, Jan Beulich wrote:
>> On 22.03.2021 15:59, Andrew Cooper wrote:
>>> On 22/03/2021 14:52, Jan Beulich wrote:
>>>> On 22.03.2021 14:33, Jason Andryuk wrote:
>>>>> make install-xen fails when EFI_VENDOR is set (=fedora) with:
>>>>> install: cannot create regular file '/home/user/xen/dist/install/boot/efi/efi/fedora/xen-4.15.0-rc.efi': No such file or directory
>>>>>
>>>>> Create the EFI_VENDOR directory so xen.efi can be installed within.
>>>>>
>>>>> This removes the need for Fedora and Qubes xen.spec files to manually
>>>>> create the directory in advance.
>>>> While I'm not strictly against, I'd like to point out that it was
>>>> deliberate to not create this directory here. I also didn't expect
>>>> anyone's xen.spec to do so. Instead I'd expect the distro to create
>>>> it during OS installation. If this was a bad assumption, I'd prefer
>>>> if the commit message here could point out why such an expectation
>>>> won't hold in general.
>>> This reasoning is broken for anything other `make install DESTDIR=/` on
>>> a live system.
>>>
>>> It is incompatible with how RPM, deb, etc packages work.
>> I'm afraid I don't understand, for both of your statements. If distro
>> installation put in place the designated directory, there wouldn't be
>> any live system lacking it, and there wouldn't be any concern in the
>> packaging of any software.
>>
>> To take a perhaps too extreme example - packages typically expect e.g.
>> /usr to exist as well, don't they?
> 
> No.  A buildroot starts out fully empty, by design.
> 
> The packaging environment (usually a chroot) invokes `make install
> DESTDIR=/path/to/staging/root` so you don't interfere with any of the
> tools inside the environment, and the resulting tar/cpio has the
> buildroot stripped out of paths.
> 
> The failure being discussed here is the build within the packaging
> environment, not the metadata which forms the final package.  Installing
> a deb/rpm/etc will make directories as applicable.

Ah, I see. But then this _still_ isn't the right thing to do. In fact,
the package build and installation shouldn't put xen.efi in the EFI
partition _at all_. The build system doing so is for developers only,
so they don't need to invoke boot loader configuration every time they
rebuild and re-install. Hence the packaging build shouldn't set
EFI_VENDOR in the first place. There it instead should be a subsequent
boot loader re-configuration which picks up xen.efi from its install
location (under $(EFI_DIR)) and places it on the EFI partition.

With the above I take back my "I'm not strictly against" - I'm pretty
firmly against. If the warning emitted is deemed a problem, I'm sure
we can find a way to silence it.

Jan
Jason Andryuk March 23, 2021, 12:34 p.m. UTC | #10
On Tue, Mar 23, 2021 at 3:23 AM Jan Beulich <jbeulich@suse.com> wrote:
>
> On 22.03.2021 18:08, Andrew Cooper wrote:
> > On 22/03/2021 15:15, Jan Beulich wrote:
> >> On 22.03.2021 15:59, Andrew Cooper wrote:
> >>> On 22/03/2021 14:52, Jan Beulich wrote:
> >>>> On 22.03.2021 14:33, Jason Andryuk wrote:
> >>>>> make install-xen fails when EFI_VENDOR is set (=fedora) with:
> >>>>> install: cannot create regular file '/home/user/xen/dist/install/boot/efi/efi/fedora/xen-4.15.0-rc.efi': No such file or directory
> >>>>>
> >>>>> Create the EFI_VENDOR directory so xen.efi can be installed within.
> >>>>>
> >>>>> This removes the need for Fedora and Qubes xen.spec files to manually
> >>>>> create the directory in advance.
> >>>> While I'm not strictly against, I'd like to point out that it was
> >>>> deliberate to not create this directory here. I also didn't expect
> >>>> anyone's xen.spec to do so. Instead I'd expect the distro to create
> >>>> it during OS installation. If this was a bad assumption, I'd prefer
> >>>> if the commit message here could point out why such an expectation
> >>>> won't hold in general.
> >>> This reasoning is broken for anything other `make install DESTDIR=/` on
> >>> a live system.
> >>>
> >>> It is incompatible with how RPM, deb, etc packages work.
> >> I'm afraid I don't understand, for both of your statements. If distro
> >> installation put in place the designated directory, there wouldn't be
> >> any live system lacking it, and there wouldn't be any concern in the
> >> packaging of any software.
> >>
> >> To take a perhaps too extreme example - packages typically expect e.g.
> >> /usr to exist as well, don't they?
> >
> > No.  A buildroot starts out fully empty, by design.
> >
> > The packaging environment (usually a chroot) invokes `make install
> > DESTDIR=/path/to/staging/root` so you don't interfere with any of the
> > tools inside the environment, and the resulting tar/cpio has the
> > buildroot stripped out of paths.
> >
> > The failure being discussed here is the build within the packaging
> > environment, not the metadata which forms the final package.  Installing
> > a deb/rpm/etc will make directories as applicable.
>
> Ah, I see. But then this _still_ isn't the right thing to do. In fact,
> the package build and installation shouldn't put xen.efi in the EFI
> partition _at all_. The build system doing so is for developers only,
> so they don't need to invoke boot loader configuration every time they
> rebuild and re-install. Hence the packaging build shouldn't set
> EFI_VENDOR in the first place. There it instead should be a subsequent
> boot loader re-configuration which picks up xen.efi from its install
> location (under $(EFI_DIR)) and places it on the EFI partition.

On Fedora, RPMs drop EFI binaries directly into /boot/efi/EFI/fedora/.
grub, shim, fwupdate and xen are all packaged that way.  It seems
reasonable to have those important binaries tracked by the package
manager.

Does SuSE populate EFI_VENDOR from EFI_DIR when some boot loader
script is called?

I think Xen's population of EFI_VENDOR is sensible and fine.  Plus
it's *used*.  I don't see why it needs to be removed.  I was just
trying to fix a bug.

Regards,
Jason
Jan Beulich March 23, 2021, 1:36 p.m. UTC | #11
On 23.03.2021 13:34, Jason Andryuk wrote:
> On Tue, Mar 23, 2021 at 3:23 AM Jan Beulich <jbeulich@suse.com> wrote:
>>
>> On 22.03.2021 18:08, Andrew Cooper wrote:
>>> On 22/03/2021 15:15, Jan Beulich wrote:
>>>> On 22.03.2021 15:59, Andrew Cooper wrote:
>>>>> On 22/03/2021 14:52, Jan Beulich wrote:
>>>>>> On 22.03.2021 14:33, Jason Andryuk wrote:
>>>>>>> make install-xen fails when EFI_VENDOR is set (=fedora) with:
>>>>>>> install: cannot create regular file '/home/user/xen/dist/install/boot/efi/efi/fedora/xen-4.15.0-rc.efi': No such file or directory
>>>>>>>
>>>>>>> Create the EFI_VENDOR directory so xen.efi can be installed within.
>>>>>>>
>>>>>>> This removes the need for Fedora and Qubes xen.spec files to manually
>>>>>>> create the directory in advance.
>>>>>> While I'm not strictly against, I'd like to point out that it was
>>>>>> deliberate to not create this directory here. I also didn't expect
>>>>>> anyone's xen.spec to do so. Instead I'd expect the distro to create
>>>>>> it during OS installation. If this was a bad assumption, I'd prefer
>>>>>> if the commit message here could point out why such an expectation
>>>>>> won't hold in general.
>>>>> This reasoning is broken for anything other `make install DESTDIR=/` on
>>>>> a live system.
>>>>>
>>>>> It is incompatible with how RPM, deb, etc packages work.
>>>> I'm afraid I don't understand, for both of your statements. If distro
>>>> installation put in place the designated directory, there wouldn't be
>>>> any live system lacking it, and there wouldn't be any concern in the
>>>> packaging of any software.
>>>>
>>>> To take a perhaps too extreme example - packages typically expect e.g.
>>>> /usr to exist as well, don't they?
>>>
>>> No.  A buildroot starts out fully empty, by design.
>>>
>>> The packaging environment (usually a chroot) invokes `make install
>>> DESTDIR=/path/to/staging/root` so you don't interfere with any of the
>>> tools inside the environment, and the resulting tar/cpio has the
>>> buildroot stripped out of paths.
>>>
>>> The failure being discussed here is the build within the packaging
>>> environment, not the metadata which forms the final package.  Installing
>>> a deb/rpm/etc will make directories as applicable.
>>
>> Ah, I see. But then this _still_ isn't the right thing to do. In fact,
>> the package build and installation shouldn't put xen.efi in the EFI
>> partition _at all_. The build system doing so is for developers only,
>> so they don't need to invoke boot loader configuration every time they
>> rebuild and re-install. Hence the packaging build shouldn't set
>> EFI_VENDOR in the first place. There it instead should be a subsequent
>> boot loader re-configuration which picks up xen.efi from its install
>> location (under $(EFI_DIR)) and places it on the EFI partition.
> 
> On Fedora, RPMs drop EFI binaries directly into /boot/efi/EFI/fedora/.
> grub, shim, fwupdate and xen are all packaged that way.  It seems
> reasonable to have those important binaries tracked by the package
> manager.
> 
> Does SuSE populate EFI_VENDOR from EFI_DIR when some boot loader
> script is called?

Yes. And back at the time, when I consulted our EFI person, I was left
with the impression that this is the only reasonable approach. The
primary reason, as said, was that the EFI partition as a whole may get
rebuilt perhaps even from scratch at any point. Hence it's not
reasonable to expect package-managed files to live there. (This is
also expressed by us installing xen.efi into two places, which ought
to be a clear indication by itself that one of them is only to ease
things, not for packaging.)

As indicated - if the error is confusing, let's try to address it by,
perhaps, covering the case of the directory not existing also via the
"partially done" message. And the message, should that also be deemed
confusing, could maybe be dropped - I wouldn't be happy about it, but
if e.g. it was replaced by one reporting the secondary install step
was actually done, this would look acceptable.

Jan
Ian Jackson March 23, 2021, 1:41 p.m. UTC | #12
Jan Beulich writes ("Re: [PATCH] xen: Create EFI_VENDOR directory"):
> On 23.03.2021 13:34, Jason Andryuk wrote:
...
> > On Fedora, RPMs drop EFI binaries directly into /boot/efi/EFI/fedora/.
> > grub, shim, fwupdate and xen are all packaged that way.  It seems
> > reasonable to have those important binaries tracked by the package
> > manager.
> > 
> > Does SuSE populate EFI_VENDOR from EFI_DIR when some boot loader
> > script is called?
> 
> Yes. And back at the time, when I consulted our EFI person, I was left
> with the impression that this is the only reasonable approach. The
> primary reason, as said, was that the EFI partition as a whole may get
> rebuilt perhaps even from scratch at any point. Hence it's not
> reasonable to expect package-managed files to live there.

I agree with this analysis but it is for people like Fedora to decide
how they want to build their packages.

There is also the case of ad-hoc packages (eg our "make debball")
which the user might reasonably choose to have dump things in the EFI
system partition.

Conversely, I see no downside to the mkdir.  Jan, is there some actual
harm in it ?  If not, we should be accomodating to people's build and
packaging strategies even if we don't entirely approve of them.

Thanks,
Ian.
Jan Beulich March 23, 2021, 3:31 p.m. UTC | #13
On 23.03.2021 14:41, Ian Jackson wrote:
> Jan Beulich writes ("Re: [PATCH] xen: Create EFI_VENDOR directory"):
>> On 23.03.2021 13:34, Jason Andryuk wrote:
> ...
>>> On Fedora, RPMs drop EFI binaries directly into /boot/efi/EFI/fedora/.
>>> grub, shim, fwupdate and xen are all packaged that way.  It seems
>>> reasonable to have those important binaries tracked by the package
>>> manager.
>>>
>>> Does SuSE populate EFI_VENDOR from EFI_DIR when some boot loader
>>> script is called?
>>
>> Yes. And back at the time, when I consulted our EFI person, I was left
>> with the impression that this is the only reasonable approach. The
>> primary reason, as said, was that the EFI partition as a whole may get
>> rebuilt perhaps even from scratch at any point. Hence it's not
>> reasonable to expect package-managed files to live there.
> 
> I agree with this analysis but it is for people like Fedora to decide
> how they want to build their packages.
> 
> There is also the case of ad-hoc packages (eg our "make debball")
> which the user might reasonably choose to have dump things in the EFI
> system partition.

Well, it that's deemed reasonable, then perhaps yes. Albeit such
ad-hoc packaging could then also involve the creation of that dir.

> Conversely, I see no downside to the mkdir.  Jan, is there some actual
> harm in it ?  If not, we should be accomodating to people's build and
> packaging strategies even if we don't entirely approve of them.

"Actual harm" is relative: Nothing's going to break afaict. There'll
be a leftover dir from an install immediately followed by an
uninstall. I consider such okay for the purpose of the install step
that I did outline; I wouldn't consider it okay for a package
install/uninstall. But nothing worse, I guess. So bottom line - my
objection is not to be taken as a NAK. If everyone else wants the
change, then so be it.

Jan
Michael Young March 23, 2021, 3:58 p.m. UTC | #14
On Tue, 23 Mar 2021, Ian Jackson wrote:

> Jan Beulich writes ("Re: [PATCH] xen: Create EFI_VENDOR directory"):
>> On 23.03.2021 13:34, Jason Andryuk wrote:
> ...
>>> On Fedora, RPMs drop EFI binaries directly into /boot/efi/EFI/fedora/.
>>> grub, shim, fwupdate and xen are all packaged that way.  It seems
>>> reasonable to have those important binaries tracked by the package
>>> manager.
>>>
>>> Does SuSE populate EFI_VENDOR from EFI_DIR when some boot loader
>>> script is called?
>>
>> Yes. And back at the time, when I consulted our EFI person, I was left
>> with the impression that this is the only reasonable approach. The
>> primary reason, as said, was that the EFI partition as a whole may get
>> rebuilt perhaps even from scratch at any point. Hence it's not
>> reasonable to expect package-managed files to live there.
>
> I agree with this analysis but it is for people like Fedora to decide
> how they want to build their packages.
>
> There is also the case of ad-hoc packages (eg our "make debball")
> which the user might reasonably choose to have dump things in the EFI
> system partition.
>
> Conversely, I see no downside to the mkdir.  Jan, is there some actual
> harm in it ?  If not, we should be accomodating to people's build and
> packaging strategies even if we don't entirely approve of them.

There is a request in https://bugzilla.redhat.com/show_bug.cgi?id=1750733 
for xen on Fedora to install the efi file elsewhere and then copy it to 
/boot/efi post install. I could change the current Fedora set up for 
Fedora 35 (which should have xen-4.15) if there is a good reason to do so. 
I am not sure how useful the xen.efi file in /boot/efi is anyway for the 
the Fedora set up as it will generally use a xen*.gz file in /boot via 
grub.

 	Michael Young
Roman Shaposhnik March 23, 2021, 5:30 p.m. UTC | #15
On Tue, Mar 23, 2021 at 6:36 AM Jan Beulich <jbeulich@suse.com> wrote:

> On 23.03.2021 13:34, Jason Andryuk wrote:
> > On Tue, Mar 23, 2021 at 3:23 AM Jan Beulich <jbeulich@suse.com> wrote:
> >>
> >> On 22.03.2021 18:08, Andrew Cooper wrote:
> >>> On 22/03/2021 15:15, Jan Beulich wrote:
> >>>> On 22.03.2021 15:59, Andrew Cooper wrote:
> >>>>> On 22/03/2021 14:52, Jan Beulich wrote:
> >>>>>> On 22.03.2021 14:33, Jason Andryuk wrote:
> >>>>>>> make install-xen fails when EFI_VENDOR is set (=fedora) with:
> >>>>>>> install: cannot create regular file
> '/home/user/xen/dist/install/boot/efi/efi/fedora/xen-4.15.0-rc.efi': No
> such file or directory
> >>>>>>>
> >>>>>>> Create the EFI_VENDOR directory so xen.efi can be installed within.
> >>>>>>>
> >>>>>>> This removes the need for Fedora and Qubes xen.spec files to
> manually
> >>>>>>> create the directory in advance.
> >>>>>> While I'm not strictly against, I'd like to point out that it was
> >>>>>> deliberate to not create this directory here. I also didn't expect
> >>>>>> anyone's xen.spec to do so. Instead I'd expect the distro to create
> >>>>>> it during OS installation. If this was a bad assumption, I'd prefer
> >>>>>> if the commit message here could point out why such an expectation
> >>>>>> won't hold in general.
> >>>>> This reasoning is broken for anything other `make install DESTDIR=/`
> on
> >>>>> a live system.
> >>>>>
> >>>>> It is incompatible with how RPM, deb, etc packages work.
> >>>> I'm afraid I don't understand, for both of your statements. If distro
> >>>> installation put in place the designated directory, there wouldn't be
> >>>> any live system lacking it, and there wouldn't be any concern in the
> >>>> packaging of any software.
> >>>>
> >>>> To take a perhaps too extreme example - packages typically expect e.g.
> >>>> /usr to exist as well, don't they?
> >>>
> >>> No.  A buildroot starts out fully empty, by design.
> >>>
> >>> The packaging environment (usually a chroot) invokes `make install
> >>> DESTDIR=/path/to/staging/root` so you don't interfere with any of the
> >>> tools inside the environment, and the resulting tar/cpio has the
> >>> buildroot stripped out of paths.
> >>>
> >>> The failure being discussed here is the build within the packaging
> >>> environment, not the metadata which forms the final package.
> Installing
> >>> a deb/rpm/etc will make directories as applicable.
> >>
> >> Ah, I see. But then this _still_ isn't the right thing to do. In fact,
> >> the package build and installation shouldn't put xen.efi in the EFI
> >> partition _at all_. The build system doing so is for developers only,
> >> so they don't need to invoke boot loader configuration every time they
> >> rebuild and re-install. Hence the packaging build shouldn't set
> >> EFI_VENDOR in the first place. There it instead should be a subsequent
> >> boot loader re-configuration which picks up xen.efi from its install
> >> location (under $(EFI_DIR)) and places it on the EFI partition.
> >
> > On Fedora, RPMs drop EFI binaries directly into /boot/efi/EFI/fedora/.
> > grub, shim, fwupdate and xen are all packaged that way.  It seems
> > reasonable to have those important binaries tracked by the package
> > manager.
> >
> > Does SuSE populate EFI_VENDOR from EFI_DIR when some boot loader
> > script is called?
>
> Yes. And back at the time, when I consulted our EFI person, I was left
> with the impression that this is the only reasonable approach. The
> primary reason, as said, was that the EFI partition as a whole may get
> rebuilt perhaps even from scratch at any point. Hence it's not
> reasonable to expect package-managed files to live there. (This is
> also expressed by us installing xen.efi into two places, which ought
> to be a clear indication by itself that one of them is only to ease
> things, not for packaging.)
>

Big +1 to the above -- in running our own distro we've come to appreciate
that very point -- EFI partition is basically a cache and the source of
truth
is always elsewhere.

Thanks,
Roman.
Roman Shaposhnik March 23, 2021, 5:32 p.m. UTC | #16
On Tue, Mar 23, 2021 at 8:59 AM Michael Young <m.a.young@durham.ac.uk>
wrote:

>
>
> On Tue, 23 Mar 2021, Ian Jackson wrote:
>
> > Jan Beulich writes ("Re: [PATCH] xen: Create EFI_VENDOR directory"):
> >> On 23.03.2021 13:34, Jason Andryuk wrote:
> > ...
> >>> On Fedora, RPMs drop EFI binaries directly into /boot/efi/EFI/fedora/.
> >>> grub, shim, fwupdate and xen are all packaged that way.  It seems
> >>> reasonable to have those important binaries tracked by the package
> >>> manager.
> >>>
> >>> Does SuSE populate EFI_VENDOR from EFI_DIR when some boot loader
> >>> script is called?
> >>
> >> Yes. And back at the time, when I consulted our EFI person, I was left
> >> with the impression that this is the only reasonable approach. The
> >> primary reason, as said, was that the EFI partition as a whole may get
> >> rebuilt perhaps even from scratch at any point. Hence it's not
> >> reasonable to expect package-managed files to live there.
> >
> > I agree with this analysis but it is for people like Fedora to decide
> > how they want to build their packages.
> >
> > There is also the case of ad-hoc packages (eg our "make debball")
> > which the user might reasonably choose to have dump things in the EFI
> > system partition.
> >
> > Conversely, I see no downside to the mkdir.  Jan, is there some actual
> > harm in it ?  If not, we should be accomodating to people's build and
> > packaging strategies even if we don't entirely approve of them.
>
> There is a request in https://bugzilla.redhat.com/show_bug.cgi?id=1750733
> for xen on Fedora to install the efi file elsewhere and then copy it to
> /boot/efi post install. I could change the current Fedora set up for
> Fedora 35 (which should have xen-4.15) if there is a good reason to do so.
> I am not sure how useful the xen.efi file in /boot/efi is anyway for the
> the Fedora set up as it will generally use a xen*.gz file in /boot via
> grub.
>

FWIW: /boot as the source of truth and EFI partition as a cache for that is
also what we've settled on in EVE distro.

As a somewhat unrelated side-note: on ARM at least, with u-boot playing the
role of UEFI more and more -- we can actually pick EFI payloads straight
from source of truth and completely by-pass EFI partition altogether (which
is fine -- it is, after all, only a cache).

Thanks,
Roman.
diff mbox series

Patch

diff --git a/xen/Makefile b/xen/Makefile
index 0b97e459e2..f372b44de3 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -289,6 +289,7 @@  _install: $(TARGET)$(CONFIG_XEN_INSTALL_SUFFIX)
 		ln -sf $(T)-$(XEN_FULLVERSION).efi $(D)$(EFI_DIR)/$(T)-$(XEN_VERSION).efi; \
 		ln -sf $(T)-$(XEN_FULLVERSION).efi $(D)$(EFI_DIR)/$(T).efi; \
 		if [ -n '$(EFI_MOUNTPOINT)' -a -n '$(EFI_VENDOR)' ]; then \
+			$(INSTALL_DIR) $(D)$(EFI_MOUNTPOINT)/efi/$(EFI_VENDOR); \
 			$(INSTALL_DATA) $(TARGET).efi $(D)$(EFI_MOUNTPOINT)/efi/$(EFI_VENDOR)/$(T)-$(XEN_FULLVERSION).efi; \
 		elif [ "$(D)" = "$(patsubst $(shell cd $(XEN_ROOT) && pwd)/%,%,$(D))" ]; then \
 			echo 'EFI installation only partially done (EFI_VENDOR not set)' >&2; \