Wednesday, September 3, 2014

Errors were encountered while processing: mysql-server-5.5 ... E: Sub-process /usr/bin/dpkg returned an error code (1)

start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing mysql-server-5.5 (--configure):

subprocess installed post-installation script returned error exit status 1
No apport report written because MaxReports is reached already
Errors were encountered while processing:
mysql-server-5.5
E: Sub-process /usr/bin/dpkg returned an error code (1)


I know you have tried all these solutions that's why you are here but just take a look at once before watching my final solution which is going to work for you.

Solution : 1
Run command
sudo dpkg --configure -a
Solution : 2
Remove and install mysql server again, Run commands :
sudo apt-get --purge remove mysql-server
sudo apt-get install mysql-server

Solution : 3
Remove mysql-server and mysql-server-5.5 package from the file /var/lib/dpkg/status and reconfigure mysql-server
sudo dpkg --configure -a
But you have tried all these solutions and still you are facing same problem, try this Final Solution.
 
Final Solution
Run Command :
sudo apt-get install --reinstall apparmor
Now comment following line in the file /etc/mysql/my.cnf
skip-bdb
Restart mysql
sudo service mysql start
Now your mysql will be started.

Saturday, August 9, 2014

Transfer files from one linux server to another linux server

scp from one remote server to another remote server

If you are trying to transfer files from one remote server to another remote server using scp and you are getting permission denied error, here is the solution for you.

Suppose you are using system A and you want to transfer files from system B to system C and you are trying
scp user1@systemB-IP:/location/sourcefile user2@systemC-IP:/location/targetFile
But you are getting permission denied error

You should use
ssh user1@systemB-IP scp /location/sourceFile user2@systemC-IP:/location/targetFile
But still you are getting permission denied error, try
ssh -t user1@systemB-IP scp /location/sourceFile user2@systemC-IP:/location/targetFile
Example :
IP of system A - 192.168.0.11
IP of system B - 192.168.0.12
IP of system C - 192.168.0.13

Source file location on system B - /opt/lampp/htdocs/install.log
Destination location on system C - /opt/logs

You are log in to system A and you want to transfer file from system B to system C. Run following command :
ssh -t root@192.168.0.12 scp /opt/lampp/htdocs/install.log root@192.168.0.13:/opt/logs


Solution : 2
Save public key file of your system (system A) into system B and system C.

scp $HOME/.ssh/filename.pub root@192.168.0.12:/root/.ssh/authorized_keys

scp $HOME/.ssh/filename.pub root@192.168.0.13:/root/.ssh/authorized_keys

and now run
scp root@192.168.0.12:/opt/lampp/htdocs/install.log root@192.168.0.13:/opt/logs

Pseudo-terminal will not be allocated because stdin is not a terminal

Pseudo-terminal will not be allocated because stdin is not a terminal

if you get this error while log into another Linux account using ssh, here is the solution.

Use -t -t with ssh.
ssh -t -t hostname
Example :
ssh -t -t user@192.168.0.7