Comment 3 for bug 727603

Revision history for this message
Steve Langasek (vorlon) wrote : Re: [Bug 727603] Re: /var/lib/dpkg/info/$arch still a directory on new installs

On Wed, Mar 02, 2011 at 09:43:50AM -0000, Colin Watson wrote:
> However, debootstrap 1.0.28ubuntu1 now creates the symlink before any of
> that. Anything that's debootstrapping natty needs to make sure to use
> at least this version.

Aha, ok.

> The reason I don't like approaches such as 'mv
> /var/lib/dpkg/info/armel/* /var/lib/dpkg/info/ && rmdir
> /var/lib/dpkg/info/armel && ln -sf . /var/lib/dpkg/info/armel' (as you
> suggested on IRC) are that they're unsafe; a power failure in the middle
> of that will result in a corrupted dpkg database.

Yes, I don't like it either, I was only suggesting it in the context of a
quick test. If we needed to do this for a real upgrade fix, I would
suggest:

  if [ -d /var/lib/dpkg/info/$arch ] && ! [ -L /var/lib/dpkg/info/$arch ]; then
    cp -a /var/lib/dpkg/info/$arch/* /var/lib/dpkg/info
  fi
  if ! [ -L /var/lib/dpkg/info/$arch ]; then
    if [ -d /var/lib/dpkg/info/$arch ]; then
      mv /var/lib/dpkg/info/$arch /var/lib/dpkg/info/${arch}.dpkg-bak
    fi
    ln -sf . /var/lib/dpkg/info/$arch
  fi
  rm -rf /var/lib/dpkg/info/${arch}.dpkg-bak

That's not 100% safe either wrt database corruption, but it reduces the
window to the time between the directory move and the symlink creation, and
should be recoverable by hand at every point.

But I think we don't want to do this until the dpkg multiarch db layout is
finalized, anyway.

--
Steve Langasek Give me a lever long enough and a Free OS
Debian Developer to set it on, and I can move the world.
Ubuntu Developer http://www.debian.org/
<email address hidden> <email address hidden>