Posts Tagged ‘Ubuntu’

deb Linux: How to add support for Bulgarian, Russian, Belarusian, Ukrainian, Serbian, Macedonian, Bosnian language cyrillic localization to Xfce, GNOME, KDE Desktop

Monday, March 18th, 2013

If just installed Ubuntu or Xubuntu and choose as a default language English by mistake and you happen to live in Bulgaria, Russia, Ukraine, Belarus or any other cyrillic speaking / writting country and you want to make the desktop graphical environment to display menus in mother language Cyrillic. Here is how;

To add cyrillic localization, native support in GUI environment for major Dsektop Graphic Environments (XFCE, GNOME, KDE …) run in terminal:

For Bulgarian Cyrillic language Desktop support:

linux:~# apt-get install language-pack-bg

Четене на списъците с пакети… Готово
Изграждане на дървото със зависимости      
Четене на информацията за състоянието… Готово
Следните допълнителни пакети ще бъдат инсталирани:
  firefox-locale-bg language-pack-bg-base
Следните НОВИ пакети ще бъдат инсталирани:
  firefox-locale-bg language-pack-bg language-pack-bg-base
0 актуализирани, 3 нови инсталирани, 0 за премахване и 2 без промяна.
Необходимо е да се изтеглят 0 B/1048 kB архиви.
След тази операция ще бъде използвано 3533 kB допълнително дисково пространство.
Искате ли да продължите [Y/n]? Y
Selecting previously unselected package language-pack-bg-base.
(Reading database … 287291 files and directories currently installed.)
Unpacking language-pack-bg-base (from …/language-pack-bg-base_1%3a12.04+20130128_all.deb) …
Selecting previously unselected package language-pack-bg.
Unpacking language-pack-bg (from …/language-pack-bg_1%3a12.04+20130128_all.deb) …
Selecting previously unselected package firefox-locale-bg.
Unpacking firefox-locale-bg (from …/firefox-locale-bg_19.0.2+build1-0ubuntu0.12.04.1_i386.deb) …
Processing triggers for software-center …
Updating software catalog…this may take a moment.
INFO:softwarecenter.db.pkginfo_impl.aptcache:aptcache.open()
Software catalog update was successful.
Инсталиране на firefox-locale-bg (19.0.2+build1-0ubuntu0.12.04.1) …
Инсталиране на language-pack-bg (1:12.04+20130128) …
Инсталиране на language-pack-bg-base (1:12.04+20130128) …
Generating locales…
  bg_BG.UTF-8… up-to-date
Generation complete.
 

Two packages language-pack-bg and language-pack-bg-base packages add to system localization files which in Linux are in the format of .mo files. Here is list of 2 packs file content:

 

linux:~# dpkg -L language-pack-bg

/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/language-pack-bg
/usr/share/doc/language-pack-bg/copyright
/usr/share/doc/language-pack-bg/changelog.gz
/usr/share/locale-langpack
 

 

linux:~# dpkg -L language-pack-bg-base

/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/language-pack-bg-base
/usr/share/doc/language-pack-bg-base/copyright
/usr/share/doc/language-pack-bg-base/changelog.gz
/usr/share/locale-langpack
/usr/share/locale-langpack/bg
/usr/share/locale-langpack/bg/LC_MESSAGES
/usr/share/locale-langpack/bg/LC_MESSAGES/Linux-PAM.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/pidgin.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/findutils.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/mutt.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/help2man.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/pppconfig.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/jade.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/recode.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/wdiff-gnulib.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/software-properties.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/grub.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/cracklib.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/ggzcore.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/libapt-inst1.4.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/system-service.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/gwibber-service-sohu.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/mlocate.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/lynx.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/dnsmasq.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/apparmorapplet.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/gettext-tools.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/binutils.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/hello.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/quota.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/ld.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/libvisual-0.4.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/friendly-recovery.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/gnupg2.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/git-gui.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/bash.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/apturl.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/sharutils.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/ubuntuone-control-panel.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/pulseaudio.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/hello-debhelper.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/hunspell.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/dctrl-tools.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/gwibber-service-sina.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/popt.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/powertop.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/xdiagnose.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/ubuntuone-client.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/gettext-runtime.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/debian-tasks.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/nano.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/lvm2.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/ecryptfs-utils.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/duplicity.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/ubuntu-wallpapers.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/dselect.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/debconf.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/mountall.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/JabberBot.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/net-tools.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/apport.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/libidn.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/newt.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/tar.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/gnupg.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/coreutils.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/make.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/libapt-pkg4.12.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/kerneloops.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/ldm.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/ufw.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/pidgin-libnotify.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/pppoeconf.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/acl.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/python-apt.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/gutenprint.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/MoinMoin.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/usbcreator.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/launchpad-integration.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/example-content.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/avahi.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/transmission-gtk.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/xkeyboard-config.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/dpkg-dev.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/libgpg-error.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/human-theme.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/grep.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/sane-backends.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/NetworkManager.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/libvirt.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/ubuntu-sso-client.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/app-install-data.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/dpkg.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/whois.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/system-config-kickstart.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/gprof.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/zeitgeist.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/shared-mime-info.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/virt-manager.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/bison-runtime.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/wget.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/quilt.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/command-not-found.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/jockey.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/attr.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/ltsp-login.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/kcm_gtk.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/alsa-utils.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/aspell.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/fetchmail.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/man-db-gnulib.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/devscripts.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/xscreensaver.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/unity-2d.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/compiz.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/apt.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/gODBCConfig.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/libc.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/plasma_applet_menubarapplet.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/update-manager.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/psmisc.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/screen-resolution-extra.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/unattended-upgrades.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/adduser.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/sysstat.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/checkbox.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/apt-listchanges.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/ubuntuone-installer.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/upstart.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/upower.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/tasksel.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/byobu.mo
/usr/share/locale-langpack/bg/LC_MESSAGES/language-selector.mo
/var
/var/lib
/var/lib/locales
/var/lib/locales/supported.d
/var/lib/locales/supported.d/bg
 

 

Above .mo files are  binary files, generated from plain text .po / .pod files. In free software OS .po files are the most common language translation files, where for each different language a set of .po files exist. Translators usually translate from English to respective language using a GUI text editor called poedit. Once translation is made from those .po files .mo binaries are generated and shipped as localizations for program or group of programs. Below is edit of one of Polish translation of lang file belonging to CUPS Printing service.

poedit gnu linux xubuntu screenshot editing cups .po language plain text file

Once .po files are created, generation of .mo files can be done in various way, however usually Linux system uses msgfmt – (compile message catalog to binary format). In order to generate .mo file out of lets say cups_pl.po;

hipo@linux:~$ msgfmt cups_pl.so
hipo@linux:~$ ls -al *.mo
-rw-rw-r-- 1 hipo hipo 31988 Mar 18 12:38 messages.mo

Anyways, here is how to add Cyrillic support for rest of Major cyrillic speaking countries, issue;

For Russian Cyrillic language Linux Desktop env support;

linux:~# apt-get install --yes language-pack-ru
...

For Belarusian Cyrillic Linux Desktop;

linux:~# apt-get install --yes language-pack-be

For Linux Desktop in Ukrainian;

linux:~# apt-get install --yes language-pack-uk

For Linux Desktop in Serbian language;

linux:~# apt-get install --yes language-pack-sr
...

For Graphic Environment in Macedonian;

linux:~# apt-get install --yes llanguage-pack-mk
...

For Linux GUI in Bosnian;

linux:~# apt-get install --yes language-pack-bs
...

For Kyrgyz language Linux localization;

linux:~# apt-get install --yes language-pack-ky

Whether, you are using Linux Desktop internationalization on some other Cyrillic related language, which I'm missing here please feel free to drop me a comment how you install it? I

 

How to check what process is listening on network port with: lsof & fuser commands in Linux / BSD

Saturday, March 16th, 2013

It is a common thing for me as a Linux and FreeBSD sysadmin to know what process assignes to which port number? I'm sure many novice system administrators will end up sooner or later with same question. Knowing what kind of processes has listening to TCP and UDP protocol / ports is a must to have a proper configured Linux / BSD system. In Linux there are two commands ( lsof and fuser) with which you can get various extra PID information on running processes (i.e. get information which cannot otherwise be obtained via the usual ps and netstat  To use them on most Linux distributions, you will have to have them installed.

1. Install fuser / lsof on Linux / BSD

a) On RPM based Linux distros – Fedora, CentOS, RHEL, SuSE /sbin/fuser is usually part of base install psmisc rpm package, however /usr/sbin/lsof is not among standard installed rpms, so you have to manually install via yum:

[root@centos ~]# yum install -y lsof
….

b) On Deb based Linuxes (Debian, Ubuntu, Mint, ArchLinux etc.). both lsof and fuser has to be installed via a separate packages non-part of Debian base install packs.

server:~# apt-get --yes install lsof fuser
....

On Debian full path location of both is in /bin/fuser and /usr/bin/lsof.

Two tools are precious swiss army knife outfit to use, whether you doubt someone cracked into a server or in doubt you might have "hidden" cracker processes on server.

c) Install fuser on Free/Net/Open/ BSD

bsd# cd /usr/ports/sysutils/fuser
bsd# make install clean
....
bsd# cd /usr/ports/sysutils/lsof
bsd# make install clean
....

2. Using fuser and lsof to look up process PIDs assigned to port numbers

lsof name is derived from List Open Files, as we know in UNIX, GNU / Linux,  *BSD everything on the system is a file, thus to get all kind of information concerning all active files (i.e. ports, PIDs, procotols and process names;

server:~# lsof +M -i4 | less

COMMAND     PID     USER   FD   TYPE   DEVICE SIZE/OFF NODE NAME
portmap    1317   daemon    4u  IPv4     3930      0t0  UDP *:sunrpc[portmapper]
portmap    1317   daemon    5u  IPv4     3939      0t0  TCP *:sunrpc[portmapper] (LISTEN)
rpc.statd  1329    statd    4u  IPv4     3974      0t0  UDP *:657
rpc.statd  1329    statd    6u  IPv4     3983      0t0  UDP *:28530[status]
rpc.statd  1329    statd    7u  IPv4     3986      0t0  TCP *:58515[status] (LISTEN)
apache2    1625 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2    1625 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
sshd       1918     root    3u  IPv4     4945      0t0  TCP *:ssh (LISTEN)
miniserv.  2155     root    5u  IPv4     5299      0t0  TCP *:20000 (LISTEN)
miniserv.  2155     root    6u  IPv4     5300      0t0  UDP *:20000
miniserv.  2161     root    6u  IPv4     5367      0t0  TCP *:webmin (LISTEN)
miniserv.  2161     root    7u  IPv4     5368      0t0  UDP *:10000
ntpd       2172      ntp   16u  IPv4     5395      0t0  UDP *:ntp
ntpd       2172      ntp   18u  IPv4     5402      0t0  UDP localhost:ntp
ntpd       2172      ntp   19u  IPv4     5403      0t0  UDP iqtest.soccerfame.com:ntp
ntpd       2172      ntp   20u  IPv4    16028      0t0  UDP secure.broomlake.com:ntp
apache2    4505 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2    4505 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2    4539 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2    4539 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2    4780 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2    4780 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2    4900 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2    4900 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2    4907 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2    4907 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2    4915 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2    4915 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2    5067 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2    5067 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2    5133 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2    5133 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2    5134 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2    5134 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2    5148 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2    5148 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2    5152 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2    5152 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2    5259 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2    5259 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2    5265 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2    5265 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2    5266 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2    5266 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2    5346 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2    5346 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2    5356 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2    5356 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2    5467 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2    5467 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2    5523 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2    5523 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2    5568 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2    5568 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2    5715 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2    5715 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2    5716 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2    5716 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2    5758 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2    5758 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2    5789 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2    5789 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2    6106 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2    6106 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   16608 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   16608 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   16904 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   16904 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   17124 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   17124 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   17280 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   17280 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   20855 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   20855 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   20920 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   20920 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   21023 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   21023 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   22182 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   22182 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   23307 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   23307 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   23366 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   23366 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   23408 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   23408 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   23419 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   23419 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   23428 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   23428 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   23452 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   23452 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   23561 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   23561 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   23579 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   23579 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   23851 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   23851 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   24103 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   24103 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   24659 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   24659 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
sshd      25073     root    3u  IPv4 29855891      0t0  TCP iqtest.soccerfame.com:ssh->www.pc-freak.net:50176 (ESTABLISHED)
sshd      25084     hipo    3u  IPv4 29855891      0t0  TCP iqtest.soccerfame.com:ssh->www.pc-freak.net:50176 (ESTABLISHED)
apache2   25089 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   25089 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   26737 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   26737 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   27243 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   27243 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   27282 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   27282 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   27633 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   27633 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   28205 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   28205 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   29244 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   29244 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   29372 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   29372 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   29411 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   29411 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   29462 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   29462 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   29548 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   29548 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   30161 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   30161 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   31876 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   31876 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   31958 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   31958 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   32052 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   32052 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   32061 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   32061 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   32143 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   32143 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   32149 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   32149 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   32440 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   32440 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   32635 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   32635 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   32790 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   32790 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   40211 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   40211 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   40309 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   40309 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   40432 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   40432 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   40476 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   40476 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   46319     root    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   46319     root    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   46438 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   46438 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   46439 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   46439 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   46440 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   46440 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   46441 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   46441 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   46442 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   46442 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   46443 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   46443 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   46509     root    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   46509     root    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   46510     root    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   46510     root    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   46515     root    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   46515     root    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   51287 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   51287 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   51485 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   51485 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   51804 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   51804 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
named     54418     bind   20u  IPv4 31298857      0t0  TCP localhost:domain (LISTEN)
named     54418     bind   21u  IPv4 31298859      0t0  TCP iqtest.soccerfame.com:domain (LISTEN)
named     54418     bind   22u  IPv4 31298861      0t0  TCP secure.broomlake.com:domain (LISTEN)
named     54418     bind   23u  IPv4 31298865      0t0  TCP localhost:953 (LISTEN)
named     54418     bind  512u  IPv4 31298856      0t0  UDP localhost:domain
named     54418     bind  513u  IPv4 31298858      0t0  UDP iqtest.soccerfame.com:domain
named     54418     bind  514u  IPv4 31298860      0t0  UDP secure.broomlake.com:domain
named     54418     bind  515u  IPv4 31298864      0t0  UDP *:domain
proftpd   62010  proftpd    1u  IPv4 31306260      0t0  TCP *:ftp (LISTEN)
mysqld    62420    mysql   11u  IPv4 31306903      0t0  TCP *:mysql (LISTEN)
apache2   62582 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   62582 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   62845 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   62845 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)
apache2   64748 www-data    3u  IPv4     5456      0t0  TCP *:www (LISTEN)
apache2   64748 www-data    4u  IPv4     5458      0t0  TCP *:https (LISTEN)

Above lsof command lists all active listening processes port number on UDP and TCP/IP 4 proto with the assigned process PID number (in second column). This is very useful if you find out to have listening service on port number and you cannot figure out what process name exactly is listening.

A classic example, where this is very helpful is if you have a listening process on SMTP port 25 and you cannot identify what kind of mail server is taking up the port? This has happened me many times on Debian Linux based hosts, which by default had priorly installed sendmail and I later removed sendmail to install Postfix or Exim SMTP.
To find out what is assigning port 25, you had to grep the protocol name from all binded host processes, like so:

 

server:~# lsof +M -i4 | grep -i smtp

exim4     17550     root    3u  IPv4 31577966      0t0  TCP localhost:smtp (LISTEN)

Whether you want to get information on Process ID, binding other random port lets say port 10000, following same logic you can grep it:

server:~# lsof +M -i4 |grep -i 10000
miniserv.  2161     root    7u  IPv4     5368      0t0  UDP *:10000

To get rid of a process for which you're unsure what kind of (/etc/init.d/service-name) init script is starting it, you can then use kill cmd to stop it;

server:~# kill -9 2161

Second approach to find out what kind of process is listening on a random port or socket, lets say port num 58515 is by using fuser.

 

 

server:~# netstat -ltn4
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State     
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:10000           0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:58515           0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:21              0.0.0.0:*               LISTEN    
tcp        0      0 77.92.85.71:53          0.0.0.0:*               LISTEN    
tcp        0      0 109.123.106.44:53       0.0.0.0:*               LISTEN    
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN    
tcp        0      0 127.0.0.1:953           0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:20000           0.0.0.0:*               LISTEN    

Below netstat cmmand, lists all active listening processes on respective IP address and port for protocol TCPIP v.4.

Hence on to get more information on what process is listening on port 58515?

server:~#  fuser -v 58515/tcp

                     USER        PID ACCESS COMMAND
58515/tcp:           statd      1329 F…. rpc.statd

Once you know what is listening, whether you want to kill it this is also possible directly through fuser;

 

server:~# fuser -vk 58515/tcp

As a close-up, I will say fuser and lsof are two must have software tools on any productive server. It is among the critical applications admin has to install during initial server set-up. fuser and lsof helps me often in my sysadmin work, it was more than once I've used them to identify script-kiddies exploit scanners running as a standard process names, as well secretly listening on weird port number  cracker back-doors.

Hopefully this little article, helps someone learn something new. Plenty is written and will be written and if one takes the time to research he can learn much, much more. I'm sure my tiny article is nothing new under the sun for old-school admins, I still hope it will be of use to novice. I'm looking forward to hear if I'm missing some neat use or some interesting case, when lsof or fuser "saved your ass" 🙂
 

Get more peaceful night sleep on Ubuntu, Mint and Xubuntu Linux using gtk-redshift

Monday, March 11th, 2013

gtk redshift Xubuntu Linux screenshot sleep peacefully when using computer at late

If you want to have more peaceful night sleep when working on Ubuntu or other Debian based Linux distro, be sure to have gtk-redshift installed.
It is a little program that simply changes the color gamma of screen and makes your screen look more reddish at night. According to many scientific research done on how we humans react, whether using computer late at night. It is concluded that less bright colors and especially reddish color gamma relaxes our eye strain and thus makes it easier for us to get a sleep quickly once in bed. gtk-redshift is available in latest Ubuntu 12.04 as well as on other Ubuntu derivatives (Xubuntu, Mint Linux) etc.

Easiest way to install it is via respective GUI Package Manager or via good old Synaptic (GUI aptitude frontend).
I personally prefer to always install Synaptic on new Desktop Linux PCs, use it as package GUI frontend, for the simple reason it offers one very similar "unified" package Installer outlook across different Linux distros.

The quickest way to use GUI version of Redshift is to install with apt:

root@xubuntu:~# apt-get install --yes gtk-redshift
....

To further use it it needs one time to be run with color gamma paraments, launch it first time via terminal with:
user@xubuntu:~$ gtk-redshift  -l 52.5:13.4

It is a good idea to make a tiny shell script wrapper with good settings for gtk-redshift and later use this shell wrapper as launcher :

root@xubuntu:~# echo '#!/bin/sh' >> /usr/local/bin/gtk-redshift
root@xubuntu:~# echo 'gtk-redshift' >> /usr/local/bin/gtk-redshift
root@xubuntu:~# chmod +x /usr/local/bin/gtk-redshift

From then on, to launch it you can directly open it via terminal

user@xubuntu:~$ /usr/local/bin/gtk-redshift

To make the program permanently work, make it run via respective GUI environment startup . In GNOME add it start-up from:

user@xubuntu:~$ gnome-session-manager

Important note to make about gtk-redshift is that on some older monitor screens, very early in morning the screen becomes too red, making screen look like displaying on very old long time used CRT monitors. For people working in fields like; Web Design, Architecture, or any drawing twisted colors effect will be annoying and will probably interfere with your perception of colors. However for programmers, system administrators and people who use computer mainly for typing and reading gtk-redshift is huge blessing.

Enjoy ! 🙂
 

Preventing packages on Debian and Ubuntu Linux to not update on system updates

Wednesday, March 6th, 2013

On Debian based GNU / Linux distros, there are some critical packages which need to be disabled to update during the common routine apt-get update && apt-get upgrade which is a almost daily part of Debian sysadmin living. Example for packages which are good to mark not to upgrade are for example; linux kernel, java virtual machine, adobe flash plugin,  etc.

Setting a package to omit upgrade on system package update for adobe flash plugin for example is with:

# echo adobe-flashplugin hold | dpkg –set-selections
debian:~# echo adobe-flash-properties-gtk hold | dpkg --set-selections
debian:~# echo flashplugin-nonfree-extrasound hold | dpkg --set-selections

To do deb package update on hold for kernel;

 

debian:~# echo linux-image-generic hold | dpkg --set-selections
debian:~# echo linux-image-3.2.0-38-generic | dpkg --set-selections

Do the same for as many packages which seem to break up on updates and when, you explicitly want remove the hold/s run:

debian:~# echo adobe-flashplugin install | dpkg --set-selections
....
debian:~# echo linux-image-generic install | dpkg --set-selections

 

 

 

Secure delete files irreverseble on Debian and Fedora GNU / Linux

Thursday, February 21st, 2013

I just read an article in Linux-Magazine on Advanced File Management named – "Beyond the Basics". Most of what the article says is pretty trivial and known by any Linux enthusiast average user and administrator. There was one command mentioned shred which is probably not so well known among Free Software users shred allows the user to "secure delete files" / from the hard disk irreversible.

The tool is part of coreutils package and available across mostly all Linux distributions including Debian / Ubuntu debian derivatives and the RedHat based distros CentOS, Fedora, RHEL etc.

Just for info for those who don't know how to check, to which package a command belongs with rpm and dpkg, here is how;

[hipo@centos ~]$ rpm -qf /usr/bin/shred
coreutils-5.97-23.el5_4.2

hipo@debian:~$ dpkg -S /usr/bin/shred
coreutils: /usr/bin/shred

Here is how to delete a sample file ovewritting 3 times (-n2 – means 3 because in comuters we know we countr from 0 – 0 1 2 3), the z option fills up with zeros after overwritting the file ( just like seen on paste), -v option shows verbose what shred is doing and -u option truncates removes file after overwritting

noah:/var/tmp# shred -n2 -zvu crash20121113021508.txt
shred: crash20121113021508.txt: pass 1/3 (random)…
shred: crash20121113021508.txt: pass 2/3 (random)…
shred: crash20121113021508.txt: pass 3/3 (000000)…
shred: crash20121113021508.txt: removing
shred: crash20121113021508.txt: renamed to 00000000000000000000000
shred: 00000000000000000000000: renamed to 0000000000000000000000
shred: 0000000000000000000000: renamed to 000000000000000000000
shred: 000000000000000000000: renamed to 00000000000000000000
shred: 00000000000000000000: renamed to 0000000000000000000
shred: 0000000000000000000: renamed to 000000000000000000
shred: 000000000000000000: renamed to 00000000000000000
shred: 00000000000000000: renamed to 0000000000000000
shred: 0000000000000000: renamed to 000000000000000
shred: 000000000000000: renamed to 00000000000000
shred: 00000000000000: renamed to 0000000000000
shred: 0000000000000: renamed to 000000000000
shred: 000000000000: renamed to 00000000000
shred: 00000000000: renamed to 0000000000
shred: 0000000000: renamed to 000000000
shred: 000000000: renamed to 00000000
shred: 00000000: renamed to 0000000
shred: 0000000: renamed to 000000
shred: 000000: renamed to 00000
shred: 00000: renamed to 0000
shred: 0000: renamed to 000
shred: 000: renamed to 00
shred: 00: renamed to 0
shred: crash20121113021508.txt: removed
 

One common use of shred is by sysadmins who has to prepare old server containing lets say client data (SQL) – mail boxes or just file data and then sell it to third parties making sure data will be un-restorable for the new owner. Also shred is used a lot by crackers who set up "time bombs" activated on user activity or inactivity to destroy evidences in case of crackers PC is being captured by police. Though shred cannot guarantee 100% that deleted data can't be recoved within a special data recovery lab in most of cases it is enough to assure data with it will be almost impossible to recover.

Disabling sound kernel modules on Debian and Ubuntu GNU / Linux servers

Friday, October 19th, 2012

First step is to list modules related to sound (snd):


root@pcfreak:/var/www# lsmod|grep -i snd
snd_hda_codec_realtek 235234 1
snd_hda_intel 20035 0
snd_hda_codec 53940 2 snd_hda_codec_realtek,snd_hda_intel
snd_hwdep 5220 1 snd_hda_codec
snd_pcm_oss 32415 0
snd_mixer_oss 12478 1 snd_pcm_oss
snd_pcm 60151 3 snd_hda_intel,snd_hda_codec,snd_pcm_oss
snd_seq_midi 4256 0
snd_rawmidi 15323 1 snd_seq_midi
snd_seq_midi_event 4628 1 snd_seq_midi
snd_seq 41281 2 snd_seq_midi,snd_seq_midi_event
snd_timer 15502 2 snd_pcm,snd_seq
snd_seq_device 4493 3 snd_seq_midi,snd_rawmidi,snd_seq
snd 45998 11
snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_rawmidi,snd_seq,snd_timer,snd_seq_device
soundcore 4566 1 snd
snd_page_alloc 6217 2 snd_hda_intel,snd_pcm

Then snd modules could be removed from current live system, for my Intel RealTek SoundBlaster, I had to remove following modules in (remove) order as follows:


root@pcfreak:/var/www# rmmod soundcore
ERROR: Module soundcore is in use by snd
root@pcfreak:/var/www# rmmod snd_hda_codec_realtec
ERROR: Module snd_hda_codec_realtec does not exist in /proc/modules
root@pcfreak:/var/www# rmmod snd_hda_intel
root@pcfreak:/var/www# rmmod snd_hda_codec
ERROR: Module snd_hda_codec is in use by snd_hda_codec_realtek
root@pcfreak:/var/www# rmmod snd_hda_codec_realtek
root@pcfreak:/var/www# rmmod snd_hda_codec
root@pcfreak:/var/www# rmmod snd_pcm_oss
root@pcfreak:/var/www# rmmod snd_seq_midi
root@pcfreak:/var/www# rmmod snd_rawmidi
root@pcfreak:/var/www# rmmod snd_seq_midi_event
root@pcfreak:/var/www# rmmod snd_seq
root@pcfreak:/var/www# rmmod snd_timer
ERROR: Module snd_timer is in use by snd_pcm
root@pcfreak:/var/www# rmmod snd_seq_device
root@pcfreak:/var/www# rmmod snd_pcm
root@pcfreak:/var/www# rmmod snd_seq_device
ERROR: Module snd_seq_device does not exist in /proc/modules
root@pcfreak:/var/www# rmmod snd_hda_intel
ERROR: Module snd_hda_intel does not exist in /proc/modules
rmmod snd_hwdep
root@pcfreak:/var/www# rmmod snd_mixer_oss
root@pcfreak:/var/www# rmmod snd_timer
root@pcfreak:/var/www# rmmod snd
root@pcfreak:/var/www# rmmod soundcore
root@pcfreak:/var/www#

Next step is to permanently disable all (blacklist) on system boot time loaded kernel modules, to do so in file /etc/modprobe.d/snd-bkaclist.conf, put:


blacklist soundcore
blacklist snd
blacklist snd_pcm
blacklist snd_pcsp
blacklist pcspkr

You can do it from shell ‘echo’-ing into file, like so:

# touch /etc/modprobe.d/snd-blacklist.conf
# cd /etc/modprobe.d/
# echo ‘blacklist soundcore’ >> snd-blacklist.conf
# echo ‘blacklist snd’ >> snd-blacklist.conf
# echo ‘blacklist snd_pcm’ >> snd-blacklist.conf
# echo ‘blacklist snd_pcsp’ >> snd-blacklist.conf
# echo ‘blacklist pcspkr’ >> snd-blacklist.conf

Another way is to use a tiny shellscript containing all previously shown rmmod commands and set the script to be executed via /etc/rc.local by adding the rmmod modules script, before exit 0 rc.local line.

Shell script removing my Realtek ICH sound driversis here
If you like to use it download it in /usr/local/bin or somewhere and invoke it via rc.local.
Removing sound blaster kernel support does not impact the overall machine performance, but in terms of security. Having sound driver modules constantly loaded in memory is a point which a possible attacker can use to root the host, so in my view always sound driver support should be removed.
Well that’s it hope this post helps someone 🙂

How to Install and configure webcam trust WB 3320X Live on Ubuntu /Debian Linux

Wednesday, September 26th, 2012

Trust Hires Webcam Live WB 3320X on Ubuntu, Debian, Xubuntu Install how to

I had to install WebCAM TRUST WB 3320X on one Xubuntu Linux install. Unfortunately by default the camera did not get detected (the Webcam vendor did not provide driver or specifications for Linux either).
Thus I researched on the internet if and how this camera can be made work on Ubuntu Linux. I found some threads discussing the same issues as mine in Ubuntu Forums here . The threads even suggested a possible fix, which when followed literally did not work on this particular 32-bit Xubuntu 12.04.1 installation.

I did 20 minutes research more but couldn’t find much on how to make the Webcam working. I used Cheese and Skype to test if the webcamera can capture video, but in both of them all I see was just black screen.

he camera was detected in lsusb displayed info as:


# lsusb | grep -i webcam

Bus 002 Device 002: ID 093a:2621 Pixart Imaging, Inc. PAC731x Trust Webcam

After reading further a bit I found out some people online suggesting loading the gspca kernel module. I searched what kind of gspca*.kokernel modules are available using:


locate gspca |grep -i .ko

1. Load proper camera kernel modules

I found a dozen of modules and after some testing with few of the found ones I realized the Camera works, whether gspca_pac730.ko and gspca_pac7311 are loaded, to test the camera I loaded both with:


# /sbin/modprobe gspca_pac730
# /sbin/modprobe gspca_pac7311

Seeing while this two modules are loaded the camera is fine capturing video. I added the above two to auto load on each Ubuntu boot:


# echo "gspca_pac730" >> /etc/modules
# echo "gspca_pac7311" >> /etc/modules

Before really I can see the camera properly capturing video, though I had to adjust few settings in default GNOME settings for Video device in gstreamer-properties

2. Change settings for video camera in gstreamer-properties


$ gstreamer-properties

The settings in the Video tab should be as you see in screenshot:

3. Testing if video camera works with VLC

There are numerous ways to test if camera is properly capturing video, vlc, mplayer, cheese or even Skype can be used. First time I tested it I used VLC, like so:


vlc v4l2:///dev/video0

Above as VLC argument I use /dev/video0 as video capturing device cause video camera is found under /dev/video0. This might vary on other Linux distros; to check the exact assigned dev, ls it:


# ls -al /dev/vide*

crw-rw----+ 1 root video 81, 0 sep 25 20:53 /dev/video0

Testing the Trust WB 3320X Live on Linux can be done with Cheese or Skype too by running them vide a LD_PRELOAD predefined bash variable;


$ LD_PRELOAD=/usr/lib/i386-linux-gnu/libv4l/v4l1compat.so cheese

or for Skype


LD_PRELOAD=/usr/lib/i386-linux-gnu/libv4l/v4l1compat.so skype

Still using vlc to test webcam is preferrable, as there is no need to invoke it via a predefined LD_PRELOAD=/usr/lib/i386-linux-gnu/libv4l/v4l1compat.so bash var.

Anyways below is a screenshot of the WebCam capturing video in Skype (on the Screenshot Sali a very good person who help me a lot here in Netherlands).

Though the camera driver works, the quality is quite bad the capture image is distorted and whenever there is a movement in front of the camera the picture is really bad … Expect quality of the captured video to be maybe about 2 times? worser than those in Windows OS.

Lest the bad quality the picture is good enough to distinguish you and recognize you on the other side, so for people who are not image quality freaks quality will be okay.

4. Making the Trust WB 3320 work in skype

As prior said you need to each time invoke Skype binary with a LD_PRELOAD pre-defined variable:


$ LD_PRELOAD=/usr/lib/i386-linux-gnu/libv4l/v4l1compat.so skype

Same goes for Cheese too:


$ LD_PRELOAD=/usr/lib/i386-linux-gnu/libv4l/v4l1compat.so cheese

Typing all this long line and even remembering it is a taugh task, so I created two little wrappers scripts for both Cheese and Skype in /usr/local/bin/skype-camera-fix and /usr/local/bin/cheese-camera-fix.


$ su root
Password:
# echo '#!/bin/bash' >> /usr/local/bin/skype-camera-fix
# echo 'LD_PRELOAD=/usr/lib/i386-linux-gnu/libv4l/v4l1compat.so skype' >> /usr/local/bin/skype-camera-fix
# chmod +x /usr/local/bin/skype-camera-fix

and


# echo '#!/bin/bash' >> /usr/local/bin/cheese-camera-fix
# echo 'LD_PRELOAD=/usr/lib/i386-linux-gnu/libv4l/v4l1compat.so cheese' >> /usr/local/bin/cheese-camera-fix
# chmod +x /usr/local/bin/cheeese-camera-fix

Now as this two wrappers, are existing it is good idea to modify in GNOME menus Skype and Cheese to launch the modified bash wrapper scripts instead of the original binaries:

4. Changing default Skype and Cheese path in GNOME to skype-camera-fix and cheese-camera-fix wrapper scripts

Edit /usr/share/applications/skype.desktop and change inside, where the line says:


Exec=skype

to


Exec=/usr/local/bin/skype-camera-fix

After the change the content of skype.desktop should be as:


[Desktop Entry]
Name=Skype
Comment=Skype Internet Telephony
Exec=/usr/local/bin/skype-cam-fix
Icon=skype.png
Terminal=0
Type=Application
Encoding=UTF-8
Categories=Network;Application;

Then same goes for Cheese, change the Exec= line in file /usr/share/applications/cheese.desktop to equal to:


Exec=/usr/local/bin/cheese-camera-fix

Now after restarting the PC or logging off and then logging in again to GNOME both applications should be executing via the wrapper script.

5. Changing Brightness and tuning various other Webcam settings

As I red online, there are plenty of apps that can be used to tune up webcam color gamma, saturation, explosure etc.

I however tried only two ;

  • v4l2ucp
  • guvcview
  • I red online there is also another (camera settings feature rich) program – gtk-v4l, though never tried this one.

    From my little testing I concluded v4lucp seems to be more options rich, so I suggest using it as a primary tool for tuning webcam:

    Besides that v4l2ucp is present inside standard Ubuntu / Debian repositories, so there is no need to add any extra repositories to install it.
    Install v4l2ucp via:


    # apt-get install v4l2ucp
    # apt-get install v4l2loopback-dkms

    v4l2ucp has multiple of settings you can play with, so after installing it run it to see if you can make the camera video display a bit better. In my case it was beneficial to raise up a bit the camera brightness and correct the red as the captured video was reddish and darky


    $ v4l2ucp

    v4l2ucp change linux webcam video4linux settings

    Secondly I give a try gucview. Unfortunately it is not part of official Ubuntu repositories, so I had to add external repository:


    # add-apt-repository ppa:pj-assis/ppa
    # apt-get update
    # apt-get install guvcview

    GUVCView Chainging brightness / saturation on Trust 3220X webcam

    Well thats all though the picture is a bit distorted, Camera works. Distorted is better than none at all. Cheers 😉

How to Repair Ubuntu Linux which failed due to computer switch off during update :)

Tuesday, August 28th, 2012

My sister tried updating her Ubuntu to a newer version 12.04 (Precise Pangolin) but in the middle of the dist-update process had to go out and hence closed her notebook thinking the update would continue by itself. I’m not fully aware what happened next, maybe the battery charge went down, maybe the computer entered sleep mode in the middle of some important package update or whatever. The result however on next opening OF her Ubuntu powered Acer Aspire 5736Z was Ubuntu unable to boot properly.
The boot up failed in the middle of booting the BootSplash (from some of the /etc/init.d … init scripts)

. The BootSplash status was therefore failing and on the screen the GUI cursor appeared refreshing every few seconds, whether on every refresh the screen become blank, the hard drive was reading on and on, continuously as well. Since the screen was keeping mostly blank I had no way to see exactly why the hard drive was scraping on and on….

My first guess was to try to boot the Ubuntu in single user mode (without GUI environment) and then complete the interrupted packages apt-get dist-upgrade.

In the old days of RedHat and probably nowdays in Fedora, I remember entering single user mode was easy just press I button few times on OS boot in non-interactive mode. The I (boot single-mode) shortcut however is not compatible with Deb based distros (as I found out by trying it out unsuccesfully).

Actually during booting process, this notebook did not even prompted the GRUB menu with even simple choice to choose an old kernel or something, hence I took a quick look on the net how can I make the GRUB menu appear on Ubuntu!.
As I read the reason why GRUB menu did not appear on the laptop boot was due to very short GRUB (select) boot timeout delay set.

Therefore to make the GRUB prompt (select) prompt appear in Ubuntu it is necessery to:

1. Hold continously the SHIFT key at boot

Ubuntu Linux version 12.04 GRUB boot textscreen picture

Once the textmode GRUB selection screen appears, as I read in instructions in blogs one has to:
HIT e key, over default boot-up kernel, e.g.:

Ubuntu, with Linux 3.2.0-23-generic

Now to boot Ubuntu in single user mode as I red it is necessery to modify near line:

linux /boot/vmlinuz-3.2.0-24-generic root=UUID=bc6f8146-1523-46a6-8b\6a-64b819ccf2b7 ro quiet splash

to something like:

linux /boot/vmlinuz-3.2.0-24-generic root=UUID=bc6f8146-1523-46a6-8b\6a-64b819ccf2b7 ro single quiet splash
initrd /boot/initrd.img-3.2.0-24-generic

Then finally to load up with the changed GRUB options, I have pressed Ctrl+X
Unfortunately this didn’t work on this totally bugged Ubuntu. After continuously looking for way to boot in sigle user or textmode (without X server), I found another blog recommending to change: quiet splash words with text in grub kernel load-up options ..

In my case none of the ways worked out so I finally decided to do it the “old-fashioned” classical way to recover Ubuntu, e.g. – by using Ubuntu Install CD, booting in “Try Ubuntu” mode and using the good old chroot cmd.

Fixing the failed updates Ubuntu, came up to booting with Ubuntu Install CD with option: Try Ubuntu without any change of your computer, further on once the CD boot up, I entered console and inside console used commands similar to one of my previous posts – How to mount /proc, /dev and chroot in Linux

Ubuntu fix was up-to to issuing :

# mkdir /mnt/recover
# chroot /dev/sda1 /mnt/recover
root@ubuntu:~# mount /proc
root@ubuntu:~# mount /proc/pts
root@ubuntu:~# mount -a
root@ubuntu:~# mount /dev
root@ubuntu:~# dpkg-reconfigure -a
root@ubuntu:~# apt-get update
....
root@ubuntu:~# apt-get --yes upgrade
....
root@ubuntu:~# apt-get --yes dist-upgrade
....

Onwards during the apt-get upgrade and apt-get dist-upgrade few questions poped up asking me if I would like to replace some files with their new versions on each questions I substituted the files with the new maintainer version. Then finally after PC restart my sis Ubuntu boot up now fine with the latest Ubuntu version 12.04.

Installing XMMS on Debian Squeeze from a Package / Installing XMMS on Debian – the debian way

Tuesday, July 17th, 2012

installing xmms on debian squeeze linux playing free software song green skin screenshot

I use Debian Linux for my desktop for quite some time; Even though there are plenty of MP3 / CD players around in Debian, I’m used to the good old XMMS, hence I often prefer to use XMMS to play my music instead of newer players like RhythmBox or audacious.
Actually audacious is not bad substitute for XMMS and is by default part of Debian but to me it seems more buggy and tends to crash during playing some music formats more than xmms ….

As most people might know, XMMS is no longer supported in almost all modern Linux distributions, so anyone using Debian, Ubuntu or other deb derivative Linux would have to normally compile it from source.
Compiling from source is time consuming and I think often it doesn’t pay back the effort. Thanksfully, though not officially supported by Debian crew XMMS still can be installed using a deb xmms prebuilt package repository kindly provided by a hacker fellow knuta.

Using the pre-build deb packages, installing xmms on new Debian installs comes to:

debian:~# echo 'deb http://www.pvv.ntnu.no/~knuta/xmms/squeeze ./' >> /etc/apt/sources.list
debian:~# echo 'deb-src http://www.pvv.ntnu.no/~knuta/xmms/squeeze ./' >> /etc/apt/sources.list
debian:~# apt-get update && apt-get -y install xmms

There are also deb xmms built for Ubuntu, so Ubuntu users could install xmms using repositories:

deb http://www.pvv.ntnu.no/~knuta/xmms/karmic ./
deb-src http://www.pvv.ntnu.no/~knuta/xmms/karmic ./
That’s all now xmms is ready to use. Enjoy 🙂