• srfg

    (@srfg)


    Hello,

    Since WordPress 6.6, automatic updates (core, plugins) no longer work via an SSH connection. We run about 70 websites and the problem affects all of them. PHP version is 8.2. We have completely reinstalled WordPress on an internal test server. The problem still exists. Nothing has changed in our infrastructure and all updates work normally if you trigger them manually. Unfortunately, we do not receive any information in the log file. In the admin interface, the counter for updates is reset to 12 hours without an update having been carried out.

    To get more information, we tried the “Easy Updates Manager plugin. It does not work either and we received the following error:

    [16-Oct-2024 13:39:21 UTC] PHP Fatal error: Uncaught TypeError: ftp_nlist(): Argument #1 ($ftp) must be of type FTP\Connection, null given in /var/www/https/..at/wp/wp-admin/includes/class-wp-filesystem-ftpext.php:438

    Stack trace:
    #0 /var/www/https/..at/wp/wp-admin/includes/class-wp-filesystem-ftpext.php(438): ftp_nlist()
    #1 /var/www/https/..at/wp/wp-admin/includes/class-wp-filesystem-base.php(231): WP_Filesystem_FTPext->exists()
    #2 /var/www/https/..at/wp/wp-admin/includes/class-wp-filesystem-base.php(58): WP_Filesystem_Base->find_folder()
    #3 /var/www/https/..at/wp/wp-admin/includes/class-wp-upgrader.php(997): WP_Filesystem_Base->abspath()
    #4 /var/www/https/..at/wp/wp-admin/includes/class-wp-automatic-updater.php(474): WP_Upgrader->maintenance_mode()
    #5 /var/www/https/..at/wp/wp-admin/includes/class-wp-automatic-updater.php(676): WP_Automatic_Updater->update()
    #6 /var/www/https/..at/wp/wp-includes/update.php(855): WP_Automatic_Updater->run()
    #7 /var/www/https/..at/wp/wp-content/plugins/stops-core-theme-and-plugin-updates/includes/MPSUM_Admin_Ajax.php(1057): wp_maybe_auto_update()
    #8 /var/www/https/..at/wp/wp-content/plugins/stops-core-theme-and-plugin-updates/includes/MPSUM_Admin_Ajax.php(144): MPSUM_Admin_Ajax->force_updates()
    #9 /var/www/https/..at/wp/wp-includes/class-wp-hook.php(324): MPSUM_Admin_Ajax->ajax_handler()
    #10 /var/www/https/..at/wp/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
    #11 /var/www/https/..at/wp/wp-includes/plugin.php(517): WP_Hook->do_action()
    #12 /var/www/https/..at/wp/wp-admin/admin-ajax.php(192): do_action()
    #13 {main} thrown in /var/www/https/..at/wp/wp-admin/includes/class-wp-filesystem-ftpext.php on line 438

    A value is obviously missing. If we use the setting define(‘FS_METHOD’, ‘ssh2’);, we get another fatal error:

    [16-Oct-2024 15:41:54 UTC] Automatic updates starting…
    [16-Oct-2024 15:41:54 UTC] Automatic plugin updates starting…
    [16-Oct-2024 15:41:54 UTC] Upgrading plugin ‘better-search-replace’…
    [16-Oct-2024 15:41:54 UTC] PHP Fatal error: Uncaught TypeError: ssh2_sftp_realpath(): Argument #1 ($sftp) must be of type resource, null given in /var/www/https/..at/wp/wp-admin/includes/class-wp-filesystem-ssh2.php:304

    Stack trace:
    #0 /var/www/https/..at/wp/wp-admin/includes/class-wp-filesystem-ssh2.php(304): ssh2_sftp_realpath()
    #1 /var/www/https/..at/wp/wp-admin/includes/class-wp-filesystem-base.php(261): WP_Filesystem_SSH2->cwd()
    #2 /var/www/https/..at/wp/wp-admin/includes/class-wp-filesystem-base.php(238): WP_Filesystem_Base->search_for_folder()
    #3 /var/www/https/..at/wp/wp-admin/includes/class-wp-filesystem-base.php(58): WP_Filesystem_Base->find_folder()
    #4 /var/www/https/..at/wp/wp-admin/includes/class-wp-upgrader.php(997): WP_Filesystem_Base->abspath()
    #5 /var/www/https/..at/wp/wp-admin/includes/class-wp-automatic-updater.php(474): WP_Upgrader->maintenance_mode()
    #6 /var/www/https/..at/wp/wp-admin/includes/class-wp-automatic-updater.php(676): WP_Automatic_Updater->update()
    #7 /var/www/https/..at/wp/wp-includes/update.php(855): WP_Automatic_Updater->run()
    #8 /var/www/https/..at/wp/wp-content/plugins/stops-core-theme-and-plugin-updates/includes/MPSUM_Admin_Ajax.php(1057): wp_maybe_auto_update()
    #9 /var/www/https/..at/wp/wp-content/plugins/stops-core-theme-and-plugin-updates/includes/MPSUM_Admin_Ajax.php(144): MPSUM_Admin_Ajax->force_updates()
    #10 /var/www/https/..at/wp/wp-includes/class-wp-hook.php(324): MPSUM_Admin_Ajax->ajax_handler()
    #11 /var/www/https/..at/wp/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
    #12 /var/www/https/..at/wp/wp-includes/plugin.php(517): WP_Hook->do_action()
    #13 /var/www/https/..at/wp/wp-admin/admin-ajax.php(192): do_action()
    #14 {main} thrown in /var/www/https/..at/wp/wp-admin/includes/class-wp-filesystem-ssh2.php on line 304

    It is important to us that we can continue to use WordPress with SSH2. Our Configuration:

    define(‘FTP_METHOD’,’ssh2′);
    define(‘FTP_PUBKEY’,’/xxx/xxx/xxx.xx’);
    define(‘FTP_PRIKEY’,’/xxx/xxx/xxx.xx’);
    define(‘FTP_USER’,’xxxxxxxx’);
    define(‘FTP_PASS’,”);
    define(‘FTP_HOST’,’127.0.0.1:22′);

Viewing 3 replies - 1 through 3 (of 3 total)
  • threadi

    (@threadi)

    If you deactivate the Easy Update Manager, are there also debug.log entries for it? What do they look like, if they exist? If they are not there, are there any entries in the hosting error log?

    Thread Starter srfg

    (@srfg)

    Hello,
    there are no debug.log entries and no entries in the hosting error log after deactivating Easy Update Manager.

    Thread Starter srfg

    (@srfg)

    Hi,

    thanks for helping us out. It's very appriciated.

    ++++++++++++++++++++++++++++++++++++++++++++++++


    +++++++++++++++++++++++++++++++++++++++++++++++++

    CURRENT KONFIGURATION

    +++++++++++++++++++++++++++++++++++++++++++++++++

    We are running an sftp-server environment and necessary SFTP Libraries (SFTP PHP8.2 Libraries) to connect over sftp with a dedicated useraccount and Key-Based Authentication:

    ii libssh2-1:amd64 1.10.0-3+b1 amd64 SSH2 client-side library
    ii libssh2-1-dev:amd64 1.10.0-3+b1 amd64 SSH2 client-side library (development headers)
    ii openssh-client 1:9.2p1-2+deb12u3 amd64 secure shell (SSH) client, for secure access to remote machines
    ii openssh-server 1:9.2p1-2+deb12u3 amd64 secure shell (SSH) server, for secure access from remote machines
    ii openssh-sftp-server 1:9.2p1-2+deb12u3 amd64 secure shell (SSH) sftp server module, for SFTP access from remote machines
    ii php-ssh2 1.3.1+0.13-7 amd64 Bindings for the libssh2 library
    ii php8.2-ssh2 1.3.1+0.13-7 amd64 Bindings for the libssh2 library
    ii task-ssh-server 3.73 all SSH server

    We are using a WordPress offered ssh2-Konfiguration and consequently sftp.

    Permissions on the local Filesystem are set in such a way as to enable write permissions for the dedicated update user.

    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    SFTP ERRORS:

    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    Following error message ist somewhat misleading, because ssh/sftp connection is working.


    PHP Fatal error: Uncaught TypeError: ftp_nlist(): Argument #1 ($ftp) must be of type FTP\Connection, null given in /var/www/https/..at/wp/wp-admin/includes/class-wp-filesystem-ftpext.php:438


    We are using the update function/configuration (SSH2) offered by WordPress successfully.

    Meaning, we can update WordPress, Plugins, Translations, within the WordPress-GUI manually over sftp by pushing the buttons.

    Alternatively wp-cli works wonderfully:

    sudo -u wp-user wp --debug plugin update --all

    So Everything's fine up to a certain point.

    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    AUTOMATIC UPDATE

    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    Our "ssh2"-configuration with automatic updates worked until WordPress-version 6.5.5. (tested)

    My Impression is, from Version 6.6 on, mentioned Wordpess Automatic-Update-Function seems to be broken. (tested)
    But that's me.

    Mentioned SSH2-Configuration:

    define(‘FTP_METHOD’,’ssh2');
    define(‘FTP_PUBKEY’,’/xxx/xxx/xxx.xx’);
    define(‘FTP_PRIKEY’,’/xxx/xxx/xxx.xx’);
    define(‘FTP_USER’,’xxxxxxxx’);
    define(‘FTP_PASS’,”);
    define(‘FTP_HOST’,’127.0.0.1:22');

    My guess was, I have to tell WordPress which Method to use when accessing the local Filesystem:

    define('FS_METHOD', 'ssh2');

    which is acknowledged with the following error:

    [22-Oct-2024 16:11:52 UTC] Automatic updates starting…
    [22-Oct-2024 16:11:52 UTC] Automatic plugin updates starting…
    [22-Oct-2024 16:11:52 UTC] Upgrading plugin 'maintenance'…
    [22-Oct-2024 16:11:52 UTC] PHP Fatal error: Uncaught TypeError: ssh2_sftp_realpath(): Argument #1 ($sftp) must be of type resource, null given in /var/www/https/xxx.xxx.xx/wp/wp-admin/includes/class-wp-filesystem-ssh2.php:304
    Stack trace: 0 /var/www/https/xxx.xxx.xx/wp/wp-admin/includes/class-wp-filesystem-ssh2.php(304): ssh2_sftp_realpath() 1 /var/www/https/xxx.xxx.xx/wp/wp-admin/includes/class-wp-filesystem-base.php(261): WP_Filesystem_SSH2->cwd() 2 /var/www/https/xxx.xxx.xx/wp/wp-admin/includes/class-wp-filesystem-base.php(238): WP_Filesystem_Base->search_for_folder() 3 /var/www/https/xxx.xxx.xx/wp/wp-admin/includes/class-wp-filesystem-base.php(58): WP_Filesystem_Base->find_folder() 4 /var/www/https/xxx.xxx.xx/wp/wp-admin/includes/class-wp-upgrader.php(997): WP_Filesystem_Base->abspath() 5 /var/www/https/xxx.xxx.xx/wp/wp-admin/includes/class-wp-automatic-updater.php(474): WP_Upgrader->maintenance_mode() 6 /var/www/https/xxx.xxx.xx/wp/wp-admin/includes/class-wp-automatic-updater.php(676): WP_Automatic_Updater->update() 7 /var/www/https/xxx.xxx.xx/wp/wp-includes/update.php(855): WP_Automatic_Updater->run() 8 /var/www/https/xxx.xxx.xx/wp/wp-content/plugins/stops-core-theme-and-plugin-updates/includes/MPSUM_Admin_Ajax.php(1057): wp_maybe_auto_update() 9 /var/www/https/xxx.xxx.xx/wp/wp-content/plugins/stops-core-theme-and-plugin-updates/includes/MPSUM_Admin_Ajax.php(144): MPSUM_Admin_Ajax->force_updates() 10 /var/www/https/xxx.xxx.xx/wp/wp-includes/class-wp-hook.php(324): MPSUM_Admin_Ajax->ajax_handler() 11 /var/www/https/xxx.xxx.xx/wp/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() 12 /var/www/https/xxx.xxx.xx/wp/wp-includes/plugin.php(517): WP_Hook->do_action() 13 /var/www/https/xxx.xxx.xx/wp/wp-admin/admin-ajax.php(192): do_action() 14 {main}

    thrown in /var/www/https/xxx.xxx.xx/wp/wp-admin/includes/class-wp-filesystem-ssh2.php on line 304

    Going a step further and specifying the local path of the WordPressinstallation doesn't help either, or seem's to be ignored:

    define('FTP_BASE', '/var/www/https/xxx.xxx.xx/wp');
    define( 'FTP_CONTENT_DIR', '/var/www/https/xxx.xxx.xx/wp/wp-content' );
    define( 'FTP_PLUGIN_DIR ', '/var/www/https/xxx.xxx.xx/wp/wp-content/plugins' );

    By the way, define('fs_method' 'direct') works. But the apache-user has to have write permissions in the file-system. Something we want to avoid as much as possible.

    What we know:

    Manually triggered Updates (GUI OR WP-CLI) are working (SSH2,SFTP)

    Automatically triggered Updates do not work (same configuration)

    If WordPress is rolled back to 6.5.5 everything's fine.
Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.