lost and found ( for me ? )

Showing posts with label Fedora 18. Show all posts
Showing posts with label Fedora 18. Show all posts

yum update error : rpmdb: BDB0113 Thread/process 12738/140625764685632 failed

small tips.
How to fix a yum related problem.

# cat /etc/redhat-release
Fedora release 18 (Spherical Cow)

# uname -ri
3.9.4-200.fc18.x86_64 x86_64

# yum update
error: rpmdb: BDB0113 Thread/process 12738/140625764685632 failed: BDB1507 Thread died in Berkeley DB library
error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db5 -  (-30973)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:

Error: rpmdb open failed
#



# ls /var/lib/rpm/*
/var/lib/rpm/Basenames     /var/lib/rpm/Group         /var/lib/rpm/Requirename
/var/lib/rpm/Conflictname  /var/lib/rpm/Installtid    /var/lib/rpm/Sha1header
/var/lib/rpm/__db.001      /var/lib/rpm/Name          /var/lib/rpm/Sigmd5
/var/lib/rpm/__db.002      /var/lib/rpm/Obsoletename  /var/lib/rpm/Triggername
/var/lib/rpm/__db.003      /var/lib/rpm/Packages
/var/lib/rpm/Dirnames      /var/lib/rpm/Providename

rm __db.00* files
# rm /var/lib/rpm/__db.00* -f

# ls /var/lib/rpm/*
/var/lib/rpm/Basenames     /var/lib/rpm/Name          /var/lib/rpm/Sha1header
/var/lib/rpm/Conflictname  /var/lib/rpm/Obsoletename  /var/lib/rpm/Sigmd5
/var/lib/rpm/Dirnames      /var/lib/rpm/Packages      /var/lib/rpm/Triggername
/var/lib/rpm/Group         /var/lib/rpm/Providename
/var/lib/rpm/Installtid    /var/lib/rpm/Requirename

try “yum update”
okay. I was able to solve the problem.
# yum update -y
Loaded plugins: langpacks, presto, refresh-packagekit, versionlock
No Packages marked for Update

install munin on Fedora 18

Here’s how to install munin on Fedora 18.


I’ve installed munin server and munin node on the same box , which means that one box acts as both munin server and client.

[root@f18 ~]# uname -ri
3.9.0-0.rc5.git1.1.vanilla.mainline.knurd.1.fc18.x86_64 x86_64
[root@f18 ~]# cat /etc/fedora-release
Fedora release 18 (Spherical Cow)

install munin , munin-node and httpd via yum.
# yum -y install munin munin-node httpd

[ munin server ]

use default configuration.
# egrep -v ^# /etc/munin/munin.conf | grep -v ^$
includedir /etc/munin/conf.d
graph_strategy cron
html_strategy cron
[localhost]
   address 127.0.0.1
   use_node_name yes

[ munin node ]

use default configuration as well.
# egrep -v ^# /etc/munin/munin-node.conf | grep -v ^$
log_level 4
log_file /var/log/munin-node/munin-node.log
pid_file /var/run/munin/munin-node.pid
background 1
setsid 1
user root
group root
ignore_file [\#~]$
ignore_file DEADJOE$
ignore_file \.bak$
ignore_file %$
ignore_file \.dpkg-(tmp|new|old|dist)$
ignore_file \.rpm(save|new)$
ignore_file \.pod$
allow ^127\.0\.0\.1$
allow ^::1$
host *
port 4949
#

start munin-node
[root@f18 ~]# systemctl start munin-node.service

[root@f18 ~]# systemctl status munin-node.service
munin-node.service - Munin Node Server.
 Loaded: loaded (/usr/lib/systemd/system/munin-node.service; disabled)
 Active: active (running) since Sat 2013-04-13 02:50:12 JST; 1s ago
   Docs: man:munin-node
Process: 8403 ExecStart=/usr/sbin/munin-node (code=exited, status=0/SUCCESS)
Main PID: 8404 (munin-node)
 CGroup: name=systemd:/system/munin-node.service
 └─8404 /usr/bin/perl -wT /usr/sbin/munin-node

start munin-node when booting the OS
# systemctl enable munin-node.service
ln -s '/usr/lib/systemd/system/munin-node.service' '/etc/systemd/system/multi-user.target.wants/munin-node.service'

configure apache to browse statistics via HTTP.
# egrep -v ^# /etc/httpd/conf.d/munin.conf  | grep -v ^$
<directory /var/www/html/munin>
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 192.168.11.0/24
ExpiresActive On
ExpiresDefault M310
</directory>
ScriptAlias /munin-cgi/munin-cgi-graph /var/www/cgi-bin/munin-cgi-graph

start httpd
# apachectl start


The following is an output of CPU usage.


list munin plugins
# munin-node-configure --suggest
Plugin                     | Used | Suggestions                            
------                     | ---- | -----------                            
acpi                       | no   | no [cannot read []                     
amavis                     | no   | no                                     
apache_accesses            | no   | no [apache server-status not found. check if mod_status is enabled]
apache_processes           | no   | no [apache server-status not found. check if mod_status is enabled]
apache_volume              | no   | no [apache server-status not found. check if mod_status is enabled]
apc_envunit_               | no   | no [no units to monitor]               
bonding_err_               | no   | no [No /proc/net/bonding]              
courier_mta_mailqueue      | no   | no [spooldir not found]                
courier_mta_mailstats      | no   | no [could not find executable]         
courier_mta_mailvolume     | no   | no [could not find executable]         
cps_                       | no   | no                                     
cpu                        | yes  | yes                                    
cpuspeed                   | no   | no [missing /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state]
cupsys_pages               | no   | no [logfile not readable]              
df                         | yes  | yes                                    
df_inode                   | yes  | yes                                    
diskstats                  | yes  | yes                                    
entropy                    | yes  | yes                                    
exim_mailqueue             | no   | no [no exiqgrep]                       
exim_mailstats             | no   | no ['/usr/sbin/exim -bP log_file_path' returned an error]
fail2ban                   | no   | no [fail2ban-server does not respond to ping]
forks                      | yes  | yes                                    
fw_conntrack               | yes  | yes                                    
fw_forwarded_local         | yes  | yes                                                                                                    
<snip>

munin plugins are stored in /usr/share/munin/plugins directory
# ls /usr/share/munin/plugins/*
/usr/share/munin/plugins/acpi
/usr/share/munin/plugins/amavis
/usr/share/munin/plugins/apache_accesses
/usr/share/munin/plugins/apache_processes
/usr/share/munin/plugins/apache_volume
/usr/share/munin/plugins/apc_envunit_
/usr/share/munin/plugins/apc_nis
/usr/share/munin/plugins/apt
/usr/share/munin/plugins/apt_all
/usr/share/munin/plugins/asterisk_channels
/usr/share/munin/plugins/asterisk_channelstypes
/usr/share/munin/plugins/asterisk_codecs
/usr/share/munin/plugins/asterisk_meetme
/usr/share/munin/plugins/asterisk_meetmeusers
/usr/share/munin/plugins/asterisk_sipchannels
<snip>

fedora 18 : change Ethernet device name from pXXpX to ethX



[root@f18 ~]# cat /etc/fedora-release
Fedora release 18 (Spherical Cow)
[root@f18 ~]# uname -ri
3.9.0-0.rc5.git1.1.vanilla.mainline.knurd.1.fc18.x86_64 x86_64

My laptop has one physical NIC and the device name is p10p1.
Here’s an explanation of how to change the device name from p10p1 to eth0.

- before change the device name

# biosdevname -i p10p1 -d
BIOS device: p10p1
Kernel name: p10p1
Permanent MAC: 78:E7:D1:xx:xx:xx
Assigned MAC : 78:E7:D1:xx:xx:xx
ifIndex: 2
Driver: r8169
Driver version: 2.3LK-NAPI
Firmware version: rtl_nic/rtl8168d-2.fw
Bus Info: 0000:02:00.0
PCI name      : 0000:02:00.0
PCI Slot      : 10
Index in slot: 1

There is no “70-net-persistent.rules” file under “/etc/udev/rules.d”
# ls /etc/udev/rules.d/*
/etc/udev/rules.d/60-sysprof.rules
#

# pwd
/etc/sysconfig/network-scripts

# cat ifcfg-p10p1
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=p10p1
UUID=2b9e9659-417d-4c35-a6b6-f33e8acf8ac1
ONBOOT=yes
HWADDR=78:E7:D1:xx:xx:xx
IPADDR0=192.168.11.100
PREFIX0=24
GATEWAY0=192.168.11.1
DNS1=127.0.0.1
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes

- change the device name to eth0 from p10p1

edit /etc/default/grub
add “biosdevname=0”
# cat /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_CMDLINE_LINUX="biosdevname=0 rd.md=0 rd.lvm=0 rd.dm=0 vconsole.keymap=jp106 $([ -x /usr/sbin/rhcrashkernel-param ] && /usr/sbin/rhcrashkernel-param || :) rd.luks=0 rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
GRUB_THEME="/boot/grub2/themes/system/theme.txt"

update grub2 config
# grub2-mkconfig > /boot/grub2/grub.cfg

I assigned an static IP.
create  ifcfg-eth0 file unnder /etc/sysconfig/network-scripts directory.
# cp ifcfg-p10p1 ifcfg-eth0

edit ifcfg-eth0
change the device name “NAME” to eth0 from p10p1
# diff ifcfg-p10p1 ifcfg-eth0
9c9
< NAME=p10p1
---
> NAME=eth0

# cat /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=eth0
UUID=2b9e9659-417d-4c35-a6b6-f33e8acf8ac1
ONBOOT=yes
HWADDR=78:E7:D1:xx:xx:xx
IPADDR0=192.168.11.100
PREFIX0=24
GATEWAY0=192.168.11.1
DNS1=127.0.0.1
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
#

reboot the OS.

after rebooting the OS.

the device name has been changed to eth0.
# ifconfig eth0 | grep "inet"
       inet 192.168.11.100  netmask 255.255.255.0  broadcast 192.168.11.255

# biosdevname -i eth0 -d
BIOS device: p10p1
Kernel name: eth0
Permanent MAC: 78:E7:D1:xx:xx:xx
Assigned MAC : 78:E7:D1:xx:xx:xx
ifIndex: 2
Driver: r8169
Driver version: 2.3LK-NAPI
Firmware version: rtl_nic/rtl8168d-2.fw
Bus Info: 0000:02:00.0
PCI name      : 0000:02:00.0
PCI Slot      : 10
Index in slot: 1

TCP session hijack : sessionlist


about sessionlist


I was able to compile sessionlist on Fedora 18. I , however , can not compilse that on ubuntu 12.04..
Here are logs including trial and error.

[ install sessionlist on Fedora 18 ( success ) ]

 999  git clone https://github.com/iamrage/sessionlist.git
1000  cd sessionlist/
1006  yum install -y libpcap-devel
1007  make

[root@f18 sessionlist]# locate libpcap.so
/usr/lib64/libpcap.so.1
/usr/lib64/libpcap.so.1.3.0
[root@f18 sessionlist]# locate libncurses
/usr/lib64/libncurses.so
/usr/lib64/libncurses.so.5
/usr/lib64/libncurses.so.5.9
/usr/lib64/libncursesw.so
/usr/lib64/libncursesw.so.5
/usr/lib64/libncursesw.so.5.9
[root@f18 sessionlist]# locate libpthread.so
/usr/lib64/libpthread.so
/usr/lib64/libpthread.so.0

usage
./sessionlist [eth number] [port number]
[root@f18 sessionlist]# ./sessionlist p10p1 80

***************************************************
sessionlist v1.0
***************************************************
c0ded by rage
***************************************************
Current hijacked sessions: 1 out of 7 tracked sessions

Found data for Host:  ad.jp.doubleclick.net
Found data for Host:  fls-fe.amazon.co.jp



if sessionlist can hijack TCP sessions , logs will be outputted in sessions.txt file.
[root@f18 sessionlist]# tail -f sessions.txt

Session 0 of 5 - IP: 192.168.11.100 IP: 176.32.120.142 - payload elements: 2
Host:  www.amazon.co.jp
user-agent:  Mozilla/5.0 (X11; Linux x86_64; rv:19.0) Gecko/20100101 Firefox/19.0
cookie:  x-wl-uid=1mAKbfgI6NBpx
<snip>


[ install sessionlist on ubuntu 12.04 ( fail ! ) ]

root@ubuntu1204-vm1:~# git clone https://github.com/iamrage/sessionlist.git
root@ubuntu1204-vm1:~# cd sessionlist/

error
root@ubuntu1204-vm1:~/sessionlist# make
g++ -march=native -O2 -pipe main.cpp sessionlist.cpp -lpcap -lpthread -lncurses -o sessionlist && strip sessionlist
In file included from main.h:25:0,
                from main.cpp:21:
sessionlist.h:24:18: fatal error: pcap.h: No such file or directory
compilation terminated.
In file included from sessionlist.cpp:21:0:
sessionlist.h:24:18: fatal error: pcap.h: No such file or directory
compilation terminated.
make: *** [all] Error 1

# apt-get install libpcap-dev

another error
root@ubuntu1204-vm1:~/sessionlist# make
g++ -march=native -O2 -pipe main.cpp sessionlist.cpp -lpcap -lpthread -lncurses -o sessionlist && strip sessionlist
In file included from main.h:25:0,
                from main.cpp:21:
sessionlist.h:37:21: fatal error: ncurses.h: No such file or directory
compilation terminated.
In file included from sessionlist.cpp:21:0:
sessionlist.h:37:21: fatal error: ncurses.h: No such file or directory
compilation terminated.

install
root@ubuntu1204-vm1:~/sessionlist# sudo apt-get install libncurses5-dev -y

try again
root@ubuntu1204-vm1:~/sessionlist# make
g++ -march=native -O2 -pipe main.cpp sessionlist.cpp -lpcap -lpthread -lncurses -o sessionlist && strip sessionlist
In file included from sessionlist.h:27:0,
                from main.h:25,
                from main.cpp:21:
headers.h:25:2: warning: ‘typedef’ was ignored in this declaration [enabled by default]
headers.h:42:2: warning: ‘typedef’ was ignored in this declaration [enabled by default]
headers.h:68:1: warning: ‘typedef’ was ignored in this declaration [enabled by default]
In file included from main.h:25:0,
                from main.cpp:21:
sessionlist.h:76:1: warning: ‘typedef’ was ignored in this declaration [enabled by default]
In file included from sessionlist.h:27:0,
                from sessionlist.cpp:21:
headers.h:25:2: warning: ‘typedef’ was ignored in this declaration [enabled by default]
headers.h:42:2: warning: ‘typedef’ was ignored in this declaration [enabled by default]
headers.h:68:1: warning: ‘typedef’ was ignored in this declaration [enabled by default]
In file included from sessionlist.cpp:21:0:
sessionlist.h:76:1: warning: ‘typedef’ was ignored in this declaration [enabled by default]
sessionlist.cpp: In function ‘void displayUsableSessionInfo()’:
sessionlist.cpp:394:167: warning: format ‘%i’ expects argument of type ‘int’, but argument 8 has type ‘std::list<unsigned char*>::size_type {aka long unsigned int}’ [-Wformat]
sessionlist.cpp:394:167: warning: format ‘%i’ expects argument of type ‘int’, but argument 8 has type ‘std::list<unsigned char*>::size_type {aka long unsigned int}’ [-Wformat]
sessionlist.cpp: In function ‘bool hasUsableSessionInfo(std::list<SESSION_INFO>::iterator, char*, char*, char*)’:
sessionlist.cpp:439:60: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
sessionlist.cpp:449:71: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
sessionlist.cpp: In function ‘void displayUsableSessionInfo()’:
sessionlist.cpp:419:27: warning: ignoring return value of ‘int system(const char*)’, declared with attribute warn_unused_result [-Wunused-result]
root@ubuntu1204-vm1:~/sessionlist# echo $?
0

root@ubuntu1204-vm1:~/sessionlist# ./sessionlist
/*
sessionlist v1.0
by rage
rage@0xrage.com
*/
Usage:
./sessionlist [interface] [port]- port is optional and defaults to 80. simple eh?

Seen  from README file , libpcap.so.1 , libncurses.so and libpthread.so are required to compile sessionlist.
Dependencies
------------

libpcap.so.1
libncurses.so.5
libpthread.so.0

So ensure you have these first.

nnn , core dump..
root@ubuntu1204-vm1:~/sessionlist# ./sessionlist eth0 80
/*
sessionlist v1.0
by rage
rage@0xrage.com
*/
Illegal instruction (core dumped)

In case of Fedora 18 , libpcap version is 1.3.
root@ubuntu1204-vm1:~/sessionlist# locate libpcap.so
/usr/lib/x86_64-linux-gnu/libpcap.so.0.8
/usr/lib/x86_64-linux-gnu/libpcap.so.1.1.1
root@ubuntu1204-vm1:~/sessionlist# locate libncurses.so
/lib/x86_64-linux-gnu/libncurses.so.5
/lib/x86_64-linux-gnu/libncurses.so.5.9
root@ubuntu1204-vm1:~/sessionlist# locate libpthread.so
/lib/x86_64-linux-gnu/libpthread.so.0