Monday, 6 July 2009

SUDO: UNABLE TO RESOLVE HOST

You might get this message if you've changed your hostname. Every time you use 'sudo'. Luckily, the fix is fairly simple.

Open your hosts file:
sudo nano -w /etc/hosts

find every instance of your old hostname, and change it to your new hostname. Usually there's just one entry:
127.0.1.1 old-hostname

Change to:
127.0.1.1 new-hostname

Save the file and you're done.

MISSING ETH0

Sometimes copying or cloning a virtual machine can result in the guest OS detecting a new NIC (I think VMWare creates a new instance to avoid conflicts?). The result is your networking goes south because the new NIC has been named eth1. You can fix this by changing the networking persistent rules as detailed here.

Stop the networking and udev services:
sudo /etc/init.d/udev stop
/etc/init.d/networking stop

Open your persistent-net.rules file:
sudo nano -w /etc/udev/rules.d/70-persistent-net.rules

You'll see two instances of the NIC, the first is the original and the second is the new one.

# PCI device 0x1022:0x2000 (vmxnet)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:36:xx:xx", ATTR{type}=="1", NAME="eth0"

# PCI device 0x1022:0x2000 (vmxnet)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:75:xx:xx", ATTR{type}=="1", NAME="eth1"

Delete the first entry, then change the eth1 to eth0 on the second. So you get:

# PCI device 0x1022:0x2000 (vmxnet)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:75:xx:xx", ATTR{type}=="1", NAME="eth0"

Save the file, then restart udev and networking:
/etc/init.d/udev start
/etc/init.d/networking start

No need to reboot, you should now have your networking abilities back.

Wednesday, 1 July 2009

CHANGE SUS ADDRESS ON LEOPARD CLIENTS

If you have a Software Update server somewhere on your network you can use MCX to force clients to use it. But what about clients that aren't bound to Open Directory? Time to bring up the Terminal to manually change the update server.

It's probably a good idea to make a backup first:
sudo cp /Library/Preferences/com.apple.SoftwareUpdate.plist /Library/Preferences/com.apple.SoftwareUpdate.bak

Now make the changes:
sudo defaults write /Library/Preferences/com.apple.SoftwareUpdate CatalogURL 'http://<software update server address>:8088/'

Start Software Update and if you're successful you should see your server name in brackets on the Software Update window title.

NOTE:
Software Update may not work if the server address you used is different to what is referenced in the SU Catalog (say you used myServer.local instead of myServer.myDomain.com). You can find out what address the SU Catalog is using by viewing the catalog in your browser:
http://<software update server address>:8088/index.sucatalog

CHANGE THE PACKAGE LOCATION FOR LEOPARD SUS

Leopard Software Update Server uses a static path to store update packages, and no option to change it. Combine this with incredibly expensive HDD's and single updates pushing 1Gb in size and you start to appreciate the problem. Cheers Apple!

Well there may be light at the end of the tunnel. Using symlinks we can point the update directory to a SAN/NAS/External drive with more/cheaper capacity. Please take note that I've only done very preliminary testing so far. Don't roll this out in a working environment until you have tested thoroughly.

Move the update directory to the new location:
sudo mv /usr/share/swupd/html <your alternate location>

Then create the symlink:
sudo ln -s <your alternate location> /usr/share/swupd/html

Start up the Software Update service and you should be good to go.

Friday, 26 June 2009

WORKSPACE SWITCHER FIX

After playing around with Compiz cube settings I realised that I'd completely screwed the workspace switcher. Hotkeys didn't work, clicking on the workspace icon didn't work, then it did but I had an empty desktop, no taskbar and no way to switch back! Anyway, here's the fix I found in the ubuntu forums:

Fire up gconf-editor and change the settings below
apps/compiz/general/screen0/options/hsize = 4 (or how many desktops you usually use)
apps/compiz/general/screen0/options/number_of_desktops = 1

Thursday, 25 June 2009

CIFS VFS: SERVER NOT RESPONDING...

You might see this message when you shutdown or restart, and the system seems to hang for a few minutes. Here's a fix:

Navigate to /etc/rc0.d
cd /etc/rc0.d

Now you want to look for a file named ***umountnfs.sh -Where the stars might be different depending on your system (mine was S31umountnfs.sh). Now just replace the first part of the filename with K15.
sudo mv S31umountnfs.sh K15umountnfs.sh

Repeat the process for /etc/rc6.d and the error should be fixed!
cd /etc/rc6.d
sudo mv S31umountnfs.sh K15umountnfs.sh

Thursday, 11 June 2009

MOUNT TIME CAPSULE IN LINUX

Install smbfs/smbclient:
sudo aptitude install smbfs

Then create a directory to mount the capsule to:
sudo mkdir /media/capsule

Now mount the capsule:
sudo mount.cifs //<time capsule address>/<time capsule directory>/ /media/capsule -o pass=<password>

<time capsule directory> is the name assigned to your Time Capsule when it it set up on the Mac, look how the volume is listed on a Mac machine.

<password> is whatever password you used during the Airport configuration.