Category Archives: Computer

All Computer Stuff

How to compile the client of Bacula 5.0.2 on Mac OS X Snow Leopard 64bit

After a fiddling around quite a while I finally managed to compile a working 64bit client of Bacula 5.0.2 for Mac OS X Snow Leopard (10.6.4).

After downloading the source tar.gz from http://www.bacula.org you would untar the file, enter the directory – and there is a special make command make -C platforms/osx to compile the client. This does not work on 10.6.4 and not with 64bit.

My patch (bacula-5.0.2-snowleopard-64bit.patch.gz) can be applied as follows:

  • Download bacula-5.0.2.tar.gz from http://www.bacula.org
  • tar xvzf bacula-5.0.2.tar.gz
  • cd bacula-5.0.2/platforms/osx
  • zcat ../../../wherever_you_saved_the_patch/bacula-5.0.2-snowleopard-64bit.patch.gz | patch -p1
  • make dmg

You will then find a mountable DMG within the products directory.

My patch is changing the following:

  • Runs the file daemon as root after startup of the system
  • Creates the config file with a director name of bacula-dir – to change this edit the file resources/postflight.in AFTER patching and replace bacula-dir by your_director_host-dir. This way all your clients already know the director host!
  • Compiles a native 64bit executable under 10.6.4 with current SDKs

Hope this will help others!

iPhone refusing to re-pair with headset

For whatever reason today my iPhone and my Sennheiser MM 450 did not want to communicate with each other anymore via Bluetooth. I managed to factory reset my headset, but of course wanted to avoid this on my iPhone. But no chance, no new pairing happened and I could not get rid of the old entry of the headset in my iPhone list.

After a lot of searching and playing around I found two files on the iPhone you have to edit:

Convert the first file into editable XML format:

plutil -convert xml1 /private/var/mobile/Library/Preferences/com.apple.MobileBluetooth.devices.plist

Here you will find your device’s MAC address (00:16:94:09:AA:AA) which you will need for the second file:

sqlite3 /Library/Keychains/keychain-2.db

Look for your MAC address in the output of the command

select * from genp;

It will look like this:

54||||||||||||||00:16:94:09:AA:AA|MobileBluetooth||h######a;#########9Hx###fd######a####zo####

To remove that line having a 54 in the first column (with name rowid), enter

delete from genp where rowid=54;

and your iPhone will not know how to talk to your headset anymore and ask for re-pairing.

Of course you will need to have a JB iPhone and the packages com.ericasadun.utilities and sqlite3 available via Cydia!

I hope this saves you a reset of your networking settings as it did for me!

How to compile Bacula FD 2.2.8 on Mac OS X 10.6 Snow Leopard

First patch the original source code with this:

--- ./src/filed/restore.c-orig 2009-11-06 10:20:57.000000000 +0100
+++ ./src/filed/restore.c 2009-11-06 10:22:43.000000000 +0100
@@ -153,7 +153,7 @@
uint32_t buf_size; /* client buffer size */
int stat;
ATTR *attr;
- intmax_t rsrc_len = 0; /* Original length of resource fork */
+ int64_t rsrc_len = 0; /* Original length of resource fork */
r_ctx rctx;
/* ***FIXME*** make configurable */
crypto_digest_t signing_algorithm = have_sha2 ?
@@ -547,7 +547,7 @@
continue;
}

- rctx.fork_size = rsrc_len;
+ rctx.fork_size = (intmax_t)rsrc_len;
Dmsg0(30, "Restoring resource fork\n");
}

--- ./src/findlib/find.c-orig 2009-11-06 10:23:34.000000000 +0100
+++ ./src/findlib/find.c 2009-11-06 10:24:18.000000000 +0100
@@ -67,13 +67,13 @@

/* Get system path and filename maximum lengths */
path_max = pathconf(".", _PC_PATH_MAX);
- if (path_max < 1024) { - path_max = 1024; + if (path_max < 2048) { + path_max = 2048; } name_max = pathconf(".", _PC_NAME_MAX); - if (name_max < 1024) { - name_max = 1024; + if (name_max < 2048) { + name_max = 2048; } path_max++; /* add for EOS */ name_max++; /* add for EOS */ --- ./src/lib/base64.c-orig 2009-11-06 10:17:36.000000000 +0100 +++ ./src/lib/base64.c 2009-11-06 10:19:12.000000000 +0100 @@ -74,9 +74,9 @@ * stored (not including the EOS). */ int -to_base64(intmax_t value, char *where) +to_base64(int64_t value, char *where) { - uintmax_t val; + uint64_t val; int i = 0; int n; @@ -98,7 +98,7 @@ val = value; where[i] = 0; do { - where[--i] = base64_digits[val & (uintmax_t)0x3F]; + where[--i] = base64_digits[val & (uint64_t)0x3F]; val >>= 6;
} while (val);
return n;
@@ -112,9 +112,9 @@
* Returns the value.
*/
int
-from_base64(intmax_t *value, char *where)
+from_base64(int64_t *value, char *where)
{
- uintmax_t val = 0;
+ uint64_t val = 0;
int i, neg;

if (!base64_inited)
@@ -131,7 +131,7 @@
val += base64_map[(uint8_t)where[i++]];
}

- *value = neg ? -(intmax_t)val : (intmax_t)val;
+ *value = neg ? -(int64_t)val : (int64_t)val;
return i;
}

--- ./src/lib/protos.h-orig 2009-11-06 10:19:28.000000000 +0100
+++ ./src/lib/protos.h 2009-11-06 10:28:46.000000000 +0100
@@ -42,8 +42,8 @@

/* base64.c */
void base64_init (void);
-int to_base64 (intmax_t value, char *where);
-int from_base64 (intmax_t *value, char *where);
+int to_base64 (int64_t value, char *where);
+int from_base64 (int64_t *value, char *where);
int bin_to_base64 (char *buf, int buflen, char *bin, int binlen,
int compatible);

Then configure using

./configure --prefix=/usr/local --enable-client-only --with-openssl --with-working-dir=/var/db/bacula --with-pid-dir=/var/run

Run make && sudo make install

Configuration and the like can be found here

Enjoy!

Disable “Call forwarding”/”Call forwarded” message on iPhones

If you are using an unlocked iPhone, you might be getting messages telling you that this call is being forwarded in either direction. You always have to press the OK button to get rid of them – annoying.

To switch this off, you need a JB phone. Then you can log in to the phone using SSH and either convert the file

/System/Library/Carrier Bundles/Unknown.bundle/carrier.plist

so that two keys get different values:

[code lang=”xml”]ShowCallForwarded

ShowCallForwarding
[/code]

A final reboot is needed.

You can do this by converting the binary file into XML using plutil before editing – but if you have that tool already installed you can use the easier method

[code]cd /System/Library/Carrier Bundles/Unknown.bundle/
plutil -key ShowCallForwarding -setvalue 0 carrier.plist
plutil -key ShowCallForwarded -setvalue 0 carrier.plist
reboot[/code]

HTH!
Kic

Use automounter on Mac OS X with Linux exports

To be able to automount NFS exports of Linux servers on Mac OS X machines, you have to edit /etc/auto_master and add the option resvport so that the line looks like this:

/net                    -hosts          -nobrowse,nosuid,resvport

VGA modes when booting the Linux kernel

Use these modes in the kernel boot parameters list with vga=0x317 for 800x600x16, more in the table:

 Colours   640x400 640x480 800x600 1024x768 1152x864 1280x1024 1600x1200
  -------+--------------------------------------------------------------
  4 bits |    ?       ?     0x302      ?        ?        ?         ?
  8 bits |  0x300   0x301   0x303    0x305    0x161    0x307     0x31C
 15 bits |    ?     0x310   0x313    0x316    0x162    0x319     0x31D
 16 bits |    ?     0x311   0x314    0x317    0x163    0x31A     0x31E
 decimal |           d785    d788     d791
 24 bits |    ?     0x312   0x315    0x318      ?      0x31B     0x31F
 decimal |           d786    d789     d792
 32 bits |    ?       ?       ?        ?      0x164      ?