Re: [PATCH] mount-boot.eclass: do not create /boot/.keep in pkg_prerm

Mike Gilbert <[email protected]> Thu, 18 Jun 2026 09:07:44 -0400
Newsgroups gmane.linux.gentoo.devel
Message-ID <CAJ0EP42pikKm1tjOEi0SppROKT63xb0OeuKRCGaStLi1y=GyZw@mail.gmail.com>
On Thu, Jun 18, 2026 at 1:30 AM Ulrich Müller <[email protected]> wrote:
>
> >>>>> On Wed, 17 Jun 2026, Mike Gilbert wrote:
>
> > systemd-gpt-auto-generator ignores mount points which are not empty
> > directories. Let's avoid creating a .keep file under /boot every time a
> > package using this eclass gets unmerged.
>
> > [...]
>
> > +     if [[ -n ${BOOT_EXISTS} && ! -d ${EROOT}/boot ]]; then
> > +             # Recreate /boot in case it got un-merged
> > +             mkdir "${EROOT}"/boot
> >       fi
>
> That looks like a horrible hack.

What's so horrible about it? It accomplishes the same goal without
leaving an orphaned file behind. If it will cause problems, please
elaborate.

On the subject of "hacks":
I would consider .keep files to be a "hack" to work around a design
limitation in the package manager.
This entire eclass is a "hack" to allow ebuilds to install files in a
location where they really have no business installing anything. 😀

> Can't systemd-gpt-auto-generator be fixed instead, to ignore .keep* or .*?

Probably. I will look into that if I find a .keep file that cannot be
eliminated.

> Also, there's nothing wrong with a mount point containing files (/dev is a common example).

There's nothing wrong with it, but they do prevent
systemd-gpt-auto-generator from working as designed.

The files in /dev serve a purpose on OpenRC systems because devtmpfs
is not mounted early enough.
They serve no purpose for systemd, but they also do not interfere:
systemd will always overmount /dev regardless of its content.

systemd-gpt-auto-generator is taking a more conservative approach with
/boot by not automatically overmounting a directory that already
contains files without more explicit instructions (/etc/fstab) from
the user to do so.