On Mon, Oct 27, 2014 at 12:07:24 +0100, Santiago Vila wrote:
> On Mon, 27 Oct 2014, Michael Tautschnig wrote:
> 
> > I'm hoping this is not going to be too philosophical, so I'll enlist the 
> > facts
> > first (please let me know if I got any of them wrong):
> > 
> > debootstrap'ing a system fails, because
> > 
> > - chown root:root ... won't work when invoked from base-files' postinst
> > - version 7.7 of base-files is the first to actually have this call when 
> > invoked
> >   from within (c)debootstrap
> 
> Regarding previous point, it should be noted that base-files postinst
> has a lot of chown calls. I would like to know how it is possible that
> only the recently added is the one that fails and not the others
> (if that's really the case).
> 

I suppose none of the others are being executed as all of them are guarded by
some combination of checks?

> BTW: I don't know what is the proper way to debug this (private
> repository using reprepro?). Can anybody confirm that the chown that
> fails is exactly the one at the very end?
> 

Indeed it could be a very different one.  I'm attaching a full log with the
postinst script having set -evx. It might be obvious, but this is being run on a
wheezy system.

> > So let's see what Debian Policy says in 3.8 Essential packages:
> > 
> > "[...] Since dpkg will not prevent upgrading of other packages while an
> > essential package is in an unconfigured state, all essential packages must
> > supply all of their core functionality even when unconfigured. If the 
> > package
> > cannot satisfy this requirement it must not be tagged as essential, and any
> > packages depending on this package must instead have explicit dependency 
> > fields
> > as appropriate. [...]"
> 
> This is about dpkg when making upgrades. It means that once an
> essential package is properly configured, it should not stop working
> because of it being "unconfigured" by dpkg (whatever that means).
> 
> I think it does not apply here.
> 

Then maybe take the first sentence in 3.8 Essential packages instead: "Essential
is defined as the minimal set of functionality that must be available and usable
on the system at all times, even when packages are in the "Unpacked" state."

If not this one (and not the one above), which bit of policy are you then
relying on when you do the chown calls?

> [ snipped philosophical stuff. I would much prefer to have free time
>   to work on this rather than discuss about it. Really ].
> 

As you please. I was just hoping to find potential options other than "revert
the change in base-files."

Best,
Michael

root@mt-farm05:~# mkdir /srv/sid-base.cow
root@mt-farm05:~# pbuilder create --aptcache /srv/jenkins-slave/aptcache 
--debootstrapopts --keyring=/usr/share/keyrings/debian-archive-keyring.gpg 
--buildplace /srv/sid-base.cow --mirror ftp://ftp.uk.debian.org/debian 
--distribution sid --no-targz --extrapackages cowdancer
I: Running in no-targz mode
I: Distribution is sid.
I: Current time: Mon Oct 27 11:44:42 GMT 2014
I: pbuilder-time-stamp: 1414410282
I: Building the build environment
I: running debootstrap
/usr/sbin/debootstrap
I: Retrieving Release
I: Retrieving Release.gpg
I: Checking Release signature
I: Valid Release signature (key id A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553)
I: Retrieving Packages
I: Validating Packages
I: Resolving dependencies of required packages...
I: Resolving dependencies of base packages...
I: Found additional required dependencies: acl adduser dmsetup 
init-system-helpers insserv libaudit-common libaudit1 libbz2-1.0 libcap2 
libcap2-bin libcryptsetup4 libdb5.3 libdebconfclient0 libdevmapper1.02.1 
libgcrypt20 libgdbm3 libgpg-error0 libkmod2 libncursesw5 libprocps3 
libsemanage-common libsemanage1 libslang2 libsystemd0 libudev1 libustr-1.0-1 
perl perl-modules procps systemd systemd-sysv udev
I: Found additional base dependencies: binutils bzip2 cpp cpp-4.9 
debian-archive-keyring dpkg-dev g++ g++-4.9 gcc gcc-4.9 gnupg gpgv 
libapt-pkg4.12 libasan1 libatomic1 libc-dev-bin libc6-dev libcilkrts5 
libcloog-isl4 libdpkg-perl libgcc-4.9-dev libgmp10 libgomp1 libisl10 libitm1 
liblsan0 libmpc3 libmpfr4 libquadmath0 libreadline6 libstdc++-4.9-dev 
libstdc++6 libtimedate-perl libtsan0 libubsan0 libusb-0.1-4 linux-libc-dev make 
patch readline-common xz-utils
I: Checking component main on ftp://ftp.uk.debian.org/debian...
I: Retrieving acl
I: Validating acl
I: Retrieving libacl1
I: Validating libacl1
I: Retrieving adduser
I: Validating adduser
I: Retrieving apt
I: Validating apt
I: Retrieving libapt-pkg4.12
I: Validating libapt-pkg4.12
I: Retrieving libattr1
I: Validating libattr1
I: Retrieving libaudit-common
I: Validating libaudit-common
I: Retrieving libaudit1
I: Validating libaudit1
I: Retrieving base-files
I: Validating base-files
I: Retrieving base-passwd
I: Validating base-passwd
I: Retrieving bash
I: Validating bash
I: Retrieving binutils
I: Validating binutils
I: Retrieving build-essential
I: Validating build-essential
I: Retrieving bzip2
I: Validating bzip2
I: Retrieving libbz2-1.0
I: Validating libbz2-1.0
I: Retrieving libdebconfclient0
I: Validating libdebconfclient0
I: Retrieving libcloog-isl4
I: Validating libcloog-isl4
I: Retrieving coreutils
I: Validating coreutils
I: Retrieving libcryptsetup4
I: Validating libcryptsetup4
I: Retrieving dash
I: Validating dash
I: Retrieving libdb5.3
I: Validating libdb5.3
I: Retrieving debconf
I: Validating debconf
I: Retrieving debconf-i18n
I: Validating debconf-i18n
I: Retrieving debian-archive-keyring
I: Validating debian-archive-keyring
I: Retrieving debianutils
I: Validating debianutils
I: Retrieving diffutils
I: Validating diffutils
I: Retrieving dpkg
I: Validating dpkg
I: Retrieving dpkg-dev
I: Validating dpkg-dev
I: Retrieving libdpkg-perl
I: Validating libdpkg-perl
I: Retrieving e2fslibs
I: Validating e2fslibs
I: Retrieving e2fsprogs
I: Validating e2fsprogs
I: Retrieving libcomerr2
I: Validating libcomerr2
I: Retrieving libss2
I: Validating libss2
I: Retrieving findutils
I: Validating findutils
I: Retrieving gcc-4.7-base
I: Validating gcc-4.7-base
I: Retrieving gcc-4.8-base
I: Validating gcc-4.8-base
I: Retrieving cpp-4.9
I: Validating cpp-4.9
I: Retrieving g++-4.9
I: Validating g++-4.9
I: Retrieving gcc-4.9
I: Validating gcc-4.9
I: Retrieving gcc-4.9-base
I: Validating gcc-4.9-base
I: Retrieving libasan1
I: Validating libasan1
I: Retrieving libatomic1
I: Validating libatomic1
I: Retrieving libcilkrts5
I: Validating libcilkrts5
I: Retrieving libgcc-4.9-dev
I: Validating libgcc-4.9-dev
I: Retrieving libgcc1
I: Validating libgcc1
I: Retrieving libgomp1
I: Validating libgomp1
I: Retrieving libitm1
I: Validating libitm1
I: Retrieving liblsan0
I: Validating liblsan0
I: Retrieving libquadmath0
I: Validating libquadmath0
I: Retrieving libstdc++-4.9-dev
I: Validating libstdc++-4.9-dev
I: Retrieving libstdc++6
I: Validating libstdc++6
I: Retrieving libtsan0
I: Validating libtsan0
I: Retrieving libubsan0
I: Validating libubsan0
I: Retrieving cpp
I: Validating cpp
I: Retrieving g++
I: Validating g++
I: Retrieving gcc
I: Validating gcc
I: Retrieving libgdbm3
I: Validating libgdbm3
I: Retrieving libc-bin
I: Validating libc-bin
I: Retrieving libc-dev-bin
I: Validating libc-dev-bin
I: Retrieving libc6
I: Validating libc6
I: Retrieving libc6-dev
I: Validating libc6-dev
I: Retrieving multiarch-support
I: Validating multiarch-support
I: Retrieving libgmp10
I: Validating libgmp10
I: Retrieving gnupg
I: Validating gnupg
I: Retrieving gpgv
I: Validating gpgv
I: Retrieving grep
I: Validating grep
I: Retrieving gzip
I: Validating gzip
I: Retrieving hostname
I: Validating hostname
I: Retrieving init
I: Validating init
I: Retrieving init-system-helpers
I: Validating init-system-helpers
I: Retrieving insserv
I: Validating insserv
I: Retrieving libisl10
I: Validating libisl10
I: Retrieving libkmod2
I: Validating libkmod2
I: Retrieving libcap2
I: Validating libcap2
I: Retrieving libcap2-bin
I: Validating libcap2-bin
I: Retrieving libgcrypt20
I: Validating libgcrypt20
I: Retrieving libgpg-error0
I: Validating libgpg-error0
I: Retrieving liblocale-gettext-perl
I: Validating liblocale-gettext-perl
I: Retrieving libselinux1
I: Validating libselinux1
I: Retrieving libsemanage-common
I: Validating libsemanage-common
I: Retrieving libsemanage1
I: Validating libsemanage1
I: Retrieving libsepol1
I: Validating libsepol1
I: Retrieving libtext-charwidth-perl
I: Validating libtext-charwidth-perl
I: Retrieving libtext-iconv-perl
I: Validating libtext-iconv-perl
I: Retrieving libtext-wrapi18n-perl
I: Validating libtext-wrapi18n-perl
I: Retrieving libtimedate-perl
I: Validating libtimedate-perl
I: Retrieving libusb-0.1-4
I: Validating libusb-0.1-4
I: Retrieving linux-libc-dev
I: Validating linux-libc-dev
I: Retrieving lsb-base
I: Validating lsb-base
I: Retrieving dmsetup
I: Validating dmsetup
I: Retrieving libdevmapper1.02.1
I: Validating libdevmapper1.02.1
I: Retrieving make
I: Validating make
I: Retrieving mawk
I: Validating mawk
I: Retrieving libmpc3
I: Validating libmpc3
I: Retrieving libmpfr4
I: Validating libmpfr4
I: Retrieving libncurses5
I: Validating libncurses5
I: Retrieving libncursesw5
I: Validating libncursesw5
I: Retrieving libtinfo5
I: Validating libtinfo5
I: Retrieving ncurses-base
I: Validating ncurses-base
I: Retrieving ncurses-bin
I: Validating ncurses-bin
I: Retrieving libpam-modules
I: Validating libpam-modules
I: Retrieving libpam-modules-bin
I: Validating libpam-modules-bin
I: Retrieving libpam-runtime
I: Validating libpam-runtime
I: Retrieving libpam0g
I: Validating libpam0g
I: Retrieving patch
I: Validating patch
I: Retrieving libpcre3
I: Validating libpcre3
I: Retrieving perl
I: Validating perl
I: Retrieving perl-base
I: Validating perl-base
I: Retrieving perl-modules
I: Validating perl-modules
I: Retrieving libprocps3
I: Validating libprocps3
I: Retrieving procps
I: Validating procps
I: Retrieving libreadline6
I: Validating libreadline6
I: Retrieving readline-common
I: Validating readline-common
I: Retrieving sed
I: Validating sed
I: Retrieving sensible-utils
I: Validating sensible-utils
I: Retrieving login
I: Validating login
I: Retrieving passwd
I: Validating passwd
I: Retrieving libslang2
I: Validating libslang2
I: Retrieving startpar
I: Validating startpar
I: Retrieving libsystemd0
I: Validating libsystemd0
I: Retrieving libudev1
I: Validating libudev1
I: Retrieving systemd
I: Validating systemd
I: Retrieving systemd-sysv
I: Validating systemd-sysv
I: Retrieving udev
I: Validating udev
I: Retrieving initscripts
I: Validating initscripts
I: Retrieving sysv-rc
I: Validating sysv-rc
I: Retrieving sysvinit-utils
I: Validating sysvinit-utils
I: Retrieving tar
I: Validating tar
I: Retrieving tzdata
I: Validating tzdata
I: Retrieving libustr-1.0-1
I: Validating libustr-1.0-1
I: Retrieving bsdutils
I: Validating bsdutils
I: Retrieving libblkid1
I: Validating libblkid1
I: Retrieving libmount1
I: Validating libmount1
I: Retrieving libsmartcols1
I: Validating libsmartcols1
I: Retrieving libuuid1
I: Validating libuuid1
I: Retrieving mount
I: Validating mount
I: Retrieving util-linux
I: Validating util-linux
I: Retrieving liblzma5
I: Validating liblzma5
I: Retrieving xz-utils
I: Validating xz-utils
I: Retrieving zlib1g
I: Validating zlib1g
I: Chosen extractor for .deb packages: dpkg-deb
I: Extracting acl...
I: Extracting libacl1...
I: Extracting adduser...
I: Extracting libattr1...
I: Extracting libaudit-common...
I: Extracting libaudit1...
I: Extracting base-files...
I: Extracting base-passwd...
I: Extracting bash...
I: Extracting libbz2-1.0...
I: Extracting libdebconfclient0...
I: Extracting coreutils...
I: Extracting libcryptsetup4...
I: Extracting dash...
I: Extracting libdb5.3...
I: Extracting debconf...
I: Extracting debconf-i18n...
I: Extracting debianutils...
I: Extracting diffutils...
I: Extracting dpkg...
I: Extracting e2fslibs...
I: Extracting e2fsprogs...
I: Extracting libcomerr2...
I: Extracting libss2...
I: Extracting findutils...
I: Extracting gcc-4.7-base...
I: Extracting gcc-4.8-base...
I: Extracting gcc-4.9-base...
I: Extracting libgcc1...
I: Extracting libgdbm3...
I: Extracting libc-bin...
I: Extracting libc6...
I: Extracting multiarch-support...
I: Extracting grep...
I: Extracting gzip...
I: Extracting hostname...
I: Extracting init...
I: Extracting init-system-helpers...
I: Extracting insserv...
I: Extracting libkmod2...
I: Extracting libcap2...
I: Extracting libcap2-bin...
I: Extracting libgcrypt20...
I: Extracting libgpg-error0...
I: Extracting liblocale-gettext-perl...
I: Extracting libselinux1...
I: Extracting libsemanage-common...
I: Extracting libsemanage1...
I: Extracting libsepol1...
I: Extracting libtext-charwidth-perl...
I: Extracting libtext-iconv-perl...
I: Extracting libtext-wrapi18n-perl...
I: Extracting lsb-base...
I: Extracting dmsetup...
I: Extracting libdevmapper1.02.1...
I: Extracting mawk...
I: Extracting libncurses5...
I: Extracting libncursesw5...
I: Extracting libtinfo5...
I: Extracting ncurses-base...
I: Extracting ncurses-bin...
I: Extracting libpam-modules...
I: Extracting libpam-modules-bin...
I: Extracting libpam-runtime...
I: Extracting libpam0g...
I: Extracting libpcre3...
I: Extracting perl...
I: Extracting perl-base...
I: Extracting perl-modules...
I: Extracting libprocps3...
I: Extracting procps...
I: Extracting sed...
I: Extracting sensible-utils...
I: Extracting login...
I: Extracting passwd...
I: Extracting libslang2...
I: Extracting startpar...
I: Extracting libsystemd0...
I: Extracting libudev1...
I: Extracting systemd...
I: Extracting systemd-sysv...
I: Extracting udev...
I: Extracting initscripts...
I: Extracting sysv-rc...
I: Extracting sysvinit-utils...
I: Extracting tar...
I: Extracting tzdata...
I: Extracting libustr-1.0-1...
I: Extracting bsdutils...
I: Extracting libblkid1...
I: Extracting libmount1...
I: Extracting libsmartcols1...
I: Extracting libuuid1...
I: Extracting mount...
I: Extracting util-linux...
I: Extracting liblzma5...
I: Extracting zlib1g...
I: Installing core packages...
W: Failure trying to run: chroot /srv/sid-base.cow/. dpkg --force-depends 
--install /var/cache/apt/archives/base-files_7.8_amd64.deb 
/var/cache/apt/archives/base-passwd_3.5.36_amd64.deb
W: See /srv/sid-base.cow/./debootstrap/debootstrap.log for details (possibly 
the package package is at fault)
E: debootstrap failed
W: Aborting with an error
root@mt-farm05:~# chroot /srv/sid-base.cow/
bash: warning: setlocale: LC_ALL: cannot change locale (en_GB.UTF-8)
root@mt-farm05:/# mv /etc/passwd /etc/passwd.old
root@mt-farm05:/# mv /etc/group /etc/group.old
root@mt-farm05:/# sed -i '2s/set -e/set -evx/' 
/var/lib/dpkg/info/base-files.postinst
root@mt-farm05:/# /var/lib/dpkg/info/base-files.postinst configure 7.8

install_local_dir() {
  if [ ! -d $1 ]; then
    mkdir -p $1
  fi
  if [ -f /etc/staff-group-for-usr-local ]; then
    chown root:staff $1 2> /dev/null || true
    chmod 2775 $1 2> /dev/null || true
  fi
}

install_from_default() {
  if [ ! -f $2 ]; then
    cp -p $1 $2
  fi
}

install_directory() {
  if [ ! -d /$1 ]; then
    mkdir /$1
    chown root:$3 /$1
    chmod $2 /$1
  fi
}

migrate_directory() {
  if [ ! -L $1 ]; then
    rmdir $1
    ln -s $2 $1
  fi
}

update_to_current_default() {
  if [ -f /etc/$1 ]; then
    md5=`md5sum /etc/$1 | cut -f 1 -d " "`
    if grep -q "$md5" /usr/share/base-files/$1.md5sums; then
      if ! cmp -s /usr/share/base-files/$1 /etc/$1; then
        cp -p /usr/share/base-files/$1 /etc/$1
        echo Updating /etc/$1 to current default.
      fi
    fi
  fi
}

if [ ! -e /etc/dpkg/origins/default ]; then
  if [ -e /etc/dpkg/origins/debian ]; then
    ln -sf debian /etc/dpkg/origins/default
  fi
fi
+ [ ! -e /etc/dpkg/origins/default ]

if [ "$1" = "configure" ] && [ "$2" = "" ]; then
  install_from_default /usr/share/base-files/staff-group-for-usr-local \
    /etc/staff-group-for-usr-local
  install_from_default /usr/share/base-files/nsswitch.conf /etc/nsswitch.conf
  install_from_default /usr/share/base-files/dot.profile   /root/.profile
  install_from_default /usr/share/base-files/dot.bashrc    /root/.bashrc
  install_from_default /usr/share/base-files/profile       /etc/profile
  install_from_default /usr/share/base-files/motd          /etc/motd
  install_directory mnt       755 root
  install_directory srv       755 root
  install_directory opt       755 root
  install_directory etc/opt   755 root
  install_directory var/opt   755 root
  install_directory media     755 root
  install_directory var/mail 2775 mail
  if [ ! -L /var/spool/mail ]; then
    ln -s ../mail /var/spool/mail
  fi
  install_directory run/lock 1777 root
  migrate_directory /var/run /run
  migrate_directory /var/lock /run/lock

  install_local_dir /usr/local
  install_local_dir /usr/local/share
  install_local_dir /usr/local/share/man
  install_local_dir /usr/local/bin
  install_local_dir /usr/local/games
  install_local_dir /usr/local/lib
  install_local_dir /usr/local/include
  install_local_dir /usr/local/sbin
  install_local_dir /usr/local/src
  install_local_dir /usr/local/etc
  ln -sf share/man /usr/local/man

  if [ ! -f /var/log/wtmp ]; then
    echo -n>/var/log/wtmp
  fi
  if [ ! -f /var/log/btmp ]; then
    echo -n>/var/log/btmp
  fi
  if [ ! -f /var/log/lastlog ]; then
    echo -n>/var/log/lastlog
  fi
  chown root:utmp /var/log/wtmp /var/log/btmp /var/log/lastlog
  chmod 664 /var/log/wtmp /var/log/lastlog
  chmod 660 /var/log/btmp
  if [ ! -f /var/run/utmp ]; then
    echo -n>/var/run/utmp
  fi
  chown root:utmp /var/run/utmp
  chmod 664 /var/run/utmp
fi
+ [ configure = configure ]
+ [ 7.8 =  ]

if [ ! -d /var/lib/dpkg ]; then
  mkdir -m 755 -p /var/lib/dpkg
  chown root:root /var/lib/dpkg
fi
+ [ ! -d /var/lib/dpkg ]
if [ ! -f /var/lib/dpkg/status ]; then
  echo > /var/lib/dpkg/status
  chmod 644 /var/lib/dpkg/status
  chown root:root /var/lib/dpkg/status
fi
+ [ ! -f /var/lib/dpkg/status ]

if [ ! -f /usr/info/dir ] && [ ! -f /usr/share/info/dir ]; then
  install_from_default /usr/share/base-files/info.dir /usr/share/info/dir
  chmod 644 /usr/share/info/dir
  chown root:root /usr/share/info/dir
fi
+ [ ! -f /usr/info/dir ]
+ [ ! -f /usr/share/info/dir ]
+ install_from_default /usr/share/base-files/info.dir /usr/share/info/dir
+ [ ! -f /usr/share/info/dir ]
+ cp -p /usr/share/base-files/info.dir /usr/share/info/dir
+ chmod 644 /usr/share/info/dir
+ chown root:root /usr/share/info/dir
chown: invalid user: 'root:root'
root@mt-farm05:/#

Attachment: pgpFojb6p9R3p.pgp
Description: PGP signature

Reply via email to