Archive for the ‘Technology’ Category
I switched back over to the latest and greatest CyanogenMod on my Droid 1 yesterday. I’d ditched it for “stock” (with a few customizations) about a year ago because it seemed to slow my phone down, and most of the bells and whistles I never really made use of. However, after reading some good things on LWN about the latest release (corbet there uses it on an ancient Nexus One) I decided maybe it was time to give it another shot.
So far am really liking it. It’s pretty quick and I get my small font sizes back in the SMS/MMS app. I had some troubles with my text messages, though. Thought I backed them up with Titanium, but when I restored after upgrading, apparently I pulled from a dump of data taken in August of last year. That was pretty confusing to say the least, but made for kind of an interesting time warp. Weird to see the conversations you were having with people a year back…
In any case, so far I haven’t regretted switching. Let’s see if I stick with it or feel compelled to go out and buy a Droid 3 (can you root that thing yet? Guess I’ll have to check).
After upgrading to RHEL 5.7, one of my Apache servers which protects content using mod_ldap authenticating against Active Directory stopped working. Error logs showed the following:
auth_ldap authenticate: user xxxx authentication failed; URI /viewvc/
[ldap_search_ext_s() for user failed][Operations error]
This usually means there is a problem with referrals, but OpenLDAP was properly configured to not follow them (/etc/openldap.ldap.conf w/ REFERRALS off).
Turns out that buriedin the RHEL 5.7 release notes, this gem can be found. A brand new configuration directive called LDAPChaseReferrals. Apparently, when referrals are provided in a result-set, mod_ldap by default does not bind to them using the provided credentials. The new version of Apache in RHEL 5.7 corrects that and provides this new directive to enable or disable the feature.
However, I couldn’t find any documentation for it upstream, and after following the bugzilla link in the release notes realized that the Apache project had actually gone a different route and called their directive LDAPReferrals in addition to adding another directive to limit the number of hops that would be followed.
End result is that it appears Red Hat has added in a one-off and undocumented configuration directive. 🙂 Likely unintentionally, but this definitely led me to some confusion.
Opened a new bug to see about getting this resolved.
I recently discovered tmux. It’s actually been around for about four years, but as I’ve been reasonably happy with GNU screen, I’d never thought to look elsewhere. tmux piqued my curiosity and as there were packages readily available in EPEL, I installed it and have been using it most of the day.
The screen keystrokes are firmly stuck in my brain, and of course there’s the chance that I might have to use screen again on other systems, so I’d rather stick with them vs. re-learning tmux’s C-b based command structure. After some tinkering, I found that the following in my
~/.tmux.conf file gets me most of the way there:
set-option -g prefix C-a bind-key p previous-window bind-key C-p previous-window bind-key Space next-window bind-key C-Space next-window unbind-key C-b # Makes CTRL-A A work like in screen (jumps to beginning of line) bind-key a send-keys C-a
In a nutshell, this sets the command key sequence to C-a (CTRL-A) and sets the ‘p’ and spacebar keys to cycle through my windows. As I often find myself keeping the CTRL key pressed down as I hit the p or spacebar, I also mapped things so the windows will shift whether or not I leave CTRL pressed or not.
I’ve never been a screen power user, but anything with a smaller memory footprint is a win for me as I primarily have been using screen on a low-memory Linode system.
I have at last completely joined the 21st century by replacing my last CRT (a beautiful old 20″ Dell Trinitron) with an eBay’d LCD.
Right now I am P2V’ing an old CentOS box so I can further consolidate my hardware. Spring cleaning in June…
A couple of years back, I migrated all of my email off of my Postfix/Dovecot mail server to Google Apps. I was tired of fighting spam and dealing with the occasional outages to my server that would impact the family and friends whose email lived there.
I didn’t have a lot of accounts to migrate, and many of my users were POP3 users who downloaded everything — so there wasn’t a lot of email to move over. What there was I did manually with an IMAP capable email client and just copied folders and their contents “en masse” over to GMail.
This worked pretty well except for the fact that I’d been using Mutt, and had all my sent mail copied to a series of folders embedded under a parent “Sent” folder with the year and month in the name. So Sent/Sent-Mail-2001-05, etc. There were a ton of these folders and in GMail they show up as Labels. A very long list of labels. With no easy way to hide them all.
I dealt with a few manually, but GMail didn’t seem to have a way to do any sort of bulk actions within their UI, and recursively moving the contents of these folders into GMail’s Sent Mail folder from within Thunderbird wasn’t much easier.
Enter Python and imaplib. The following hacky and one-off script ended up doing the job for me pretty nicely:
import re import imaplib LRP = re.compile(r'\((?P<flags>.*?)\) "(?P<delimiter>.*)" (?P<name>.*)') def main(): global LRP m = imaplib.IMAP4_SSL('imap.gmail.com', 993) m.login('username', 'password') status, mailboxes = m.list("/Sent", '*') for mb in mailboxes: flags, delimiter, mailbox_name = LRP.match(mb).groups() print mailbox_name s, d = m.select(mailbox_name) # If we got an OK and there are > 0 messages in the folder. if s == 'OK' and int(d) > 0: print " Trying to move %d messages." % int(d) typ, [response] = m.search(None, 'SEEN') if typ != 'OK': raise RunTimeError(response) msg_ids = ','.join(response.split(' ')) m.copy(msg_ids, '[Gmail]/Sent Mail') m.store(msg_ids, '+FLAGS', '\\Deleted') m.expunge() else: if mailbox_name != '"Sent"': if int(d) == 0: print " No messages, deleting %s" % mailbox_name m.delete(mailbox_name) else: print " Skipping Sent" if __name__ == '__main__': main()
Now my GMail is much more neat and tidy. It would be nice if imaplib had a move() call…
In the process of troubleshooting a file locking issue on a Samba/NFS server, I needed to be able to take a look at the locks on a Solaris 10 system. In Linux this is fairly straightforward to do with the lslk command or by taking a peek at /proc/locks. No such luck on Solaris.
The ::lminfo command gave me almost exactly what I needed, except, as Chris mentions in his wiki entry, the path information is truncated. You can easily cycle through and print only the path out, but then you’re missing the rest of the information which is awfully nice to see.
> ::lminfo ADDR TP FLAG PID COMM VNODE PATH 600114a7040 WR 0021 315 ypbind 60012161080 /var/yp/binding/xpr 6001203ea00 WR 0021 315 ypbind 60012160080 /var/yp/binding/xpr 6001203e800 WR 0021 315 ypbind 600115b0140 /var/yp/binding/xpr 60011452700 WR 0001 558 mdmonitord 600131da100 /etc/lvm/.mdmonitor 6001203eb00 WR 0021 315 ypbind 60012160180 /var/yp/binding/xpr 60010a90e80 WR 0001 505 automountd 60013024180 /etc/svc/volatile/f
I couldn’t figure out a good way to convince ::print to display multiple lock_descriptor_t members — and format it as nicely as ::lminfo did. I was about to write an external parser in awk or python to hack this together, when Jonathan Adams of Sun suggested that an mdb module could be created to accomplish just what I was after.
After some trials and tribulations getting this going, I was able to create a ::lminfo2 module that not only displays the pathname of the locked file sans truncation, but also spits out the whence, start and length information for ranged locks! Sample output:
# echo "::load /home/rayvd/src/mdb/sparcv9/lminfo2.so; ::lminfo2" | mdb -k ADDR TP FLAG PID COMM VNODE WHENCE START LEN PATH 600114a7040 WR 0021 315 ypbind 60012161080 1 0 1 /var/yp/binding/xprt.udp.2 6001203ea00 WR 0021 315 ypbind 60012160080 1 0 1 /var/yp/binding/xprt.ticlts.2 6001203e800 WR 0021 315 ypbind 600115b0140 1 0 1 /var/yp/binding/xprt.ticotsord.3 60011452700 WR 0001 558 mdmonitord 600131da100 0 0 0 /etc/lvm/.mdmonitord.lock 6001203eb00 WR 0021 315 ypbind 60012160180 1 0 1 /var/yp/binding/xprt.ticlts.3 60010a90e80 WR 0001 505 automountd 60013024180 0 0 0 /etc/svc/volatile/filesystem-autofs.lock
The main challenge I encountered was dealing with the mdb_printf and mdb_snprintf commands. Both are “smart” in that they automatically truncate lines at the end of the terminal.
To build the module, you need a C compiler, the SUNWmdbdm package, and also, a header file (mdb_ks.h) from the mdb sources (available in OpenSolaris) to gain access to some internal mdb functions not exposed by mdb_modapi.h.
The module, and some basic instructions on building are available here. Feedback welcome.