From: Henning Schild <henning.schild@siemens.com>
To: "Andreas Reichel" <andreas.reichel.ext@siemens.com>
Cc: <isar-users@googlegroups.com>
Subject: Re: Integration of Pseudo into Isar
Date: Thu, 3 Aug 2017 09:50:11 +0200 [thread overview]
Message-ID: <20170803095011.05aaa73c@md1em3qc> (raw)
In-Reply-To: <20170802132413.GA25215@iiotirae>
Another thing that might be important is which steps actually fail with
pseudo. Currently we use sudo in several places.
1 multistrap
2 configure.sh
3 ext4fs
4 populate
And maybe more, i do not know by heart.
1 needs to work for sure
2 can be merged into 1 when all configuration is moved into debian
packages
3 will be replaced by wic if you choose to use wic
4 will move into 1 if my second patchq gets merged
But i am guessing 1 already causes problems. Maybe in OE the magic that
makes pseudo work is in the combination of pseudo and wic. In that case
the magic needs to be understood and applied to 1 or maybe 1 can be
done inside wic?
Henning
Am Wed, 2 Aug 2017 15:24:14 +0200
schrieb "Andreas Reichel" <andreas.reichel.ext@siemens.com>:
> # Integrating pseudo into isar
>
> Idea was to exchange `sudo` by `pseudo`. The function of `pseudo` is
> to intercept system calls and file accesses by preloading a library.
> All such operations are recorded in a database. For this to work, a
> `PSEUDO_PREFIX` variable must be seet, which is `/` if `pseudo` is
> installed to the default location.
>
> # Given test configuration #
>
> - Docker container based on debian 9
> - `multistrap` from Siemens Debian repository
> - `pseudo` from Siemens Debian repository
>
> Using the following multistrap configuration named `simple-config`:
>
> ```
> [General]
> unpack=true
> bootstrap=Debian
> aptsources=Debian
> noauth=true
>
> [Debian]
> packages=
> source=http://ftp.de.debian.org/debian
> suite=stretch
> ```
>
> Inside chroot (which is inside pseudo):
>
> ```
> # mkdir rootfs
> # multistrap -f simple-config -d rootfs
> ```
>
> # Results #
>
> * Error during package configuration. (Cannot write to
> `/etc/ld.so.cache~`)
>
> This error can be tracked down to `ldconfig`.
> It turned out that `ldconfig` is linked *statically*. Which means,
> its file accesses cannot be intercepted by LDPRELOAD, which is only
> for dynamically linked binaries. Thus, wether being in a pseudo
> chroot or not, `ldconfig` will always access `/etc/ld.so.cache~` on
> the host, which fails.
> This is *NOT* a question of the Debian version and not a bug in
> `dpkg --configure -a`, which calls `ldconfig` internally.
>
> * Extremely odd behaviour within `chroot` within `pseudo`:
>
> ```
> $ pseudo
> # chroot rootfs
> # export PATH=/sbin:/bin
> # ldconfig
> Can't create temporary cache file /etc/ld.so.cache~
> ```
>
> Idea was then to rename `ldconfig` to `ldconfig_` and create a
> symbolic link to `/bin/true` to mimic successful execution of
> `ldconfig`.
>
> ```
> $ sudo mv rootfs/sbin/ldconfig rootfs/sbin/ldconfig_
> $ sudo ln -s /bin/true rootfs/sbin/ldconfig
> ```
>
> Here, behavior becomes very odd:
>
> ```
> $ pseudo
> # chroot rootfs
> # export PATH=/sbin:/bin
> # ldconfig
> /bin/sh: 16: ldconfig: not found
> ```
> Although it is in path...
> ```
> # /sbin/ldconfig
> /sbin/ldconfig: Can't create temporary cache file /etc/ld.so.cache~:
> Permission denied
> ```
>
> So this is not our symbolic link but the real ldconfig from the host
>
> ```
> # cd /sbin
> # ./ldconfig
> #
> ```
>
> This works and returns `true`.
>
> ```
> # cd /
> # /sbin/ldconfig
> /sbin/ldconfig: Can't create temporary cache file /etc/ld.so.cache~:
> Permission denied
> # sbin/ldconfig
> #
> ```
>
> So a relative path works, but an absolute path does not.
>
> Even more funny is:
>
> ```
> # exec sh
> # exit
> $
> ```
>
> The first `exec` replaces the current shell with `sh` from *OUTSIDE*
> of the `chroot`. The `exit` then exits the `pseudo` environment
> instead of the `chroot` environment.
>
> # Summary #
>
> * operations with `chroot inside pseudo` are completely messed-up.
> * `ldconfig` will never work with `pseudo` since it is static.
>
> But if packets are not configured, initramfs is not generated, etc...
>
> # Ideas #
>
> * Yocto Morty uses pseudo with own patches, which may solve some or
> all issues
> * Do not use multistrap but another tool
> * Stracing / Kernel tracing to analyze problem more deeply
>
>
> Kind regards,
> Andreas
>
next prev parent reply other threads:[~2017-08-03 7:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-02 13:24 Andreas Reichel
2017-08-02 14:36 ` Andreas Reichel
2017-08-02 14:39 ` Henning Schild
2017-08-02 14:55 ` Claudius Heine
2017-08-03 7:50 ` Henning Schild [this message]
2017-08-03 9:11 ` Andreas Reichel
2017-08-03 19:45 ` Schild, Henning
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170803095011.05aaa73c@md1em3qc \
--to=henning.schild@siemens.com \
--cc=andreas.reichel.ext@siemens.com \
--cc=isar-users@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox