luet
luet copied to clipboard
luet override existing symlinks
Luet version: 0.11.0
CPU architecture, OS, and Version: Linux sab-worker1 5.4.0-sabayon #1 SMP Tue Feb 25 22:46:38 UTC 2020 x86_64 Intel(R) Xeon(R) CPU X5680 @ 3.33GHz GenuineIntel GNU/Linux
Describe the bug luet replace existing symlinks.
To Reproduce Get an old sabayon rootfs where /lib is a link to /lib64 or just you install a package to a path and a prefix of the path is a link.
Expected behavior
If the path prefix is a link luet
could use it directly.
Logs
lsab-worker1 ~ # ls -l /
total 8
drwxr-xr-x 1 root root 1678 9 mar 2020 bin
drwxr-xr-x 4 root root 4096 9 mar 2020 boot
drwxr-xr-x 19 root root 3900 24 ott 16.57 dev
drwxr-xr-x 1 root root 3576 10 dic 17.59 etc
drwxr-xr-x 1 root root 32 6 feb 2020 home
lrwxrwxrwx 1 root root 5 5 nov 2018 lib -> lib64
drwxr-xr-x 1 root root 1518 9 mar 2020 lib32
drwxr-xr-x 1 root root 5694 9 mar 2020 lib64
drwxr-xr-x 1 root root 10 4 nov 2018 media
drwxr-xr-x 1 root root 10 4 nov 2018 mnt
drwxr-xr-x 1 root root 56 19 feb 2020 opt
dr-xr-xr-x 221 root root 0 24 ott 16.57 proc
drwxr-xr-x 1 root root 264 11 feb 16.39 root
drwxr-xr-x 27 root root 720 6 nov 18.42 run
drwxr-xr-x 1 root root 4824 9 mar 2020 sbin
drwxr-xr-x 1 root root 18 12 mar 2020 srv
dr-xr-xr-x 13 root root 0 24 ott 16.57 sys
drwxrwxrwt 5 root root 100 11 feb 16.39 tmp
drwxr-xr-x 1 root root 152 9 mar 2020 usr
drwxr-xr-x 1 root root 90 9 mar 2020 var
sab-worker1 ~ # cp^C
sab-worker1 ~ # curl https://get.mocaccino.org/luet/get_luet_root.sh | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1491 100 1491 0 0 5563 0 --:--:-- --:--:-- --:--:-- 5605
+ export LUET_NOLOCK=true
+ LUET_NOLOCK=true
++ curl -s https://api.github.com/repos/mudler/luet/releases/latest
++ grep -oP '"tag_name": "\K(.*)(?=")'
+ LUET_VERSION=0.11.0
+ LUET_ROOTFS=/
+ LUET_DATABASE_PATH=/var/luet/db
+ LUET_DATABASE_ENGINE=boltdb
+ LUET_CONFIG_PROTECT=1
+ curl -L https://github.com/mudler/luet/releases/download/0.11.0/luet-0.11.0-linux-amd64 --output luet
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 631 100 631 0 0 1561 0 --:--:-- --:--:-- --:--:-- 1565
100 11.8M 100 11.8M 0 0 3211k 0 0:00:03 0:00:03 --:--:-- 4208k
+ chmod +x luet
+ mkdir -p /etc/luet/repos.conf.d
+ mkdir -p /var/luet/db
+ mkdir -p /var/tmp/luet
+ '[' 1 = 1 ']'
+ mkdir -p /etc/luet/config.protect.d
+ curl -L https://raw.githubusercontent.com/mudler/luet/master/contrib/config/config.protect.d/01_etc.yml.example --output /etc/luet/config.protect.d/01_etc.yml
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 35 100 35 0 0 105 0 --:--:-- --:--:-- --:--:-- 105
+ curl -L https://raw.githubusercontent.com/mocaccinoOS/repository-index/master/packages/mocaccino-repository-index.yml --output /etc/luet/repos.conf.d/mocaccino-repository-index.yml
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 269 100 269 0 0 777 0 --:--:-- --:--:-- --:--:-- 781
+ cat
+ ./luet install -y repository/luet repository/mocaccino-repository-index
⠐ Downloaded repository.yaml of 0.00 MB ( 0.00 MiB/s )
⠠ Downloaded tree.tar.gz of 0.00 MB ( 0.00 MiB/s )
⠖ Downloaded repository.meta.yaml.tar.gz of 0.00 MB ( 0.01 MiB/s )
⠒ 🏠 Repository mocaccino-repository-index revision: 1 - 2021-01-02 17:47:32 +0100 CET
ℹ Repository: mocaccino-repository-index Priority: 1 Type: http
Packages that are going to be installed in the system:
luet-repository-20200717 (mocaccino-repository-index) mocaccino-repository-index-repository-20201005 (mocaccino-repository-index)
luet-repository-20200717.package.tar.gz - 0% [ ] ( 0B/337 B, ) [0s:0s]
Downloaded luet-repository-20200717.package.tar.gz of 0.00 MB ( 0.00 MiB/s )
📦 Package repository/luet-20200717 downloaded
mocaccino-repository-index-repository-20201005.package.tar.gz - 0% [ ] ( 0B/366 B, ) [0s:0s]
Downloaded mocaccino-repository-index-repository-20201005.package.tar.gz of 0.00 MB ( 0.00 MiB/s )
📦 Package repository/mocaccino-repository-index-20201005 downloaded
Found protected file /etc/luet/repos.conf.d/mocaccino-repository-index.yml. Creating /etc/luet/repos.conf.d/._cfg0001_mocaccino-repository-index.yml.
📦 Package repository/mocaccino-repository-index-20201005 installed
📦 Package repository/luet-20200717 installed
+ ./luet install -y system/luet system/luet-extensions
⠋ 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
⠒ Downloaded repository.yaml of 0.00 MB ( 0.00 MiB/s )
⠠ Downloaded tree.tar.gz of 0.00 MB ( 0.00 MiB/s )
⠐ Downloaded repository.meta.yaml.tar of 0.01 MB ( 0.03 MiB/s )
🏠 Repository luet-official revision: 1 - 2021-02-10 19:00:21 +0100 CET
ℹ Repository: luet Priority: 1 Type: http
⠒ 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
Packages that are going to be installed in the system:
luet-system-0.11.0 (luet) luet-extensions-system-0.9.9 (luet)
luet-extensions-system-0.9.9.package.tar.gz - 0% [ ] ( 0B/1.9 kB, ) [0s:0s]
Downloaded luet-extensions-system-0.9.9.package.tar.gz of 0.00 MB ( 0.00 MiB/s )
📦 Package system/luet-extensions-0.9.9 downloaded
luet-system-0.11.0.package.tar.gz - 92% [==================================================================================================================> ] (9.9/11 MB, 3.903 MB/s) [2s:0s]
Downloaded luet-system-0.11.0.package.tar.gz of 11.19 MB ( 3.38 MiB/s )
📦 Package system/luet-0.11.0 downloaded
📦 Package system/luet-extensions-0.9.9 installed
📦 Package system/luet-0.11.0 installed
+ rm -rf luet
sab-worker1 ~ # let^C
sab-worker1 ~ # luet install repository/mocaccino-extra-stable repository/mocaccino-os-commons-stable
⠋ 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
⠒ 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-repository-index is already up to date.
ℹ Repository: mocaccino-repository-index Priority: 1 Type: http
Packages that are going to be installed in the system:
mocaccino-extra-stable-repository-20201018 (mocaccino-repository-index) mocaccino-os-commons-stable-repository-20201216 (mocaccino-repository-index)
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
mocaccino-extra-stable-repository-20201018.package.tar.gz - 0% [ ] ( 0B/333 B, ) [0s:0s]
Downloaded mocaccino-extra-stable-repository-20201018.package.tar.gz of 0.00 MB ( 0.00 MiB/s )
mocaccino-os-commons-stable-repository-20201216.package.tar.gz - 0% [ ] ( 0B/337 B, ) [0s:0s]
Downloaded mocaccino-os-commons-stable-repository-20201216.package.tar.gz of 0.00 MB ( 0.00 MiB/s )
📦 Package repository/mocaccino-extra-stable-20201018 downloaded
📦 Package repository/mocaccino-os-commons-stable-20201216 downloaded
📦 Package repository/mocaccino-os-commons-stable-20201216 installed
📦 Package repository/mocaccino-extra-stable-20201018 installed
sab-worker1 ~ # ls -l /
total 8
drwxr-xr-x 1 root root 1678 9 mar 2020 bin
drwxr-xr-x 4 root root 4096 9 mar 2020 boot
drwxr-xr-x 19 root root 3900 24 ott 16.57 dev
drwxr-xr-x 1 root root 3584 2 gen 17.46 etc
drwxr-xr-x 1 root root 32 6 feb 2020 home
lrwxrwxrwx 1 root root 5 5 nov 2018 lib -> lib64
drwxr-xr-x 1 root root 1518 9 mar 2020 lib32
drwxr-xr-x 1 root root 5694 9 mar 2020 lib64
drwxr-xr-x 1 root root 10 4 nov 2018 media
drwxr-xr-x 1 root root 10 4 nov 2018 mnt
drwxr-xr-x 1 root root 56 19 feb 2020 opt
dr-xr-xr-x 220 root root 0 24 ott 16.57 proc
drwxr-xr-x 1 root root 264 11 feb 17.37 root
drwxr-xr-x 27 root root 720 6 nov 18.42 run
drwxr-xr-x 1 root root 4824 9 mar 2020 sbin
drwxr-xr-x 1 root root 18 12 mar 2020 srv
dr-xr-xr-x 13 root root 0 24 ott 16.57 sys
drwxrwxrwt 5 root root 100 11 feb 17.36 tmp
drwxr-xr-x 1 root root 152 10 feb 18.34 usr
drwxr-xr-x 1 root root 98 11 feb 17.36 var
sab-worker1 ~ # luet install dev-util/mottainai-agent
⠋ 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
⠒ 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 )
⠤ Downloaded tree.tar.gz of 0.01 MB ( 0.02 MiB/s )
⠤ Downloaded repository.meta.yaml.tar.gz of 0.01 MB ( 0.04 MiB/s )
⠦ 🏠 Repository mocaccino-extra revision: 136 - 2021-02-04 11:53:16 +0100 CET
ℹ Repository: mocaccino-extra-stable Priority: 2 Type: http
⠒ Downloaded repository.yaml of 0.00 MB ( 0.00 MiB/s )
⠒ Downloaded tree.tar.gz of 0.00 MB ( 0.01 MiB/s )
⠉ Downloaded repository.meta.yaml.tar.gz of 0.01 MB ( 0.02 MiB/s )
⠈ 🏠 Repository mocaccino-os-commons revision: 42 - 2021-02-10 10:33:43 +0100 CET
ℹ Repository: mocaccino-os-commons-stable Priority: 2 Type: http
⠈ 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
Packages that are going to be installed in the system:
mottainai-groups-0 (mocaccino-extra-stable) docker-container-19.03.14 (mocaccino-extra-stable) entities-system-0.3 (luet) mocaccino-skel-init-20210207 (mocaccino-os-commons-stable) mottainai-agent-dev-util-0.0.1_pre20210122+1 (mocaccino-extra-stable) mottainai-agent-users-0 (mocaccino-extra-stable)
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
mottainai-groups-0.package.tar.gz - 0% [ ] ( 0B/229 B, ) [0s:0s]
Downloaded mottainai-groups-0.package.tar.gz of 0.00 MB ( 0.00 MiB/s )
mottainai-agent-users-0.package.tar.gz - 0% [ ] ( 0B/298 B, ) [0s:0s]
Downloaded mottainai-agent-users-0.package.tar.gz of 0.00 MB ( 0.00 MiB/s )
📦 Package groups/mottainai-0 downloaded
mocaccino-skel-init-20210207.package.tar.gz - 0% [ ] ( 0B/2.5 kB, ) [0s:0s]
Downloaded mocaccino-skel-init-20210207.package.tar.gz of 0.00 MB ( 0.01 MiB/s )
📦 Package users/mottainai-agent-0 downloaded% [ ] ( 0B/63 MB, ) [0s:0s]
📦 Package init/mocaccino-skel-20210207 downloaded.tar.gz - 0% [ ] ( 0B/28 MB, ) [0s:0s]
mottainai-agent-dev-util-0.0.1_pre20210122+1.package.tar.gz - 17% [================> ] (5.0/28 MB, 3.018 MB/s) [1s:7s]
Downloaded entities-system-0.3.package.tar.gz of 5.61 MB ( 2.67 MiB/s )
📦 Package system/entities-0.3 downloaded
mottainai-agent-dev-util-0.0.1_pre20210122+1.package.tar.gz - 95% [==============================================================================================> ] (27/28 MB, 3.739 MB/s) [7s:0s]
Downloaded mottainai-agent-dev-util-0.0.1_pre20210122+1.package.tar.gz of 29.70 MB ( 3.73 MiB/s )
docker-container-19.03.14.package.tar.gz - 52% [=============================================================> ] (33/63 MB, 3.829 MB/s) [8s:7s] 📦 Package dev-util/mottainai-agent-0.0.1_pre20210122+1 downloaded
docker-container-19.03.14.package.tar.gz - 97% [==================================================================================================================> ] (62/63 MB, 4.105 MB/s) [15s:0s]
Downloaded docker-container-19.03.14.package.tar.gz of 66.45 MB ( 3.94 MiB/s )
📦 Package container/docker-19.03.14 downloaded
Found protected file /etc/os-release. Creating /etc/._cfg0001_os-release.
📦 Package users/mottainai-agent-0 installed
📦 Package groups/mottainai-0 installed
📦 Package init/mocaccino-skel-20210207 installed
📦 Package system/entities-0.3 installed
Found protected file /etc/mottainai/mottainai-agent.yaml. Creating /etc/mottainai/._cfg0001_mottainai-agent.yaml.
📦 Package dev-util/mottainai-agent-0.0.1_pre20210122+1 installed
📦 Package container/docker-19.03.14 installed
Executing finalizer for init/mocaccino-skel-20210207
🐚 Executing finalizer on / sh [-c /usr/sbin/mocaccino-init-skel]
Executing finalizer for users/mottainai-agent-0
🐚 Executing finalizer on / sh [-c entities create -f /etc/passwd /etc/entities/mottainai_agent_entity_add.yaml || true]
Error: Entity already present
Usage:
entities create [flags]
Flags:
-h, --help help for create
Global Flags:
-f, --file string File to manipulate (defaults /etc/passwd) (default "/etc/passwd")
Entity already present
Executing finalizer for groups/mottainai-0
🐚 Executing finalizer on / sh [-c entities create -f /etc/group /etc/entities/mottainai-group_entity.yaml || true]
Error: Entity already present
Usage:
entities create [flags]
Flags:
-h, --help help for create
Global Flags:
-f, --file string File to manipulate (defaults /etc/passwd) (default "/etc/passwd")
Entity already present
Executing finalizer for dev-util/mottainai-agent-0.0.1_pre20210122+1
🐚 Executing finalizer on / sh [-c chown mottainai-agent:mottainai -R /srv/mottainai]
sab-worker1 ~ # ls -l /
total 4
drwxr-xr-x 1 root root 1678 9 mar 2020 bin
drwxr-xr-x 4 root root 4096 9 mar 2020 boot
drwxr-xr-x 19 root root 3900 24 ott 16.57 dev
drwxr-xr-x 1 root root 3666 22 gen 23.20 etc
drwxr-xr-x 1 root root 32 6 feb 2020 home
drwxr-xr-x 1 root root 14 22 gen 23.20 lib
drwxr-xr-x 1 root root 1518 9 mar 2020 lib32
drwxr-xr-x 1 root root 5694 9 mar 2020 lib64
drwxr-xr-x 1 root root 10 4 nov 2018 media
drwxr-xr-x 1 root root 10 7 feb 11.42 mnt
drwxr-xr-x 1 root root 56 19 feb 2020 opt
dr-xr-xr-x 222 root root 0 24 ott 16.57 proc
drwxr-xr-x 1 root root 264 11 feb 17.37 root
drwxr-xr-x 28 root root 740 11 feb 17.38 run
drwxr-xr-x 1 root root 4824 9 mar 2020 sbin
drwxr-xr-x 1 root root 18 22 gen 23.20 srv
dr-xr-xr-x 13 root root 0 24 ott 16.57 sys
drwxrwxrwt 5 root root 100 11 feb 17.36 tmp
drwxr-xr-x 1 root root 152 23 dic 21.20 usr
drwxr-xr-x 1 root root 98 22 gen 23.20 var
sab-worker1 ~ #
Maybe a good time to have a look at #90 - this for sure is not coming directly from luet code, as we don't handle explictly file copy or unpack. For sure we don't remove anything during install.
We only unpack files during install, and more generally, we do handle file copy/unpack only in two places:
- When we carry over changed files while we generating artifacts - https://github.com/mudler/luet/blob/b93357e36c7468cdf72b31331c67479b1c7276c5/pkg/compiler/artifact.go#L708
- When extracting artifacts to the target rootfs: https://github.com/mudler/luet/blob/b93357e36c7468cdf72b31331c67479b1c7276c5/pkg/helpers/archive.go#L72
imho, instead of to use another lib I prefer to complete what is already been done for the --same-owner
option and directly use the low-level API. And in general implement unpacker like an interface that could be managed by different implementation, at least until we found a valid solution for every scenario.