Bug 1218459

Summary: rpm scriptlets left over after snasphot updates
Product: [openSUSE] openSUSE Tumbleweed Reporter: Dirk Weber <d_werner>
Component: libzyppAssignee: Michael Schröder <mls>
Status: NEW --- QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: arvidjaar, patrick.schaaf
Version: Current   
Target Milestone: ---   
Hardware: x86-64   
OS: openSUSE Tumbleweed   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Dirk Weber 2023-12-30 19:11:35 UTC
I noticed on 2 Tumbleweed systems that since middle of October 2023 rpm scriptlets remain in the /var/tmp directory.

For one of the systems the oldest files are related to the update from snapshot 
20231012 to snapshot 20231013 on Oct. 15:

$ ll -rt /var/tmp/rpm-tmp.* |head
-rw------- 1 root root  177 15. Okt 14:07 /var/tmp/rpm-tmp.xEtA52
-rw------- 1 root root  479 15. Okt 14:07 /var/tmp/rpm-tmp.EXLxob
-rw------- 1 root root  311 15. Okt 14:07 /var/tmp/rpm-tmp.bjfewF
-rw------- 1 root root  648 15. Okt 14:07 /var/tmp/rpm-tmp.ZDYSLb
-rw------- 1 root root  179 15. Okt 14:07 /var/tmp/rpm-tmp.BYmaWt
-rw------- 1 root root  176 15. Okt 14:07 /var/tmp/rpm-tmp.aXzaBF
-rw------- 1 root root  311 17. Okt 16:38 /var/tmp/rpm-tmp.eX0BsI
-rw------- 1 root root  638 18. Okt 19:02 /var/tmp/rpm-tmp.F05Leb
-rw------- 1 root root  311 18. Okt 19:02 /var/tmp/rpm-tmp.rxs60L
-rw------- 1 root root  546 18. Okt 19:02 /var/tmp/rpm-tmp.nnvrQo

and new files were created also with the update from snapshot 
20231225 to snapshot 20231226 on Dec. 28:

$ ll -rt /var/tmp/rpm-tmp.* |tail
-rw------- 1 root root  311 22. Dez 19:32 /var/tmp/rpm-tmp.WVqG89
-rw------- 1 root root 1694 22. Dez 19:32 /var/tmp/rpm-tmp.1hF4yH
-rw------- 1 root root  166 22. Dez 19:33 /var/tmp/rpm-tmp.eJdGQd
-rw------- 1 root root  162 23. Dez 17:30 /var/tmp/rpm-tmp.ZsqgtG
-rw------- 1 root root  177 23. Dez 17:30 /var/tmp/rpm-tmp.pPVWkF
-rw------- 1 root root  311 23. Dez 17:30 /var/tmp/rpm-tmp.M8ojbB
-rw------- 1 root root  311 26. Dez 20:16 /var/tmp/rpm-tmp.SLRu25
-rw------- 1 root root  166 28. Dez 06:08 /var/tmp/rpm-tmp.fYFPnC
-rw------- 1 root root  311 28. Dez 06:09 /var/tmp/rpm-tmp.V99rNu
-rw------- 1 root root  253 28. Dez 06:09 /var/tmp/rpm-tmp.Kn51G9

I do not find a tmpfiles.d configuration which would cause removal of files in /var/tmp owned by root reaching a certain age, therefore I suspect this started with snapshot 20231013.



Currently the directory contains 236 such files on this system:
$ ll /var/tmp/rpm-tmp.* |wc -l
236

Seems the files are created during the posttrans step of the snapshot update with zypper dup:

stat rpm-tmp.bjfewF
  File: rpm-tmp.bjfewF
  Size: 311             Blocks: 8          IO Block: 4096   regular file
Device: 254,1   Inode: 662121      Links: 1
Access: (0600/-rw-------)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2023-12-30 18:38:13.806666658 +0100
Modify: 2023-10-15 14:07:33.799999952 +0200
Change: 2023-10-15 14:07:33.799999952 +0200
 Birth: 2023-10-15 14:07:33.796666619 +0200


fits to /var/log/zypp/history entry:
# 2023-10-15 14:07:33 %posttrans(grub2-x86_64-efi-2.12~rc1-5.1.noarch) script output:
# ++ cat /run/fde-tpm-helper/update
# ++ uniq


The number of files created during snapshot updates varies, probably depending on the updated packages and the related posttrans scriptlets.


Content of the files generated on Oct 15:
# cat $(ll -rt rpm-tmp.* |grep 'Oct 15' |awk '{print $9}')
set -x
# Migration to /usr/etc, restore just created .rpmsave
for i in logrotate.d/zypp-history.lr; do
   test -f /etc/${i}.rpmsave && mv -v /etc/${i}.rpmsave /etc/${i} ||:
done
set -x

if test -x /sbin/update-bootloader; then 
  if test -f /run/update-bootloader/reinit; then 
    rm -f -- /run/update-bootloader/reinit /run/update-bootloader/refresh 
    if test -x /usr/libexec/grub2-instdev-fixup.pl; then 
      /usr/libexec/grub2-instdev-fixup.pl || : 
    fi 
    /sbin/update-bootloader --reinit || : 
  elif test -f /run/update-bootloader/refresh; then 
    rm -f /run/update-bootloader/refresh 
    /sbin/update-bootloader --refresh || : 
  fi 
fi
set -x
# Launch the issue-generator: we have a new config file in /usr/lib/issue.d that needs to be represented
if [ -x /usr/sbin/issue-generator ]; then
    if [ -x /usr/bin/systemd-tmpfiles ]; then
      /usr/bin/systemd-tmpfiles --create issue-generator.conf || :
    fi
    /usr/sbin/issue-generator || :
fi
set -x

if test -x /sbin/update-bootloader; then 
  if test -f /run/update-bootloader/reinit; then 
    rm -f -- /run/update-bootloader/reinit /run/update-bootloader/refresh 
    if test -x /usr/libexec/grub2-instdev-fixup.pl; then 
      /usr/libexec/grub2-instdev-fixup.pl || : 
    fi 
    /sbin/update-bootloader --reinit || : 
  elif test -f /run/update-bootloader/refresh; then 
    rm -f /run/update-bootloader/refresh 
    /sbin/update-bootloader --refresh || : 
  fi 
fi 


if test -f /run/fde-tpm-helper/update; then 
  /usr/libexec/fde/fde-tpm-helper "`cat /run/fde-tpm-helper/update | uniq`" || : 
  rm -f /run/fde-tpm-helper/update 
fi
set -x
# Migration to /usr/etc, restore just created .rpmsave
for i in logrotate.d/samba pam.d/samba; do
   test -f /etc/${i}.rpmsave && mv -v /etc/${i}.rpmsave /etc/${i} ||:
doneset -x
# Migration to /usr/etc, restore just created .rpmsave
for i in logrotate.d/samba-winbind ; do
   test -f /etc/${i}.rpmsave && mv -v /etc/${i}.rpmsave /etc/${i} ||:
done
Comment 1 Dirk Weber 2023-12-31 15:13:20 UTC
Comparing with the second system:
the files started to appear or rather remain leftover with the snapshot update following the snapshot which contained the update of libzypp to version 17.31.22-2.1 on the respective system.

This version of libzypp was part of snapshot 20231012.


The announcement 
"New Tumbleweed snapshot 20231012 released!"
mentioned these changes:

==== libzypp ====
Version update (17.31.20 -> 17.31.22)

- Preliminary disable 'rpm --runposttrans' usage for chrooted
  systems (bsc#1216091)
  This limits the %transfiletrigger(postun|in) support in the
  default installer iff --root is used (as described in bug
  1041742). The chrooted execution of the scripts in 'rpm
  - -runposttrans' broke in rpm-4.18. It's expected to be fixed in
  rpm-4.19. Then we'll enable the feature again.
- fix comment typo on zypp.conf (boo#1215979)
- version 17.31.22 (22)
- Attempt to delay %transfiletrigger(postun|in) execution if rpm
  supports it (bsc#1041742)
  Decide during installation whether rpm is capable of delayed
  %posttrans %transfiletrigger(postun|in) execution or whether we
  can just handle the packages %posttrans. On TW a delayed
  %transfiletrigger handling is possible since rpm-4.17.
- Make sure the old target is deleted before a new one is created
  (bsc#1203760)
- version 17.31.21 (22)
Comment 2 Michael Andres 2024-01-09 15:07:02 UTC
Those scriptlets are created by rpm. I suppose 'rpm --runposttrans' does not clean up propery.
-> rpm maintainer
Comment 3 Dirk Weber 2024-02-02 16:10:42 UTC
Just for information: the leftover files still happen with rpm 4.19.1.

On a system updated to snapshot 20240131 containing rpm 4.19.1-1.1 on 2024-02-01 and then updated to snapshot 20240201 on 2024-02-02 these new files remain:

-rw------- 1 root root  311  2. Feb 16:46 /var/tmp/rpm-tmp.1jag4X
-rw------- 1 root root  349  2. Feb 16:46 /var/tmp/rpm-tmp.Tncoe7
Comment 4 Patrick Schaaf 2024-02-13 07:19:39 UTC
Can confirm, I'm seeing these (now I look) on all my tw machines, oldest files going back to October 20th last year.