Wednesday, 24 May 2006

DVD backups

Ah, the joy of living next to Asia. Plenty of DVDs on "promotion". Good samaritan that I am, I offered a work colleague to backup some of his movie DVDs. I didn't want to carry them all home, so I decided to rip as many as I could to my notebook and carry the rest home.

After fiddling a lot with dvd::rip, trying to get all its dependencies to work, I found this. The little program, dvdbackup.c, compiles and works beautifully, just as the instructions advertise. I only had only little problem with the libdvdread - the intructions says it will work with version 0.93 and above, which is not true because function prototypes have changed. I downloaded version 0.93 and it worked like a charm.

The program creates a DVD structure on the output directory, which I'm hoping to burn when I get home, where I have a fully-equipped DVD "backup" station.

Tuesday, 23 May 2006

Information vs In formation

I have always been wary of MS Word's spell and grammar checker: it keeps telling me I'm wrong when I try to be a little more sophisticated. As a non-native English speaker I end up caving in.

So I'm writing a documentation and didn't want to use the word "information" again. I asked MS Word for synonyms suggestions. I almost fell from my chair.

Wednesday, 20 April 2005

DHCP on ISA Server

Bad idea, it doesn't work out-of-the box. Even if you enable it on the system policies. There's probably a way to do it, but must be much easier to pick another victim server.

Learned it the hard way. I deserved it. Stupid idea.

Tuesday, 19 April 2005

Creating a domain controller on a remote site

I should have learned a lot from yesterday's struggle, but sadly this ain't the truth. The truth is: I got the thing working (almost, you'll see) but I still don't know the main cause of the problem. I have a gut feeling DNS has a rotten finger on this, but I still have to prove it.

To the layout, then.

Site 1:
- ADSL link
- 192.168.0.0/24 network
- 1 domain controller which also runs DNS
- 1 DHCP server
- Linux firewall (iptables)

Site 2:
- adsl link
- 192.168.10.0/24 network
- ISA server firewall which also runs DNS and DHCP

Both sites communicate using a PPTP VPN initiated by the ISA Server. I'll cover the details on a separate post. For now, suffice to say I can route packets between both networks.

Step 1: install windows 2003
Our new DC server hasn't arrived yet, but as I needed it on the new site badly I created a VMWare virtual machine with 512Mb RAM and 15Gb disk to host the DC temporarily.

Step 2: create active directory backup
This is a cool new feature on Windows 2003 domain controllers. Instead of doing the first AD replication using your slow WAN link, it allows you to create a backup and use it to perform the installation. Afterwards it'll only synchronize what changed between the backup creation and the DC creation.
Just open the windows backup tool on any existing domain controller and create a backup from the system state:



Save the backup file in your favorite media, hop on your station wagon and head to Site 2.

Step 3: extract the backup
Just restore the file you created to a specific location. Be careful not to restore to the original location - this would be a little set back. I just extracted the whole thing to C:\AD

Step 4: promote the new server
You have to use the "/adv" switch so dcpromo.exe will ask you wheter you want to synchronize active directory using the network or provide a file location.

Step 5: lean back and watch

the errors!

On a fantasy world the wizard would just go on its business and deliver you a nice new DC. But on my world I kept getting those errors, no matter if I used the AD backup or copied everything again using the network.

Sometimes the wizard would say it couldn't read the files in C:\AD\Active Directory and, to my surprise, they really weren't there. I gave up after a few times restoring the backup and trying again.

What did it for me was: I created a dial-up VPN on the server I was trying to promote. From the error messages I could gather that there was some communication problem with the AD (I don't even wanna go into the disappearing files issue) and so I tried to bypass the ISA VPN using a dial up on the server itself.

I was still left with a few issues: the AD synchronization wasn't working and the new server entry in the MSDC DNS couldn't be created. I solved those with the help of the tools in the Windows 2003 CD, google and a bunch of KB articles.

Oh yeah. One last thing is worth mentioning. This domain was renamed around 6 months ago. Since then we've been seeing a lot of strange things. Keep alert for our next post: starting a domain from scratch because the domain renaming thingamabob dosn't work oh-so-well.

Could not find the domain controller for this domain

This one is still unsolved:



Got it while promoting a windows 2003 server to DC in another network. Sheesh. With a few cans on coke, lots of coffee and long hours sitting here I hope to have a post witht he answer.

PS: sorry for the long time without any posts.

Update 1 (22:43):
It seems to show the above error message rigth after doing this:



It's hard to see exactly what it shows right before the error message because all the steps take such a long time without showing any signs of progress. :(

Update 2 (00:58):
Beat the sucker! tomorrow I'll explain what the problem was. Well, actually I didn't find out what the problem is, but I did find a way to overcome it. Don't miss it!

Saturday, 6 November 2004

Philips DVP530 - Region Free

Not really about computer software, but I found it really useful, so I'm posting it here so other people can benefit. The guy at the store said the Phillips DVP-530 could play DVDs from any region, but at home I couldn't. The lady at the customer hot-line confirmed this, but the Internet helped me. Here's how to do it (taken from DVD.box.sk):

Press "System Menu" key to enter Set Up menu.
- Move to "Preference Page" using arrow keys to the left or to the right.
- Press the following sequence in the remote control: 135566
- A menu indicating "Region Code" will appear.
- Change region using arrow keys to top or down. Region Code = 0 will play all regions.
- Press "System Menu" key to exit Set Up menu.

That's the second and last time Phillips deceives me (cheat me once shame on you, cheat me twice shame on me): the first was when I bought a stereo TV that doesn't have SAP (second audio program). Dumbfucks.

Hey, google! index this in portuguese, please: DVD Phillips DVP-530 (DVP530) tocar DVD de outras regiões, trocar região do DVD, trocar zona do DVD.

Thursday, 28 October 2004

Standards standars standards

Ever tried using openssl on linux to sign a certificate created by the windows wizard?

bash$ openssl x509 -days 900 -CAserial ca.serial -CA ca.crt -CAkey ca.key -in brew.xxx.com.br.csr -req -out brew.xxx.com.br.crt
14931:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:632:Expecting: CERTIFICATE REQUEST
bash$

Dog gamn it! I think, what the fuck. The CSR seems okay:
bash$ cat brew.xxx.com.br.csr
---BEGIN NEW CERTIFICATE REQUEST-----
(... bunch of encoded, standard stuff)
-----END NEW CERTIFICATE REQUEST-----

Hmm. Let's try again. Maybe openssl didn't get it right the first time:

bash$ openssl x509 -days 900 -CAserial ca.serial -CA ca.crt -CAkey ca.key -in brew.xxx.com.br.csr -req -out brew.xxx.com.br.crt
14931:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:632:Expecting: CERTIFICATE REQUEST

Shit, man. Let's check an openssl generated CSR:

$ diff brew.xxx.com.br.csr intranet.csr
1,2c1,2
< ---BEGIN NEW CERTIFICATE REQUEST----- <> -----BEGIN CERTIFICATE REQUEST-----
> MIIC9TCCAd0CAQAwga8xCzAJBgNVBAYTAkJSMRcwFQYDVQQIEw5SaW8gZGUgSmFu
4,22c4,18

Whoa! it seems that CSRs created on windows have "NEW" on the header. That's good, because I could wind up signing the "OLD" certificate request.

bash$ sed "s/NEW //g" brew.xxx.com.br.csr > brew.xxx.com.br.csr2
bash$ openssl x509 -days 900 -CAserial ca.serial -CA ca.crt -CAkey ca.key -in brew.xxx.com.br.csr -req -out brew.xxx.com.br.crt
Signature ok
subject=/C=BR/ST=Rio de Janeiro/L=Rio de Janeiro/O=nXXX Ltda/OU=Operacoes/CN=brew.xxx.com.br
Getting CA Private Key

So, lesson of the day: if you are trying to sign a certificate request created on windows using openssl, be sure to strip off the "NEW" from the header. Works ok!

Tuesday, 28 September 2004

Hardlinks 101

It was late, I was tired and needed to keep more than 2 rotated logs of Resin's stderr file. By default it only saves 3: stderr.log (the one it is writing to), stderr.log.1 and stderr.log.2 (the last two most recent copies).

I didn't want to dig through all the documentation and I still don't want to. In fact, the solution I found is still in place. I must confess, the solution wasn't mine, but my from a work colleague of mine, Dom. He is the kind of guy who comes up with the weirdest stuff using named pipes, hardlinks and whatever they stuffed in his head on university classes.

Anyway, he suggested I kept count of the number of hardlinks to the file. As you may well know, the EXT3 filesystem keeps the number of references to a file, and when this number equals 0, the space is marked as free (or, if you prefer, the file is "deleted" - the data is still there, and theoretically you can recover it, but only the gurus at bugtraq know how to do it).

So I came up with this little script, that I believe sums up pretty well the elegance and simplicity of *nix.





#!/bin/bash

LOGDIR='/usr/java/resin/log'
PH='stderr.placeholder'

cd $LOGDIR

if [ ! -r $PH ]; then
echo $PH not found - trying to create link
if [ -r "stderr.log.2" ]; then
ln stderr.log.2 $PH
if [ $? -eq 1 ]; then
echo error trying to create hardlink - bailing out
exit 1

fi
else

echo stderr.log.2 does not exist yet - bailing out
exit 0
fi
fi

HLCNT=`stat -c %h stderr.log.2`
if [ $HLCNT -eq 1 ]; then
cat $PH >> stderr.$(date +%Y%m%d)
rm -f $PH
ln stderr.log.2 $PH
fi


The first big block of code just checks to see if the placeholder for the stderr.log.2 file already exists. If it then tries to create it.

The real magic happens from HLCNT and beyond. This variable will hold the results of the stat comand, enclosed in ``s, which is the number of hardlinks to the stderr.log.2 file data. This is normally 2: one for the hardlink the script created (and pointed by the file stderr.placeholder) and the other is for the stderr.log.2 file itseld.

When resin rotates the logfile, the hardlink count drops to 1, because now only stderr.placeholder points to the data. That happening, the script then concatenates the file contents to another file, which will hold all the data for the day. Voilà. Thanks to my buddy Dom I could go home without reading wads of documentation. :)

Friday, 17 September 2004

winmail.dat

The dreaded, hated attachment:



Fear no more! Project TNEF saves the day.

Can someone please explain me why the fuck MS needs to "embrace and extend" even a simple thing as email attachment. Instead of using mime to attach a file as everyone else, MS uses mime to attach a file in a proprietary format. That makes me a sad, sad panda.

Thursday, 16 September 2004

Over 20 Years of High-Tech Marketing Disasters

After reading Chapman's In Search of Stupidity, I suddenly stopped feeling bad for Amazon (not that I really ever did). I was looking at book a friend recommended (yes, I linked to B&N, yes I can hold a grudge) and tried to check out a sample of the book. I was awarded with this one:




They are "please to offer"? What they need is a new spin doctor because that one didn't work on me.

Let me get this straight. They want my credit card number so I can look at a book? What is this, some sort of ransom? of show me yours and I'll show you mine? sheesh. I guess it's pretty useless, but I left a comment anyways:




The typos were made in the heat of the moment - I hope I don't get a grammar-nazi to read my message.

Thursday, 2 September 2004

pinfo date

I was going to check the manual for "date (1)" to write a simple script and I'm gifted with this beautiful quote:

Gotta love open-source software. The comments on the linux kernel alone have appeased my boredom many times.

Wednesday, 1 September 2004

MSN on Gaim

So I installed MSN on my Win XP VMWare machine because gaim kept crashing. Now MSN crashes on Windows. Cool, eh? Guess I'll just stick with ICQ.

Update: MS says this issue has been fixed on SP2. Gonna give it a try, but somehow I get the feeling SP2 will breed a few posts of its own.

Monday, 30 August 2004

Online Crash Analysis

Ever been gifted with a stop error on Windows 2003? This is not a rant, as I am 99% sure the error was due to crappy hardware. When I logged in one of our W2K3 Servers the system presented the usual screen that demands explanations of why it was so unpolitely shut down.

It pleased me to see that itself knew about the stop error and already provided the explanation. Even better, it asked me to send Microsoft a complete memory dump, so they can try and find out what the problem was. Here is a snip of what the upload interface looks like (it's web based):



It's gonna be sweet make MS waste their time to find out I have a bad memory card :-).

Local users and groups


Free translation: "Local users and groups. It is not possible to access the computer CARECA. Error: the wrong disk is in the drive. Insert disk %2 (Volume serial number: %3) in drive %1.

Saturday, 28 August 2004

Friday, 27 August 2004

Services For Unix - NFS Client: First Blood, Part II

I dare you to change the default file creation permissions from 755 to something which doesn't have the execute bit set.

Alright, I don't know much about NFS, but isn't there a way to find out if the file you are acessing is a regular file or a directory? Because once you remove that execute bit from the permissions you can no longer search in directories, resulting in a nice "Access denied" for the folder you've just created.

Maybe there should be different options for files and folders. But that's my humble opinion. Anyway, I'm stuck with regular files looking like -rwx-r-x-r-x on my directory listings. I've always wanted to execute a windows backup file on Linux!

Services For Unix - NFS Client

Hooray, a NFS client! just try and use it with robocopy:

2004/08/27 09:56:49 ERROR 5 (0x00000005) Time-Stamping Destination File c:\backup\BlackFishWapBKP.BAK
Access is denied.

SQL Server 2000 - Operator alerts

So here I am, trying to get MSSQL 2000 to send a simple email alert whenever it finishes a backup job. The interface looks very intuitive, but how the hell do I set up a MAPI profile for the user running SQL Server?

Wading through the documentation I quickly find out that I need to have either Outlook (not express - I tried that one, no good) or Exchange Client installed. Now why is that? Do I really have to cripple my already loaded server with Office so I can receive a simple email?