Ph: 933652511

Archive

Archive for the ‘Linux’ Category

cpp fails sanity check solved for pecl installations!

June 25th, 2009

I hate this error. It was a pain to figure out what was wrong in the first place because i’m only getting it when trying to install pear/pecl extensions!

...
configure: error: C preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details.
insanity check

Config.log? What config.log!? It was no where to be found because I was trying to install through the web console or from the command line. The temporary structures created to configure and make the packages get deleted upon exit with or without failure.

I found pecl:svn wanted to ask me two questions about subversion, so I was able to let it sit there while I opened another terminal to look in the temp directory and find the log. So I finally figured out what its problem was.

The fix

I had glibc installed, but it needs the backend packages for glibc, which I didn’t have installed.

$ sudo yum install glibc-headers glibc-utils glibc-devel

Now when I run through the installer, it works fine.

$ pecl install svn

...
Build process completed successfully
Installing '/usr/lib/php/modules/svn.so'
install ok: channel://pecl.php.net/svn-0.5.0
Extension svn enabled in php.ini

This also happened to fix the same insanity check problem that a couple of other modules whined about.

Linux cpp, glibc, pear, pecl, php, sanity check

Manual, low-level recovery of deleted jpeg images

June 19th, 2009

I have an old 128 meg thumbdrive I haven’t used in years. It had pictures on it once, but they were deleted a long time ago. I want to recover whatever images are still on the disk that didn’t get written over.

First, make a copy of the device or partition you want to scavenge from. You don’t want to accidentally write over whatever is left on the original device.

dd if=/dev/sda3 of=/tmp/sda3.dd

256977+0 records in
256977+0 records out
131572224 bytes (132 MB) copied, 144.036 s, 913 kB/s

Here’s a rough estimate of how many jpeg’s may still exist on the disk using xxd to search for “ffd8″, followed by 4 bytes, then “4a46″. This indicates the beginning of a jpeg header.

JPEG-JFIF is “ffd8 ffe0″, while JPEG-DCF, which is what cameras will spit out onto their media cards, will be “ffd8 ffe1″.

xxd sda3.dd | grep “ffd8 …. …. 4a46″

0300400: ffd8 ffe0 0010 4a46 4946 0001 0101 0048  ......JFIF.....H
030e400: ffd8 ffe0 0010 4a46 4946 0001 0200 0064  ......JFIF.....d
0700400: ffd8 ffe0 0010 4a46 4946 0001 0200 0064  ......JFIF.....d
1b44200: ffd8 ffe0 0010 4a46 4946 0001 0201 0048  ......JFIF.....H
1b4c200: ffd8 ffe0 0010 4a46 4946 0001 0201 012c  ......JFIF.....,
1b4c540: 0001 ffd8 ffe0 0010 4a46 4946 0001 0201  ........JFIF....
1b5c200: ffd8 ffe0 0010 4a46 4946 0001 0101 0060  ......JFIF.....`
1b68200: ffd8 ffe0 0010 4a46 4946 0001 0200 0064  ......JFIF.....d
1b6c200: ffd8 ffe0 0010 4a46 4946 0001 0201 0061  ......JFIF.....a
1b78200: ffd8 ffe0 0010 4a46 4946 0001 0201 0048  ......JFIF.....H
1b88200: ffd8 ffe0 0010 4a46 4946 0001 0101 0048  ......JFIF.....H
1b8c200: ffd8 ffe0 0010 4a46 4946 0001 0101 0060  ......JFIF.....`
1b98200: ffd8 ffe0 0010 4a46 4946 0001 0200 0064  ......JFIF.....d
1b9c200: ffd8 ffe0 0010 4a46 4946 0001 0101 012c  ......JFIF.....,
1ba4200: ffd8 ffe0 0010 4a46 4946 0001 0100 0001  ......JFIF......

There’s a bunch of jpeg headers on there, so that’s a good sign. I may be able to recover full jpegs, or perhaps pictures only partially overwritten. I’ll use the first one on the disk for example.

ffd8 starts the header, and it was found at the beginning of a line, so I don’t have to offset it, I can start where that line starts, which is 0300400. Converting that from hex I get 3146752

echo “ibase=16;0300400″ | bc

3146752

Skipping to that address, I’ll search for ffd9 which should be the end of the file. It may be part of some other file that got written in the middle of my jpeg, but that will become apparent once I try to view the picture. For now, lets just see the address of that ffd9.

xxd -s 3146752 sda3.dd | grep ffd9 | head -1

03ec300: ffd9 e732 689f b729 74e1 a6c9 3365 2511  ...2h..)t...3e%.

03ec300 is the beginning of the line, so add two bytes to include the “ff” and “d9″ to capture that too (however, most picture viewers won’t care if its missing!) oh I almost forgot, bc wants capital letters, so make the “ec” into “EC” for example.

Converting it from base 16 hexidecimal…

echo “ibase=16;03EC300″ | bc

4113152

Subtracting one from the other, you get the offset between the beginning and end. This is the length of the file.

echo “3146752-4113152″ | bc

-966400

Now I can copy from the start to the end of what I think might be a picture file using dd.

dd if=sda3.dd of=pic1.jpg bs=1 count=966400 skip=3146752

966400+0 records in
966400+0 records out
966400 bytes (966 kB) copied, 2.32158 s, 416 kB/s

Now I can view it in any image viewer or editor and find out if it’s worth keeping…

eog pic1.jpg

There’s plenty of tools out there that will do this for you, so it might be a waste of time to write your own script to do this, but at least I can do it now, and basically from any linux/unix machine I can get my hands on.

Linux, ooo! Shiny...

Motion capture and time lapse with a basic webcam

June 9th, 2009

Motion is a video motion detector with tracking support for webcams.

But you don’t have to build it from source. Motion is a package available in Fedora and Ubuntu, and it’s available in Gentoo under media-video/motion. I like it when the package name so very clearly matches the application. I’m not sure about debian based systems under aptitude, but if your machine has a yum repository addiction, you’ll find it easier to use the pre-packaged rpm version available for your distribution.

If you still want to build from source, and you figure out how to get support for ffmpeg working, please let me know. I have Fedora 11’s ffmpeg packages and they’re not in the right place, and when I link/copy all the files where motion wants to build them from, motion still chokes. I’d like to have the time lapse features working, but it seems I need ffmpeg_timelapse and other ffmpeg variables set in the configuration in order to get that working.

Besides that mess, it builds just fine. And that was good enough for my initial purposes. I just wanted jpeg’s captured every time the camera saw motion. I don’t have pan and tilt features on the camera, it’s just an cheap usb cam that’s several years old that I found in my parts bin the other day covered with dust.

After installing from source, I grabbed the /etc/motion/motion.conf from the fedora package and copied that into place. Other than the location of the output files, the defaults in the fedora package suited me just fine.

Here’s a few things you may be initially interested in tweaking right out of the box, especially if you’re capturing motion in the distance:

#####################################
# Motion Detection Settings:
#####################################

# Threshold for number of changed pixels that
# triggers motion detection (default: 1500)
threshold 1500

# Automatically tune the threshold down if possible (default: off)
threshold_tune off

# Noise threshold for the motion detection (default: 32)
noise_level 32

# Automatically tune the noise threshold (default: on)
noise_tune on

But there’s plenty of tuning features available, so feel free to get crazy with the cheese wiz. And if you have ffmpeg working:

# Use ffmpeg to encode mpeg movies in realtime (default: off)
ffmpeg_cap_new on

# Use ffmpeg to make movies with only the pixels moving
# object (ghost images) (default: off)
ffmpeg_cap_motion off

# Use ffmpeg to encode a timelapse movie
# Default value 0 = off - else save frame every Nth second
ffmpeg_timelapse 0

# The file rollover mode of the timelapse video
# Valid values: hourly, daily (default), weekly-sunday, weekly-monday, monthly, manual
ffmpeg_timelapse_mode daily

# Bitrate to be used by the ffmpeg encoder (default: 400000)
# This option is ignored if ffmpeg_variable_bitrate is not 0 (disabled)
ffmpeg_bps 500000

# Enables and defines variable bitrate for the ffmpeg encoder.
# ffmpeg_bps is ignored if variable bitrate is enabled.
# Valid values: 0 (default) = fixed bitrate defined by ffmpeg_bps,
# or the range 2 - 31 where 2 means best quality and 31 is worst.
ffmpeg_variable_bitrate 0

Linux motion, time lapse, video capture, webcam

Howto connect Evolution to Exchange 2007 in Fedora 11 with mapi

June 3rd, 2009

My base installation came with evolution, but I had to add an extra package from the standard repository which also installed a few dependencies.

$ sudo yum install evolution-mapi

Running Transaction
  Installing     : samba4-libs                                                         1/5
  Installing     : libtevent                                                           2/5
  Installing     : libldb                                                              3/5
  Installing     : openchange                                                          4/5
  Installing     : evolution-mapi                                                      5/5

Start Evolution

Once this is installed, the option, “Exchange-mapi” will show up as the type of connection when you first launch Evolution. Choose this as the connection type after entering your name and email address on the first page.

Next

Type in your Active Directory user name and the domain name. The case is important. I tried it all lowercase at first and it just gave me a funny error message. Then I typed the domain in all caps. After a brief pause, it connected successfully.

Next

The rest is just options/preferences. Choose how often you want to check for new mail and if you want to turn the junk filter on, etc.

Next / Finished

That’s it. If you’re impatient, hit F9 to force evolution to immediately send and receive mail. The progress bar went to 100% almost immediately for me and just sat there. I had a lot of crap in my inbox and rss feeds so it took awhile to sync the first time.

Linux, howto, microsoft evolution, exchange, Fedora 11, mapi

Cat your logs backwards to preserve the date order

May 29th, 2009

I learned a new command today. It was such a simple one, I can’t believe i’ve never heard of it before or seen anyone else use it.

It’s nice to be able to ‘cat’ dated logs that are split into multiple files with a simple command

cat /var/log/messages*

but that leaves you with the dates mixed up. There’s an easy solution: cat, backwards!

tac /var/log/messages*

Tada.

From the man page:

NAME
tac - concatenate and print files in reverse

SYNOPSIS
tac [OPTION]… [FILE]…

DESCRIPTION
Write each FILE to standard output, last line first. With no FILE, or when
FILE is -, read standard input.

Mandatory arguments to long options are mandatory for short options too.

-b, –before
attach the separator before instead of after

-r, –regex
interpret the separator as a regular expression

-s, –separator=STRING
use STRING as the separator instead of newline

–help display this help and exit

–version
output version information and exit

Linux cat, date, logs, tac

Install phpMyFAQ from scratch

May 14th, 2009

There’s a few packages you might not have installed that you’ll need before php phpMyFAQ will install. On a basic, headless virtual machine, I don’t install a web server, php or databases by default. So I’ll start from there.

Install a database.

If you want mysql:

$ sudo yum install mysql-server php-mysql

$ sudo /etc/init.d/mysql start

$ sudo /usr/bin/mysql_secure_installation

If you want postgresql:

$ sudo yum install postgresql-server php-pgsql

$ sudo /etc/init.d/postgresql initdb

$ sudo /etc/init.d/postgresql start

Install the web server.

$ sudo yum install lighttpd lighttpd-fastcgi php

Unpack phpMyFAQ under your webroot. If you use the default webroot, that would be /var/www/lighttpd/ (if you use apache, it would probably be /var/www/html/ but some distributions put it under htdocs the way apache meant it to be)

tar zxvf phpmyfaq*.tar.gz -C /var/www/lighttpd/

Optional:

Rename the phpmyfaq directory to just “faq”

Load the page in a browser. Fill out the fields and click Install! If you’re using postgres and you didn’t modify the database user and password, it’s postgres postgres. If you ran the secure installation script for mysql, it asked you to supply the password to use.

Linux apache, lighttpd, lighty, mysql, php, phpMyFAQ, postgresql, yum

Free the fish

May 14th, 2009

There’s a hidden easter egg in Gnome. This will work on Ubuntu and Fedora at least.

1. Hold ALT and hit F2 to open the “Run Application” window.
2. Type in “free the fish” and hit enter or click Run.

Now, other than clicking on the fish to make them scurry off the screen, how do you unfree the fish!? (Other than restarting X or killing gnome panel!)

I wonder how long this has been aroung in Gnome? I wonder if it’s anything like the old vi help screens.

:help 42
:help holy-grail
:help!

Almost random, Linux easter eggs, fish, gnome

Fedora Minimal Install .iso less than 150 Meg

May 8th, 2009

Minimal installation images are available. boot.iso should be enough to get you going. You should be able to find it on most fedora mirrors. The one I just downloaded was only 147 megabytes.

The default grub menu gives you the options to install or upgrade an existing system, rescue an existing system, boot from the local drive, or run a memtest. There’s also the option for installing with basic video driver. This adds the boot options xdriver=vesa and nomodeset

This one (F10-x86_64) also gives me the option of using ext4 file systems while installing. This won’t be a big deal in future releases, but the regular release of Fedora 10 did not include this feature!

You will notice, however, there’s an extra dialog window presented that lets you know you’re using a developmental release. Don’t be surprised when you find little changes here and there, especially with the descriptive explanations of installation options.

Linux fedora 10, Fedora 11, install, iso, minimal

Fedora 10 live cd and Fedora 11 coming soon!

May 7th, 2009

There’s a 32-bit live cd version of Fedora 10 out now that’s installable.

This is great for installing on older systems that don’t have a DVD rom. The whole image is 681MB. You can install more software after installing the base system. Even if you installed from DVD, you’d probably want to upgrade the packages anyway with the latest fixes.

Only 19 days to go until Fedora 11 comes out. I really wish these release cycles were slowed down. I think a yearly release would be much better!

Linux 32-bit, fedora 10, Fedora 11, i686, live cd, release

dd with a progress bar

April 23rd, 2009

dd is a great bit stream utility to make image copies of one thing to another whether it’s a partition, a file, a device, or even a stream of zeros or randomness. But it doesn’t have much in the way of a user interface.

You can use the pv utility in conjunction with double buffering dd with pipes to get a nice little progress bar. Y ou can customize this to see elapsed time, and transfer rate.

First you’ll need to install the pv utility. Don’t worry, it’s pretty skinny. Here’s the contents of the entire package on a Fedora system.

/usr/bin/pv
/usr/share/doc/pv-1.1.0
/usr/share/doc/pv-1.1.0/COPYING
/usr/share/doc/pv-1.1.0/NEWS
/usr/share/doc/pv-1.1.0/README
/usr/share/doc/pv-1.1.0/TODO
/usr/share/locale/de/LC_MESSAGES/pv.mo
/usr/share/locale/fr/LC_MESSAGES/pv.mo
/usr/share/locale/pl/LC_MESSAGES/pv.mo
/usr/share/locale/pt/LC_MESSAGES/pv.mo
/usr/share/man/man1/pv.1.gz

The only file you’ll really need from this package is /usr/bin/pv.

Writing zeros to a usb drive while displaying elapsed time, and a rate of transfer. Update every 2 seconds.

dd if=/dev/zero | pv -ptr -i 2 | dd of=/dev/sdf

0:01:46 [5.34MB/s] [        <=>                               ]

Copy SCSI disk a to SCSI disk b

dd if=/dev/sda | pv -pt | dd of=/dev/sdb

0:01:32 [       <=>                                           ]

You can also use pv with other utilities such as tar. Using the -L option allows rate limiting. You can dynamically change the rate by opening another shell and calling pv with the remote pid!

pv -R 19832 -L 100k

This will modify the rate for the pv that is currently running with pid 19832.

Linux dd, pipes, progress bar, pv, rate limit, tar, time


You are viewing a mobilized version of this site...
View original page here

Mobilized by Mowser Mowser
Mobilytics