DevHeads.net

Ubuntu 14.04's Debmirror broken?

I have been using debmirror (1:2.16ubuntu1.1) on an Ubuntu 14.04 server to
maintain a local mirror of Ubuntu 14.04, but in the past week it is failing:

Use of uninitialized value $l in chop at /usr/share/perl5/LockFile/Simple.pm line 438.
Use of uninitialized value $l in string eq at /usr/share/perl5/LockFile/Simple.pm line 439.
Use of uninitialized value $stamp in chop at /usr/share/perl5/LockFile/Simple.pm line 570.
Use of uninitialized value $stamp in pattern match (m//) at /usr/share/perl5/LockFile/Simple.pm line 576.
Use of uninitialized value $hostname in string ne at /usr/share/perl5/LockFile/Simple.pm line 578.
WARNING: waiting for /Mirror/ubuntu lock since 20 seconds
Use of uninitialized value $stamp in chop at /usr/share/perl5/LockFile/Simple.pm line 570.
Use of uninitialized value $stamp in pattern match (m//) at /usr/share/perl5/LockFile/Simple.pm line 576.
Use of uninitialized value $hostname in string ne at /usr/share/perl5/LockFile/Simple.pm line 578.
Use of uninitialized value $stamp in chop at /usr/share/perl5/LockFile/Simple.pm line 570.
Use of uninitialized value $stamp in pattern match (m//) at /usr/share/perl5/LockFile/Simple.pm line 576.
Use of uninitialized value $hostname in string ne at /usr/share/perl5/LockFile/Simple.pm line 578.
Use of uninitialized value $stamp in chop at /usr/share/perl5/LockFile/Simple.pm line 570.
Use of uninitialized value $stamp in pattern match (m//) at /usr/share/perl5/LockFile/Simple.pm line 576.
Use of uninitialized value $hostname in string ne at /usr/share/perl5/LockFile/Simple.pm line 578.
WARNING: still waiting for /Mirror/ubuntu lock after 50 seconds
Use of uninitialized value $stamp in chop at /usr/share/perl5/LockFile/Simple.pm line 570.
Use of uninitialized value $stamp in pattern match (m//) at /usr/share/perl5/LockFile/Simple.pm line 576.
Use of uninitialized value $hostname in string ne at /usr/share/perl5/LockFile/Simple.pm line 578.
Use of uninitialized value $stamp in chop at /usr/share/perl5/LockFile/Simple.pm line 570.
Use of uninitialized value $stamp in pattern match (m//) at /usr/share/perl5/LockFile/Simple.pm line 576.
Use of uninitialized value $hostname in string ne at /usr/share/perl5/LockFile/Simple.pm line 578.
Use of uninitialized value $stamp in chop at /usr/share/perl5/LockFile/Simple.pm line 570.
Use of uninitialized value $stamp in pattern match (m//) at /usr/share/perl5/LockFile/Simple.pm line 576.
Use of uninitialized value $hostname in string ne at /usr/share/perl5/LockFile/Simple.pm line 578.
WARNING: still waiting for /Mirror/ubuntu lock after 80 seconds
Use of uninitialized value $stamp in chop at /usr/share/perl5/LockFile/Simple.pm line 570.
Use of uninitialized value $stamp in pattern match (m//) at /usr/share/perl5/LockFile/Simple.pm line 576.
Use of uninitialized value $hostname in string ne at /usr/share/perl5/LockFile/Simple.pm line 578.
Use of uninitialized value $stamp in chop at /usr/share/perl5/LockFile/Simple.pm line 570.
Use of uninitialized value $stamp in pattern match (m//) at /usr/share/perl5/LockFile/Simple.pm line 576.
Use of uninitialized value $hostname in string ne at /usr/share/perl5/LockFile/Simple.pm line 578.
Use of uninitialized value $stamp in chop at /usr/share/perl5/LockFile/Simple.pm line 570.
Use of uninitialized value $stamp in pattern match (m//) at /usr/share/perl5/LockFile/Simple.pm line 576.
Use of uninitialized value $hostname in string ne at /usr/share/perl5/LockFile/Simple.pm line 578.
WARNING: still waiting for /Mirror/ubuntu lock after 110 seconds
Use of uninitialized value $stamp in chop at /usr/share/perl5/LockFile/Simple.pm line 570.
Use of uninitialized value $stamp in pattern match (m//) at /usr/share/perl5/LockFile/Simple.pm line 576.
Use of uninitialized value $hostname in string ne at /usr/share/perl5/LockFile/Simple.pm line 578.
Use of uninitialized value $stamp in chop at /usr/share/perl5/LockFile/Simple.pm line 570.
Use of uninitialized value $stamp in pattern match (m//) at /usr/share/perl5/LockFile/Simple.pm line 576.
Use of uninitialized value $hostname in string ne at /usr/share/perl5/LockFile/Simple.pm line 578.
Archive-Update-in-Progress-ub140464.wendellfreelibrary.org exists or you lack proper permissions; aborting at /usr/bin/debmirror line 867.

The fragment of /usr/share/perl5/LockFile/Simple.pm where this error is
occuring is this:

#
# _acs_lock -- private
#
# Internal locking routine.
#
# If $try is true, don't wait if the file is already locked.
# Returns true if the file was locked.
#
sub _acs_lock { ## private
my $self = shift;
my ($file, $format, $try) = @_;
my $max = $self->max;
my $delay = $self->delay;
my $stamp = $$;

# For NFS, we need something more unique than the process's PID
$stamp .= ':' . hostname if $self->nfs;

# Compute locking file name -- hardwired default format is "%f.lock"
my $lockfile = $file . $self->ext;
$format = $self->format unless defined $format;
$lockfile = $self->lockfile($file, $format) if defined $format;

# Detect stale locks or break lock if held for too long
$self->_acs_stale($file, $lockfile) if $self->stale;
$self->_acs_check($file, $lockfile) if $self->hold;

my $waited = 0; # Amount of time spent sleeping
my $lastwarn = 0; # Last time we warned them...
my $warn = $self->warn;
my ($wmin, $wafter, $wfunc);
($wmin, $wafter, $wfunc) =
($self->wmin, $self->wafter, $self->wfunc) if $warn;
my $locked = 0;
my $mask = umask(0333); # No write permission
local *FILE;

while ($max-- > 0) {
if (-f $lockfile) {
next unless $try;
umask($mask);
return 0; # Already locked
}

# Attempt to create lock
if (open(FILE, ">$lockfile")) {
local $\ = undef;
my $buf = "$stamp\n";
if (!syswrite(FILE, $buf, length($buf))) {
&$wfunc("writing to $lockfile: $!\n");
close(FILE);
if (!unlink($lockfile)) {
&$wfunc("removing $lockfile: $!");
}
umask($mask);
return 0; # Couldn't write to file
}
close FILE;
open(FILE, $lockfile); # Check lock
my $l;
chop($l = <FILE>);
$locked = $l eq $stamp;
$l = <FILE>; # Must be EOF
$locked = 0 if defined $l;
close FILE;
last if $locked; # Lock seems to be ours
} elsif ($try) {
umask($mask);
return 0; # Already locked, or cannot create lock
}
} continue {
sleep($delay); # Busy: wait
$waited += $delay;

# Warn them once after $wmin seconds and then every $wafter seconds
if (
$warn &&
((!$lastwarn && $waited > $wmin) ||
($waited - $lastwarn) > $wafter)
) {
my $waiting = $lastwarn ? 'still waiting' : 'waiting';
my $after = $lastwarn ? 'after' : 'since';
my $s = $waited == 1 ? '' : 's';
&$wfunc("$waiting for $file lock $after $waited second$s");
$lastwarn = $waited;
}

# While we wait, existing lockfile may become stale or too old
$self->_acs_stale($file, $lockfile) if $self->stale;
$self->_acs_check($file, $lockfile) if $self->hold;
}

umask($mask);
return $locked;
}

Line 438 is the "my $l;", just after the 'open(FILE, $lockfile); # Check
lock' line. I don't know Perl well enough to know what the problem is.

My ~/.debmirror file contains:

# Default config for debmirror

# The config file is a perl script so take care to follow perl syntax.
# Any setting in /etc/debmirror.conf overrides these defaults and
# ~/.debmirror.conf overrides those again. Take only what you need.
#
# The syntax is the same as on the command line and variable names
# loosely match option names. If you don't recognize something here
# then just stick to the command line.
#
# Options specified on the command line override settings in the config
# files.

# Location of the local mirror (use with care)
$mirrordir="/Mirror/ubuntu";

# Output options
$verbose=0;
$progress=0;
$debug=0;

# Download options
$host="us.archive.ubuntu.com";
$user="anonymous";
$passwd="anonymous@";
$remoteroot="ubuntu";
$download_method="http";
#@dists="precise,precise-updates,precise-security,precise-backports,trusty,trusty-updates,trusty-security,trusty-backports";
@dists="trusty,trusty-updates,trusty-security,trusty-backports";
@sections="main,universe,restricted,multiverse,debian-installer";
@arches="i386,amd64";
#@di_dists="dists";
#@di_archs="archs";
# @ignores="";
# @excludes="";
# @includes="";
# @excludes_deb_section="";
# @limit_priority="";
$omit_suite_symlinks=0;
$skippackages=0;
# @rsync_extra="doc,tools";
$i18n=0;
$getcontents=0;
$do_source=0;
$max_batch=0;

@di_dists="trusty";
@di_archs="i386,amd64";

# Save mirror state between runs; value sets validity of cache in days
$state_cache_days=0;

# Security/Sanity options
$ignore_release_gpg=0;
$ignore_release=0;
$check_md5sums=0;
$ignore_small_errors=0;

# Cleanup
$cleanup=1;
$post_cleanup=1;
$pre_cleanup=1;

# Locking options
$timeout=300;

# Rsync options
$rsync_batch=200;
$rsync_options="-aIL --partial";

# FTP/HTTP options
$passive=0;
# $proxy="http://proxy:port/";

# Dry run
$dry_run=0;

# Don't keep diff files but use them
$diff_mode="use";

# The config file must return true or perl complains.
# Always copy this.
1;