containers / qm

QM is a containerized environment for running Functional Safety qm (Quality Management) software
https://github.com/containers/qm
GNU General Public License v2.0
20 stars 21 forks source link

setup: the dir /usr/lib/qm/rootfs/ is kept after package removed #401

Closed dougsland closed 4 months ago

dougsland commented 4 months ago

The setup set this dir and it's kept in the OS after package removed.

[root@localhost ~]# rpm -qa | grep -i qm
qm-0.6.2-3.el9iv.noarch

[root@localhost ~]# ls /usr/lib/qm/rootfs/
afs  boot  etc   lib    media  opt   root  sbin  sys  usr
bin  dev   home  lib64  mnt    proc  run   srv   tmp  var

[root@localhost ~]# dnf remove -y qm
Dependencies resolved.
================================================================================
 Package      Architecture     Version                  Repository         Size
================================================================================
Removing:
 qm           noarch           0.6.2-3.el9iv            @System            76 k

Transaction Summary
================================================================================
Remove  1 Package

Freed space: 76 k
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1
  Erasing          : qm-0.6.2-3.el9iv.noarch                                1/1
  Running scriptlet: qm-0.6.2-3.el9iv.noarch                                1/1
  Verifying        : qm-0.6.2-3.el9iv.noarch                                1/1

Removed:
  qm-0.6.2-3.el9iv.noarch

Complete!
[root@localhost ~]# ls /usr/lib/qm/rootfs/
afs  boot  etc   lib    media  opt   root  sbin  sys  usr
bin  dev   home  lib64  mnt    proc  run   srv   tmp  var

# rpm -qf /usr/lib/qm/rootfs/
file /usr/lib/qm/rootfs is not owned by any package

also noticed this selinux complain after the package was removed looking the logs:

Apr 27 10:55:45 donald.medogz.local setroubleshoot[3346]: SELinux is preventing /usr/lib/systemd/systemd from search access >

                                                          *****  Plugin restorecon (71.4 confidence) suggests   ************>

                                                          If you want to fix the label.
                                                          /usr/lib/qm/rootfs default label should be lib_t.
                                                          Then you can run restorecon. The access attempt may have been stop>
                                                          Do
                                                          # /sbin/restorecon -v /usr/lib/qm/rootfs

                                                          *****  Plugin file (21.7 confidence) suggests   ******************>

                                                          If you think this is caused by a badly mislabeled machine.
                                                          Then you need to fully relabel.
                                                          Do
                                                          touch /.autorelabel; reboot

should we remove during dnf remove qm -y like rm -rf /usr/lib/qm?

dougsland commented 4 months ago

@rhatdan @Yarboa PTAL

dougsland commented 4 months ago

Build a rpm with the purpose patch for tests:

# ./runvm --nographics ./cs9-qemu-qm-minimal-regular.x86_64.qcow2
BdsDxe: loading Boot0001 "UEFI Misc Device" from PciRoot(0x0)/Pci(0x3,0x0)
BdsDxe: starting Boot0001 "UEFI Misc Device" from PciRoot(0x0)/Pci(0x3,0x0)
System BootOrder not found.  Initializing defaults.
Creating boot entry "Boot0007" with label "CentOS Linux" for file "\EFI\centos\shimx64.efi"

  Booting `Automotive Stream Distribution (5.14.0-438.391.el9iv.x86_64) 9'

[    1.750824] Error: Driver 'pcspkr' is already registered, aborting...
[    3.515865] overlayfs: idmapped layers are currently not supported

Automotive Stream Distribution 9
Kernel 5.14.0-438.391.el9iv.x86_64 on an x86_64

localhost login: root
Password:
[root@localhost ~]# podman ps
CONTAINER ID  IMAGE       COMMAND     CREATED        STATUS        PORTS       NAMES
622baf5c257a              /sbin/init  6 seconds ago  Up 6 seconds              qm

[root@localhost ~]# ls -la /usr/lib/qm/rootfs/
total 72
dr-xr-xr-x. 18 root root 4096 Apr 28 13:58 .
drwxr-xr-x.  3 root root 4096 Apr 28 13:59 ..
dr-xr-xr-x.  2 root root 4096 Aug  9  2021 afs
lrwxrwxrwx.  1 root root    7 Aug  9  2021 bin -> usr/bin
dr-xr-xr-x.  2 root root 4096 Aug  9  2021 boot
drwxr-xr-x.  2 root root 4096 Apr 28 13:58 dev
drwxr-xr-x. 46 root root 4096 Apr 28 13:58 etc
drwxr-xr-x.  2 root root 4096 Aug  9  2021 home
lrwxrwxrwx.  1 root root    7 Aug  9  2021 lib -> usr/lib
lrwxrwxrwx.  1 root root    9 Aug  9  2021 lib64 -> usr/lib64
drwxr-xr-x.  2 root root 4096 Aug  9  2021 media
drwxr-xr-x.  2 root root 4096 Aug  9  2021 mnt
drwxr-xr-x.  2 root root 4096 Aug  9  2021 opt
drwxr-xr-x.  2 root root 4096 Apr 28 13:58 proc
dr-xr-x---.  3 root root 4096 Apr 28 13:58 root
drwxr-xr-x. 12 root root 4096 Apr 28 13:58 run
lrwxrwxrwx.  1 root root    8 Aug  9  2021 sbin -> usr/sbin
drwxr-xr-x.  2 root root 4096 Aug  9  2021 srv
drwxr-xr-x.  2 root root 4096 Apr 28 13:58 sys
drwxrwxrwt.  2 root root 4096 Aug  9  2021 tmp
drwxr-xr-x. 12 root root 4096 Apr 28 13:58 usr
drwxr-xr-x. 18 root root 4096 Apr 28 13:58 var

[root@localhost ~]# dnf remove -y qm
Dependencies resolved.
================================================================================
 Package        Architecture       Version            Repository           Size
================================================================================
Removing:
 qm             noarch             X.1-1              @System              83 k

Transaction Summary
================================================================================
Remove  1 Package

Freed space: 83 k
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1
  Running scriptlet: qm-X.1-1.noarch                                        1/1
  Erasing          : qm-X.1-1.noarch                                        1/1
  Running scriptlet: qm-X.1-1.noarch                                        1/1
  Verifying        : qm-X.1-1.noarch                                        1/1

Removed:
  qm-X.1-1.noarch

Complete!
[root@localhost ~]# ls -la /usr/lib/qm/rootfs/
ls: cannot access '/usr/lib/qm/rootfs/': No such file or directory
[root@localhost ~]#
rhatdan commented 4 months ago

Why not add qm and rootfs directories spec file?

dougsland commented 4 months ago

Why not add qm and rootfs directories spec file?

Agreed. I did. I just added a patch to setup to remove it as it was setup which added it in first place. Also, users in the future might want to decide to use a different path so the rpm needs to be adaptable. I will send the PR in few minutes.