[Reopen, Enhancement] Use apt-get upgrade and apt-get update instead of just apt upgrade/update in the CLP update script. #298

Closed
opened 2026-04-05 20:26:32 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @peaklabs-dev on 1/11/2024

CloudPanel version(s) affected

2.4.0

Description

Reopened because it has not been added yet!

In the CLP update script at https://update.cloudpanel.io/v2. you will find these lines almost at the bottom:

else
    addAptSourceList
    apt -y upgrade
    UPDATED_APP_VERSION=$(su -s /bin/bash -c "clpctl app:get:config-value 'app_version'" clp)
    if [[ $UPDATED_APP_VERSION == $LATEST_APP_VERSION ]]; then
      echo "${GREEN_TEXT_COLOR}CloudPanel has been updated to v$LATEST_APP_VERSION ${RESET_TEXT_COLOR}"
    fi
  fi
}

And a little further up is the update line.

  echo -e "$CLOUDPANEL_SOURCE_LIST" > /etc/apt/sources.list.d/packages.cloudpanel.io.list
  echo -e "$CLOUDPANEL_APT_PREFERENCES" > /etc/apt/preferences.d/00packages.cloudpanel.io.pref
  apt update -y
  apt clean -y
}

-> Use apt-get upgrade and apt-get update -> Because if you use the automatic update script for CLP updates, this Warning will appear in the logs (only when there is an update, as far as I can tell):

WARNING: apt does not have a stable CLI interface. Use with caution in scripts. -> This is not causing a problem on the server at the moment, but may cause a problem on the server at some point in the future, just the log Warning is concerning.

-> and it is simply not good practice to use apt upgrade in any non-interactive scripts (see solution).

How to reproduce

Use the automatic update script https://www.techbreeze.in/auto-update-securing-cloudpanel/ and watch the log, when there is an update the log will contain the following Warning:
WARNING: apt does not have a stable CLI interface. Use with care in scripts.

Possible Solution

Use apt-get instead of just apt, because apt is designed for interactive use on the command line, not for use in scripts. For scripts, you should use apt-get or apt-cache instead, which provide stable, parsable output.

Additional Context

No response

*Originally created by @peaklabs-dev on 1/11/2024* ### CloudPanel version(s) affected 2.4.0 ### Description Reopened because it has not been added yet! In the CLP update script at https://update.cloudpanel.io/v2. you will find these lines almost at the bottom: ``` else addAptSourceList apt -y upgrade UPDATED_APP_VERSION=$(su -s /bin/bash -c "clpctl app:get:config-value 'app_version'" clp) if [[ $UPDATED_APP_VERSION == $LATEST_APP_VERSION ]]; then echo "${GREEN_TEXT_COLOR}CloudPanel has been updated to v$LATEST_APP_VERSION ${RESET_TEXT_COLOR}" fi fi } ``` And a little further up is the update line. ``` echo -e "$CLOUDPANEL_SOURCE_LIST" > /etc/apt/sources.list.d/packages.cloudpanel.io.list echo -e "$CLOUDPANEL_APT_PREFERENCES" > /etc/apt/preferences.d/00packages.cloudpanel.io.pref apt update -y apt clean -y } ``` -> Use apt-get upgrade and apt-get update -> Because if you use the automatic update script for CLP updates, this Warning will appear in the logs (only when there is an update, as far as I can tell): `WARNING: apt does not have a stable CLI interface. Use with caution in scripts.` -> This is not causing a problem on the server at the moment, but may cause a problem on the server at some point in the future, just the log Warning is concerning. -> and it is simply not good practice to use apt upgrade in any non-interactive scripts (see solution). ### How to reproduce Use the automatic update script https://www.techbreeze.in/auto-update-securing-cloudpanel/ and watch the log, when there is an update the log will contain the following Warning: `WARNING: apt does not have a stable CLI interface. Use with care in scripts.` ### Possible Solution Use apt-get instead of just apt, because apt is designed for interactive use on the command line, not for use in scripts. For scripts, you should use apt-get or apt-cache instead, which provide stable, parsable output. ### Additional Context _No response_
Sign in to join this conversation.