02 - Upgrading CyberPanel

Create a bash file example update.sh

#!/bin/bash
sh <(curl https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh || wget -O - https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh)

And let it run in a crontab at a time interval you want.

I got this error when I try to upgrade to the lasted version.
Can anyone help?
Could not find platform independent libraries
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to [:<exec_prefix>]
Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = (not set)
program name = ‘/usr/local/CyberCP/bin/python3’
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = ‘/usr/local/CyberCP/bin/python3’
sys.base_prefix = ‘/usr’
sys.base_exec_prefix = ‘/usr’
sys.executable = ‘/usr/local/CyberCP/bin/python3’
sys.prefix = ‘/usr’
sys.exec_prefix = ‘/usr’
sys.path = [
‘/usr/lib/python38.zip’,
‘/usr/lib/python3.8’,
‘/usr/lib/lib-dynload’,
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named ‘encodings’

Current thread 0x00007f36f7155740 (most recent call first):

above command failed…

please fix this i cant upgrade the cyberpanel ubuntu 22

‘int’ object has no attribute ‘execute’
Traceback (most recent call last):
File “/root/cyberpanel_upgrade_tmp/upgrade.py”, line 842, in applyLoginSystemMigrations
cursor.execute(“UPDATE loginSystem_acl SET config = ‘%s’ where name = ‘admin’” % (Upgrade.AdminACL))
AttributeError: ‘int’ object has no attribute ‘execute’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/root/cyberpanel_upgrade_tmp/upgrade.py”, line 3072, in
main()
File “/root/cyberpanel_upgrade_tmp/upgrade.py”, line 3068, in main
Upgrade.upgrade(args.branch)
File “/root/cyberpanel_upgrade_tmp/upgrade.py”, line 2976, in upgrade
Upgrade.applyLoginSystemMigrations()
File “/root/cyberpanel_upgrade_tmp/upgrade.py”, line 845, in applyLoginSystemMigrations
import sleep
ModuleNotFoundError: No module named ‘sleep’
above command failed…

You can create an alias to simplify the upgrading/update CyberPanel command. Aliases in Linux allow you to create shortcuts for long or complex commands, making them easier to remember and execute. In this case, you can add an alias in your shell configuration file, such as .bashrc or .zshrc, depending on your environment.

Here’s how to do it for a Bash shell, which is common on many Linux systems. Open your .bashrc file in a text editor:

nano ~/.bashrc

Then, add a line at the end of the file to create your alias. For example, you could name it update_cyberpanel :

alias update_cyberpanel="sh <(curl https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh || wget -O - https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh)"

Save and close the file. Next, for the changes to take effect, reload your .bashrc by running:

source ~/.bashrc

Now, instead of typing the entire command, you can simply type update_cyberpanel in your terminal to execute the CyberPanel update script.

Please note that this alias will be available only for your current user and only in shell sessions that load the .bashrc file.

image
:white_check_mark:

1 Like

From V2.3.5, you can upgrade or downgrade the CyberPanel version from the versionManagment page.
PS: This feature is Beta in V2.3.5, the safest option is still to use the SSH command.

Hello, I just upgrade to:

Cyberpanel: 2.3
Build: 5
Current Commit: ef026d0ffabec88133a1f672519ba20a8df5e2ed

I have used:

sh <(curl https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh || wget -O - https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh)

My Server is Ubuntu 22.04

But OLS has not been upgraded, into OLS panel I still see:

CURRENT VERSION: OpenLiteSpeed 1.7.19 [New Release: 1.8.1]

How I can proceed?
Thank you for your time.

1.7.19 is the latest “stable” release. Be patient, once 1.8.1 becomes stable Cyberpanel will upgrade it automatically.

1 Like

Thanks a lot! have a great day!

Any way to automate the update process?

I don’t recommend automating the upgrade, because there are many minor updates, so you should only update when you want, and have a backup ready, in case you need to revert to a working version.

Good evening, I am facing an issue with the upgrade of CyberPanel. For some reason, it does not allow me to upgrade, and I don’t know why. I have been using the same command for a long time, and after that, I always did a restart.

root@vmi :~# sudo su - -c "sh <(curl https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh || wget -O - https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh)"

 

Enjoy your accelerated Internet by CyberPanel.

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   396  100   396    0     0   2212      0 --:--:-- --:--:-- --:--:--  2212

Fetching latest data from CyberPanel server...

This may take few seconds...

Checking root privileges...

You are running as root...

Checking server location...

System: Ubuntu 20 detected...


Press the Enter key to continue with latest version, or enter specific version such as: 1.9.4 , 1.9.5 ...etc

If nothing is input in 10 seconds, script will proceed with the latest stable version.

Please press the Enter key or specify a version number, or wait for 10 seconds:
Branch name set to v2.3.5
Hit:1 http://asi-fs-d.contabo.net/ubuntu focal InRelease
Hit:2 http://asi-fs-d.contabo.net/ubuntu focal-updates InRelease
Hit:3 http://asi-fs-d.contabo.net/ubuntu focal-backports InRelease
Hit:4 http://security.ubuntu.com/ubuntu focal-security InRelease
Get:6 https://dlm.mariadb.com/repo/mariadb-server/10.10/repo/ubuntu focal InRelease [7,767 B]
Hit:7 http://ppa.launchpad.net/ondrej/php/ubuntu focal InRelease
Get:8 https://dlm.mariadb.com/repo/maxscale/latest/apt focal InRelease [9,338 B]
Hit:9 https://repo.imunify360.cloudlinux.com/imunify360/ubuntu/20.04 focal InRelease
Hit:5 https://downloads.mariadb.com/Tools/ubuntu focal InRelease
Ign:10 http://rpms.litespeedtech.com/debian focal InRelease
Get:11 https://download.imunify360.com/ubuntu/20.04/slot-1 focal InRelease [1,138 B]
Get:12 https://download.imunify360.com/ubuntu/20.04/slot-2 focal InRelease [1,150 B]
Hit:13 https://download.imunify360.com/ubuntu/20.04/slot-3 focal InRelease
Hit:14 http://rpms.litespeedtech.com/debian focal Release
Get:15 https://download.imunify360.com/ubuntu/20.04/slot-4 focal InRelease [1,138 B]
Get:16 https://download.imunify360.com/ubuntu/20.04/slot-5 focal InRelease [1,138 B]
Hit:17 https://download.imunify360.com/ubuntu/20.04/slot-6 focal InRelease
Get:18 https://download.imunify360.com/ubuntu/20.04/slot-7 focal InRelease [1,138 B]
Get:19 https://download.imunify360.com/ubuntu/20.04/slot-8 focal InRelease [1,138 B]
Fetched 23.9 kB in 2s (13.6 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
htop is already the newest version (2.2.0-2build1).
libattr1 is already the newest version (1:2.4.48-5).
libattr1-dev is already the newest version (1:2.4.48-5).
libpsl-dev is already the newest version (0.21.0-1ubuntu1).
librtmp-dev is already the newest version (2.4+20151223.gitfa8646d.1-2build1).
telnet is already the newest version (0.17-41.2build1).
git is already the newest version (1:2.25.1-1ubuntu3.13).
libcomerr2 is already the newest version (1.45.5-2ubuntu1.1).
libcurl4-gnutls-dev is already the newest version (7.68.0-1ubuntu2.23).
libgcrypt20-dev is already the newest version (1.8.5-5ubuntu1.1).
libgnutls28-dev is already the newest version (3.6.13-2ubuntu1.11).
libgpgme-dev is already the newest version (1.13.1-7ubuntu2.2).
libgssapi-krb5-2 is already the newest version (1.17-6ubuntu4.4).
libk5crypto3 is already the newest version (1.17-6ubuntu4.4).
libkrb5-dev is already the newest version (1.17-6ubuntu4.4).
libldap2-dev is already the newest version (2.4.49+dfsg-2ubuntu1.10).
liblzma-dev is already the newest version (5.2.4-1ubuntu1.1).
libnghttp2-dev is already the newest version (1.40.0-1ubuntu0.3).
libssl-dev is already the newest version (1.1.1f-1ubuntu2.23).
nettle-dev is already the newest version (3.5.1+really3.5.1-2ubuntu0.2).
dnsutils is already the newest version (1:9.18.28-0ubuntu0.20.04.1).
nghttp2 is already the newest version (1.40.0-1ubuntu0.3).
virtualenv is already the newest version (20.0.17-1ubuntu0.4).
idn2 is already the newest version (2.3.0-1+ubuntu20.04.1+deb.sury.org+2).
libidn2-0-dev is already the newest version (2.3.0-1+ubuntu20.04.1+deb.sury.org+2).
libidn2-dev is already the newest version (2.3.0-1+ubuntu20.04.1+deb.sury.org+2).
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libmariadbclient-dev : Depends: libmariadb-dev (= 1:10.3.39-0ubuntu0.20.04.2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-pip is already the newest version (20.0.2-5ubuntu1.10).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
libffi-dev is already the newest version (3.3-4).
python3-dev is already the newest version (3.8.2-0ubuntu2).
build-essential is already the newest version (12.8ubuntu1.1).
libssl-dev is already the newest version (1.1.1f-1ubuntu2.23).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-venv is already the newest version (3.8.2-0ubuntu2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Hit:1 http://asi-fs-d.contabo.net/ubuntu focal InRelease
Hit:2 http://asi-fs-d.contabo.net/ubuntu focal-updates InRelease
Hit:3 http://asi-fs-d.contabo.net/ubuntu focal-backports InRelease
Hit:4 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:5 http://ppa.launchpad.net/ondrej/php/ubuntu focal InRelease
Get:7 https://dlm.mariadb.com/repo/mariadb-server/10.10/repo/ubuntu focal InRelease [7,767 B]
Get:8 https://dlm.mariadb.com/repo/maxscale/latest/apt focal InRelease [9,338 B]
Hit:9 https://repo.imunify360.cloudlinux.com/imunify360/ubuntu/20.04 focal InRelease
Hit:6 https://downloads.mariadb.com/Tools/ubuntu focal InRelease
Ign:10 http://rpms.litespeedtech.com/debian focal InRelease
Get:11 https://download.imunify360.com/ubuntu/20.04/slot-1 focal InRelease [1,138 B]
Get:12 https://download.imunify360.com/ubuntu/20.04/slot-2 focal InRelease [1,150 B]
Hit:13 http://rpms.litespeedtech.com/debian focal Release
Hit:14 https://download.imunify360.com/ubuntu/20.04/slot-3 focal InRelease
Get:15 https://download.imunify360.com/ubuntu/20.04/slot-4 focal InRelease [1,138 B]
Get:16 https://download.imunify360.com/ubuntu/20.04/slot-5 focal InRelease [1,138 B]
Hit:17 https://download.imunify360.com/ubuntu/20.04/slot-6 focal InRelease
Get:18 https://download.imunify360.com/ubuntu/20.04/slot-7 focal InRelease [1,138 B]
Get:19 https://download.imunify360.com/ubuntu/20.04/slot-8 focal InRelease [1,138 B]
Fetched 23.9 kB in 2s (13.1 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
Get more security updates through Ubuntu Pro with 'esm-apps' enabled:
  libmagickcore-6.q16-6-extra libopenexr-dev libmagickwand-6.q16-6
  libmagickwand-6-headers redis libmagickcore-6-headers redis-tools
  libmagickcore-6-arch-config libmagickwand-6.q16-dev libopenexr24
  libmagickcore-6.q16-6 libmagickwand-dev redis-server traceroute
  libmagickcore-6.q16-dev imagemagick-6-common
Learn more about Ubuntu Pro at https://ubuntu.com/pro
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Requirement already satisfied: virtualenv in /usr/local/lib/python3.8/dist-packages (20.26.3)
Requirement already satisfied: distlib<1,>=0.3.7 in /usr/local/lib/python3.8/dist-packages (from virtualenv) (0.3.8)
Requirement already satisfied: filelock<4,>=3.12.2 in /usr/local/lib/python3.8/dist-packages (from virtualenv) (3.15.4)
Requirement already satisfied: platformdirs<5,>=3.9.1 in /usr/local/lib/python3.8/dist-packages (from virtualenv) (4.2.2)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.

[notice] A new release of pip is available: 24.1 -> 24.2
[notice] To update, run: python3 -m pip install --upgrade pip

Nothing found, need fresh setup...

AttributeError: module 'virtualenv.create.via_global_ref.builtin.cpython.mac_os' has no attribute 'CPython2macOsFramework'
above command failed...

Did you manage to resolve this? I am getting the exact same error.

Requirement already up-to-date: virtualenv in /usr/local/lib/python3.8/dist-packages (20.26.3)
Requirement already satisfied, skipping upgrade: filelock<4,>=3.12.2 in /usr/local/lib/python3.8/dist-packages (from virtualenv) (3.15.4)
Requirement already satisfied, skipping upgrade: distlib<1,>=0.3.7 in /usr/local/lib/python3.8/dist-packages (from virtualenv) (0.3.8)
Requirement already satisfied, skipping upgrade: platformdirs<5,>=3.9.1 in /usr/local/lib/python3.8/dist-packages (from virtualenv) (4.2.2)

Nothing found, need fresh setup...

AttributeError: module 'virtualenv.create.via_global_ref.builtin.cpython.mac_os' has no attribute 'CPython2macOsFramework'
above command failed...

Same issue

I get this error when I do upgrade via SSH:

Building wheels for collected packages: cffi
  Building wheel for cffi (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [70 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-310
      creating build/lib.linux-x86_64-cpython-310/cffi
      copying cffi/model.py -> build/lib.linux-x86_64-cpython-310/cffi
      copying cffi/commontypes.py -> build/lib.linux-x86_64-cpython-310/cffi
      copying cffi/api.py -> build/lib.linux-x86_64-cpython-310/cffi
      copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-cpython-310/cffi
      copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-cpython-310/cffi
      copying cffi/verifier.py -> build/lib.linux-x86_64-cpython-310/cffi
      copying cffi/error.py -> build/lib.linux-x86_64-cpython-310/cffi
      copying cffi/recompiler.py -> build/lib.linux-x86_64-cpython-310/cffi
      copying cffi/pkgconfig.py -> build/lib.linux-x86_64-cpython-310/cffi
      copying cffi/vengine_gen.py -> build/lib.linux-x86_64-cpython-310/cffi
      copying cffi/cparser.py -> build/lib.linux-x86_64-cpython-310/cffi
      copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-cpython-310/cffi
      copying cffi/__init__.py -> build/lib.linux-x86_64-cpython-310/cffi
      copying cffi/lock.py -> build/lib.linux-x86_64-cpython-310/cffi
      copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-cpython-310/cffi
      copying cffi/ffiplatform.py -> build/lib.linux-x86_64-cpython-310/cffi
      copying cffi/_cffi_include.h -> build/lib.linux-x86_64-cpython-310/cffi
      copying cffi/parse_c_type.h -> build/lib.linux-x86_64-cpython-310/cffi
      copying cffi/_embedding.h -> build/lib.linux-x86_64-cpython-310/cffi
      copying cffi/_cffi_errors.h -> build/lib.linux-x86_64-cpython-310/cffi
      running build_ext
      building '_cffi_backend' extension
      creating build/temp.linux-x86_64-cpython-310
      creating build/temp.linux-x86_64-cpython-310/c
      x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/local/CyberPanelTemp/include -I/usr/include/python3.10 -c c/_cffi_backend.c -o build/temp.linux-x86_64-cpython-310/c/_cffi_backend.o
      c/_cffi_backend.c: In function ‘ctypedescr_dealloc’:
      c/_cffi_backend.c:405:23: error: lvalue required as left operand of assignment
        405 |         Py_REFCNT(ct) = 43;
            |                       ^
      c/_cffi_backend.c:408:23: error: lvalue required as left operand of assignment
        408 |         Py_REFCNT(ct) = 0;
            |                       ^
      c/_cffi_backend.c: In function ‘prepare_callback_info_tuple’:
      c/_cffi_backend.c:5987:5: warning: ‘PyEval_InitThreads’ is deprecated [-Wdeprecated-declarations]
       5987 |     PyEval_InitThreads();
            |     ^~~~~~~~~~~~~~~~~~
      In file included from /usr/include/python3.10/Python.h:130,
                       from c/_cffi_backend.c:2:
      /usr/include/python3.10/ceval.h:122:37: note: declared here
        122 | Py_DEPRECATED(3.9) PyAPI_FUNC(void) PyEval_InitThreads(void);
            |                                     ^~~~~~~~~~~~~~~~~~
      c/_cffi_backend.c: In function ‘b_callback’:
      c/_cffi_backend.c:6042:5: warning: ‘ffi_prep_closure’ is deprecated: use ffi_prep_closure_loc instead [-Wdeprecated-declarations]
       6042 |     if (ffi_prep_closure(closure, &cif_descr->cif,
            |     ^~
      In file included from c/_cffi_backend.c:15:
      /usr/include/x86_64-linux-gnu/ffi.h:347:1: note: declared here
        347 | ffi_prep_closure (ffi_closure*,
            | ^~~~~~~~~~~~~~~~
      In file included from c/cffi1_module.c:20,
                       from c/_cffi_backend.c:7552:
      c/call_python.c: In function ‘_get_interpstate_dict’:
      c/call_python.c:20:30: error: invalid use of incomplete typedef ‘PyInterpreterState’ {aka ‘struct _is’}
         20 |     builtins = tstate->interp->builtins;
            |                              ^~
      c/call_python.c: In function ‘_update_cache_to_call_python’:
      c/call_python.c:160:39: error: invalid use of incomplete typedef ‘PyInterpreterState’ {aka ‘struct _is’}
        160 |     new1 = PyThreadState_GET()->interp->modules;
            |                                       ^~
      c/call_python.c: In function ‘cffi_call_python’:
      c/call_python.c:249:63: error: invalid use of incomplete typedef ‘PyInterpreterState’ {aka ‘struct _is’}
        249 |         if (externpy->reserved1 != PyThreadState_GET()->interp->modules) {
            |                                                               ^~
      error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for cffi
  Running setup.py clean for cffi
Failed to build cffi
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (cffi)
1 Like

Me too. Same error.

I’m upgrading on Ubuntu 20 from 2.3 Build: 5
Current Commit: 874cdfdc56e94f19f779db337e2d2404de63b486

I tried on 4 different servers and same error, it’s MAJOR BUG !

Ubuntu 20.04 and Ubuntu 22.04 tested.

I’ve resolved this error yesterday. Are you guys still experiencing? If so please DM me root access.

Or better open ticket here: https://platform.cyberpersons.com/

2 Likes

For me it’s fixed. Thx!

I get this error when trying to update:

error: [Errno 13] Permission denied: ‘/tmp/pip-build-2lkjlu0v/pynacl/src/libsodium/configure’

Command “/usr/bin/python3.6 -u -c “import setuptools, tokenize;file=‘/tmp/pip-build-2lkjlu0v/pynacl/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(‘\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /tmp/pip-m9zguxfy-record/install-record.txt --single-version-externally-managed --compile” failed with error code 1 in /tmp/pip-build-2lkjlu0v/pynacl/
above command failed…

I can confirm, it is fixed for me as well, thanks.