Posts Tagged ‘linux’

Posted by Kent at 3 January 2010

Category: Dev

Tags: ,

rpm --rebuilddb

Popularity: 16% [?]

Posted by Kent at 14 October 2009

Category: Ikke interessant

Tags: ,

set background=dark
set tabstop=4
set showmatch
set showcmd
set autowrite
""""""""""""""""""""""""""""""""""""""""""""""""""
"                 Color scheme                   "
"                 "                                                "
"                 """"""""""""""""""""""""""""""""""""""""""""""""""

" Some custom color modifications.  reference :help highlight and
" :help  cterm
highlight ModeMsg cterm=bold ctermfg=2 ctermbg=black    " set mode message ( --INSERT-- ) to green
highlight StatusLine ctermfg=7 ctermbg=9               " set the     active statusline to black on white
highlight StatusLineNC ctermfg=8 ctermbg=9              " set   inactive statusline to black on grey
syntax on

Popularity: 3% [?]

Posted by Kent at 11 June 2009

Category: Dev, Tip

Tags: , ,

mdadm --assemble /dev/md0 /dev/sd[abcd]1

Popularity: 3% [?]

Posted by Kent at 21 February 2009

Category: Dev

Tags: , , ,

If you’re on a system as a user and with no means of installing custom libraries or updating libraries for your custom program, you can load your own libraries with this simple command.

$ ./executable
./executable: error while loading shared libraries: libcurl.so.4: cannot open shared object file: No such file or directory

Use ldd to find out what missing libraries you have:

$ ldd executable
        linux-gate.so.1 =>  (0xa942d000)
        libncursesw.so.5 => /lib/libncursesw.so.5 (0xa93e9000)
        libcurl.so.4 => not found
        librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0xa93df000)
        libssl.so.0.9.8 => /usr/lib/i686/cmov/libssl.so.0.9.8 (0xa939d000)
        libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xa9399000)
        libz.so.1 => /usr/lib/libz.so.1 (0xa9384000)
        libcrypto.so.0.9.8 => /usr/lib/i686/cmov/libcrypto.so.0.9.8 (0xa9241000)
        libsigc-2.0.so.0 => /usr/lib/libsigc-2.0.so.0 (0xa923b000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xa9148000)
        libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xa9123000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xa9118000)
        libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xa8fc9000)
        libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xa8fb0000)
        /lib/ld-linux.so.2 (0xa942e000)

Copy over your libcurl.so.4 to the system and invoke your custom executable with:

$ LD_PRELOAD=./libcurl.so.4:./libexecutable.so.11 ./executable

Separate different libraries with a colon (:).

Popularity: 3% [?]

Posted by Kent at 30 January 2009

Category: Dev, Tip

Tags: , , , , ,

This is a brief guide on how to set up Subversion with Trac on Apache with commit-mails sent with SVN::Notify Perl module.

First of all, we need to install some software.

# emerge -av subversion apache

When everythin has installed fine, continue.

Create a repository somewhere.

# cd /var/svn/
# svnadmin create test
# ll
drwxr-xr-x  6 root   root   4.0K 2009-01-30 12:56 test

Change the permissions to apache:apache and rights 770:

# chown apache:apache test -R && chmod 770 test -R
# ll
drwxrwx---  6 apache apache 4.0K 2009-01-30 12:56 test

Our repository root is at /var/svn/test and our Subversion root is /var/svn.

Two more files are needed if you are doing HTTP Authentication, /var/svn/htpasswd and /var/svn/authz.

Create the htpasswd file with htpasswd2.

# htpasswd2 -c htpasswd username

The authz file looks like this (with the defaults).

[groups]
# harry_and_sally = harry,sally

[/]
username = rw
* =

# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r

Our next step is to configure Apache to work with Subversion.

Open up/etc/conf.d/apache2 and make sure APACHE2_OPTS contains “-D SVN -D SVN_AUTHZ -D PHP5 -D DAV”.

If you’re doing a SVN repository with authentication, I’d advise you to use SVN over SSL (HTTPS).

If we want to use svn.example.com as our Subversion repository URL, our Apache config should look like:

<VirtualHost *:443>
    ServerName svn.example.com
    #Include /etc/apache2/vhosts.d/default_vhost.include
    ErrorLog /var/log/apache2/ssl_error_log

    <IfModule log_config_module>
        TransferLog /var/log/apache2/ssl_access_log
    </IfModule>

    <Location />
        AuthType Basic
        AuthName "Subversion repository and Trac"
        AuthUserFile /var/svn/htpasswd
        Require valid-user
        SSLRequireSSL

        DAV svn
        SVNParentPath /var/svn/
        BrowserMatch "SVN" redirect-carefull
        AuthzSVNAccessFile  /var/svn/authz
        SVNListParentPath on
    </Location>

    DocumentRoot "/var/www/localhost/htdocs"
</VirtualHost>

If everything is successful, you’ll be able to access your subversion repository at https://svn.example.com/test.

Final touch is the Perl module SVN::Notify. Fire up CPAN.

# cpan

cpan shell -- CPAN exploration and modules installation (v1.9301)
ReadLine support enabled

cpan[1]> install SVN::Notify
cpan[2]> install HTML::Entities

Enter your SVN hooks directory.

# cd /var/svn/test/hooks

And copy the post commit template to post commit.

# cp post-commit.tmpl post-commit
# vim post-commit

Make sure the following lines are present:

REPOS="$1"
REV="$2"

export LANG="nb_NO.UTF-8" # optional
/usr/bin/svnnotify --repos-path "/var/svn/test" --revision "$REV" --svnlook /usr/bin/svnlook --sendmail /usr/sbin/sendmail --to mail@example.com --from svn@example.com --with-diff --reply-to no-reply@example.com --linkize --handler HTML::ColorDiff --smtp localhost --svn-encoding "UTF-8"

Whenever someone does a commit, a mail with the colored diff is sent out to the recipients.

Popularity: 100% [?]

Posted by Kent at 9 December 2008

Category: Dev, Tip

Tags: , , , , ,

After being puzzled by this error for some time, I finally was able to solve it with lots of help from my friend Simeon. GTK+ ./configure failed both on emerge gtk+ and on a manual source build with these errors.

configure:33559: gcc -o conftest -g -O2 -Wall -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/pixman-1       conftest.c -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0    >&5
/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../libcairo.so: undefined reference to `XRenderFindStandardFormat'
/opt/blackdown-jdk-1.4.2.03/jre/lib/i386/libXrender.so.1: undefined reference to `XMissingExtension'
/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../libcairo.so: undefined reference to `XRenderQuerySubpixelOrder'
/opt/blackdown-jdk-1.4.2.03/jre/lib/i386/libXrender.so.1: undefined reference to `XextRemoveDisplay'
/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../libcairo.so: undefined reference to `XRenderSetPictureFilter'
/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../libcairo.so: undefined reference to `XRenderCompositeTrapezoids'
/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../libcairo.so: undefined reference to `XRenderCompositeText32'
/opt/blackdown-jdk-1.4.2.03/jre/lib/i386/libXrender.so.1: undefined reference to `XextFindDisplay'
/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../libcairo.so: undefined reference to `XRenderCompositeText16'
/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../libcairo.so: undefined reference to `XRenderCompositeText8'
/opt/blackdown-jdk-1.4.2.03/jre/lib/i386/libXrender.so.1: undefined reference to `XextAddDisplay'
/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../libcairo.so: undefined reference to `XRenderSetPictureTransform'
collect2: ld returned 1 exit status
configure:33566: $? = 1

While installing cairo, I got these warnings:

/sbin/ldconfig: /opt/blackdown-jdk-1.4.2.03/jre/lib/i386/libXxf86vm.so.1 is not a symbolic link
/sbin/ldconfig: /opt/blackdown-jdk-1.4.2.03/jre/lib/i386/libXxf86misc.so.1 is not a symbolic link
/sbin/ldconfig: /opt/blackdown-jdk-1.4.2.03/jre/lib/i386/libXxf86dga.so.1 is not a symbolic link
/sbin/ldconfig: /opt/blackdown-jdk-1.4.2.03/jre/lib/i386/libXv.so.1 is not a symbolic link
...

I found this:

grep -R VMHANDLE /etc/
/etc/csh.env:setenv VMHANDLE 'blackdown-jdk-1.4.2'
/etc/env.d/20java:VMHANDLE=blackdown-jdk-1.4.2
/etc/profile.env:export VMHANDLE='blackdown-jdk-1.4.2'
/etc/profile.csh:setenv VMHANDLE 'blackdown-jdk-1.4.2'

Opened up /etc/env.d/20java and commented everything. Then I did:

env-update
source /etc/profile

And I did:

emerge -av cairo gtk+

Which resulted in GTK+ being correctly configured, compiled, linked and installed!

Popularity: 3% [?]