Showing posts with label open source. Show all posts
Showing posts with label open source. Show all posts

Saturday, July 30, 2011

Required packages for building an Android OS on Ubuntu

Problem
You're trying to install the required packages for building a complete Android Operating System from scratch. Upon pasting the commands from the official documentation, you get the following error:

E: Couldn't find package lib32ncurses5-dev
E: Couldn't find package lib32readline5-dev
E: Couldn't find package lib32z-dev
E: Couldn't find package mingw32


Solution
The list of required packages for building an Android OS is wrong. The correct packages are:

sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev libc6-dev lib64ncurses5-dev \
x11proto-core-dev libx11-dev lib64readline5-dev lib64z-dev \
libgl1-mesa-dev g++-multilib tofrodos


Note: This has been tested on Ubuntu 10.04 (Lucid Lynx). YMMV.

Wednesday, March 16, 2011

Downgrading from PHP 5.3 to 5.2 on Debian Squeeze

Problem

You've installed PHP 5.3 on your Debian Squeeze system. Problem is, some web apps have trouble running on that version. You need to downgrade your system from 5.3 to 5.2.

Solution

Remove the PHP 5.3 packages from your system:
sudo aptitude purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`
Clean the cache just to be sure:
rm -f /var/cache/apt/archives/php5*
Use Karmiс for PHP packages:

echo -e "Package: php5\nPin: release v=karmic\nPin-Priority: 991\n" | sudo tee /etc/apt/preferences.d/php > /dev/null
apt-cache search php5-|grep php5-|awk '{print "Package:", $1,"\nPin: release v=karmic\nPin-Priority: 991\n"}'|sudo tee /etc/apt/preferences.d/php > /dev/null
Add Ubuntu Karmic to source list:

cd /etc/apt/sources.list.d
sudo wget -O karmic.list "http://pastebin.com/download.php?i=q9ya307g"
(Update, October 18, 2012: The sources list has been updated, because Ubuntu no longer supports Karmic. Please leave a comment if this still doesn't work.)

Update the package database:
sudo apt-get update
If the command above produces this error:

W: GPG error: http://security.ubuntu.com karmic-security Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5
W: GPG error: http://archive.ubuntu.com karmic Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5
W: GPG error: http://archive.ubuntu.com karmic-updates Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5
Then import the required keys and add them to your list of trusted keys:

gpg --keyserver hkp://subkeys.pgp.net --recv-keys 40976EAF437D05B5
gpg --export --armor 437D05B5 | sudo apt-key add -

gpg --keyserver hkp://subkeys.pgp.net --recv-keys 40976EAF437D05B5
gpg --export --armor 40976EAF437D05B5 | sudo apt-key add -

gpg --keyserver hkp://subkeys.pgp.net --recv-keys 40976EAF437D05B5
gpg --export --armor 40976EAF437D05B5 | sudo apt-key add -
Finally, install PHP 5.2:
sudo apt-get install -t karmic php5-cli php5-cgi libapache2-mod-php5
UPDATE: Using the Ubuntu sources to download old packages works on Debian. So far, it works on my system, but you may need to use the Debian sources just in case.

Thursday, August 05, 2010

I hate Linux part 2

OK, I was able to run SystemRescueCd's USB creator by running it in Ubuntu Lucid. The USB stick booted, but when I ran GParted, it wasn't able to detect the RAID array.

Linux = FAIL.

The point of this exercise was to run GParted in order to resize our FreeBSD's /usr partition to make way for ZFS. I allocated around ~400GB of space to that partition, but I realized that it's better to use that space for ZFS since I'll be using it for jails.

FreeBSD jails + ZFS = WIN.

I'll just copy /usr to /var, resize it, and move back /usr to the new partition. I hope this works.


(this is probably GParted's fault, but I love to troll hahaha)

Tuesday, August 03, 2010

I hate Linux


Yet another reason why I hate Linux:

SystemRescueCd, a Linux distro designed for administering or repairing a system, doesn't boot and stops with the following error:

!! Cannot find device with /sysrcd.dat. Retrying...

After a bit of googling, it turns out that this occurs because Linux can't detect the USB CD-ROM that was used to boot it. This use case isn't QA'd anymore. Apparently, the solution is to use a USB stick instead.

But what happens if you use a USB stick? It doesn't work:

[root@soulfury mnt]# mount -o loop,exec ~simoncpu/Desktop/systemrescuecd-x86-1.5.8.iso cdrom
[root@soulfury mnt]# cd cdrom
[root@soulfury cdrom]# ls
bootdisk bootprog isolinux ntpasswd sysrcd.dat sysrcd.md5 usb_inst usb_inst.sh usbstick.htm version
[root@soulfury cdrom]# bash usb_inst.sh
No valid USB/Removable device has been detected on your system

I checked the usb_inst.sh source code, and it makes some invalid assumptions on what a USB stick is. Blah. I need to sleep.

Monday, July 26, 2010

FreeBSD: Unable to find device node for dev /dev/ar0s1b in /dev

Problem:
Sysinstall can't continue and stops with the error, "unable to find device node for dev /dev/ar0s1b in /dev".

Solution:
Remove the existing partition table by writing zeros at the start of the disk:
dd if=/dev/zero of=/dev/ar0 bs=64k count=1
(replace as necessary, e.g., ad0)

Saturday, July 17, 2010

Apache: Restricting folders by IP addresses

1st Problem:
You are running an Apache server. You need to restrict access to certain folders by IP addresses.

Solution to 1st problem:
Use .htacess to deny all access to that folder, then allow certain hosts/IP addresses.

AuthName "simoncpu's dark secret"
AuthType Basic

<Limit GET POST>
order deny,allow
deny from all
allow from 10.0.0.
allow from .example.org
allow from this.is.an.example.invalid
</Limit>

2nd Problem:
Your Apache is behind a proxy such as nginx. All requests to your Apache server appear to originate from your proxy.

Solution to 2nd problem:
Install mod_rpaf and restart your web server. .htaccess will now correctly restrict access to your folders.  Refer to its web page for installation instructions.

Wednesday, June 03, 2009

Moo

simoncpu-dev:~# apt-get moo
(__)
(oo)
/------\/
/ | ||
* /\---/\
~~ ~~
...."Have you mooed today?"...
simoncpu-dev:~# aptitude moo
There are no Easter Eggs in this program.
simoncpu-dev:~# aptitude -v moo
There really are no Easter Eggs in this program.
simoncpu-dev:~# aptitude -vv moo
Didn't I already tell you that there are no Easter Eggs in this program?
simoncpu-dev:~# aptitude -vvv moo
Stop it!
simoncpu-dev:~# aptitude -vvvv moo
Okay, okay, if I give you an Easter Egg, will you go away?
simoncpu-dev:~# aptitude -vvvvv moo
All right, you win.

/----\
-------/ \
/ \
/ |
-----------------/ --------\
----------------------------------------------
simoncpu-dev:~# aptitude -vvvvvv moo
What is it? It's an elephant being eaten by a snake, of course.

Wednesday, January 21, 2009

HOWTO Revert your Git repo to a certain commit

Get the SHA1 hash of the commit that you wish to revert to.

% git log

...

commit 9ce5e10ac4fe43e9b580344454dd27172b6c4456
Author: Simon Cornelius P. Umacob
Date: Tue Jan 20 16:30:42 2009 +0800

show/hide icmp6box

commit f193cf92b2c925a2f3f71a713d766efd1e4d81e0
Author: Simon Cornelius P. Umacob
Date: Tue Jan 20 15:52:39 2009 +0800

Merge IPv6 changes

commit 1f9f2a95b7b42cf33e730535092e56e214fdb848
Author: Simon Cornelius P. Umacob
Date: Tue Jan 20 14:55:07 2009 +0800

Merge IPv6 changes

commit ce996bd3014b05fea5eaffd7c738c5c549fd7677
Author: Simon Cornelius P. Umacob
Date: Tue Jan 20 14:30:27 2009 +0800

add IPv6.inc and NetUtils.js

...

% git reset --hard ce996bd3014b05fea5eaffd7c738c5c549fd7677

HEAD now points to ce996bd3...

To go back to the "original" HEAD, find its SHA1 hash and reset your current HEAD to that state.

% git reflog
simoncpu@pfsense:/home/pfsense/simoncpu-IPv6> git reflog
74fb85b... HEAD@{0}: pull git@rcs.pfsense.org:pfsense/mainline.git: Fast forward
9ce5e10... HEAD@{1}: commit: show/hide icmp6box
f193cf9... HEAD@{2}: commit: Merge IPv6 changes
1f9f2a9... HEAD@{3}: commit: Merge IPv6 changes
ce996bd... HEAD@{4}: commit: add IPv6.inc and NetUtils.js
cfc4dab... HEAD@{5}: clone: from http://gitweb.pfsense.org/pfsense/simoncpu-IPv6.git

% git reset --hard 74fb85b

Note that you need not use the full SHA1 string to refer to an object.
The first few characters is enough.

Friday, January 16, 2009

pfSense IPv6

I'm currently merging our IPv6 changes to pfSense by hand so that I can commit our changes upstream once their migration from CVS to git is complete.

"With a thousand eyes, all bugs are shallow", they say. Sharing this code to the world will most likely uncover many bugs and make our code more stable. I just hope that with a thousand eyes, I won't receive a thousand flak from users in case I break something.

I'll probably break something. :)

UPDATE: As of January 16, 2011, development has been stopped. If you wish to continue development, please contact me (simoncpu at gmail.com) or post a bounty. Thanks! :)


(whoah, I realized that this post was made exactly 2 years ago lol)

Thursday, November 13, 2008

FreeBSD Problem: Can't see files/dirty state at each boot.

Weird problem. The filesystem is in an unclean state at each boot, even though I have ran fsck before booting the system. Initially, our problem is that our app can't "see" certain files at first read, although subsequent attempts on reading them are OK. Later, we discovered that the filesystem is dirty at each boot. The problem is similar to this issue in FreeBSD-CURRENT. We're using FreeBSD 7.0-RELEASE though, so I'm not sure if we have the same problem. I need to track this down.

Wednesday, September 10, 2008

Google Chrome Browser on Mac OS X

While waiting for a Mac OS X version of the Chrome browser, I've content myself with VMWare Fusion's Unity feature instead:


Cool, huh?

Thursday, June 19, 2008

MySQL: How to merge two databases

I'm currently managing a couple of databases in a production server. The problem: I need to know what new tables were created from Database 1 and merge them to Database 2.

Here's the solution:

0. Backup the target database.
% mysqldump -h [HOST] -P [PORT] -u [USERNAME] -p[PASSWORD] Database2 > Database2.sql

1. Extract the table names from the source and target databases.
% echo show tables | mysql -h [HOST] -P [PORT] -u [USERNAME] -p[PASSWORD] Database1 | sed '1d' > one.tables
% echo show tables | mysql -h [HOST] -P [PORT] -u [USERNAME] -p[PASSWORD] Database2 | sed '1d' > two.tables

2. Perform the merge.
% mysqldump -h [HOST] -P [PORT] -u [USERNAME] -p[PASSWORD] Database1 \
`diff --unchanged-line-format='' --new-line-format='%l ' two.tables one.tables` | \

mysql [HOST] -P [PORT] -u [USERNAME] -p[PASSWORD] Database2

Wednesday, June 04, 2008

Unix/Linux Tip: Syntax check your PHP files

If you wish to syntax check (lint) all the PHP files in your current directory, simply do:
    for i in `ls *.php`; do
        php -l $i
    done

Thursday, May 29, 2008

Fedora/Redhat Linux: C/C++ : unfound library "mysql.h"

If you encounter this problem while compiling an application that links to MySQL, you can fix this by simply installing mysql-dev:
    # /etc/init.d/mysqld stop
    # yum install mysql-dev

Saturday, April 26, 2008

FreeBSD Tip: How to delete all IPv6 address in an interface

You can delete all IPv6 addresses in an interface using the following command (vanilla Bourne shell):

while i="`ifconfig le0 | grep inet6 | grep -m 1 -v '%'`"; do
ifconfig le0 $i delete
done
Note: replace le0 with your interface name.

Friday, April 25, 2008

Bridge problem with FreeBSD 7.0-RELEASE

Problem
The FreeBSD Handbook states that "if the bridge host needs an IP address, then the correct place to set this is on the bridge interface itself rather than one of the member interfaces."

With FreeBSD 6.x and FreeBSD 8.0-CURRENT, setting the IP address on the bridge works without any problem. With FreeBSD 7.0-RELEASE, however, this does not work. The OS doesn't even properly boot when the IP address is set via /etc/rc.conf.

Solution
This is probably a temporary solution, but try setting the IP address to one of the member interface. This is in direct opposition to the advice given in the Handbook, but it works for me.

If this is a bug (which I suspect it is), a patch probably exists somewhere. Please feel free to leave a comment.

Friday, April 18, 2008

JPEG support for ImageMagick

Problem
On Debian Linux, there seems to be no out-of-the-box support for JPEG in ImageMagick.

Solution
First, install libjpeg62-dev library. libjpeg62 doesn't work because it doesn't include the necessary development files. Next, download ImageMagick's source and compile it manually. Use ./configure --with-jpeg=yes for configuring.

Tuesday, April 08, 2008

OpenLaszlo IDEforLaszlo Eclipse plugin


Syte GMBH has provided an update for IDEforLaszlo plugin to support OpenLaszlo 4.0.10 and OpenLaszlo 3.4. IDEforLaszlo has been stale for quite some time now, and I'm glad that someone has offered their time and effort for this project. I'll be checking it out later.

IDEforLaszlo can be found at http://www.syte.ch/en/laszlo.xml.

Thursday, March 20, 2008

dnsmasq: unknown interface xennet0

As of version 2.41, dnsmasq doesn't support Xen virtual network interfaces in NetBSD. This means that running dnsmasq inside a Xen domU results in the following error:

dnsmasq: unknown interface xennet0

Uberlord made a patch just a few moments ago:
- http://roy.marples.name/~roy/dnsmasq-netbsd.patch
- http://roy.marples.name/~roy/dnsmasq-bridge.patch

The beauty of Open Source... =)