systemd-setup-machine-id leaving mount behind? (was "Bug#871835: Call for help: review patches for debootstrap")

Antonio Terceiro terceiro at debian.org
Sun Apr 22 14:09:42 BST 2018


Dear systemd team: the context here is a patch set for debootstrap that,
while using a local apt cache, makes debootstrap complete in 2/3 of the
time, compared to the version currently in unstable.

see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=871835 for details

On Sat, 21 Apr 2018 20:30:47 -0300 Antonio Terceiro <terceiro at debian.org> wrote:
> I have also looked at these patches, and they look good to me, and also
> work great here. Using a local APT proxy, these patches make debootstrap
> complete in ~ 2/3 of the time that debootstrap from unstable takes.
> 
> The one thing I found is that trying to use debootstrap with these
> patches with mkosi makes mkosi crash like this:
> 
> ‣ Installing Debian complete.
> ‣ Assigning hostname...
> ‣ Assigning hostname complete.
> ‣ Unmounting Package Cache...
> ‣ Unmounting Package Cache complete.
> ‣ Resetting machine ID...
> Traceback (most recent call last):
>   File "/usr/bin/mkosi", line 2904, in <module>
>     main()
>   File "/usr/bin/mkosi", line 2900, in main
>     build_stuff(args)
>   File "/usr/bin/mkosi", line 2852, in build_stuff
>     raw, tar, root_hash = build_image(args, workspace, run_build_script=False)
>   File "/usr/bin/mkosi", line 2711, in build_image
>     reset_machine_id(args, workspace.name, run_build_script, for_cache)
>   File "/usr/bin/mkosi", line 1186, in reset_machine_id
>     os.unlink(machine_id)
> OSError: [Errno 16] Device or resource busy: '/home/terceiro/tmp/test-systemd-containers/.mkosi-agbwha1l/root/etc/machine-id'
> Traceback (most recent call last):
>   File "/usr/lib/python3.6/weakref.py", line 624, in _exitfunc
>     f()
>   File "/usr/lib/python3.6/weakref.py", line 548, in __call__
>     return info.func(*info.args, **(info.kwargs or {}))
>   File "/usr/lib/python3.6/tempfile.py", line 936, in _cleanup
>     _rmtree(name)
>   File "/usr/lib/python3.6/shutil.py", line 480, in rmtree
>     _rmtree_safe_fd(fd, path, onerror)
>   File "/usr/lib/python3.6/shutil.py", line 418, in _rmtree_safe_fd
>     _rmtree_safe_fd(dirfd, fullname, onerror)
>   File "/usr/lib/python3.6/shutil.py", line 418, in _rmtree_safe_fd
>     _rmtree_safe_fd(dirfd, fullname, onerror)
>   File "/usr/lib/python3.6/shutil.py", line 438, in _rmtree_safe_fd
>     onerror(os.unlink, fullname, sys.exc_info())
>   File "/usr/lib/python3.6/shutil.py", line 436, in _rmtree_safe_fd
>     os.unlink(name, dir_fd=topfd)
> OSError: [Errno 16] Device or resource busy: 'machine-id'
>
> I can't reproduce this with current debootstrap from unstable, but 1)
> none of these patches seem to do anything related, and 2) the error
> happens after debootstrap is already done, so I suspect this might be an
> issue with mkosi that is surfaced by debootstrap running faster, and not
> an issue with debootstrap itself.

Investigating further, I tested debootstrap alone, and realized that
with this patch set applied, after debootstrap finishes, a mount point
is left over:

# findmnt | grep machine-id
├─/root/patched2/etc/machine-id                        /dev/mapper/lemur--vg-root[/root/patched2/run/machine-id] ext4            ro,relatime,errors=remount-ro,data=ordered

This explains the crash in mkosi and points the problem to something
that happens during the debootstrap run.

I compared the output of debootstrap from unstable with the patched
debootstrap, and they are idential, i.e. packages are installed in the
same order, but for some reason, when running with the faster
debootstrap, the above mount is left over.

Looking around, I suspect that this could be left behind by
systemd-machine-id-setup, however, I couldn't understand yet why this
would happen.

systemd team: could you provide any insight? for reference, I am
attaching the current diff between debootstrap master branch, and a
local branch where I have Thomas Lange's patched applied.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: debootstrap.diff
Type: text/x-diff
Size: 3048 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-systemd-maintainers/attachments/20180422/159053cf/attachment.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-systemd-maintainers/attachments/20180422/159053cf/attachment.sig>


More information about the Pkg-systemd-maintainers mailing list