Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Saturday, January 14, 2012

run-init: /sbin/init" I/O error "kernel panic not syncing: Attempted to kill init!

My Ubuntu 10.04 LTS / 64 bit failed to start with the error message, "run-init: /sbin/init" I/O error "kernel panic not syncing: Attempted to kill init!", with the CAPSLOCK constantly blinking, all of a sudden. It was working very fine, till the day before, and all of a sudden this failure happened without any apparent reason. The recovery mode and the attempts to log in through the previous versions of the kernel were not successful either. When logging in through a Live CD, it suggested no error on disk and it had been mounted properly too.

So I tried to use "mkinitramfs" from /boot to build mkinitrd and rebooted. "update-mkinitramfs" (sudo, of course!) from the live CD didn't work either, as the drive was found to be read-only media just for that command! Similarly also tried to get initramdr from the LiveCD using the same command, and also downloaded from the relevant site, and restarted after adding the relevant menu entry to /boot/grub/grub.cfg and rebooted. Still no luck.

menuentry 'Ubuntu, with Linux 3.0.0-14-generic' --class ubuntu --class gnu-linux 
--class gnu --class os {
    recordfail
    set gfxpayload=$linux_gfx_mode
    insmod gzio
    insmod part_msdos
    insmod ext2
    set root='(hd0,msdos5)'
    search --no-floppy --fs-uuid --set=root 890aebc7-6238-4ce9-99d1-356b3f0163a4
    linux    /boot/vmlinuz-3.0.0-14-generic root=UUID=890aebc7-6238-4ce9-99d1-356b3f0163a4 ro   quiet splash vt.handoff=7
    initrd    /boot/initrd.img-3.0.0-14-generic
}
menuentry 'Ubuntu, with Linux 3.0.0-14-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
    recordfail
    insmod gzio
    insmod part_msdos
    insmod ext2
    set root='(hd0,msdos5)'
    search --no-floppy --fs-uuid --set=root 890aebc7-6238-4ce9-99d1-356b3f0163a4
    echo    'Loading Linux 3.0.0-14-generic ...'
    linux    /boot/vmlinuz-3.0.0-14-generic root=UUID=890aebc7-6238-4ce9-99d1-356b3f0163a4 ro recovery nomodeset
    echo    'Loading initial ramdisk ...'
    initrd    /boot/initrd.img-3.0.0-14-generic
}


There are many threads on "Kernel Panic". But only a very few comes to the point, and only a tiny bit of those sites actually suggests some fix to try, where many of those threads are still unanswered questions for years. From what I learned, this "Kernel Panic" seems to be one deadly issue that can happen for multiple reasons - and is not an easy fix - except by the means of compiling the kernel or simply reinstalling the operating system. After trying all possible attempts to fix this, and also after trying to compile kernel, I decided the time invested on this is a bit waste. Hence I backed up everything on my Ubuntu to my windows partition through the Live CD and re-installed Ubuntu.

I have installed Ubuntu 11.10 (Oneiric Ocelot), where I had 10.04 before. The first impressions were not so nice, thanks to the new Unity interface. However, "sudo apt-get install gnome-shell" followed by "sudo apt-get remove unity" resolved the issue, letting me switch to gnome3 interface. :) Now I am awaiting the release of Ubuntu 12.04 LTS to upgrade in a few months.

Apart from this Kernel Panic, there were a few other remarkable events too. One was the GSoC awareness session at the University of Jaffna (Presentation Slides). The WSO2 offsite at Avani Hotel, Bentota was remarkable as well. These were the remarkable events of the first fortnight of the year 2012. This year seems to be so eventful!

Wednesday, June 8, 2011

How to close an open port in unix/linux environments

In many cases it is not uncommon to see exception like "java.net.BindException: Address already in use" when running programs. Sometimes this exception occurs even after the program that was using the particular address/port has been terminated. That is mostly due to improperly terminated application. Here the port is still assigned to the process of the particular program. How can we release the port and let the new program use that specific port, without throwing address already in use exceptions.

First let's find the process attached to the program running on the particular port.
pradeeban@pradeeban:~/LB/wso2lb-1.0.0/bin$ lsof | grep 8243
notificat  1802  pradeeban  txt       REG                8,4     53296   13638243 /usr/lib/gnome-panel/notification-area-applet
firefox-b  1821  pradeeban   52u     IPv4             896036       0t0        TCP pradeeban.local:43306->pradeeban.local:8243 (ESTABLISHED)
java      10500  pradeeban  113u     IPv6             867578       0t0        TCP pradeeban.local:8243->pradeeban.local:45898 (CLOSE_WAIT)
java      10500  pradeeban  300u     IPv6             867966       0t0        TCP pradeeban.local:8243->pradeeban.local:46006 (CLOSE_WAIT)
java      10500  pradeeban  471u     IPv6             858667       0t0        TCP *:8243 (LISTEN)
Here, lsof lists open files. From the above command, we notice that a process having the pid of 10500 is listening on the port 8243.

If you know the name of the running application process or part of it, you can use
ps -xa | grep
instead, to get the pid.

Now we can easily release the port 8243 by killing the relevant process (process of pid 10500).
pradeeban@pradeeban:~/LB/wso2lb-1.0.0/bin$ kill 10500

Wednesday, March 9, 2011

Building AbiWord 2.9.0 on Ubuntu 10.04 / 64 bit from Source

Short and sweet information on this can be found from AbiWord wiki. This post just deals with a few commonest errors found in building AbiWord, when it goes wrong.

As we are happily moving towards the release of AbiWord-3.0.0, many developers are joining the effort. With the announcement of Google Summer of Code-2011, many students too are interested in joining the project. This guide targets to help anyone to build AbiWord on Ubuntu 10.04/64 bit. This is still applicable to many other linux distributions too, though it is tested on Ubuntu. Unlike the usual building guides, this one is going to follow the worst-path -- assuming every failed cases, for a complete novice.. :)
So, as mentioned in the AbiWord's wiki page, let's start with installing autoconf.
sudo apt-get install autoconf

pradeeban@pradeeban:~/programs/abiword$ sh autogen.sh
Can't exec "libtoolize": No such file or directory at /usr/bin/autoreconf line 189.
Use of uninitialized value in pattern match (m//) at /usr/bin/autoreconf line 189.

configure.in:130: error: possibly undefined macro: AC_LIBTOOL_WIN32_DLL
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.in:131: error: possibly undefined macro: AC_PROG_LIBTOOL
autoreconf: /usr/bin/autoconf failed with exit status: 1
Running ./configure --enable-maintainer-mode ...
configure: error: cannot find install-sh, install.sh, or shtool in "." "./.." "./../.."
==========================================================================================
OK. We need libtool installed!

sudo apt-get install libtool

==========================================================================================

NOW!
pradeeban@pradeeban:~/programs/abiword$ sh autogen.sh
.............................
checking pkg-config is at least version 0.9.0... yes
checking whether gcc understands -Wall... no
checking whether gcc understands -Wextra... no
checking whether gcc understands -Wsign-compare... no
checking whether gcc understands -Wpointer-arith... no
checking whether gcc understands -Wchar-subscripts... no
checking whether gcc understands -Wwrite-strings... no
checking whether gcc understands -Wmissing-noreturn... no
checking whether gcc understands -Wunused... no
checking whether gcc understands -Wpointer-arith... no
checking whether gcc understands -Wshadow... no
checking for libpng... no
checking for libpng14... no
checking for libpng12... no
checking png.h usability... no
checking png.h presence... no
checking for png.h... no
configure: error: `png.h' not found, install libpng or specify CPPFLAGS to include custom locations

As we can see, we will be installing each of the dependencies one by one, if we follow the same steps like this.
But we actually need not to!
pradeeban@pradeeban:~/programs/abiword$ sudo apt-get build-dep abiword
Reading package lists... Done
Building dependency tree      
Reading state information... Done
Note, selecting libwpd8-dev instead of libwpd-dev
Note, selecting libxslt1-dev instead of libxslt-dev
The following NEW packages will be installed:
  build-essential cdbs cvs debhelper diffstat dpkg-dev fakeroot fdupes g++ g++-4.4 gettext html2text intltool intltool-debian libaiksaurus-1.2-0c2a
  libaiksaurus-1.2-data libaiksaurus-1.2-dev libaiksaurusgtk-1.2-0c2a libaiksaurusgtk-1.2-dev libasio-dev libatk1.0-dev libboost-date-time-dev
  libboost-date-time1.40-dev libboost-date-time1.40.0 libboost-dev libboost-regex-dev libboost-regex1.40-dev libboost-regex1.40.0 libboost-serialization1.40-dev
  libboost-serialization1.40.0 libboost1.40-dev libbz2-dev libcairo2-dev libdbus-1-dev libdbus-glib-1-dev libdirectfb-dev libdirectfb-extra libenchant-dev
  libexpat1-dev libfontconfig1-dev libfreetype6-dev libfribidi-dev libgconf2-dev libgcrypt11-dev libgdome2-0 libgdome2-cpp-smart-dev libgdome2-cpp-smart0c2a
  libgdome2-dev libglade2-dev libglib2.0-dev libgnutls-dev libgoffice-0.8-8 libgoffice-0.8-8-common libgoffice-0.8-dev libgpg-error-dev libgsf-1-dev libgtk2.0-dev
  libgtkmathview-dev libgtkmathview0c2a libgucharmap2-dev libice-dev libicu-dev libidl-dev libidn11-dev libjpeg62-dev liblink-grammar4 liblink-grammar4-dev
  libloudmouth1-dev libmail-sendmail-perl libncurses5-dev liborbit2-dev libots-dev libots0 libpango1.0-dev libpixman-1-dev libpng12-dev libpopt-dev libpsiconv-dev
  libpsiconv6 libpthread-stubs0 libpthread-stubs0-dev libreadline-dev libreadline6-dev librsvg2-dev libsm-dev libsoup2.4-dev libssl-dev libstdc++6-4.4-dev
  libsys-hostname-long-perl libsysfs-dev libt1-dev libt1-doc libtasn1-3-dev libwmf-dev libwpd-stream8c2a libwpd8-dev libwpg-dev libwps-dev libwv-1.2-3 libwv-dev
  libx11-dev libxau-dev libxaw7-dev libxcb-render-util0-dev libxcb-render0-dev libxcb1-dev libxcomposite-dev libxcursor-dev libxdamage-dev libxdmcp-dev libxext-dev
  libxfixes-dev libxft-dev libxi-dev libxinerama-dev libxml2-dev libxmu-dev libxmu-headers libxpm-dev libxrandr-dev libxrender-dev libxslt1-dev libxt-dev
  link-grammar-dictionaries-en orbit2 po-debconf quilt x11proto-composite-dev x11proto-core-dev x11proto-damage-dev x11proto-fixes-dev x11proto-input-dev
  x11proto-kb-dev x11proto-randr-dev x11proto-render-dev x11proto-xext-dev x11proto-xinerama-dev xtrans-dev xz-utils zlib1g-dev
0 upgraded, 140 newly installed, 0 to remove and 3 not upgraded.
Need to get 60.4MB of archives.
After this operation, 269MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
 
Now again,
pradeeban@pradeeban:~/programs/abiword$ sh autogen.sh
.......................................
checking for libpng... yes
checking for PNG... yes
checking jpeglib.h usability... yes
checking jpeglib.h presence... yes
checking for jpeglib.h... yes
checking for jpeg_read_header in -ljpeg... yes
checking zlib.h usability... yes
checking zlib.h presence... yes
checking for zlib.h... yes
checking for DEPS... yes
checking for GTK214... yes
checking for GSFGI... yes
checking for PLUGIN... yes
checking for OPENDOCUMENT... configure: error: Package requirements ( libgsf-1 >= 1.12 redland >= 1.0.10 rasqal >= 0.9.17 ) were not met:

No package 'redland' found
No package 'rasqal' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables OPENDOCUMENT_CFLAGS
and OPENDOCUMENT_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

Let's fix the redland RDF dependency issue by installing it.
pradeeban@pradeeban:~$ sudo apt-get install librdf0-dev

again, pradeeban@pradeeban:~/programs/abiword$ sh autogen.sh Now it builds fine!
......................
config.status: creating plugins/ots/xp/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands

Configuration:
  host                  x86_64-unknown-linux-gnu
  dynamic binary        yes
  static binary         no
  platform              unix (embedded: no)
  toolkit               gtk
  debug                 no

Optional features:
  menubutton            no
  printing              yes
  spell checking        yes
  status bar            yes
  emacs keybinding      yes
  vi keybinding         yes
  clipart               no
  templates             no

Optional dependencies:
  gtk2 > 2.14           yes
  gnome-vfs             no
  gio            yes
  gsf-gio               yes
  goffice               yes

Builtin plugins        
Plugins                 opendocument

Now type `make' to compile.

pradeeban@pradeeban:~/programs/abiword$ make
"make" goes fine too.
Let's "make install" now!
pradeeban@pradeeban:~/programs/abiword$ make install
...................
test -z "/usr/local/share/abiword-2.9/ui" || /bin/mkdir -p "/usr/local/share/abiword-2.9/ui"
/bin/mkdir: cannot create directory `/usr/local/share/abiword-2.9': Permission denied
make[6]: *** [install-uiDATA] Error 1
make[6]: Leaving directory `/home/pradeeban/programs/abiword/src/af/xap/gtk'
make[5]: *** [install-am] Error 2
make[5]: Leaving directory `/home/pradeeban/programs/abiword/src/af/xap/gtk'
make[4]: *** [install-recursive] Error 1
make[4]: Leaving directory `/home/pradeeban/programs/abiword/src/af/xap/gtk'
make[3]: *** [install-recursive] Error 1
make[3]: Leaving directory `/home/pradeeban/programs/abiword/src/af/xap'
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory `/home/pradeeban/programs/abiword/src/af'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/home/pradeeban/programs/abiword/src'
make: *** [install-recursive] Error 1


If this permission issue arises, pls change the write permission of usr/local/share, usr/local/bin, usr/local/include, and usr/include/lib. That will make abiword-2.9 ending up in the above directories respectively.
Again,
pradeeban@pradeeban:~/programs/abiword$ make install
Now it goes fine indeed!

Now let's just run AbiWord from terminal and see whether it runs!
pradeeban@pradeeban:~$ abiword 
abiword: error while loading shared libraries: libabiword-2.9.so: cannot open shared object file: No such file or directory

Typical linking issue.
pradeeban@pradeeban:~$cd /lib
pradeeban@pradeeban:/lib$sudo ln -s /usr/local/lib/libabiword-2.9.so

Now again,
pradeeban@pradeeban:~$ abiword

YAYYY! AbiWord-2.9.0 is running!!!

you also can debug AbiWord using gdb.
pradeeban@pradeeban:~$ gdb abiword

However, my apologies for posting this lengthy post for a simple task. Just followed the worst case to cover all the student queries regarding building AbiWord-2.9.0 from trunk using Linux on terminal.

Thursday, May 20, 2010

Link them not~!

I was on the Scientific Linux FAQ, where a strange Q/A hit my eyes.

Q. Why won't you say the name of the commercial enterprise distribution S.L. is built from?

A. That name is trademarked. The easiest way to keep away from all trademark problems, is to completely avoid the name. We believe that most readers are able to figure out which commercial enterprise linux distribution we are talking about.
I found that Scientific Linux was derived from Red Hat Enterprise Linux. I also found the reason for hiding the fact is, to avoid the copyrights issues by violating the Red Hat license, from wikipedia. I later found that once CentOS, another Red Hat derivative had to face some license issues as they have used Red Hat logos in their site. Red Hat had warned CentOS for 'misleading' the users by providing links to Red Hat site in the home page of CentOS. The letter from Red Hat's outside counsel to CentOS can be found here. So think twice before linking some one.