Bash: History appending for multiple sessions

Posted on

I got a requirement for listing all the command history if  multiple terminal sessions using in different region for the single user. I followed the below steps.

step1 : Create a new file with the below entries

root@appserver:# cat /etc/profile.d/bash_history.sh
function share_history {
 history -a
 history -c
 history -r
HISTTIMEFORMAT=`echo -e "33[1;34m%d/%h/%Y 33[1;31m%H:%M:%S 33[0m"`
shopt -u histappend

Step2: activate it in run-time

root@appserver:# source /etc/profile.d/bash_history.sh

Now you can see the list of aged histories

Sample Output :

1005 26/Dec/2013 14:23:08 vi /etc/profile.d/bash_history.sh
1006 26/Dec/2013 14:23:27 source /etc/profile.d/bash_history.sh
1007 26/Dec/2013 14:23:31 history

error: E: Could not perform immediate configuration on ‘util-linux’. Please see man 5 apt.conf under APT::Immediate-Configure for details. (2

Posted on

I got an error while upgrading ubuntu 11.0 to 12.4 , broken apt manager will stop updating the packages. hours after goggling I found the solution that aptitude installation is able to fulfill this requirement , with the blow commands

$ sudo aptitude install upstart

After completing this I can able to continue updating my Ubuntu packages.

$sudo apt-get dist-upgrade -y



Error: 500 OOPS: vsftpd: refusing to run with writable root inside chroot()

Posted on

Each time while am installing VSFTPD on ubuntu and enable chroot for the users it will refuse to login to the home directory because of write permission in its parent dir, to fix this I used the command

chmod a-w  /path/to/the/ftp/home

but is was most annoying and frustrating problem. I supposed to update the vsftpd package with security fix. the steps are below.

wget http://ftp.us.debian.org/debian/pool/main/v/vsftpd/vsftpd_3.0.2-3_amd64.deb
dpkg -i vsftpd_3.0.2-3_amd64.deb
echo "allow_writeable_chroot=YES" >> /etc/vsftpd.conf
echo "seccomp_sandbox=NO" >> /etc/vsftpd.conf
service vsftpd reload

now the FTP service will work calm in my server.

Howto: Installing internet Data card on Ubuntu server Minimal

Posted on Updated on

Ubuntu server comes with not GUI platform and if we go with minimal installation not sufficient packages available for addon’s, I tried to enable internet from my datacard  I can’t use dedicated IP for this server because Google will block the IP since the server was is used for some crawling job.  I used wvdial as a auto dialer. I configured DDNS for the ServerName.

Usb storage is working well but serial communication is not, also getting error like /dev/ttyUSB0 not found , I found some necessary packages are missing. I followed the below steps and now everthing working fine.

Install Dependencies

root@IN186:~# apt-get install libwvstreams4.6-base libuniconf4.6 wvdial gnome-ppp usb-modeswitch usb-modeswitch-data libusb-dev

Enable  usb serial Kernel module

root@IN186:~# modprobe  usbserial

Now configure the Dialer,

root@IN186:~# gedit /etc/wvdial.conf
[Dialer netconnect]
New PPPD = yes
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = USB Modem
Baud = 460800
New PPPD = yes
Modem = /dev/ttyUSB0
ISDN = 0
Username = 93********
Password = 93*********
Phone = #777
Stupid Mode = 1
Auto DNS = 1
Check Def Route = 1

Change the username and password with your 10 digit MDN number given on the box of datacard. Save the file and reboot the computer. After reboot plugin your datacard and wait for 5 to 6 seconds. The connection might setup automatically. If not, run the following command

root@IN186:~# wvdial netconnect

If you face error log, saying CARRIER not found, change network settings (broadband 3.1x, high speed 1x, hybrid) as per you area availability using a Windows computer, and try again in Ubuntu. It will work !

Error: No space left on device: mod_rewrite: Parent could not create RewriteLock file

Posted on

 Apache  service on a Server stops while restart it shows following messages in error_logs
[Thu Jun 20 20:04:20 2013] [crit] (28)No space left on device: mod_rewrite: Parent could not create RewriteLock file /usr/local/apache/logs/rewrite_lock
Configuration Failed

Such errors appears when you are running out of Disk Space or Quota which is assigned (which can be increased to fix the issue) OR when semaphores of the server gets full. Semaphores are often used to restrict the number of threads than can access some (physical or logical) resource.

Using the below command you can semaphores list.

root@server04 [~]# ipcs -s | grep nobody

So, In-order to clear the semaphores list. We have execute the following command.

root@server04 [~]# ipcs -s | grep nobody | awk '{print $2}' | xargs -n 1 ipcrm sem

After clearing the semaphores list, restart the apache server. Now, it will starts without any issues.But, it is an temporary solution it will re-occur when Semaphores get full.

Add following lines in “/etc/sysctl.conf” to get this issue fixed permanently. These values will increase the limits of Semaphores on the Server.

# Increases the semaphore limits & extend Apache’s uptime.

kernel.msgmni = 512
kernel.sem = 250 128000 32 512

Then load the new settings into the kernel using the command.

root@server04 [~]# sysctl -p
Now you are in safe zone.

info: How to install java on Ubuntu.

Posted on Updated on

JAVAJava is a object-oriented computer programming language developed by James Gosling  at Sun Microsystems and released in 1995 lated it has been migrated to

Oracle systems. The code that can runs on one platform does not need to be recompiled.


Install oracle java 7 in ubuntu 12.04
Here I have described about one of the easiest installation method of Oracle-JAVA on Ubuntu using JAVA repository. for more information : http://en.wikipedia.org/wiki/Java_(programming_language)

Open the terminal and run the following commands

# java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.5) (6b24-1.11.5-0ubuntu1~12.04.1)
OpenJDK Server VM (build 20.0-b12, mixed mode)

# sudo add-apt-repository ppa:webupd8team/java
# sudo apt-get update
# sudo apt-get install oracle-java7-installer

Now check the new updated verison

# java -version
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) Server VM (build 23.21-b01, mixed mode)



Check the installation directory:

anand@desktop:~$ ll /usr/lib/jvm/java-7-oracle/
total 19720
drwxr-xr-x 8 root root 4096 May 3 09:32 .
drwxr-xr-x 6 root root 4096 May 3 09:32 ..
drwxr-xr-x 2 root root 4096 May 3 09:32 bin
-r--r--r-- 1 root root 3339 May 3 09:32 COPYRIGHT
drwxr-xr-x 4 root root 4096 May 3 09:32 db
drwxr-xr-x 3 root root 4096 May 3 09:32 include
drwxr-xr-x 5 root root 4096 May 3 09:32 jre
drwxr-xr-x 3 root root 4096 May 3 09:32 lib
-r--r--r-- 1 root root 40 May 3 09:32 LICENSE
drwxr-xr-x 4 root root 4096 May 3 09:32 man
-r--r--r-- 1 root root 114 May 3 09:32 README.html
-rw-r--r-- 1 root root 443 May 3 09:32 release
-rw-r--r-- 1 root root 19838528 May 3 09:32 src.zip
-rw-r--r-- 1 root root 123324 May 3 09:32 THIRDPARTYLICENSEREADME-JAVAFX.txt
-r--r--r-- 1 root root 172252 May 3 09:32 THIRDPARTYLICENSEREADME.txt


That’s all 🙂