mudler/luet

Unexpected behavior on file collision

Closed this issue · 1 comments

Luet version:

0.17.2
CPU architecture, OS, and Version:

your momma
Describe the bug

When there is a collision, upgrade process should not go ahead at all, in fact, should not start.
To Reproduce

Not possible at this point, collision been fixed in repo
Expected behavior

When collision is detected, do not start upgrade process.
Logs

luet upgrade
Luet version 0.17.2-gdb8bf2b85e6802f843dfe8c863beb6e28e8e4e5f 2021-07-30 0134 UTC
Luet Copyright (C) 2019-2021 Ettore Di Giacinto
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions.
⣟ Downloaded repository.yaml of 0.00 MB ( 0.00 MiB/s )
⣯ Repository mocaccino-repository-index is already up to date.
⣾ ℹ Repository: mocaccino-repository-index Priority: 1 Type: http
Downloading file repository.yaml from /user/system_repository/build
⣻ Repository luet is already up to date.
⢿ ℹ Repository: local-repository Priority: 99 Type: disk
⣯ Downloaded repository.yaml of 0.00 MB ( 0.00 MiB/s )
⣾ Repository luet-official is already up to date.
ℹ Repository: luet Priority: 1 Type: http
⡿ Downloaded repository.yaml of 0.00 MB ( 0.00 MiB/s )
⣟ Repository mocaccino-desktop is already up to date.
⣷ ℹ Repository: mocaccino-desktop-stable Priority: 3 Type: http
⣻ Downloaded repository.yaml of 0.00 MB ( 0.00 MiB/s )
⢿ Repository mocaccino-extra is already up to date.
⣟ ℹ Repository: mocaccino-extra-stable Priority: 2 Type: http
⣽ Downloaded repository.yaml of 0.00 MB ( 0.00 MiB/s )
⣻ Repository kernel-repo is already up to date.
⣽ ℹ Repository: mocaccino-kernel-stable Priority: 3 Type: http
⢿ Downloaded repository.yaml of 0.00 MB ( 0.00 MiB/s )
⣷ Downloaded tree.tar.gz of 0.03 MB ( 0.10 MiB/s )
⡿ Downloaded repository.meta.yaml.tar.gz of 0.07 MB ( 0.14 MiB/s )
⢿ 🏠 Repository mocaccino-os-commons revision: 158 - 2021-08-02 20:56:52 +0000 -00
⣾ ℹ Repository: mocaccino-os-commons-stable Priority: 2 Type: http
🤔 Computing upgrade, please hang tight... 💤
♻ Packages that are going to be removed from the system:
entity/geoclue-2 entity/man-1 entity/usb-2 init/mocaccino-skel-20210703 mocaccino/cli-0.2.1
⚡ Packages that are going to be installed in the system:
entity/geoclue-3 entity/man-2 entity/usb-3 init/mocaccino-skel-20210703+2 mocaccino/cli-0.2.4
By going forward, you are also accepting the licenses of the packages that you are going to install in your system.
Do you want to continue with this operation? [y/N]:
y
cli-mocaccino-0.2.4.package.tar.gz - 0% [ ] ( 0B/5.4 MB, ) [0s:0s]
Downloaded cli-mocaccino-0.2.4.package.tar.gz of 5.69 MB ( 9.33 MiB/s )
📦 Package mocaccino/cli-0.2.4 downloaded
man-entity-2.package.tar.gz - 0% [ ] ( 0B/368 B, ) [0s:0s]
Downloaded man-entity-2.package.tar.gz of 0.00 MB ( 0.00 MiB/s )
📦 Package entity/man-2 downloaded
mocaccino-skel-init-20210703+2.package.tar.gz - 0% [ ] ( 0B/3.1 kB, ) [0s:0s]
Downloaded mocaccino-skel-init-20210703+2.package.tar.gz of 0.00 MB ( 0.01 MiB/s )
📦 Package init/mocaccino-skel-20210703+2 downloaded
geoclue-entity-3.package.tar.gz - 0% [ ] ( 0B/368 B, ) [0s:0s]
Downloaded geoclue-entity-3.package.tar.gz of 0.00 MB ( 0.00 MiB/s )
📦 Package entity/geoclue-3 downloaded
usb-entity-3.package.tar.gz - 0% [ ] ( 0B/274 B, ) [0s:0s]
Downloaded usb-entity-3.package.tar.gz of 0.00 MB ( 0.00 MiB/s )
📦 Package entity/usb-3 downloaded
♻ cli-mocaccino-0.2.1 Removed ✔
📦 Package mocaccino/cli-0.2.4 downloaded
Checking for file conflicts..
📦 Package mocaccino/cli-0.2.4 installed
♻ man-entity-1 Removed ✔
📦 Package entity/man-2 downloaded
Checking for file conflicts..
Found protected file /etc/entities/man/group/01_group.yaml. Creating /etc/entities/man/group/._cfg0001_01_group.yaml.
Found protected file /etc/entities/man/passwd/01_user.yaml. Creating /etc/entities/man/passwd/._cfg0001_01_user.yaml.
📦 Package entity/man-2 installed
♻ mocaccino-skel-init-20210703 Removed ✔
📦 Package init/mocaccino-skel-20210703+2 downloaded
Checking for file conflicts..
file conflict found: file conflict between 'layers/system-x-0.20210626' and 'init/mocaccino-skel-20210703+2' ( file: mnt/.keep )
♻ geoclue-entity-2 Removed ✔
📦 Package entity/geoclue-3 downloaded
Checking for file conflicts..
Found protected file /etc/entities/geoclue/group/01_group.yaml. Creating /etc/entities/geoclue/group/._cfg0001_01_group.yaml.
📦 Package entity/geoclue-3 installed
♻ usb-entity-2 Removed ✔
📦 Package entity/usb-3 downloaded
Checking for file conflicts..
📦 Package entity/usb-3 installed
Executing finalizer for entity/man-2
🐚 Executing finalizer on / sh [-c entity-apply man]
Executing finalizer for init/mocaccino-skel-20210703+2
🐚 Executing finalizer on / sh [-c /usr/sbin/mocaccino-init-skel]
🚧 warning Failed running finalizer for init/mocaccino-skel-20210703+2 Failed running command: sh: line 1: /usr/sbin/mocaccino-init-skel: No such file or directory
: exit status 127
Executing finalizer for entity/geoclue-3
🐚 Executing finalizer on / sh [-c entity-apply geoclue]
Executing finalizer for entity/usb-3
🐚 Executing finalizer on / sh [-c entity-apply usb]
Error: 1 error occurred:
* Failed running command: sh: line 1: /usr/sbin/mocaccino-init-skel: No such file or directory
: exit status 127
Additional context

For some reason upgrade started, init/mocaccino-skel got removed but wasn't installed back due collision. As a result the finalizer failed to run a command that is supposed to be shipped with the removed package.

As reference, my commit here should fix this collision:
mocaccinoOS/desktop@f1a2988

I still see unwanted behavior happening. On devel I moved some packages from layers/X into layers/codecs because they better fit there and it helps slimming down our phat X layer.

On install this happens:
` 🤔 Computing upgrade, please hang tight... 💤
♻ Packages that are going to be removed from the system:
layers/X-0.7+4 layers/codecs-2+29 layers/system-x-0.20210805 system/luet-0.17.6 system/luet-devkit-0.11 system/luet-extensions-0.11
⚡ Packages that are going to be installed in the system:
entity/portage-1 layers/X-0.7+6 layers/codecs-3+2 layers/system-x-0.20210805+1 system/luet-0.17.7 system/luet-devkit-0.11.1 system/luet-extensions-0.11.1
By going forward, you are also accepting the licenses of the packages that you are going to install in your system.
Do you want to continue with this operation? [y/N]:
y
📦 Package system/luet-extensions-0.11.1 downloaded
📦 Package entity/portage-1 downloaded
system-x-layers-0.20210805+1.package.tar.gz - 0% [ ] ( 0B/484 MB, ) [0s:0s] 📦 Package system/luet-0.17.7 downloaded
system-x-layers-0.20210805+1.package.tar.gz - 0% [ ] (1.8/484 MB, 3.502 MB/s) [0s:2m17s] 📦 Package layers/codecs-3+2 downloaded
system-x-layers-0.20210805+1.package.tar.gz - 1% [ ] (6.3/484 MB, 3.991 MB/s) [1s:1m59s] 📦 Package system/luet-devkit-0.11.1 downloaded
system-x-layers-0.20210805+1.package.tar.gz - 99% [===========================================================================================================> ] (483/484 MB, 7.269 MB/s) [1m11s:0s]
Downloaded system-x-layers-0.20210805+1.package.tar.gz of 506.97 MB ( 6.74 MiB/s )
X-layers-0.7+6.package.tar.gz - 51% [===========================================================> ] (604 MB/1.1 GB, 13.314 MB/s) [1m21s:42s] 📦 Package layers/system-x-0.20210805+1 downloaded
X-layers-0.7+6.package.tar.gz - 99% [=========================================================================================================================> ] (1.1/1.1 GB, 13.540 MB/s) [2m5s:0s]
Downloaded X-layers-0.7+6.package.tar.gz of 1232.09 MB ( 9.36 MiB/s )
📦 Package layers/X-0.7+6 downloaded
Checking for file conflicts..
♻ luet-devkit-system-0.11 Removed ✔
📦 Package system/luet-devkit-0.11.1 downloaded
Checking for file conflicts..
📦 Package system/luet-devkit-0.11.1 installed
♻ luet-extensions-system-0.11 Removed ✔
📦 Package system/luet-extensions-0.11.1 downloaded
Checking for file conflicts..
📦 Package system/luet-extensions-0.11.1 installed
♻ luet-system-0.17.6 Removed ✔
📦 Package system/luet-0.17.7 downloaded
Checking for file conflicts..
📦 Package system/luet-0.17.7 installed
♻ codecs-layers-2+29 Removed ✔
📦 Package layers/codecs-3+2 downloaded
Checking for file conflicts..
file conflict found: file conflict between 'layers/X-0.7+4' and 'layers/codecs-3+2' ( file: etc/env.d/98-moz-gmp-openh264 )
📦 Package entity/portage-1 downloaded
Checking for file conflicts..
📦 Package entity/portage-1 installed
♻ X-layers-0.7+4 Removed ✔
📦 Package layers/X-0.7+6 downloaded
Checking for file conflicts..
file conflict found: file conflict between 'layers/system-x-0.20210805' and 'layers/X-0.7+6' ( file: etc/env.d/50rust-1.52.1 )
♻ system-x-layers-0.20210805 Removed ✔
📦 Package layers/system-x-0.20210805+1 downloaded
Checking for file conflicts..
Found protected file /etc/ca-certificates.conf. Creating /etc/._cfg0001_ca-certificates.conf.
Found protected file /etc/environment.d/10-gentoo-env.conf. Creating /etc/environment.d/._cfg0001_10-gentoo-env.conf.
Found protected file /etc/ld.so.conf. Creating /etc/._cfg0001_ld.so.conf.
Found protected file /etc/portage/package.env/01-system-x.env. Creating /etc/portage/package.env/._cfg0001_01-system-x.env.
Found protected file /etc/portage/savedconfig/sys-apps/busybox-1.32.1-r1. Creating /etc/portage/savedconfig/sys-apps/._cfg0001_busybox-1.32.1-r1.
Found protected file /etc/unbound/unbound_control.key. Creating /etc/unbound/._cfg0001_unbound_control.key.
Found protected file /etc/unbound/unbound_control.pem. Creating /etc/unbound/._cfg0001_unbound_control.pem.
Found protected file /etc/unbound/unbound_server.key. Creating /etc/unbound/._cfg0001_unbound_server.key.
Found protected file /etc/unbound/unbound_server.pem. Creating /etc/unbound/._cfg0001_unbound_server.pem.
📦 Package layers/system-x-0.20210805+1 installed
Executing finalizer for layers/system-x-0.20210805+1
🐚 Executing finalizer on / sh [-c chmod 4750 /usr/libexec/dbus-daemon-launch-helper]

🐚 Executing finalizer on / sh [-c ldconfig]

🐚 Executing finalizer on / sh [-c source /etc/profile && env-update]
flatpak: error while loading shared libraries: libappstream-glib.so.8: cannot open shared object file: No such file or directory
!!! Section 'gentoo' in repos.conf has location attribute set to nonexistent directory: '/var/db/repos/gentoo'
!!! Invalid Repository Location (not a dir): '/var/db/repos/gentoo'

Regenerating /etc/ld.so.cache...

Executing finalizer for layers/codecs-3+2
🐚 Executing finalizer on / sh [-c ldconfig]

Executing finalizer for layers/X-0.7+6
🐚 Executing finalizer on / sh [-c glib-compile-schemas /usr/share/glib-2.0/schemas > /dev/null 2>&1]

🐚 Executing finalizer on / sh [-c chmod u+s /usr/bin/bwrap]
🚧 warning Failed running finalizer for layers/X-0.7+6 Failed running command: chmod: cannot access '/usr/bin/bwrap': No such file or directory
: exit status 1
Executing finalizer for entity/portage-1
🐚 Executing finalizer on / sh [-c entity-apply portage]

Error: 1 error occurred:

: exit status 1

`
I noticed finalizer failed to do the chmod command on /usr/bin/bwrap because that simply isn't there anymore. In fact, the whole layers/X AND layers/codecs got removed but the new version wasn't installed. So I think the check we do must be done on the new to be installed layer if there is a new version. And then we would not have had this conflict at all.