Fresh linux install not booting? Don’t get mad, get googling. February 24, 2009
Posted by andrewgdotcom in Linux.1 comment so far
The main hard drive in my shitebox HP media centre PC died over the weekend, taking with it a significant collection of TV episodes. That didn’t bother me too much, as I rarely rewatch old TV, but it also meant that I couldn’t download any new TV, and that’s just intolerable when BSG, Dollhouse and Terminator are all airing in the States on the same night. My first reaction was to install Linux on a semi-spare USB-connected hard disk. One copy of the Lenny installer on a USB key later, and a base system was up and configured on an unclean partition.*
First problem: the bios won’t boot from USB hard drives, even though it boots from flash drives without a second thought. And no, it won’t boot from FireWire either. So, out with the screwdriver and the disk is transplanted into the main machine where the dead HD had been futilely spinning and radiating heat.
Second problem: the replacement drive is PATA, not SATA, and the mobo only has one PATA port. Not a problem, I wasn’t using the LightScribe DVDR for anything anyway…
Third problem (and this was the killer): GRUB hangs at
GRUB Loading stage 1.5
GRUB loading, please wait...
No amount of reinstalling or reconfiguring seemed to help, and I spent quite some time on google trying to track down possible reasons. I even installed grub on a USB key to see what happened; it got as far as the boot menu, but hung immediately afterwards.
Thinking it may have been something to do with installing on an unclean filesystem, I partitioned out some free space on the same drive and started from scratch. This ended up exactly the same way, but with an added “Error 22″. Much swearing was done, some of it on Twitter, and I went to bed really late and really angry two nights in a row, because I had two fresh yet broken installs of Linux and still no Galactica.
Maybe the disk wasn’t LBA? I didn’t think it was that old, but anything was worth a shot. Firing up parted, I tried to move the big partition out of the first 1024 cylinders to make space for a tiny boot partition. Parted gave me “Unable to satisfy all constraints on the partition”, which I had never seen before. When googling for this error, I stumbled across the following:
Error: Unable to satisfy all constraints on the pa: msg#00059 gnu.parted.bugs
The line about cylinder boundary alignment tickled something in the back of my brain. So, I booted up once more using the trusty usb key, ran fdisk and sure enough the old unclean partition didn’t end on a cylinder boundary. Deleting it and recreating it with the same parameters jiggled it a few kb larger and lo! both copies of Linux were magically fixed.
* Can’t be deleting the old photographs now, can we?
How to manage mailman list membership using LDAP or Active Directory February 20, 2009
Posted by andrewgdotcom in Linux, email.add a comment
Run this perl script on your mailman server once an hour using cron. Replace MY_LDAP_SERVER etc. with your own configuration. Also, depending on your LDAP implementation you may need to use group or groupOfNames instead of posixGroup.
For each list you wish to manage, create an LDAP/AD group with the email attribute set to the full address of the mailing list. The script scans all groups under the BASE_DN for any with an email address ending in @MY.LIST.SERVER. It overwrites each list’s membership with that of the corresponding LDAP group (if such a group exists, otherwise it does nothing). Make sure there is only one group for each mailing list! Multiple domain names are not supported, but could be with only a little hacking.
#!/usr/bin/perl -w
use Net::LDAP;
# Connect to LDAP proxy and authenticate
$ldap = Net::LDAP->new('ldaps://MY_LDAP_SERVER') || die "Can't connect to server\n";
$mesg = $ldap->bind(
'MY_DN',
password => 'MY_PASSWORD'
) || die "Connected to server, but couldn't bind\n";
# search for interesting AD groups
$mesg = $ldap->search(
base => "MY_BASE_DN",
filter => "(&(objectClass=posixGroup))"
);
die "Search returned no interesting security groups\n" unless $mesg;
foreach $group ($mesg->entries) {
$list_email = $group->get_value("mail");
# For groups with emails of the form "*@MY.LIST.SERVER"
# Try to chop off the name of our list server. If we fail, it wasn't meant to be.
if($list_email && $list_email=~s/\@MY\.LIST\.SERVER$//) {
# get the membership list
@member_list = $group->get_value("uniqueMember");
die "Security group for list $list_email looks empty - PANIC!\n" unless @member_list;
# make a list of emails to pass to mailman
$member_emails = "";
foreach $member_dn (@member_list) {
$mesg2 = $ldap->search(
base => $member_dn,
filter => "(&(cn=*))",
scope => "base"
);
die "Couldn't locate entry $member_dn - PANIC!\n" unless $mesg2;
$member = $mesg2->entry(0);
$member_emails .= $member->get_value("cn") . " get_value("mail") . ">\n";
};
# now update the mailman list membership
# be verbose!
print "\nchanging $list_email\n";
open( PIPE, "|/var/mailman/bin/sync_members -w=yes -g=yes -a=yes -f - $list_email" )
|| die "Couldn't fork process! $!\n";
print PIPE $member_emails;
close PIPE;
};
};
The history meme April 16, 2008
Posted by andrewgdotcom in Linux, Mac, Software.add a comment
Spreading the meme…
serenity:~ andrewg$ history | awk ‘{a[$2]++} END {for(i in a)print a[i] ” ” i}’ | sort -rn | head -10
108 telnet
63 rscreen
43 ping
24 sudo
24 ssh
20 host
16 scp
16 more
14 ls
13 xdvi
Hm. I seem to be using the command line mainly as a gateway into remote systems – which reflects my average working day. The stray ‘xdvi’ is due to my recent heavy use of TextMate to write a paper in LaTeX. Not sure why I’ve been using sudo so much on my Mac though.
Similarly, on my work Linux laptop:
andgal@nbgal185:~$ history | awk ‘{a[$2]++} END {for(i in a)print a[i] ” ” i}’ | sort -rn | head -10
68 rscreen
52 ping
45 host
36 sudo
35 rdesktop
32 xrandr
21 startmenu
20 ssh
18 ifconfig
15 telnet
rscreen is merely a wrapper for ssh:
function rscreen() { /usr/bin/ssh -t $1 ’screen -dr || /usr/bin/screen || /bin/bash’; }
and startmenu is a cool but dodgy hack to get into my windows virtual machine:
alias startmenu=’nohup rdesktop -A -s “c:\program files\seamlessrdp\seamlessrdpshell.exe explorer.exe” 192.168.185.128 -u andgal -p xxxxxxxx&
xrandr reflects the fact that I have to configure my dual-screen setup by hand after each boot under Ubuntu 7.10, as the GUI configurator just Doesn’t Work. I had to test this many many times. Apparently the latest Ubuntu beta fixes most of these problems.
Galway Linux installfest, Sat 17th Nov November 13, 2007
Posted by andrewgdotcom in Linux.1 comment so far
Galway LUG is organising a Linux installfest on Saturday 17th from 10am-noon in the DERI building, Lower Dangan (map). This is a chance for you to bring along your old laptop/desktop and give it new purpose in life! If you have thought about trying Linux, but haven’t yet summoned up the courage, here is your chance to get some hands-on help. We will have several experienced users on hand to help you select, install and configure your first Linux.
A word of warning: if you have data on your hard drive, please BACK IT UP before bringing your machine. Galway LUG and its volunteers cannot be held responsible for loss of data. It is your responsibility to have current backups.
See you there!
Avahi and dot-local addresses on Ubuntu Gutsy September 28, 2007
Posted by andrewgdotcom in Linux.Tags: avahi, local, mDNS, ubuntu
5 comments
I’ve noticed a problem with avahi and *.local addresses on ubuntu gutsy
- this will probably have cropped up on other distributions, or will do
soon. It is related to the similar Mac *.local problem.
It is thus: if you have avahi (aka zeroconf) installed, *.local
addresses are resolved via mDNS first. The default config of avahi is to
fail if mDNS is enabled and the host is not found in mDNS. This means
that you cannot resolve addresses under .local which are
in DNS but not mDNS.
To fix, edit /etc/nsswitch.conf and remove the text “[NOTFOUND=return]“
as follows:
hosts: files mdns4_minimal dns mdns4 #hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
You then need to restart the problem software. Avahi still works, but
will fail over to standard DNS if the host cannot be resolved via mDNS.
Galway Linux September 23, 2007
Posted by andrewgdotcom in Linux.Tags: Galway LUG
1 comment so far
If you’re interested in (re)starting a Galway Linux Users’ Group, sign up here. If we get enough names I’ll organise an initial meeting in the next couple of weeks.
