IT Interviews
Friday, February 17, 2012
how to install or restore grub
GRUB ERROR 24
Error 24 : Attempt to access block outside partition
In this case I use to boot up with Live Knoppix CD or USB stick and restore grub installation using the following approaches:
(I have Knoppix Linux installed on the third partition of the first HDD and due to a failure in Disk Controller of my Acer Aspire laptop it is crashing the file system from time to time)
Solution 1 (to repair grub):
- run dmesg
If you see some disk related errors run fsck
run su
>umount -f /media/sda3
>fsck.reiserfs --rebuild-tree /dev/sda3
>mount /media/sda3
> sudo grub-install --recheck --no-floppy --root-directory=/media/sda3 hd0
Soluton 2 (to install fresh grub):
1. Open terminal and run sudo grub
2. run find /boot/grub/stage1
The result would be something like : (hd0,2)
3. run root (hd0,2)
The result should be something like : Filesystem type is reiserfs, partition type 0x83
4. run setup (hd0)
5. run quit and restart
Alternatively you can try to edit the /boot/grub/menu.lst file from /dev/sda3 (assuming your linux installation in on third partition of the first harddisk, else from /dev/sd<n><X>)
Friday, January 20, 2012
Open UTF-8 files in Unix using Putty
echo -ne '\e%G\e[?47h\e%G\e[?47l'
Thursday, January 19, 2012
java -Djava.awt.headless=true ...
This fixed the following errors:
In Tomcat server: X connection to localhost:10.0 broken (explicit kill or server shutdown).
In a Swing application: No X11 DISPLAY variable was set, but this program performed an operation which requires it.
Tuesday, November 30, 2010
SSH and SCP without password prompt
Establishing SSH connectivity between 2 servers without being asked for password
To be able to execute remote shell commands (ssh, rsh) between 2 trusted servers without being prompted to introduce password each time you have to do the following:
1. Create a key pair on the server from which ssh or scp commads are executed.
ssh-keygen –t rsa
2. Please set empty password.
3. Then you should name the public key more conveniently.
cp $HOME/.ssh/id_rsa.pub $HOME/server1.pub
4. After that copy the public key to the remote server machines:
scp $HOME/server1.pub user@server2:
5. Eventually SSH to these machines and configure the public key as an authorized key.
ssh user@server2
cat $HOME/server1.pub >> $HOME/.ssh/authorized_keys
6. To test the connectivity, simply SSH from server1 machine to server2 machine.
ssh user@server2
The connection should succeed and you should not be asked for a password.