Browny's Grotto :: http://www.clan-elite.info/

News headlines

News articles

Virgin Media, Time Capsule, VPN, oh my!
- Posted 19th of May 2010, 2:28 pm by Mr.Brownstone

I recently signed-up for Virgin Media's 50Mb broadband and had a couple of problems setting it up.

1. Using Time Capsule as the main router.
2. Connecting to PPTP VPN servers.

I wanted to use my Time Capsule instead of the Virgin-supplied DLink DIR-615 as my main router, but since I couldn't get it to work at the time of installation I gave up and used the DLink instead.

This worked fine, until I tried to use PPTP-based VPN, which (as far as I can tell) just can't be configured to route through this device. In spite of efforts to configure port-forwarding and replacing the "Virgin" firmware with the latest DLink firmware, I just couldn't get PPTP to work.

But when the Virgin Media Cable Modem was connected directly to the laptop (instead of into the DLink Router) PPTP worked fine, so I knew that it was at least supported by the ISP.

I decided to try my luck with the Time Capsule again...

Solution

It turns out the only thing I didn't try back on installation-day was to reboot the Cable Modem after I had connected it to the Time Capsule. Before I had done so I got warnings in AirPort Utility about being "Double NAT'ed" or simply unable to see an Internet connection.

So I simply plugged the Cable Modem into the Time Capsule "Internet" port, rebooted the Modem (you may need to wait 5 minutes between powering it off then on in order to clear the current lease), opened AirPort Utility and configured the Time Capsule to "Share a public IP address." It works perfectly!

Comments on this article: 2
Last comment by: Mr.Brownstone, 15th of July 2010, 5:14 pm
- [ Back to top ] -

Switch between Time Machine disks using the OS X Terminal
- Posted 14th of May 2010, 10:34 am by Mr.Brownstone

For each Time Machine disk you have, do the following:

1. Manually set the Time Machine disk using System Preferences.

2. Open a Terminal and use the following command to get the 'alias' for the current backup disk:

Bash Script:
defaults read /Library/Preferences/com.apple.TimeMachine BackupAlias

3. The alias takes the form of a long string bookmarked with angle-brackets: < ...lots of stuff... >

Create your bash-scripts using the following template. Paste-in the alias you retrieved using the command above:

Bash Script:
#!/bin/bash
defaults write /Library/Preferences/com.apple.TimeMachine BackupAlias '< ...lots of stuff... >'

# Force backup
sleep 5
/System/Library/CoreServices/backupd.bundle/Contents/Resources/backupd-helper -auto &

The single-quotes are important! Don't forget to wrap your alias with them.

4. You're done! You may be interested in MarcoPolo to automate running your scripts (scroll to the bottom of the page for notes on Snow Leopard support): http://www.symonds.id.au/marcopolo/

Source: http://blog.liip.ch/archive/2009/01/20/automatically-switching-between-different-time-machine-disks.html

Comments on this article: 0
Last comment by: Mr.Brownstone, 14th of May 2010, 10:34 am
- [ Back to top ] -

Configure MySQL replication with existing data
- Posted 11th of September 2009, 3:19 pm by Mr.Brownstone

After browsing the MySQL documentation and various how-tos, I've come up with this simple procedure to get up and running with MySQL replication on Ubuntu Server with as few steps as possible.

That means that no, you don't have to lock the master database for ages while you mess about with the command-line. Neither do you have to use SHOW MASTER STATUS; and write down the names of binlogs or their indexes. mysqldump can do that for you.

This guide assumes the reader is familiar with using the -u and -p switches to access the root MySQL user when running the mysql and mysqldump commands, and that the reader is able to use sudo to elevate their privileges appropriately.

MASTER

1. Create a user for replication:

Bash Script:
mysql> GRANT REPLICATION SLAVE ON *.* TO 'repl'@'slave.domain' IDENTIFIED BY 'password';
mysql> FLUSH HOSTS;
mysql> FLUSH PRIVILEGES;

2. Configure MySQL binary-logging:

sudo nano -w /etc/mysql/conf.d/master.cnf
Plain-Text:
[mysqld]
bind-address=0.0.0.0
server-id=1
log_bin=/var/log/mysql/mysql-bin.log
sync_binlog=1
innodb_flush_log_at_trx_commit=1

3. Restart MySQL server:
Bash Script:
sudo /etc/init.d/mysql restart

4. Take a snapshot of the MASTER database, flushing logs and saving binlog position, locking tables only for the duration of the dump, and doing so in a single transaction:
Bash Script:
shell> mysqldump -u root -p --databases db1 db2 --master-data --flush-logs --single-transaction > snap.db

# Transfer the dump to the SLAVE
shell> tar zcvf snap.tgz snap.db
shell> sftp user@slave.domain
put snap.tgz
exit

SLAVE

1. Configure and restart MySQL:

sudo nano -w /etc/mysql/conf.d/slave.cnf
Plain-Text:
[mysqld]
server-id=2
replicate-do-db=db1
replicate-do-db=db2
binlog-ignore-db=mysql
binlog-ignore-db=information_schema
binlog-ignore-db=test

2. Restart MySQL server:
Bash Script:
shell> sudo /etc/init.d/mysql restart

3. Finish SLAVE configuration and import database:
Bash Script:
# Extract snap.db from gzipped tarball
shell> tar zxvf snap.tgz

# Finalise config, import data, start slave operations
shell> mysql -u root
mysql> SLAVE STOP;
mysql> CHANGE MASTER TO
MASTER_HOST='master.domain',
MASTER_USER='repl',
MASTER_PASSWORD='password';
mysql> SOURCE snap.db;
mysql> SLAVE START;

You're done.

Comments on this article: 0
Last comment by: Mr.Brownstone, 11th of September 2009, 3:19 pm
- [ Back to top ] -

Completely uninstalling MySQL in Ubuntu
- Posted 11th of September 2009, 2:15 pm by Mr.Brownstone

I recently had cause to do this and ran into a few of these errors when trying to reinstall:

Bash Script:
/var/lib/dpkg/info/mysql-server-5.0.postinst: line 143: /etc/mysql/conf.d/old_passwords.cnf: No such file or directory
/etc/init.d/mysql: WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz
/etc/init.d/mysql: line 122: /etc/mysql/debian-start: No such file or directory

Running the following fixes the issue:
Bash Script:
sudo apt-get autoremove --purge mysql-server mysql-server-5.0 mysql-common
sudo apt-get install mysql-server

For reference, here's what caused my problem in the first place:
Bash Script:
sudo dpkg --purge mysql-server
sudo apt-get autoremove
sudo rm /var/lib/mysql -rf
sudo rm /etc/mysql -rf

It looks like the mysql-common package handles the /etc/mysql directory and its default contents, so removing it manually will bork a reinstallation of the server.

Comments on this article: 0
Last comment by: Mr.Brownstone, 11th of September 2009, 2:15 pm
- [ Back to top ] -

Mac OS X upgrade from Leopard to Snow Leopard - Color Profile problems
- Posted 28th of August 2009, 3:17 pm by Mr.Brownstone

If you receive this message while trying to change your ColorSync profiles:

"The factory profile for the display could not be found."

Try resetting your PRAM. To do this:

1. Shut down your Mac.
2. Hold down the CMD, Option (or Alt for International keyboards), P and R keys.
3. Keep all these held down and press the power-button to start the Mac.
4. The grey screen will appear, and after a short moment the Mac will restart, at which point you can release the keys.

You're done.

Reference: http://support.apple.com/kb/HT1379

Comments on this article: 4
Last comment by: Mr.Brownstone, 11th of September 2009, 2:04 pm
- [ Back to top ] -

Repair GRUB after installing Windows
- Posted 20th of May 2009, 2:50 pm by Mr.Brownstone

Use the following method if you have recently needed to reinstall your Windows partition on a dual-boot Ubuntu/Windows setup. (Note: These instructions are not limited to Ubuntu only. Most any flavour of Linux and dual/multi-boot configuration can be repaired with few or no tweaks to the procedure.)

1. Boot from a recent Ubuntu installation CD (or Live CD.) Choose to "Try Ubuntu" without installing it from the boot menu.

2. Open a terminal.

3. Determine where your Ubuntu partition is using fdisk:

Bash Script:
sudo fdisk -l
It's probably the first partition with a "System" of type "Linux." In this example I will use /dev/sda6 as the Ubuntu partition, where /dev/sda is the hard-disk that contains your dual/multi-boot setup.

4. Mount it:
Bash Script:
sudo mkdir -p /media/ubuntu
sudo mount /dev/sda6 /media/ubuntu

5. Run grub-install with the root-directory option set:
Bash Script:
sudo grub-install --root-directory=/media/ubuntu /dev/sda

Reboot and you're done.

Comments on this article: 0
Last comment by: Mr.Brownstone, 20th of May 2009, 2:50 pm
- [ Back to top ] -

Windows XP Home - Repairing freezes on "Installing Network"
- Posted 18th of May 2009, 12:31 pm by Mr.Brownstone

I recently had this problem trying to fix an old laptop running Windows XP Home. I found a solution here: http://www.pcmech.com/forum/showthread.php?t=139698 but I ran into a snag of my own when trying to run Task Manager.

The message Task Manager has been disabled by your administrator popped up when I tried to follow the guide. I suspect this is a curiosity of the XP Home disc, but it was easily fixed by running the Registry Editor and changing the appropriate flag.

The whole process is documented below for reference:

1. When stuck at 31/32 minutes, press SHIFT-F10 to bring up a command-prompt (yes, that one's news to me, too.)

2. Type taskmgr and press ENTER. If the Task Manager appears skip to step 3. If you get a warning, continue to 2a:

2a. Type regedit and press ENTER.

2b. Navigate to HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Policies \ System. You will see a value labeled DisableTaskMgr and its value will be set to 1. Double-click on it and change the value to 0.

2c. Close the Registry Editor and return to the Terminal window. Type taskmgr and the Task Manager should appear this time.

3. Look for the process(es) in the Processes tab that are hogging all the resources (ie, greater than 90% CPU, huge memory usage, etc.) and causing setup to freeze. If you don't see any, your setup may not have actually frozen yet. Patience, grasshopper!

4. Click "End Process" on each rogue process once you're sure they are causing problems. Setup should start making progress quickly after you've killed the right process.

5. Setup may freeze again at the 13 minute mark. If it does, simply repeat from step 1.

Do not be trigger-happy about loading Task Manager and killing processes. Ensure the that setup has frozen by waiting 30 minutes to 1 hour before acknowledging that yes, it really doesn't have 31/32/13 minutes to go!

Comments on this article: 1
Last comment by: Mr.Brownstone, 19th of May 2009, 1:10 pm
- [ Back to top ] -

Gentoo: gcc update problems + solution
- Posted 1st of April 2009, 3:18 am by Mr.Brownstone

A recent emerge --update --deep world performed an upgrade of gcc. This was fine in itself; the problems came after running emerge --depclean, which removed my old gcc version and invalidated my current gcc profile.

But I did not actually realise gcc was broken until I tried emerging something else, and even then I did not immediately look to my gcc configuration!

Solution
These are the steps you should take when faced with upgrading gcc:

1. Before installing a new version, check that your current gcc is configured correctly:

Bash Script:
linux # gcc-config -l
linux # gcc-config 1

2. Install new version:
Bash Script:
# Manually:
linux # unset GCC_SPECS
linux # emerge gcc

# Or through a world update:
linux # emerge --update --deep world
linux # emerge --depclean
linux # revdep-rebuild

3. Update your environment:
Bash Script:
linux # source /etc/profile

4. Running gcc should now report no profile related errors:
Bash Script:
linux # gcc
gcc: no input files

Symptoms
The following errors are symptomatic of a broken gcc:

1. Problems emerging new software:
Bash Script:
linux # emerge geoip
...
configure: error: C compiler cannot create executables
See `config.log' for more details.

!!! Please attach the following file when seeking support:
!!! /var/tmp/portage/dev-libs/geoip-1.4.5/work/GeoIP-1.4.5/config.log
 * 
 * ERROR: dev-libs/geoip-1.4.5 failed.
 * Call stack:
 *               ebuild.sh, line   49:  Called src_compile
 *             environment, line 2627:  Called econf '--enable-shared'
 *               ebuild.sh, line  543:  Called die
 * The specific snippet of code:
 *   			die "econf failed"
 *  The die message:
 *   econf failed
 * 
 * If you need support, post the topmost build error, and the call stack if relevant.
 * A complete build log is located at '/var/tmp/portage/dev-libs/geoip-1.4.5/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/dev-libs/geoip-1.4.5/temp/environment'.
 * 

2. emerge --info reports that gcc cannot be found:
Bash Script:
linux # emerge --info
!!! No gcc found. You probably need to 'source /etc/profile'
!!! to update the environment of this terminal and possibly
!!! other terminals also.

3. gcc-config -l reports that your gcc profile is invalid:
Bash Script:
linux # gcc-config -l
 * gcc-config: Active gcc profile is invalid!
 [1] x86_64-pc-linux-gnu-4.3.2

4. Trying to switch gcc profiles with gcc-config 1 gives the following warning:
Bash Script:
 * Switching native-compiler to x86_64-pc-linux-gnu-4.3.2 ...

 * Your gcc has a bug with GCC_SPECS.
 * Please re-emerge gcc.
 * http://bugs.gentoo.org/68395

>>> Regenerating /etc/ld.so.cache...                                                                                                                                                                                                                                                                                 [ ok ]

 * If you intend to use the gcc from the new profile in an already
 * running shell, please remember to do:

 *   # source /etc/profile

5. Typing gcc on its own reports:
Bash Script:
linux # gcc
gcc-config error: Could not run/locate "gcc"

Comments on this article: 0
Last comment by: Mr.Brownstone, 1st of April 2009, 3:18 am
- [ Back to top ] -

Replacing a faulty drive in an mdadm managed RAID5 array
- Posted 15th of December 2008, 11:35 pm by Mr.Brownstone

Taken from elsewhere for my own notes:

1. Use "mdadm --manage /dev/md0 -r /dev/sdd" to remove the drive that was marked as faulty from the array.

2. Power down and replace the drive with a good drive.

3. Power up and set the partition table on the new drive to match those of the other drives in the array. Here we used "sfdisk -d /dev/sda | sfdisk /dev/sdd".

4. Add the proper partition on the new drive into the array, "mdadm --manage /dev/md0 -a /dev/sdd2"

5. Sit back and wait for the recovery to happen, you can "cat /proc/mdstat" to watch its progress; you should see something like:

Bash Script:
Personalities : [raid5]
md0 : active raid5 sdd2[4] sdc2[2] sdb2[1] sda2[0]
731985408 blocks level 5, 256k chunk, algorithm 2 [4/3] [UUU_]
[===>.................] recovery = 19.7% (48253056/243995136) finish=59.1min speed=55184K/sec

Comments on this article: 4
Last comment by: Mr.Brownstone, 24th of December 2008, 4:08 pm
- [ Back to top ] -

Play Outcast with WINE
- Posted 30th of June 2008, 1:18 pm by Mr.Brownstone

Image.

Outcast is a PC video game from 1999 by the now bankrupt Appeal, and was distributed by Infrogrames. At the time it was Windows-only, but today you can get your retro-fix on Linux thanks to developments with WINE.

Here are instructions on how to get Outcast working in Ubuntu Hardy Heron, although you will not have too much trouble transferring them to other distros:

Installing WINE: You will need a patched version of WINE 1.1.0 in order to fix the mouse-look problem. This problem affects other games, too. Fortunately, the patch adds an optional ENV flag, so you will not affect your other WINE applications with it.

1. Install the build-dependencies and patching utility:

Bash Script:
sudo apt-get build-dep wine
sudo apt-get install patch


2. Download the WINE 1.1.0 source to your HOME directory "~/" and extract it:
Bash Script:
mkdir ~/wine-dev
cd ~/wine-dev
tar xvf ~/wine-1.1.0.tar.bz2 -C .


3. Download this patch (original post) to your HOME directory and apply it:
Bash Script:
cd ~/wine-dev/wine-1.1.0
patch -p0 < ~/wine-force-mousewarp.patch


4. Compile WINE. This will take a long time!
Bash Script:
./configure
make
sudo make install


5. Configure WINE:
Bash Script:
winecfg
# Applications > Windows Version > Windows 98
# Graphics > Allow DirectX apps to stop the mouse leaving their window
# Audio > OSS Driver
# Drives > Autodetect... (make sure it picks up your CD-ROM drive!)
# Press OK


Installing Outcast: The following guide presumes you own a genuine copy of the game. You should be able to pick it up in most bargain-bins for about £5 these days.

1. Insert Disc 1.

2. Preparation: There exists a bug in the installer on the CD-ROM which, on a modern Windows system and even through WINE, will cause the game to be immediately uninstalled after completing DirectX tests. Appeal released a new installer to fix this, but it is not necessary to use it.

To get around the bug you simply need to delete the Uninst.isu file that is created during installation. You should keep a second terminal-window open so you can do this easily:

Bash Script:
# Terminal 1
# Install the game as normal (use the default settings)
# Assumes D:\ is how WINE detected your CD-ROM drive
wine "D:\Setup\SETUP.EXE"

# Terminal 2
# Once the installer starts copying the game-files, run
# this command to delete Uninst.isu when it exists.
# The game takes a little while to install, so you should
# not need to rush the process
rm ~/.wine/drive_c/Program\ Files/Outcast/Uninst.isu


3. After installation you will need to modify the shortcuts that start the game. The default shortcuts run this command:
Bash Script:
env WINEPREFIX="~/.wine" wine "C:\Program Files\Outcast\Outcast.exe"


Change them to this:
Bash Script:
env WINEFORCEMOUSEWARP="yes" WINEPREFIX="~/.wine" wine "C:\Program Files\Outcast\oc\loader.exe"


The WINEFORCEMOUSEWARP option was introduced in the WINE-patch you applied earlier. You can use it to fix other games that have problems with mouse-look (there are many!)

4. Download the Zip-file outcast_loader.zip from this page. Extract the contents to "~/.wine/drive_c/Program Files/Outcast/oc"

5. That's it! Insert Disc 2 and run the game!

Post-installation notes:

1. The winecfg option "Graphics > Allow the window manager to control the windows" prevents you from using the Escape-key to stop the credits when you want to exit the game. You can disable this option to allow you to exit the game quickly, but this will affect other in-game buttons (the save-game button F2 will no longer work, for example.) The workaround is to wait for the credits to finish, or ALT+Escape back to your desktop, open a terminal-window and run wineserver -k to kill the game. Unfortunately this will leave your desktop in a low-resolution, and it is tricky to change it back.

2. It is written elsewhere that you will need to use a native amstream.dll file to run the game properly. I found this was not necessary, but you do need to make sure you configure WINE to emulate Windows 98.

Comments on this article: 0
Last comment by: Mr.Brownstone, 30th of June 2008, 1:18 pm
- [ Back to top ] -