Skip to content

Application update does not clean up old files #7058

Closed

Description

@DavidePrincipi

When an application update is applied, files and directories from the previous application image are not removed. This bug was discovered in an app pre-release version, but it affects any NS8 application.

Old files that remain can cause unexpected issues in all applications.

Steps to reproduce

  • Install ghcr.io/nethserver/nextcloud:0.0.8
  • Update to ghcr.io/nethserver/nextcloud:1.1.8 (latest)

Expected behavior

The file located at AGENT_INSTALL_DIR/actions/configure-module/50migrate should not exist, as version 1.1.8 does not include it.

Actual behavior

The file remains present. Below is a file listing after the update:

-rwxr-xr-x. 1 nextcloud3 nextcloud3 2275 Sep 11 08:23 20configure
-rwxr-xr-x. 1 nextcloud3 nextcloud3 1712 Sep 11 08:23 30traefik
-rwxr-xr-x. 1 nextcloud3 nextcloud3 4150 Sep 11 08:23 40migrate
-rwxr-xr-x. 1 nextcloud3 nextcloud3 3509 Feb  7  2023 50migrate
-rwxr-xr-x. 1 nextcloud3 nextcloud3 1101 Sep 11 08:23 50systemd
-rwxr-xr-x. 1 nextcloud3 nextcloud3  847 Sep 11 08:23 70ldap
-rwxr-xr-x. 1 nextcloud3 nextcloud3  658 Sep 11 08:23 80configure_collabora
-rwxr-xr-x. 1 nextcloud3 nextcloud3  356 Sep 11 08:23 90apps_management

Notice the different modification dates.

Components

  • Core, any version.
  • Applications: Any application that has removed files from imageroot/ since its first release

See also

Discussion https://mattermost.nethesis.it/nethesis/pl/jh3agmc9uby19dfiydzhneyrxo


Thanks to @Amygos @gsanchietti

Activity

  1. moved this from New to Ready in NethServeron Oct 10, 2024
  2. DavidePrincipi commented on Oct 10, 2024

    @DavidePrincipi
    MemberAuthor

    List of repositories that may need a fix

    • ns8-collabora
    • ns8-crowdsec
    • ns8-dnsmasq
    • ns8-dokuwiki
    • ns8-ejabberd
    • ns8-imapsync
    • ns8-kickstart
    • ns8-ldapproxy
    • ns8-loki
    • ns8-mail
    • ns8-mariadb
    • ns8-mattermost
    • ns8-minio
    • ns8-netdata
    • ns8-nethsecurity-controller
    • ns8-nextcloud
    • ns8-openldap
    • ns8-piler
    • ns8-porthos
    • ns8-postgresql
    • ns8-promtail
    • ns8-roundcubemail
    • ns8-samba
    • ns8-sogo
    • ns8-traefik
    • ns8-webserver
    • ns8-webtop
    • ns8-wordpress
  3. added this to the NethServer M8.3 milestone on Nov 7, 2024
  4. removed their assignment
    on Nov 22, 2024
  5. moved this from ToDo to In Progress in NethServeron Jan 22, 2025
  6. added a commit that references this issue on Jan 23, 2025
  7. DavidePrincipi commented on Jan 23, 2025

    @DavidePrincipi
    MemberAuthor

    The merged code resolves the bug for future module updates. It is effective starting from the 2nd update after the fixed core has been installed.

    Test case 1

    Simulate the image extraction for some application on a stable core release, e.g. 3.4.2 (latest). During development I tested Nextcloud.

    From Nextcloud's history I found that at some point a file was removed. E.g.

    1. Enter the app environment

      runagent -m nextcloud1
      mkdir test1 && cd test1
      extract-image ghcr.io/nethserver/nextcloud:0.0.7 # first install
      
    2. Update core to 3.4.3-dev.2, then simulate the image extraction

      runagent -m nextcloud1
      cd test1
      extract-image ghcr.io/nethserver/nextcloud:1.1.8 # 1st update
      extract-image ghcr.io/nethserver/nextcloud:1.3.0 # 2nd update
      

    Expectations:

    • The file ./actions/configure-module/70ldap must be removed by 2nd update.

      removed './actions/configure-module/70ldap'
      
    • Files (symlinks) from 0.0.7 ./actions/restore-module/30traefik and ./actions/restore-module/40systemd are NOT removed because they were installed without this bug fix.

    Test case 2

    Run extract-image concurrently, only one instance will complete successfully.

    runagent -m nextcloud1
    mkdir test2 && cd test2
    extract-image  extract-image ghcr.io/nethserver/nextcloud:1.3.0 & extract-image ghcr.io/nethserver/nextcloud:1.3.0 &
    
  8. 17 remaining items

  9. moved this from Done to In Progress in NethServeron Jan 24, 2025
  10. moved this from In Progress to Done in NethServeron Jan 24, 2025
  11. removed their assignment
    on Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    verified

    Type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions