backup in rescue omde

Gojko

Well-Known Member
Nov 24, 2014
112
7
68
Macedonia
cPanel Access Level
Root Administrator
Hello what is the best way to transfer accounts to new server from broken server?
CentOS 7
Software RAID

accounts are in /home/
databases are in /var/lib/mysql

i tried this one: Full Disaster Recovery | cPanel & WHM Documentation

and what i get:
Code:
[email protected] ~ # mount /dev/md2 /mnt/chroot/
mount: /mnt/chroot/: mount point does not exist.
[email protected] ~ # mkdri /mnt/chroot
-bash: mkdri: command not found
[email protected] ~ # mkdir /mnt/chroot
[email protected] ~ # mount /dev/md2 /mnt/chroot/
[email protected] ~ # mount --bind /proc /mnt/chroot/proc
[email protected] ~ # mount --rbind /dev /mnt/chroot/dev
[email protected] ~ # mount --bind /sys /mnt/chroot/sys
[email protected] ~ # grep chroot /etc/mtab
/dev/md2 /mnt/chroot ext4 rw,relatime 0 0
proc /mnt/chroot/proc proc rw,nosuid,nodev,noexec,relatime 0 0
udev /mnt/chroot/dev devtmpfs rw,relatime,size=32820496k,nr_inodes=8205124,mode=755 0 0
tmpfs /mnt/chroot/dev/shm tmpfs rw,nosuid,nodev 0 0
devpts /mnt/chroot/dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
mqueue /mnt/chroot/dev/mqueue mqueue rw,relatime 0 0
hugetlbfs /mnt/chroot/dev/hugepages hugetlbfs rw,relatime,pagesize=2M 0 0
sys /mnt/chroot/sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
[email protected] ~ #  test -f /etc/sysconfig/mysql && source /etc/sysconfig/mysql; /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid ${MYSQLD_OPTS}
Please enable --log-error option or set appropriate redirections for standard output and/or standard error in daemon mode.
{chrooted}[email protected] /var/cpanel/users # /scripts/pkgacct username
[2020-10-11 23:45:14 +0200] pkgacct started.
[2020-10-11 23:45:14 +0200] pkgacct version 10 - user : username - tarball: 1 - target mysql : default - split: 0 - incremental: 0 - homedir: 1 - mailman: 1 - backup: 0 - archive version: 4 - running with uid 0
[2020-10-11 23:45:14 +0200] pkgacct using '/usr/local/cpanel/3rdparty/bin/pigz -6 --processes 1 --blocksize 4096 --rsyncable' to compress archives
[2020-10-11 23:45:14 +0200] pkgacct working dir : /home/cpmove-username
[2020-10-11 23:45:14 +0200] Copying Reseller Config...[2020-10-11 23:45:14 +0200] Done
[2020-10-11 23:45:14 +0200] Copying Suspension Info (if needed)...[2020-10-11 23:45:14 +0200] Done
[2020-10-11 23:45:14 +0200] Copying installed SSL certificates and keys...[2020-10-11 23:45:14 +0200] Performing “ApacheTLS” component....
[2020-10-11 23:45:14 +0200] Completed “ApacheTLS” component.
[2020-10-11 23:45:14 +0200] Done
[2020-10-11 23:45:14 +0200] Copying Domain Keys....[2020-10-11 23:45:14 +0200] Done
[2020-10-11 23:45:14 +0200] Copying Bandwidth Data....[2020-10-11 23:45:14 +0200] Performing “Bandwidth” component....
Summary databases … done!
[2020-10-11 23:45:14 +0200] Completed “Bandwidth” component.
[2020-10-11 23:45:14 +0200] Done
[2020-10-11 23:45:14 +0200] Copying Dns Zones....warn [pkgacct] The system had to unexpectedly restart dnsadmin because it could not connect: The system failed to connect to “/var/cpanel/dnsadmin/sock”: Connection refused
warn [pkgacct] The system had to unexpectedly restart dnsadmin because it could not connect: (XID 3csvrt) The system failed to connect a UNIX domain socket to “/var/cpanel/dnsadmin/sock” because of an error: Connection refused
warn [pkgacct] The system had to unexpectedly restart dnsadmin because it could not connect: The system failed to connect to “/var/cpanel/dnsadmin/sock”: Connection refused
warn [pkgacct] The system had to unexpectedly restart dnsadmin because it could not connect: (XID nvj23d) The system failed to connect a UNIX domain socket to “/var/cpanel/dnsadmin/sock” because of an error: Connection refused
[2020-10-11 23:46:55 +0200] (XID 7ygxpn) The system failed to connect a UNIX domain socket to “/var/cpanel/dnsadmin/sock” because of an error: Connection refused
so i can't create backup from command and i can't use mysql dump
Code:
mysqldump username-database > username-database.sql
mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) when trying to connect
it there something i can do to fix error above?
ofcrouse after installation of cpanel on that new server:
is it enough to copy /var/lib/mysql folder to new server and that is database copy?
can i copy the whole /home directory to new server and that is files transfer? can work like that is it even possible such as thing?
what about DNS zones?
 

andrew.n

Well-Known Member
Jun 9, 2020
272
55
28
EU
cPanel Access Level
Root Administrator
Certain services can't be started in chroot so you should backup with skipping the DNS entries and then manually move over the zones files from /var/named and either insrease the SOL (serial number) manually or re-saving the entries from WHM after restore. You can use this command for backup:

/scripts/pkgacct --skipdnszones cpuser
 

cPanelBrianK

Technical Analyst III
Staff member
Sep 5, 2018
14
2
78
Houston
cPanel Access Level
Root Administrator
Hello @Gojko,

I am sorry to hear you are having difficulties performing the disaster recovery steps detailed in the linked article. This article is in the process of being updated to address some of the issues you are facing. To best assist you, I can provide the details I filed for change here for your immediate reference.

The MySQL startup error indicates that there is not an error_log entry configured in the my.cnf. This will need to be added or you can append it to the daemonize command. The MySQL service should not be daemonized under the root user and that will also need to be addressed in the command. In your case, the following command would be expected to address these errors.

Code:
test -f /etc/sysconfig/mysql && source /etc/sysconfig/mysql; /usr/sbin/mysqld --daemonize --user=mysql --log-error=/var/log/mysqld.log --pid file=/var/run/mysqld/mysqld.pid ${MYSQLD_OPTS}
In regards to the DNSAdmin error, the advice provided by @andrew.n is correct. I recommend using the --skipdnszones to exclude these during the backup process. Any custom DNS entries will need to be manually copied over or recreated afterward.
 

Gojko

Well-Known Member
Nov 24, 2014
112
7
68
Macedonia
cPanel Access Level
Root Administrator
Thank you for respond andrew and briank
Now i have another error @cPanelBrianK
Code:
{chrooted}[email protected] / # test -f /etc/sysconfig/mysql && source /etc/sysconfig/mysql; /usr/sbin/mysqld --daemonize --user=mysql --log-error=/var/log/mysqld.log --pid file=/var/run/mysqld/mysqld.pid ${MYSQLD_OPTS}
Initialization of mysqld failed: 0
this error is because i didn't start mysql from command above?
Code:
[2020-10-12 13:50:24 +0200] Creating Archive ....................................................................................
..............................
[2020-10-12 13:55:07 +0200] Done
[2020-10-12 13:55:07 +0200] pkgacctfile is: /home/cpmove-username.tar.gz
[2020-10-12 13:55:17 +0200] md5sum is: b51aa55cc46362dc1cabf7a44aeb20cb
[2020-10-12 13:55:17 +0200]
[2020-10-12 13:55:17 +0200] size is: 6018518198
[2020-10-12 13:55:17 +0200]
[2020-10-12 13:55:17 +0200] homesize is: 7310884864
[2020-10-12 13:55:17 +0200]
[2020-10-12 13:55:17 +0200] homefiles is: 38510
warn [pkgacct] Error while connecting to MySQL: (XID njtxmg) The system failed to connect to the “MySQL” database “mysql” because of an error: CR_CONNECTION_ERROR (Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2))
[2020-10-12 13:55:17 +0200] Error while connecting to MySQL: (XID njtxmg) The system failed to connect to the “MySQL” database “mysql” because of an error: CR_CONNECTION_ERROR (Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)) at /usr/local/cpanel/Cpanel/Mysql/Basic.pm line 437.
@andrew.n for /var/named
i need to copy the whole named folder to new server and then what?
is this /scrtips/rebuildnamedconf will help to change IP of new server in DNS and fix?

also cPanelBriank: " Any custom DNS entries will need to be manually copied over or recreated afterward." this will not fixed by copy /var/named files to new server?
 

andrew.n

Well-Known Member
Jun 9, 2020
272
55
28
EU
cPanel Access Level
Root Administrator
Yes the error is because MySQL didn't start. Once you moved the /var/named folder you can mass change the IP of the accounts from WHM under Change Multiple IPs. All entries will be copied over if you move /var/named.

Whats the source OS? Is it CentOS 6 or 7 or 8? Disaster recovery can be troublesome sometimes and cPanel only offers some basic guidance here but there are cPanel Certified Professional System Administrators at System Administration Services who will be happy to assist you to get your server up an running as soon as possible.
 

Gojko

Well-Known Member
Nov 24, 2014
112
7
68
Macedonia
cPanel Access Level
Root Administrator
OK for DNS i understand.
Is it possible to fix this mysql problem?
Centos 7 rescue mode, well i tried one from link and took me 170$ without fixing problem, so i hire someone from upwork and he fix in 10 minutes (not this problem).
i need this to cut expense because i already bought new server to transfer accounts
 

andrew.n

Well-Known Member
Jun 9, 2020
272
55
28
EU
cPanel Access Level
Root Administrator
I'm sorry to see that you paid 170$ to somebody who didn't fix the problem by the end. Those sys admins who are cPanel certified are usually up to a standard....

Without having a closer look I'm not really sure why MySQL fails. Is there anything in MySQL logs? Either of these commands should work (starting MySQL as root or under mysql user):

test -f /etc/sysconfig/mysql && source /etc/sysconfig/mysql; /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid ${MYSQLD_OPTS}
test -f /etc/sysconfig/mysql && source /etc/sysconfig/mysql; /usr/sbin/mysqld --daemonize --user=mysql --log-error=/var/log/mysqld.log --pid file=/var/run/mysqld/mysqld.pid ${MYSQLD_OPTS}

I know for sure as last week I recovered a server similar to yours from CentOS 7 using the above commands (MySQL started under mysql user)
 

Gojko

Well-Known Member
Nov 24, 2014
112
7
68
Macedonia
cPanel Access Level
Root Administrator
This is error log what show when i run command:
Code:
2020-10-12T17:36:23.559420Z 0 [Note] libgovernor.so found
2020-10-12T17:36:23.559476Z 0 [Note] All governors functions found too
2020-10-12T17:36:23.559493Z 0 [ERROR] Governor not connected
2020-10-12T17:36:23.559497Z 0 [Note] All governors lve functions found too
2020-10-12T17:36:23.559622Z 0 [ERROR] Governor LVE initialization error
2020-10-12T17:36:23.559724Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-10-12T17:36:23.559807Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.31-cll-lve) starting as process 31079 ...
2020-10-12T17:36:23.562164Z 0 [Note] InnoDB: PUNCH HOLE support available
2020-10-12T17:36:23.562179Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-10-12T17:36:23.562183Z 0 [Note] InnoDB: Uses event mutexes
2020-10-12T17:36:23.562186Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2020-10-12T17:36:23.562188Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-10-12T17:36:23.562193Z 0 [Note] InnoDB: Using Linux native AIO
2020-10-12T17:36:23.562347Z 0 [Note] InnoDB: Number of pools: 1
2020-10-12T17:36:23.562193Z 0 [Note] InnoDB: Using Linux native AIO
2020-10-12T17:36:23.562347Z 0 [Note] InnoDB: Number of pools: 1
2020-10-12T17:36:23.562424Z 0 [Note] InnoDB: Using CPU crc32 instructions
2020-10-12T17:36:23.570898Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-10-12T17:36:23.576286Z 0 [Note] InnoDB: Completed initialization of buffer pool
2020-10-12T17:36:23.577801Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-10-12T17:36:23.589019Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2020-10-12T17:36:23.639233Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-10-12T17:36:23.639276Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2020-10-12T17:36:23.660035Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2020-10-12T17:36:23.660706Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2020-10-12T17:36:23.660713Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2020-10-12T17:36:23.660969Z 0 [Note] InnoDB: Waiting for purge to start
2020-10-12T17:36:23.711192Z 0 [Note] InnoDB: 5.7.31 started; log sequence number 125081245467
2020-10-12T17:36:23.711372Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2020-10-12T17:36:23.711659Z 0 [Note] Plugin 'FEDERATED' is disabled.
2020-10-12T17:36:23.711747Z 0 [Note] InnoDB: Buffer pool(s) load completed at 201012 19:36:23
2020-10-12T17:36:23.712250Z 0 [ERROR] unknown option '--pid'
2020-10-12T17:36:23.712269Z 0 [ERROR] Aborting
2020-10-12T17:36:23.712295Z 0 [Note] Binlog end
2020-10-12T17:36:23.712357Z 0 [Note] Shutting down plugin 'ngram'
2020-10-12T17:36:23.712367Z 0 [Note] Shutting down plugin 'partition'
2020-10-12T17:36:23.712372Z 0 [Note] Shutting down plugin 'BLACKHOLE'
2020-10-12T17:36:23.712378Z 0 [Note] Shutting down plugin 'ARCHIVE'
2020-10-12T17:36:23.712383Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2020-10-12T17:36:23.712477Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
2020-10-12T17:36:23.712483Z 0 [Note] Shutting down plugin 'MyISAM'
2020-10-12T17:36:23.712498Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
2020-10-12T17:36:23.712507Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2020-10-12T17:36:23.712515Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2020-10-12T17:36:23.712522Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2020-10-12T17:36:23.712530Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2020-10-12T17:36:23.712536Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2020-10-12T17:36:23.712543Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2020-10-12T17:36:23.712549Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2020-10-12T17:36:23.712557Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2020-10-12T17:36:23.712566Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2020-10-12T17:36:23.712573Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2020-10-12T17:36:23.712580Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2020-10-12T17:36:23.712586Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2020-10-12T17:36:23.712614Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2020-10-12T17:36:23.712629Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2020-10-12T17:36:23.712636Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2020-10-12T17:36:23.712648Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
2020-10-12T17:36:23.712653Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
2020-10-12T17:36:23.712648Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
2020-10-12T17:36:23.712653Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
2020-10-12T17:36:23.712658Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2020-10-12T17:36:23.712663Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2020-10-12T17:36:23.712668Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2020-10-12T17:36:23.712673Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2020-10-12T17:36:23.712677Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2020-10-12T17:36:23.712682Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2020-10-12T17:36:23.712687Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
2020-10-12T17:36:23.712692Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2020-10-12T17:36:23.712696Z 0 [Note] Shutting down plugin 'INNODB_CMP'
2020-10-12T17:36:23.712701Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2020-10-12T17:36:23.712706Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
2020-10-12T17:36:23.712711Z 0 [Note] Shutting down plugin 'INNODB_TRX'
2020-10-12T17:36:23.712716Z 0 [Note] Shutting down plugin 'InnoDB'
2020-10-12T17:36:23.712833Z 0 [Note] InnoDB: FTS optimize thread exiting.
2020-10-12T17:36:23.713006Z 0 [Note] InnoDB: Starting shutdown...
2020-10-12T17:36:23.813299Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2020-10-12T17:36:23.813790Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 201012 19:36:23
2020-10-12T17:36:25.342888Z 0 [Note] InnoDB: Shutdown completed; log sequence number 125081245486
2020-10-12T17:36:25.344958Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2020-10-12T17:36:25.344971Z 0 [Note] Shutting down plugin 'MEMORY'
2020-10-12T17:36:25.344976Z 0 [Note] Shutting down plugin 'CSV'
2020-10-12T17:36:25.344980Z 0 [Note] Shutting down plugin 'sha256_password'
2020-10-12T17:36:25.344983Z 0 [Note] Shutting down plugin 'mysql_native_password'
2020-10-12T17:36:25.345108Z 0 [Note] Shutting down plugin 'binlog'
2020-10-12T17:36:25.345296Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
 

andrew.n

Well-Known Member
Jun 9, 2020
272
55
28
EU
cPanel Access Level
Root Administrator
2020-10-12T17:36:23.712250Z 0 [ERROR] unknown option '--pid'

this is the reason. Did you have CloudLInux MySQL Governor installed?
 

Gojko

Well-Known Member
Nov 24, 2014
112
7
68
Macedonia
cPanel Access Level
Root Administrator
ok so if this is not possible is it possible to copy all from /var/lib/mysql for databases and for files in /home/ to new installed server and that can work like that?