ISCPonfig error after server recovery

Discussion in 'General' started by zyzzza, Nov 18, 2023.

  1. zyzzza

    zyzzza Member

    Hi,
    after server crash (lost files, especially in /etc, and some other places) i have installed fresh ispconfig on a new VPS, and copied all mysql files from 'var/lib/mysql' from old server . I also changed root password in mysql_clientdb.conf file. I can access mysql root with no problem from within the shell, all databases are there and checks are working ok. (however all other users/passwords except root probably invalid now)
    I also recovered var/www folder partially, and placed it instead of fresh ispconfig install.
    I have not recreated linux groups and users yet as they wont match on new system.

    Now , when im trying to reach ispconfig web interface im getting :

    Fatal error: Uncaught Error: Call to a member function queryOneRecord() on bool in /usr/local/ispconfig/interface/lib/app.inc.php:173 Stack trace: #0 /usr/local/ispconfig/interface/lib/app.inc.php(97): app->conf() #1 /usr/local/ispconfig/interface/lib/app.inc.php(411): app->initialize_session() #2 /usr/local/ispconfig/interface/web/index.php(32): require_once('/usr/local/ispc...') #3 {main} thrown in /usr/local/ispconfig/interface/lib/app.inc.php on line 173

    Any hints where to look for a problem ?
    Thanks !
     
  2. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Can you provide your server report, please?
     
  3. zyzzza

    zyzzza Member

    UPD - had to replace config.inc.php as well, as those passwords also got changed ! :)
     
    till and ahrasis like this.
  4. zyzzza

    zyzzza Member

    UPD 2 - maybe anyone will have ideas as i have to launch it till Monday , but it is stil stuck :(
    ISP interface is loading, however , when i tried to resync things - it halted , and not doing anything. I know that most probably this is a probelm of permissions absence, as new install linux permissions and groups are different, and of course there is no web users / clients groups or permissions created on a linux level.
    Is there a script which could magically check clients in ISP DB , recreate user/group , reapply users/group for proper folders and recreate apache configs ? (I am only running web/db on this host, so all mail related things are not an issue)

    upload_2023-11-18_17-58-21.png
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

  6. zyzzza

    zyzzza Member

    OK, thanks . I see :
    /usr/local/ispconfig/server/server.sh
    18.11.2023-18:33 - WARNING - There is already a lockfile set, but no process running with this pid (48665). Continuing.
    Database connection failed Database connection failed Database connection failed
    So most porbably there's some DB connections left unchanged . (I have copied config.inc.php from working server, but probably something left from fresh install ... ) Any thoughts please which files/ DB connections i should check more ?
    Thank you !
     
  7. zyzzza

    zyzzza Member

    Oh, ok, found it . theres 2 config.inc.php files - one for interface, and the other for server forlder. Changed both - and seems something started working :) Will inform if this ends up well :)
     
  8. zyzzza

    zyzzza Member

    OK, seems things are much better now - apache now has vhosts, and i got all the groups and users. however one thing left - all inner web files in "/web" have numerical ownerships (5005 5004 etc) , and resync seems does nothing about this. Maybe there is another script that culd do this ? (got quite some webs to go through manually :) )
     
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    I'm not aware of any script for that. Resync changes permissions of files and folders managed by ISPConfig only. The problem is, if /etc/passwd is missing, then web users likely get different uid's and clients different gid's on resync as the useradd and groupadd commands will use the next free uid and gid.
     
  10. zyzzza

    zyzzza Member

    /etc/passwd , users and groups where fixed well by resync. However as resync fixed ownership for only /web folder itself (resides for each web inside /var/www/clients/clientX/webY/), i left to do is setting inner files to same ownership as that "web" folder. With a little help of chatgpt , i got this script which fixes ownerships for ALL webs (maybe someone will find it usefull one day :) ) Still running on my server, bu i guess this would be ok.

    Code:
    #!/bin/bash
    
    # Define the root directory
    ROOT_DIR="/var/www/clients"
    
    # Find all directories named "web" that are 3 levels below the root directory
    find "$ROOT_DIR" -maxdepth 3 -type d -name "web" | while read -r WEB_FOLDER; do
       # Get the owner and group of the "web" folder
       OWNER_GROUP=$(stat -c "%U:%G" "$WEB_FOLDER")
     
       # Change ownership recursively for files and subdirectories within the "web" folder
       find "$WEB_FOLDER" -type f -exec chown "$OWNER_GROUP" {} \;
       find "$WEB_FOLDER" -type d -exec chown "$OWNER_GROUP" {} \;
      
       echo "Changed ownership for files in $WEB_FOLDER to $OWNER_GROUP"
    done
    
    
     
    Last edited: Nov 18, 2023
    till likes this.

Share This Page