How to FSCK - fix error LVM volume

Saturday, June 26, 2010
Boot from a CD
Boot from a CD with Ubuntu Desktop (or another desktop distro) on it, and run it from the CD. Then none of your filesystems are mounted, you can't run fsck on a mounted filesystem.

If you've used the Linux LVM to create your partitions, you'll need to make those accessible before you run fsck:

"lvm pvscan"
"lvm vgscan"
"lvm lvchange -ay 'NameOfYourVolumeGroup' "
"lvm lvscan"

Then you can run fsck:

"fsck -f NameOfYourVolumeGroup"

simply wait for the fsck process and boot into your Linux box again :)
Read More...

Installing Zoneminder on Ubuntu 9.04 32bit & 10.04 32bit - The open source surveillance system

Saturday, May 1, 2010
Yes... you may have heard the Linux is going into CCTV world! On this tutorial we are going to
install zoneminder on Ubuntu 9.04 32bit.
Note that this walkthrough is taken from http://www.zoneminder.com/wiki/index.php/Ubuntu_9.04_server_32bit with some modification due to update to ffmpeg module.
This also a solution to ffmpeg error on compiling zoneminder.We assume here you guys already installed the Ubuntu Server with LAMP and the SSH server if you guys want to do remote SSH,and change the IP of your server to static IP.

- Do the "apt-get update" and then "apt-get upgrade" to update your distribution to the latest
one.

- After that install webmin (optional), install sysvconfig: "apt-get install sysvconfig", enter; now
run it: "sysvconfig", enter , now choose "enable/disable", also
ensure webmin is checked if you want it; back to the main screen, hit "finished" to save; exit it;

- Ensure you had your capture card recognized, in my case i'm using Kodicom 8800 DVR card.
root@myhomeCCTV:/home/myhome# find /dev -name video*
/dev/video1
/dev/video7
/dev/video6
/dev/video5
/dev/video4
/dev/video3
/dev/video2
/dev/video0
/dev/.udev/names/video1
/dev/.udev/names/video7
/dev/.udev/names/video6
/dev/.udev/names/video5
/dev/.udev/names/video4
/dev/.udev/names/video3
/dev/.udev/names/video2
/dev/.udev/names/video0
root@myhomeCCTV:/home/myhome# lspci -v | grep Multimedia
04:08.0 Multimedia video controller: Brooktree Corporation Bt878 Video Capture (rev 11)
04:08.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture (rev 11)
04:09.0 Multimedia video controller: Brooktree Corporation Bt878 Video Capture (rev 11)
04:09.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture (rev 11)
04:0a.0 Multimedia video controller: Brooktree Corporation Bt878 Video Capture (rev 11)
04:0a.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture (rev 11)
04:0b.0 Multimedia video controller: Brooktree Corporation Bt878 Video Capture (rev 11)
04:0b.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture (rev 11)
04:0c.0 Multimedia video controller: Brooktree Corporation Bt878 Video Capture (rev 11)
04:0c.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture (rev 11)
04:0d.0 Multimedia video controller: Brooktree Corporation Bt878 Video Capture (rev 11)
04:0d.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture (rev 11)
04:0e.0 Multimedia video controller: Brooktree Corporation Bt878 Video Capture (rev 11)
04:0e.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture (rev 11)
04:0f.0 Multimedia video controller: Brooktree Corporation Bt878 Video Capture (rev 11)
04:0f.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture (rev 11)


ZM Installation :
echo "/usr/local/lib" > /etc/ld.so.conf.d/ffmpeg.conf

echo "LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH" >> /etc/bash.bashrc

echo "export LD_LIBRARY_PATH" >> /etc/bash.bashrc

ldconfig

aptitude install build-essential linux-headers-`uname -r` automake perl libnetssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl libmd5-perl libmysqlclient15-dev libarchive-zip-perl libdate-manip-perl libdevice-serialport-perl libjpeg62 libjpeg62-dev libmime-perl libstdc++6 libwww-perl zlib1g zip unzip patch ntp openssl libpcre3-dev libssl-dev libjpeg-progs libcurl4-gnutls-dev munin munin-node libmime-lite-perl netpbm libbz2-dev subversion yasm


Install Perl Modules
type "perl -MCPAN -e shell", enter
(accept yes when prompted)
type "install CPAN", enter
(accept yes when prompted)
type "exit", enter
type "perl -MCPAN -e shell", enter
type "install YAML PHP::Serialization Module::Load X10::ActiveHome", enter
(accept yes when prompted,and yes again to fix dependencies problems if so)
type "exit", enter

FFmpeg & ZoneMinder from SVN
Install FFmpeg
cd /usr/src

svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg


cd ffmpeg

echo "Checked out external at revision 29318 - Checked out revision 18890" > xxx_SVN_info.txt

./configure --enable-gpl --enable-shared --enable-pthreads

make

make install

make install-libs

cd /lib

ln -s /usr/local/lib/libswscale.so.0
ln -s /usr/local/lib/libavformat.so.52
ln -s /usr/local/lib/libavcodec.so.52
ln -s /usr/local/lib/libavutil.so.50
ln -s /usr/local/lib/libavdevice.so.52

(all commands ran smooth, no broken symbolic links so far)

Install & Config ZoneMinder
cd /usr/src

svn co http://svn.zoneminder.com/svn/zm/trunk zm


cd zm

echo "Checked out revision 2887" > xxx_SVN_info.txt

./configure --with-webdir=/var/www/zm --with-cgidir=/usr/lib/cgi-bin --withffmpeg=/usr/src/ffmpeg CPPFLAGS="-D__STDC_CONSTANT_MACROS" ZM_DB_HOST=localhost ZM_DB_NAME=zm ZM_DB_USER=zmuser ZM_DB_PASS=zmpass --enable-debug=yes --withwebgroup=www-data --with-webuser=www-data


autoconf
(ok, outputs nothing here)

aclocal

automake

(now, the most important step, that takes about 3 minutes compiling)

make

(so far so good, lets now create the initial db; when prompted, use the **root
MySQL** password you created before;)

mysql -u root -p <> db/zm_create.sql

mysql -u root -p


grant select,insert,update,delete on zm.* to 'zmuser'@localhost identified by 'zmpass';

quit

make install


Post Install
Install Cambozola
cd /usr/src

wget http://www.charliemouse.com:8080/code/cambozola/cambozola-latest.tar.gz

tar -xzvf cambozola-latest.tar.gz

cp cambozola-0.70/dist/cambozola.jar /var/www/zm


Make sure ZoneMinder starts automatically
vim /etc/init.d/zm
#!/bin/sh
# description: Control ZoneMinder as a Service
# chkconfig: 2345 99 99
# Source function library.
#. /etc/rc.d/init.d/functions
prog=ZoneMinder
ZM_PATH_BIN="/usr/local/bin"
command="$ZM_PATH_BIN/zmpkg.pl"
start() {
echo -n "Starting $prog: "
$command start
RETVAL=$?
[ $RETVAL = 0 ] && echo success
[ $RETVAL != 0 ] && echo failure
return $RETVAL
}
stop() {
echo -n "Stopping $prog: "
$command stop
RETVAL=$?
[ $RETVAL = 0 ] && echo success
[ $RETVAL != 0 ] && echo failure
}
status() {
result=`$command status`
if [ "$result" = "running" ]; then
echo "ZoneMinder is running"
RETVAL=0
else
echo "ZoneMinder is stopped"
RETVAL=1
fi
}
case "$1" in
'start')
start
;;
'stop')
stop
;;
'restart')
stop
start
;;
'status')
status
;;
*)
echo "Usage: $0 { start | stop | restart | status }"
RETVAL=1
;;
esac
exit $RETVAL


Make /etc/init.d/zm executable:
chmod 755 /etc/init.d/zm

Make zm "automatic start on boot" -- Webmin -> System -> Bootup and Shutdown

Notes :
- There are some fix to also include support for Safari users or people surfing with the iPhone's built in Safari browser.Also, there is no need to do anything for Google chrome because its being detected as Mozilla\firefox.If you are using the JPEG streaming mode (Motion JPEG) with the browser Opera or Safari, or even using your iPhone, there is no reason to use cambozola because all those browsers support MJPEG natively.The problem: with ZM's CAN_STREAM setting set to "auto", ZM's auto detection believes those browsers don't support MJPEG, although they do.This is because ZM's auto detection is slightly outdated and this fix will update it.
You can do the changes manually or use the patch below.EDIT: If after this fix you experience flickering in Opera, here is how you fix it:
http://www.zoneminder.com/forums/viewtopic.php?p=61493
(or if you want the easiest way, you can download the
functions.php file from HERE, and overwrite the file function.php on /var/www/zm/includes/function.php)
- In file include/functions.php, change the following which is at around line 823 (May vary from installation to installation):
elseif (ereg( 'Opera ([0-9].[0-9]{1,2})',$_SERVER['HTTP_USER_AGENT'],$logVersion))
to
elseif (ereg( 'Opera/([0-9].[0-9]{1,2})',$_SERVER['HTTP_USER_AGENT'],$logVersion))
- In around line 876 (May vary from installation to installation),change:
function canStreamNative()
{
return( ZM_CAN_STREAM == "yes" || ( ZM_CAN_STREAM == "auto"
&& (isNetscape() || isKonqueror()) ) );
}

to
function canStreamNative()
{
return( ZM_CAN_STREAM == "yes" || ( ZM_CAN_STREAM == "auto" && (isNetscape
() || isKonqueror() || isOpera() || isSafari()) )
);
}

- In around line 840 (May vary from installation to installation),find this:
function isNetscape()
{
getBrowser( $browser, $version );
return( $browser == "mozilla" );
}

to
function isOpera() {
getBrowser( $browser, $version );
return( $browser == "opera" );
}
function isSafari() {
getBrowser( $browser, $version );
return( $browser == "safari" );
}


- For Kodicom KMC-8800 there's a fix, make a new file on /etc/modprobe.d/bttv.conf and place the option, for

for 1 card :
options i2c-algo-bit bit_test=1
options bttv gbuffers=16 card=102,102,102,102,102,102,102,102 radio=0,0,0,0,0,0,0,0 tuner=4,4,4,4,4,4,4,4 chroma_agc=1 combfilter=2 full_luma_range=1 coring=1 autoload=0

for 2 card :
options i2c-algo-bit bit_test=1
options bttv gbuffers=16 card=102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102 radio=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 tuner=4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 chroma_agc=1 combfilter=2 full_luma_range=1 coring=1 autoload=0


- There's a issue with shared memory with my installation - i don't know if you guys got the same issue too, if so... just insert below line to /etc/sysctl.conf
vim /etc/sysctl.conf
then insert :
kernel.shmall = 134217728
kernel.shmmax = 134217728
to load this setting immediately
sysctl -p

- If you want to use another partition as storage just create a symlink from /var/www/zm/events to zoneminder default folder :
ln -s /path/to/your/partition /var/www/zm/events Read More...

Digital Surveilance with Zoneminder 1.23

Friday, April 16, 2010
After several time our church congregation got stolen, we decide to upgrade our CCTV - yes we've been using the CCTV, but the quality is very poor (we seen the theft but the picture quality is very poor and the way to retrieve the recording isn't very comfortable - we've to search every single frame and there's no other way to skip it). Then we decide to upgrade the CCTV using computerize system which we find out will be doing more good for us.

My choice drop to Zoneminder, the fact of it being open source and it ran on LINUX also!!! has been always makes me believe we're not going wrong direction. As you guys know, we are non-profit organization and our budget come from the congregation, thats why we've to consider well every penny we spent and mostly because it ran on Linux which have been famous because of it's stability and robustness.

The hardware we choose this time is a set of computer (motherboard with onboard graphic card should be enough as we're going to install a server) and a DVR card - we choose Kodicom KMC-8800 8 channel DVR card.
Here is the list of supported hardware by Zoneminder

This time i choose Ubuntu 9.04 LAMP 32bit - Jaunty Jackalope as our base system. I'm not going to tell you guys about how to install it because the installation is pretty straight forward and well documented on internet. After the installation - make sure you guys give your server a static address, and change the repository to the local one (choose the closest one to you guys).

Once again!!! make sure you guys choose to install LAMP (Linux, Apache, mysql, PHP)!!!!

After that as usually, do some package update "sudo apt-get update" and the the upgrade "sudo apt-get upgrade" - install webmin to help us configure our system.

Now we're going to the install the zoneminder, installation is pretty straight forward also - we're going to make our life easier by installing it from debian repository "sudo apt-get install zoneminder" and if it asking for dependency fire up some command "sudo apt-get install -f" and try install the zoneminder again with "sudo apt-get install zoneminder".

After the installation progress is finish, try to link Apache with Zoneminder
"sudo ln -s /etc/zm/apache.conf /etc/apache2/conf.d/zoneminder.conf" and the reload apache "/etc/init.d/apache force-reload"

Notes :
  • For Kodicom KMC-8800 we've to make bttv.conf file on /etc/modprobe.d/ and write down
     options i2c-algo-bit bit_test=1
options bttv gbuffers=16 card=102,102,102,102,102,102,102,102 radio=0,0,0,0,0,0,0,0 tuner=4,4,4,4,4,4,4,4 chroma_agc=1 combfilter=2 full_luma_range=1 coring=1 autoload=0

for 1 card - The 8 inputs are from /dev/video0 channel 0 to /dev/video7 channel 0, and

options i2c-algo-bit bit_test=1
options bttv gbuffers=16 card=102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102 radio=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 tuner=4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 chroma_agc=1 combfilter=2 full_luma_range=1 coring=1 autoload=0

for 2 card - The 16 inputs are from /dev/video0 channel 0 to /dev/video15
channel 0.
At this time it appears its not possible to install more than 2 cards of this card in the same computer, the computer will detect no more than 16 BT878 chips.



Read More...

Install Final Cut Pro/Studio on Macbook

Monday, April 12, 2010
Some of you may have facing some problem when installing Final Cut Pro on older Macbook white, yes the Final Cut Pro require us to have 128 MB of VRAM - As many of you know already, in many cases Apple's 'requirements' (and installer checks) for OS's, Apps, etc. are steeper than what the software will actualy run on (although not all features may work, or performance may be poor on some hardware).

The FCS 3 Install requirements lists "ATI or NVIDIA graphics processor (integrated Intel graphics processors not supported)" and "128MB of VRAM". They also list a higher minimum res (1280x800) display recommendation than FCS2 did (1024x768 min). And there's higher "requirements" listed for some apps like Color.

I copied the entire installation disk to my hard drive and deleted the installation check file from the FinalCutPro.mpkg file. (right click/"show package contents", etc.), and then go to "Content" - "Resources" and rename "Requirement Checker" file. Then the installer ran normally. After it was installed, I had to open up the applications' packages and change the "MRCheckPro.bundle" from the respective Contents/Resources folders (this is slightly different from older versions) with the one from here.

I should note that many newer Macbooks have more than 64MB shared VRAM, so people may not have to jump through these hoops on those models.

By the way, my experience with FCS 2 on this Macbook was that "almost" everything ran perfectly -- there were one or two filters (like "Bloom") that wouldn't render, but other than that, it was virtually indistinguishable from a Macbook Pro (and I should mention I have seen Mac Pros that couldn't render the Bloom filter either). I suspect this version will be similar...

Ok, have a great ministry with your Macbook.

Read More...