dre on the LKDC
So dre has done a great overview of the LKDC in Leopard, including a more detailed wiki page. There really isn’t enough info out there about the LKDC, and it’s quite awesome technology.
many a slip ‘twixt mind and lip…
So dre has done a great overview of the LKDC in Leopard, including a more detailed wiki page. There really isn’t enough info out there about the LKDC, and it’s quite awesome technology.
So I pretty much live in screen permanently these days, and there are a gazillion awesome introductions out there to screen that describe the amazing advantages of screen.
One thing that has been a minor niggle has been the clunky way you pick which screen session you wish to reattach to if you have multiple sessions active, so I whipped up this bash function that I’ve been finding really useful.
function scr() {
if [ ! $1 ]; then
screen -D -R
else
i=1
for j in $(screen -list | awk –posix ‘/^[[:space:]]*[[:digit:]]{2,}.*$/{print $1}’); do
screens[${i}]=$j
let i=i+1
done
# test if integer
if ! [ $1 -eq $1 2> /dev/null ]; then
echo “You must supply an integer as the argument”
elif [ $1 -eq 0 ]; then
echo “screens list count starts at 1, not zero.”
elif [[ ${1} -gt ${#screens[@]} ]]; then
echo “only ${#screens[@]} screens exist”
screen -list
else
screen -D -R ${screens[$1]}
fi
fi
}
So you can basically go scr to reattach to a single screen session, scr 1 to reattach to the first, scr 2 to reattach to the second, etc etc.
I’m kind of expecting someone to pipe up now and point out a much easier way… :)
So as host, ping, nslookup, dig etc don’t use the same resolver path as the rest of the OS, we used to always use lookupd for this.
It’s not exactly the most obvious solution in the world, but since lookupd, netinfod and memberd were all rolled into DirectoryService in 10.5, we now use dscacheutil to do this.
$ dscacheutil -q host -a name www.google.com
name: www.l.google.com
alias: www.google.com
ip_address: 74.125.19.104
ip_address: 74.125.19.147
ip_address: 74.125.19.99
ip_address: 74.125.19.103
This is a much more appropriate way of debugging host problems if the *nix tools aren’t showing any problems but OS X components are.
This will fetch the result from the cache, and if it’s not there, fetch it and place it in the cache. If you want to make sure this is a fresh request, do:
dscacheutil -flushcache
and you can always do this:
dscacheutil -cachedump -entries host
to inspect the cache for hosts.
I was actually debugging a Mobile Account problem the other day where the user agreed to create a mobile account at the loginwindow, and yet it kept logging them in with the network account.
Inspecting the DirectoryService cache with:
dscacheutil -cachedump -entries user
showed that the /Local/Default entry for that user was never retrieved. Flushing the cache fixed it.
Turns out the user said no to creating a Mobile Account once, and then logged out without rebooting (and didn’t tell us they’d said no ;-) ). OS X kept the cached entry around and failed to update when creating the Mobile Account as it should have.
Need to get that one into radar….
After spending a little while banging my head against the wall over this one….
root@snicko [ ~ ]
# port install git-core +svn +bash_completion
—> Applying patches to perl5.8
Error: Target org.macports.patch returned: shell command ” cd “/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_perl5.8/work/perl-5.8.8″ && patch -p0 < '/opt/local/var/macports/sources/rsync.macports.org/release/ports/lang/perl5.8/files/patch-makedepend.SH'" returned error 2
Command output: Get file makedepend.SH from Perforce with lock? [y]
Perforce client error:
Connect to server failed; check $P4PORT.
TCP connect to perforce failed.
perforce: host unknown.
patch: **** Can't get file makedepend.SH from Perforce
Error: The following dependencies failed to build: p5-error perl5.8 p5-libwww-perl p5-compress-zlib p5-compress-raw-zlib p5-io-compress-base p5-scalar-list-utils p5-io-compress-zlib p5-html-parser p5-html-tagset p5-uri p5-svn-simple subversion-perlbindings apr apr-util db44 sqlite3 gawk gmake readline neon subversion bash-completion p5-term-readkey rsync popt
Error: Status 1 encountered during processing.
I finally found Jack Palevich’s post talking about exporting the POSIXLY_CORRECT environment variable as follows.
POSIXLY_CORRECT=1 port install git-core +svn +bash_completion
Of course now I’ve run into an issue with tcl…. *sigh*, but I’ve seen the patch issue above crop up a few times, and this certainly seems to be fixing it.
It’s bad enough that MacPorts and Fink can’t depend upon Apple to provide sane libraries and headers in OS X, and thus you end up with most of another whole freaking operating system in /opt/local or /sw, but I simply refuse to have both installed, no matter how frustrating it is that I can’t get all the software I need working via just one of them.
And along similar lines to the afp548.com article on this, Greg Neagle written a similar piece describing how he’d use it in his environment (and it even has screenshots …).
Longer article up at AFP548.com, but basically I’ve been playing around a fair bit with MCX in DSLocal lately, and there are a lot of interesting applications….
It’s so nice to be able to just manage plists now…. NetInfo I miss you not at all.
So my webhost managed to mess up all htacess files and thus lock me out of my blog for a couple of weeks. I considered briefly posting via MySQL, but then dragged myself back into the realm of the sane and just waited it out. Apologies to the comments that were awaiting moderation…. My resolution is to actually blog more this year, so I’ve started trying out MarsEdit to see if being able to work offline improves the situation….
Another Macworld is over. To be honest, this one was a bit too hectic to really enjoy as a pure punter, and besides, I missed what was a brilliant match where India broke Australia’s record equalling winning streak in Perth.
Schoun Regan and I did the two day PowerTools conference on Advanced OS X Server, then Jeff McCune and I did a shorter presentation and demo on Puppet that seems to have provoked some interest in the MacEnterprise crowd.
The few other talks I managed to make it to were quite good, even given the difficulty of catering to the very wide range of technical ability in a Macworld crowd… I thoroughly enjoyed Andrina Kelly’s Lucid System Administration presentation, some of our Google techs were inspired by Kevin White’s Neutered Admins talk, and I heard lots of good reports about Greg Neagle and Philip Rhinehart’s System Imaging and Deployment two day session.
The two highlights of the week for me were firstly that Joel managed to work the optical inch into his Directory Services talk. Nice work….
Secondly would have to have been seeing Devo in the flesh. Thanks to Dave Pugh (you need to get that blog going Dave…), I now have much better photos than my mediocre camera gave….
Devo were simply awesome. I was prepared to have all my illusions shattered… but they put on an awesome performance….
So I don’t know about any of you, gentle readers, but ‘defaults’ really gives me the shits sometimes.
Exhibit A:
/ $ defaults read /Library/Preferences/com.apple.loginwindow.plist 2007-11-21 13:12:04.288 defaults[97501:10b] Domain com.apple.loginwindow.plist does not exist / $ defaults read /Library/Preferences/com.apple.loginwindow (snip actual working output)
Exhibit B:
/ $ cd /Library/Preferences /Library/Preferences $ defaults read ./com.apple.loginwindow.plist 2007-11-21 13:13:24.327 defaults[97540:10b] Domain ./com.apple.loginwindow.plist does not exist /Library/Preferences $ defaults read ./com.apple.loginwindow 2007-11-21 13:13:25.799 defaults[97546:10b] Domain ./com.apple.loginwindow does not exist
This really annoys me, that ‘defaults’ firstly doesn’t accept the full path to the plist, when other tools like ‘launchctl’ do, and requires that you strip off the “.plist” from the end, and secondly, that you can’t use relative paths.
This annoyed me so much that I decided to finally do something about it. This function resolves both problems.
function defread { defaults read $(echo "$@" | sed "s|\./|`pwd`/|g" | sed "s|.plist||g"); }
And now we can do:
/ $ defread /Library/Preferences/com.apple.loginwindow.plist / $ cd /Library/Preferences /Library/Preferences $ defread ./com.apple.loginwindow.plist
or even:
/Library/Preferences $ defread ./com.apple.loginwindow.plist SHOWFULLNAME 1
mmmm.
So last night I experienced my first earthquake ever….
Considering it was a 5.6 and quite close to our house, I’m a little disappointed now that it wasn’t more dramatic… nothing even fell off the shelves. Just several huge thumps that felt like something dropped from a great height into the backyard.
Not to give any impression I didn’t freak out … On the other hand, Chantal having grown up in Tokyo was calm and collected.
I see Bill Baumgarter felt it too...
Full props to Josh for getting this out there….
Seriously though, this is how imaging has to be done these days for Macs. Given that we have all these excellent tools now, and given that Apple keep messing us around by releasing hardware that isn’t quite compatible with the latest OS X point update and requires a specific kext or whatever… it’s just too much pain to manage monolithic images by hand anymore.