12.09.09
Posted in How To, Intermediate, Mac at 10:47 am by Techie
On Linux and Windows, I use an extension called It’s All
Text to add an “edit” button to text areas. Hitting this will
launch the contents of the text area in my editor of choice — emacs.
(You can pick any editor you like.)
However, on Mac, it’s not really straightforward, due to the way they
handle applications. The comments in this
post pointed me in the right direction for how to set this up.
The default proportional font in aquamacs bugs me, so I fix that by
launching it with a textarea and going to Options -> Appearance
-> Font For Text-Mode and setting it to Andale Mono. I also turn
off Soft Word Wrap and Auto Word Wrap In Text Modes under options,
because I’m used to emacs’s old unfriendly behavior.
Permalink
11.03.09
Posted in Intermediate, Linux at 7:49 am by Techie
People running VMware Workstation 6.5.3 on Intrepid or Jaunty may be in for an unpleasant surprise when upgrading to Karmic — it doesn’t work! If you run the installer, it hangs while configuring VMware Player of all things.
Fortunately, the community is already on the case, and until VMware ships an official update, aldeby.org provides these helpful instructions. Perfect!
Quick summary:
* In one terminal, run: while true; do sudo killall -9 vmware-modconfig-console; sleep 1; done
* In a second terminal, run: sudo ./VMware-Workstation-6.5.3-185404.i386.bundle --ignore-errors
* Kill loop in first terminal.
* Run: sudo vmware-modconfig --console --install-all
* Edit /etc/vmware/bootstrap to add the line: VMWARE_USE_SHIPPED_GTK=force
* If you have ~/.vmware/config, make sure the xkeymap.nokeycodeMap is commented out (previous keymap fix for Vmware/Intrepid).
Permalink
10.21.09
Posted in Intermediate, Linux at 9:20 am by Techie
This one had been bugging me for a while. Arrow keys never worked right in VMware Workstation when I switched to Intrepid Ibex. I found this post which solved it beautifully. Quick summary:
echo 'xkeymap.nokeycodeMap = true' > ~/.vmware/config
Permalink
09.15.09
Posted in Intermediate, Linux at 9:58 am by Techie
I like to use ssh-agent to make logins simpler, but had a problem that whenever I detached a screen, I’d lose my agent. This post and others provide information on how to do reconnect, but it didn’t quite work for me. In particular, what these posts suggest is editing your .bashrc or similar to create a symlink to your actual $SSH_AUTH_SOCK, then set your .screenrc to set the environmental variable $SSH_AUTH_SOCK to point to your symlink. This is all fine and good, until you log into screen the first time, and it sources your .bashrc and tries to symlink to your symlink. Here’s how to fix it.
Add the following to the end of .bashrc:
if test $SSH_AUTH_SOCK && [ $SSH_AUTH_SOCK != "/tmp/ssh-agent-$USER-screen" ]
then
rm -f /tmp/ssh-agent-$USER-screen
ln -sf "$SSH_AUTH_SOCK" "/tmp/ssh-agent-$USER-screen"
fi
This creates a symlink to your actual $SSH_AUTH_SOCK, but only if it isn’t set to your symlink.
Add the following to your .screenrc:
setenv SSH_AUTH_SOCK "/tmp/ssh-agent-$USER-screen"
That should do the trick.
Permalink
06.09.09
Posted in Intermediate, Linux at 11:39 am by Techie
Most external drives are shipped with FAT32, which is great, until you come across files larger than 2 GB. The easiest way to get around this and maintain Windows compatibility is to reformat the drive to NTFS. Sure, you could do it in Windows, but what if you just happen to only have a Linux computer handy? Here’s how to do it in Ubuntu. These instructions are for an external drive, but should work for internal drives too. This will destroy any data on the drive. You’ve been warned!
First, you’re going to need the ability to create NTFS file systems, so install ntfsprogs:
sudo apt-get install ntfsprogs
Next, connect your external drive. In my case, I’m formatting a Western Digital WDElements 1 TB external USB hard drive. This auto-mounted for me at /media/Elements. If I run df -k I can see the drive to get the disk ID:
$ df -k
[...misc output...]
/dev/sdb1 976521568 128 976521440 1% /media/Elements
Ah, so it’s at /dev/sdb. First, we blow away the partition and re-create it as NTFS. Warning: you are going to be destroying all the data on the drive! Make sure you have the write drive designation, or you could lose data on your other drives!
$ sudo umount /dev/sdb1
$ sudo fdisk /dev/sdb
Options to select:
- ‘d’ to delete the partition
- ‘n’ to create a new partition
- ‘p’ for primary
- ‘1′ for partition number
- ‘Enter’ for first cylinder (default 1)
- ‘Enter’ for last cylinder (default of max size)
- ‘t’ for type
- ‘L’ to list codes, and enter code for HPFS/NTFS. In my case, it’s ‘7′
- ‘w’ to write changes to disk, and exit
sudo umount /dev/sdb1
In the last step, I unmount the partition, because Ubuntu auto-mounted it again for me. Now, we need to create the file system. There are two ways to go about it: the impatient way (Quick Format), or the better but much longer way (Full Format).
Quick Format
This just allocates the disk space, but doesn’t zero out the drive or check for bad sectors. This means it’ll take a few seconds.
sudo mkfs.ntfs -f /dev/sdb1
Full Format
If you’re much more concerned about data integrity and don’t mind waiting, do a full format. This may take a few hours to zero out a large drive!
sudo mkfs.ntfs /dev/sdb1
That’s it!
Some other caveats:
- NTFS is a journaling file system, which means changes may not be immediately applied. Always unmount a drive before disconnecting.
- If you’re extra paranoid, run a ’sync’ before you unmount the drive, to be sure that changes are written.
- Windows is also quite paranoid about this, so always safely unmount the drive before disconnecting. Otherwise, you may find you can’t access the drive at all under Linux, until you mount it under Windows first to recover the journal.
Permalink
01.28.09
Posted in Error Messages, Intermediate, Linux at 2:59 pm by Techie
If you upgraded the perl module Compress::Zlib (or related), you may suddenly find CPAN stops working. You may start getting an error like the following:
Can't call method "value" on an undefined value at /usr/share/perl5/IO/Uncompress/RawInflate.pm line 64.
As it turns out, there’s a whole slew of Compress::Zlib modules and IO::Compress modules that are all related. They are all packaged separately, and have the same version numbers. The problem happens if you upgrade one of the modules, without upgrading all of them.
The solution: make sure to upgrade all the modules to the same version at the same time. This means that if you’re using CPAN, you might have to install the remainder by hand. A good check to find what modules differ for you is to run dpkg -l | grep compress | grep perl, and make sure versions match up.
Permalink
12.20.08
Posted in Intermediate at 1:40 am by Techie
- Soft Reset: This just reboots your phone, useful if you want to clear out the programs running in the background. Hold down Call (green button) + Menu + Power/End (red button)
- Factory Reset: Restores your phone to factory default settings, deleting any data and applications on phone. Hold Home + Back + Power, then press the Call (green) button to confirm the reset.
I’ve heard that if you use the Back button to get out of applications, it actually shuts them down. That doesn’t seem to work for me, though. I’ve also heard that the new firmware (not yet released) will include a process manager, which should preclude the need to soft reset the phone.
Permalink
10.18.08
Posted in Intermediate, Linux at 11:08 am by Techie
System administration doesn’t have to be all serious. You can have sudo insult your users who mis-enter their password, by adding ‘insults’ to the Defaults line. Enable it and see which users discover it first.
Reference: Ubuntu Unleashed: Enable Sudo insults for some laughs!
Permalink
09.05.08
Posted in Intermediate, Linux at 3:11 pm by Techie
Let’s say you have a bunch of hosts on example.com, such as mercury.example.com, venus.example.com, and jupiter.outerplanets.example.com. You spend a bunch of your time on the command line, so you want to be able to access them with just the short host name, i.e., you want to be able to just type ssh mercury and not worry about the domain.
If you happen to be on the same domain, e.g. on saturn.example.com, this usually works fine. What if you’re not? The usual answer is to edit your /etc/resolv.conf file, and edit your search domains like so:
search example.com outerplanets.example.com
This works great — you can even ssh jupiter and it’ll do the right thing. It will, that is, right until you DHCP up a new IP address, say on another Internet connection. Then it overwrites your search domains, and you have to re-edit the file. What’s a techie to do? Use dhclient.conf, of course!
On hardy, I edited the file /etc/dhcp3/dhclient.conf and added this line:
supersede domain-name "example.com outerplanets.example.com";
Then, I did an sudo /etc/init.d/dhcdbd force-reload to make the dhclient change. However, my connection still had the old network information. To fix that, I just stopped and started my connection like so:
sudo ifconfig eth0 down
sudo ifconfig eth0 up
Voila — my search domains work again, and will work the next time I DHCP up a new IP.
Permalink
09.04.08
Posted in Intermediate, Linux at 12:55 pm by Techie
How do you determine what version of a Perl module you have? If you have one module you want to check, you can call the VERSION parameter of the module. Let’s say you wanted to check the version of Test::Harness you had on your system. Run the following:
$ perl -MTest::Harness -le 'print Test::Harness->VERSION'
2.56
$
Another way:
$ perl -le 'eval "require $ARGV[0]" and print $ARGV[0]->VERSION' Test::Harness
2.56
$
Seems simple enough. But what if we want to check all module versions, versus what was current on CPAN?
$ perl -MCPAN -e 'CPAN::Shell->r'
That’s not foolproof, as some modules don’t have version numbers, but should give you a good idea. It also has the bonus of providing you with information on how out of date you are with CPAN.
Permalink
« Previous entries Next Page » Next Page »