Le 21/02/2020 à 22:15, Pierre Labastie a écrit :
> Le 21/02/2020 à 21:30, Alan Feuerbacher a écrit :
>> On Thu, 2020-02-20 at 23:12 -0600, Bruce Dubbs wrote:
>>> On 2/20/20 10:56 PM, Alan Feuerbacher wrote:
>>>> On Thu, 2020-02-20 at 21:13 -0600, Douglas R. Reno wrote:
>>>>> On 2/20/20 8:16 PM, Alan Feuerbacher wrote:
>>>>>> I managed to get the configuration settings right enough that
>>>>>> jhalfs
>>>>>> builds a lot of packages, but it stops with this:
>>>>>>
>>>> SNIP
>>>>
>>>>>> I'm probably missing something. Helpful hints?
>>>>>>
>>>>>> Alan
>>>>>>
>>>>> I've been consistently getting this problem as well, and I've
>>>>> never
>>>>> figured out what caused it. Are you using the latest bash from
>>>>> LFS?
>>>>>
>>>>>
>>>>> Normally what I do to fix this is:
>>>>>
>>>>>
>>>>> sudo chown -v root:root /mnt/lfs/jhalfs/envars
>>>>
>>>> [...]
>>
> 
> I'm not sure what to do. You and Douglas seem to have the same problem but
> Bruce and I don't, and I've tried to reproduce it to no avail. I suggested to
> Douglas to edit the Makefile in /mnt/build_dir/jhalfs before starting the 
> build:
> after the line "mk_SUDO: mk_LUSER", add:
> <tab>chown -v root:root $(MOUNT_PT)/jhalfs/envars
> 
> Pierre
> 
Ok, figured it out, but what a mess!
First using strace, I found that the error was in an openat call.
After many hours of wandering through various way to understand how this call
was working, I found a bug report:
https://bugzilla.kernel.org/show_bug.cgi?id=205727
(note that creat is the same as openat, with given flags).
The maintainer of openat pointed to a change in systemd, which amounts to have

fs.protected_regular = 1

in /usr/lib/sysctl.d/50-default.conf

Fortunately, this file points to the kernel doc:
https://www.kernel.org/doc/Documentation/sysctl/fs.txt. The entry
"protected_regular" describes exactly what we have:
----------
When set to "0", writing to regular files is unrestricted.

When set to "1" don't allow O_CREAT open on regular files that we
don't own in world writable sticky directories, unless they are
owned by the owner of the directory.

When set to "2" it also applies to group writable sticky directories.
----------

What we have is: root tries to open envars with O_CREAT flag (or'ed with
O_WRONLY|O_TRUNC, but this is not relevant), jhalfs dir is owned by the user
running jhalfs (pierre in my case), has the sticky bit set and is
world_writable, but envars is owned by lfs and is not empty.

This can be checked with "sudo cat /proc/sys/fs/protected_regular".

I think the best for jhalfs is to remove completely envars at the beginning of
the "SUDO" phase, so that root has really to create it.

Pierre

-- 
http://lists.linuxfromscratch.org/listinfo/alfs-discuss
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to