#731859 debootstrap: variant=fakechroot fails

#731859#5
Date:
2013-12-10 14:48:33 UTC
From:
To:
Running debootstrap under Debian Sid yields:

$ fakeroot fakechroot debootstrap --verbose --variant=fakechroot sid debian-sid
[...]
I: Installing core packages...
W: Failure trying to run: chroot /home/josch/debian-sid dpkg --force-depends --install /var/cache/apt/archives/base-files_7.2_amd64.deb /var/cache/apt/archives/base-passwd_3.5.28_amd64.deb
W: See /home/josch/debian-sid/debootstrap/debootstrap.log for details (possibly the package archive is at fault)

And the last lines of the log say:

dpkg: warning: parsing file '/var/lib/dpkg/status' near line 5 package 'dpkg':
 missing description
dpkg: warning: parsing file '/var/lib/dpkg/status' near line 5 package 'dpkg':
 missing architecture
dpkg: regarding .../base-files_7.2_amd64.deb containing base-files, pre-dependency problem:
 base-files pre-depends on awk
  awk is not installed.

dpkg: warning: ignoring pre-dependency problem!
Selecting previously unselected package base-files.
(Reading database ... 0 files and directories currently installed.)
Preparing to unpack .../base-files_7.2_amd64.deb ...
Unpacking base-files (7.2) ...
rm: cannot remove '/var/lib/dpkg/tmp.ci': Directory not empty
dpkg: error while cleaning up:
 subprocess rm cleanup returned error exit status 1
rm: cannot remove '/var/lib/dpkg/tmp.ci': Directory not empty
dpkg: error processing archive /var/cache/apt/archives/base-passwd_3.5.28_amd64.deb (--install):
 subprocess rm cleanup returned error exit status 1
dpkg: base-files: dependency problems, but configuring anyway as you requested:
 base-files depends on awk; however:
  Package awk is not installed.

chown: invalid user: 'root:root'
dpkg: error processing package base-files (--install):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/base-passwd_3.5.28_amd64.deb
 base-files
Setting up base-files (7.2) ...


cheers, josch

#731859#10
Date:
2014-10-30 06:06:29 UTC
From:
To:
Hi josch,

I am currently encountering the same problem with version: debootstrap
1.0.40~ubuntu0.7 using wheezy instead of sid and without using fakeroot
fakechroot, but directly using sudo.

the strange thing is that this exact same error comes when debootstrap is
called from a script. But calling the same debootstrap command in a
terminal finishes without any error.

did you realize further investigation on this bug?

Best Regards
--
Eric Keller
debian-sid
--force-depends --install /var/cache/apt/archives/base-files_7.2_amd64.deb
/var/cache/apt/archives/base-passwd_3.5.28_amd64.deb
(possibly the package archive is at fault)
'dpkg':
'dpkg':
pre-dependency problem:
/var/cache/apt/archives/base-passwd_3.5.28_amd64.deb (--install):
requested:
1

#731859#17
Date:
2015-11-12 17:33:58 UTC
From:
To:
Business Deal of 24.5m usd for you, Reply back for more details if interested.
--- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
#731859#22
Date:
2016-01-27 20:33:03 UTC
From:
To:
Dear,

My name is Alima Ahmed i an ordinary single girl looking for a serious
relationship that may lead us to some thing who knows,i love a caring
man,truthful and trust worthy that can change the history of my life
to better,i want you to send a mail to me (alimaahmed2love@gmail.com)
so that i can tell you more about me and send my pictures to you,don't
forget and i have something to tell you.

alimaahmed2love@gmail.com,
Yours Alima

#731859#27
Date:
2018-03-19 12:56:21 UTC
From:
To:
control: tags -1 +unreproducible

$ dpkg --status debootstrap
Package: debootstrap
Status: install ok installed
Priority: extra
Section: admin
Installed-Size: 227
Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
Architecture: all
Version: 1.0.55
Depends: wget
Recommends: gnupg, debian-archive-keyring
Description: Bootstrap a basic Debian system
 debootstrap is used to create a Debian base system from scratch,
 without requiring the availability of dpkg or apt. It does this by
 downloading .deb files from a mirror site, and carefully unpacking them
 into a directory which can eventually be chrooted into.

$ fakeroot fakechroot debootstrap --verbose --variant=fakechroot sid debian-sid
(snip)
I: Configuring systemd...
I: Base system installed successfully.
$ echo $?
0

#731859#34
Date:
2018-05-27 11:19:20 UTC
From:
To:
time).

The attached script ("bug-731859-demo.sh") does a nested debootstrap
run.  The outer run sets up a chroot for the  Debian suite passed on
the command line (eg, "stretch"), then runs a nested debootstrap --
variant=fakechroot in that environment.  For me both these fail:

    ./bug-731859-demo.sh stretch
    ./bug-731859-demo.sh buster

They fail in different ways, but the root cause appears to be the same:
 the ldconfig isn't working.  Note that both leave ldd.REAL and
ldconfig.REAL lying around in the nested run.

#731859#39
Date:
2018-06-15 07:18:31 UTC
From:
To:
Hi,

 Thank you for providing script :)

 I've tested it and got failure. However, I could fix it a bit by adding
 "sudo mount -t proc none "${suite}.chroot/proc"" after debootstraping.
 Because debootstrap failure is caused by "systemd-machine-id-setup" in
 systemd.postinst, and can improve it with /proc mount.

 Russell, could you test it, please?

 I'm not sure how to run nested chroot with success, it means
 "chroot "/tmp/${suite}" /bin/sh" line would still fail, though.

#731859#44
Date:
2018-06-18 11:22:28 UTC
From:
To:
Hi,

 Hmm.

 I've run it and got failure as below (my question is can we run nested
 chroot without failure?)
+ chroot /tmp/stretch /bin/sh
chroot: failed to run command '/bin/sh': No such file or directory
I: Base system installed successfully.
+ chroot /home/x/stretch /bin/sh
chroot: failed to run command '/bin/sh': No such file or directory
+ ls -l /home/x/stretch/sbin/ldconfig /home/x/stretch/sbin/ldconfig.REAL
-rwxr-xr-x 1 x x     67 Jun 18 16:47 /home/x/stretch/sbin/ldconfig
-rwxr-xr-x 1 x x 881912 Jan 14 19:39 /home/x/stretch/sbin/ldconfig.REAL
Container stretch.nspawn exited successfully.
Begin: Running /scripts/init-premount ... done.
Begin: Mounting root file system ... Begin: Running /scripts/local-top ... done.
Begin: Running /scripts/local-premount ... [    3.245515] Btrfs loaded, crc32c=crc32c-generic
Scanning for Btrfs filesystems
[    3.324262] print_req_error: I/O error, dev fd0, sector 0
[    3.327074] floppy: error 10 while reading block 0
[    3.411652] random: fast init done
done.
[    3.445007] cryptd: max_cpu_qlen set to 1000
Warning: fsck not present, so skipping root file system
[    3.492000] EXT4-fs (sda): mounting ext2 file system using the ext4 subsystem
[    3.495787] EXT4-fs (sda): mounted filesystem without journal. Opts: (null)
done.
Begin: Running /scripts/local-bottom ... done.
Begin: Running /scripts/init-bottom ... done.
/bin/sh: 0: can't access tty; job control turned off
I: Base system installed successfully.
+ chroot /home/x/buster /bin/sh
chroot: failed to run command '/bin/sh': No such file or directory
+ ls -l /home/x/buster/sbin/ldconfig /home/x/buster/sbin/ldconfig.REAL
-rwxr-xr-x 1 x x     67 Jun 18 10:07 /home/x/buster/sbin/ldconfig
-rwxr-xr-x 1 x x 901088 Mar 29 19:47 /home/x/buster/sbin/ldconfig.REAL
+ exit
+ umount buster.chroot/sys
+ umount buster.chroot/proc
+ umount buster.chroot/dev/pts
+ umount buster.chroot/dev
I: Base system installed successfully.
+ chroot /home/x/buster /bin/sh
chroot: failed to run command '/bin/sh': No such file or directory
+ ls -l /home/x/buster/sbin/ldconfig /home/x/buster/sbin/ldconfig.REAL
-rwxr-xr-x 1 x x     67 Jun 18 17:03 /home/x/buster/sbin/ldconfig
-rwxr-xr-x 1 x x 901088 Mar 30 04:47 /home/x/buster/sbin/ldconfig.REAL
Container buster.nspawn exited successfully.
Begin: Running /scripts/init-premount ... done.
Begin: Mounting root file system ... Begin: Running /scripts/local-top ... done.
Begin: Running /scripts/local-premount ... [    3.308450] Btrfs loaded, crc32c=crc32c-generic
Scanning for Btrfs filesystems
[    3.384200] print_req_error: I/O error, dev fd0, sector 0
[    3.386911] floppy: error 10 while reading block 0
[    3.471441] random: fast init done
done.
[    3.504605] cryptd: max_cpu_qlen set to 1000
Warning: fsck not present, so skipping root file system
[    3.548903] EXT4-fs (sda): mounting ext2 file system using the ext4 subsystem
[    3.553363] EXT4-fs (sda): mounted filesystem without journal. Opts: (null)
done.
Begin: Running /scripts/local-bottom ... done.
Begin: Running /scripts/init-bottom ... done.
/bin/sh: 0: can't access tty; job control turned off

#731859#49
Date:
2018-06-19 03:05:15 UTC
From:
To:
Hi,

 With provided script, it runs debootstrap under chroot, however,
 debootstraped environment under chroot causes problem with symlink.

$ sudo chroot stretch.chroot true
$ sudo chroot stretch.chroot/home/x/stretch/ true
chroot: failed to run command 'true': No such file or directory
$ ls -al stretch.chroot/home/x/stretch/lib64/
total 8
drwxr-xr-x  2 henrich henrich 4096  6月 19 02:36 .
drwxr-xr-x 19 henrich henrich 4096  6月 19 02:38 ..
lrwxrwxrwx  1 henrich henrich   47  1月 14 10:39 ld-linux-x86-64.so.2 -> /home/x/stretch/lib/x86_64-linux-gnu/ld-2.24.so

 I don't know why, but ld-linux-x86-64.so.2 point not point to
 /lib/x86_64-linux-gnu/ld-2.24.so, this scripts always returns error.

#731859#54
Date:
2018-06-20 02:16:30 UTC
From:
To:
If I parse that correctly you as asking is it possible to possible to
do a debootstrap inside of a chroot.  The answer is yes of course, but
even if it wasn't I provided examples where it failed when not running
in a chroot - it was running inside a container (ie, systemd-nspawn)
and a VM (qemu-system-x86_64).

Perhaps you are asking if it's possible to do it inside a fakechroot?
If so the answer is again yes.

But first you have to understand the root cause of the failure.  It's
this: fakechroot (and fakeroot for that matter) work by hacking Linux's
dynamic loading system.  They insert a shim dll that intercepts some
calls (eg, getuid() and chroot()) to make it appear as if the user is
root.  But ldconfig doesn't use dll's, it's statically linked, so it
doesn't see the hack.  So when the posinst scripts run by debootstrap
invoke ldconfig it attempts to alter the real systems dll
/etc/ld.so.conf, which fortunately gets a permission failure because
the user isn't really root.

The problem isn't insurmountable as ldconfig has a -r option, which
changes the directory it uses as root.  SO the authors of ldconfig have
done what they can to help us work around the problem.  If we can
arrange all attempts to invoke "$TARGET/bin/ldconfig ..." inside of the
debootstrap to instead run "$TARGET/bin/ldconfig -r $TARGET ..." it
should all work, and indeed it does work.

Unfortunately how to do that isn't obvious.  debootstrap moves
/bin/ldconfig to /bin/ldconfig.REAL, and naively replaces /bin/ldconfig
with:

   #!/bin/sh
   ...other stuff...

That won't work because of the #!/bin/sh.  /bin/sh itself depends on
dll's, and those dll's aren't set up until ldconfig is run so "...other
stuff..." is never run.

Here are options that will work:

1.  Do what is done now in a way that will work, which boils down to
    using no dynamically linked program inside of the debootstrap
    environment until ldconfig has been run successfully.  Make
    debootstrap depend on the statically linked busybox, place a copy
    of it in $TARGET/debootstrap, move $TARGET/bin/ldconfig to
    $TARGET/bin/ldconfig.REAL (as happens now), and change the
    shell script put in the place of $TARGET/bin/ldconfig to:
        #!/debootstrap/busybox sh
        "$TARGET/bin/ldconfig.REAL" -r "$TARGET" "$@"

2.  Use the FAKECHROOT_CMD_SUBST feature of fakechroot.  Set it to:
        FAKECHROOT_CMD_SUBST=/bin/ldconfig=$TARGET/debootstrap/ldconfig
    When you do that whenever a program attempts to invoke
    /bin/ldconfig inside of the chroot fakeconfig instead runs
    $TARGET/debootstrap/ldconfig outside of the chroot.  Write
    the following script to $TARGET/debootstrap/ldconfig:
        #!/bin/sh
        "$TARGET/bin/ldconfig" -r "$TARGET" "$@"

This works because we are now using the hosts /bin/sh to hack
    the
ldconfig command line.

3.  Move $TARGET/bin/ldconfig to $TARGET/bin/ldconfig.REAL (as happens
    now), include a small statically linked C program as part of 
    debootstrap that invokes $TARGET/bin/ldconfig.REAL -r $TARGET and
    temporarily replace $TARGET/bin/ldconfig with that program.

I used method 1 to verify the general approach works.

#731859#59
Date:
2023-04-17 22:51:43 UTC
From:
To:
I am sorry to bother you and intrude your privacy. I am single,
  lonely and in need of a caring, loving and romantic companion.

I am a secret admirer and would like to explore the opportunity to
learn more about each other. I know it is strange to contact you
this way and I hope you can forgive me. I am a shy person and
this is the only way I know I could get your attention. I just want
to know what you think and my intention is not to offend you.
I hope we can be friends if that is what you want, although I wish
to be more than just a friend. I know you have a few questions to
ask and I hope I can satisfy some of your curiosity with a few
answers.

I believe in the saying that 'to the world you are just one person,
but to someone special you are the world'. All I want is love,
romantic care and attention from a special companion which I am
hoping would be you.

I hope this message will be the beginning of a long term
communication between us, simply send a reply to this message, it
will make me happy.


Hugs and kisses,

Marion.

#731859#64
Date:
2024-02-04 13:36:23 UTC
From:
To:
variant=fakechroot still fails in testing, but it apparently fails in a
different way. (Do I need a new bug report?)

`fakeroot fakechroot debootstrap --variant=fakechroot testing testing`
fails.

Whereas `fakeroot fakechroot debootstrap --variant=minbase testing
testing` succeeds.

But at this point I have to ask what the purpose of variant=fakechroot
is in the first place, as it can only be run with `fakeroot fakechroot`
anyway.

$ debootstrap --variant=fakechroot testing testing
E: debootstrap can only run as root

$ fakeroot debootstrap --variant=fakechroot testing testing

E: This variant requires fakechroot environment to be started

So the only way to run a debootstrap is to either use `fakeroot
fakechroot` with variant=minbase, or as root.

debootstrap 1.0.134

#731859#69
Date:
2024-02-04 15:11:35 UTC
From:
To:
I did a bunch more testing, for fun:

Where host --> guest chroot using `fakeroot fakechroot debootstrap
--variant=fakechroot guest guest`

Jammy --> Stable: fail
Jammy --> Jammy: success
Jammy --> Testing: fail
Jammy --> Noble: fail

Stable --> Stable: success
Stable¹ --> Jammy: fail
Stable --> Testing: fail
Stable¹ --> Noble: fail

Noble --> Stable: success
Noble --> Jammy: fail
Noble --> Testing: fail
Noble --> Noble: fail

Testing --> Stable: success
Testing --> Jammy: fail
Testing --> Testing: fail
Testing --> Noble: fail

Unstable --> Stable: success
Unstable --> Jammy: fail
Unstable --> Testing: fail
Unstable --> Noble: fail
Unstable --> Unstable: fail

¹ Using patched Ubuntu git head to make it find the release
(https://code.launchpad.net/~kennybobs/ubuntu/+source/debootstrap/+git/debootstrap)

The way in which the failures occur vary, which suggests multiple bugs.
If there's any interest I will separate these into individual bug reports.

Some of the failures are the same as in the OP (base-files/base-passwd),
but those are in the Ubuntu releases. The failures in the Debian -->
Testing tests seem related to cron-daemon-common, though the failure
appears to be in systemd-sysusers so it might actually be the same bug.

Jammy: debootstrap 1.0.126+nmu1ubuntu0.5, fakeroot 1.28-1ubuntu1,
fakechroot 2.20.1+ds-2
Stable: debootstrap 1.0.128+nmu2+deb12u1, fakeroot 1.31-1.2, fakechroot
2.20.1+ds-15
Noble: debootstrap 1.0.134ubuntu1, fakeroot 1.33-1, fakechroot 2.20.1+ds-15
Testing: debootstrap 1.0.134, fakeroot 1.33-1, fakechroot 2.20.1+ds-15
Unstable: debootstrap 1.0.134, fakeroot 1.33-1, fakechroot 2.20.1+ds-15

Success rates
debootstrap 1.0.126+nmu1ubuntu0.5 (1/4)
debootstrap 1.0.128+nmu2+deb12u1 (1/2)
debootstrap 1.0.134ubuntu1² (1/6)
debootstrap 1.0.134 (2/9)
fakeroot 1.28-1ubuntu1 (1/4)
fakeroot 1.31-1.2 (1/4)
fakeroot 1.33-1 (3/13)
fakechroot 2.20.1+ds-15 (3/13)
fakechroot 2.20.1+ds-2 (1/4)

Success rates (base versions)
debootstrap 1.0.126 (1/4)
debootstrap 1.0.128 (1/2)
debootstrap 1.0.134² (3/13)
fakeroot 1.28 (1/4)
fakeroot 1.31 (1/4)
fakeroot 1.33 (3/13)
fakechroot 2.20.1 (4/21)

² Including patched Ubuntu git head (above)

So it looks like the newer release of debootstrap are the more
successful, which was probably expected. At this point I don't know what
part fakeroot might play.

I won't bother testing any older versions unless it would be considered
useful.

#731859#74
Date:
2024-02-04 18:08:42 UTC
From:
To:
Working on this, will update soon.
#731859#87
Date:
2024-07-23 01:12:12 UTC
From:
To:
Hi,

Xinyi Solar Holding Limited is hiring for a remote Data Entry/Excel position. You don't need any experience at all. Work 30-40 hrs/week at your convenience and earn up to $1500 weekly. Reply with your Resume if Interested.

Thanks,

Ivan Caban
Director Of Recruiting
Xinyi solar holding

Inform?cia:

T?to spr?va a v?etky jej pr?lohy s? ur?en? v?hradne adres?tovi (-tom) spr?vy. Obsah spr?vy a jej pr?loh m??e podlieha? ochrane pod?a osobitn?ch predpisov. Za obsah spr?vy a jej pr?lohy zodpoved? fyzick? osoba, ktor? spr?vu odoslala. Pokia? nie ste opr?vnen?m adres?tom tejto spr?vy, pros?m, ne??rte t?to spr?vu, nezverej?ujte, nekop?rujte a ani inak s touto spr?vou a jej pr?lohami nezaobch?dzajte. V pr?pade, ?e ste t?to spr?vu dostali neopr?vnene, pros?m, upovedomte okam?ite jej odosielate?a, ?e V?m t?to spr?va bola doru?en? a vyma?te ju zo svojej elektronickej po?ty.

#731859#92
Date:
2025-02-10 01:28:16 UTC
From:
To:
You have a new Lodgment that requires your attention

Check Now [1]

Thank you for your attention,

Best regards
MyGov Support Team.

This email was sent by Services Australia.

Copyright 2024 Services Australia. All Rights Reserved. Designated
trademarks and brands are the property of their respective owners.

The contents of all e-mail and any attachments are strictly private and
confidential and may contain information which is subject to legal
privilege. Such e-mail may not be used or disclosed under any
circumstances by anyone who is not a named recipient. Please return the
e-mail if you are not the intended or named recipient. Unauthorised use
of the email or its contents is prohibited and may be unlawful. Incoming
and outgoing e-mail is subject to continuous and ad hoc filtering,
scrutiny and reporting. Services Australia accepts no liability
whatsoever for any damage, loss or expense arising from this e-mail
and/or from the accessing of any files attached to this e-mail. This
message shall not be construed as a solicitation to contract nor an
offer or acceptance of any contractual obligations.

Links:
------
[1]
https://www.ticpharma.com/advertising?objet=466&url=//vtfprescont.com/vffjfde98jfposass839202jalkjnajk29312dkajaj280kjaskj38ha9292hkjw9289jkaasas822ka98s8as8asas7a9ssa89a8saas8s888s8sssfggwhj478/hla748eybn8374hdjcncb839dj3829283hdjmjdh38392hhdbcbchdj338493js8394833jd393939djd3939djdjd93847489392837djddmndnsh489393/index.php