Posts Tagged ‘Linux’

Compare two text files command line (Linux)

You’ll first need to sort the two files into new temporary files that are ordered:
sort -o tmp1.txt File1.txt && sort -o tmp2.txt File2.txt

You can then compare the new temporary files:

lines common to both files:
comm -12 tmp1.txt tmp2.txt

lines only in file 2
comm -13 tmp1.txt tmp2.txt

lines only in file 1
comm -23 tmp1.txt tmp2.txt

Yum "rpmdb: PANIC: fatal region error detected"

Is your favourite update tool Yum doing the below?

------------------------------------------------------
[root@server ~]# yum check-update
rpmdb: PANIC: fatal region error detected; run recovery
error: db4 error(-30978) from dbenv->open: DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db3 - (-30978)
error: cannot open Packages database in /var/lib/rpm
Traceback (most recent call last):
File "/usr/bin/yum", line 29, in ?
yummain.main(sys.argv[1:])
File "/usr/share/yum-cli/yummain.py", line 80, in main
base.getOptionsConfig(args)
File "/usr/share/yum-cli/cli.py", line 170, in getOptionsConfig
self.doConfigSetup(fn=opts.conffile, root=root)
File "__init__.py", line 82, in doConfigSetup
File "config.py", line 273, in __init__
File "config.py", line 385, in _getsysver
TypeError: rpmdb open failed
------------------------------------------------------

Read the rest of this post to learn how to quickly fix it.
Read more

Qmail and Wildcard Subdomains

We were working on a new email solution at work and it required wildcard subdomains to both be passed to the mailserver (via the MX) and then Qmail on the server accept them.

Read more

Regaining Root Using Grub

Ever needed access to a linux machine that you have physical access to but you’ve long since forgotten the root password?

Grub is your friend…

Read more

Custom iptables and crashing programs

We had a user in the office today of whom was using Kubuntu (the KDE Ubuntu) and wanted to allow all local addresses access to his machine on port 80.

Kubuntu comes with ufw (uncomplicated firewall), which frankly is crap and doesn’t allow ranges across more than just the last subnet. So we disabled it and jigged our own iptables script in rc.local.

Read more

Linux Apache Filecaching

I had a customer today that wanted to enable caching on certain filetypes within their site to help it’s speed. It took me a little while to get working so I thought I’d post it here for anyone else.
Read more

Return top