Bug#962300: dmraid: dmraid fails do install in a debootstrapped chroot

2020-06-09 Thread Lukasz Stelmach
It was <2020-06-09 wto 22:07>, when Andreas Beckmann wrote:
> On 09/06/2020 10.43, Lukasz Stelmach wrote:
>> I assume, however,that in case of chroot environmets running udevadm
>> isn't crucial for a successful installation. I was thinking, maybe run
>> udevadm only if /sys is mounted like this?
>
> systemd/udev already uses this check in various places, there is no need
> to add another one effectively doing the same:
>
> (implementation from systemd/sid, src/basic/virt.c)
> int running_in_chroot(void) {
> int r;
>
> if (getenv_bool("SYSTEMD_IGNORE_CHROOT") > 0)
> return 0;
>
> r = files_same("/proc/1/root", "/", 0);
> if (r < 0)
> return r;
>
> return r == 0;
> }

I hadn't got /proc mounted in chroot. Hence, files_same returned r < 0
as did running_in_chroot() which in turn confused udevadm trigger.

if (running_in_chroot() > 0) {
log_info("Running in chroot, ignoring request.");
return 0;
}

Mounting /proc in chroot fixes the problem. 

Honestly, I am not quite sure what is the right solution here. They are
all arbitrary. On one hand, probably chroot should have all the API file
systems mounted properly to expect tools like udevadm to behave
reasonably. But on the other, I can't see a reason (as I mentioned
before), for the dmraid postinst script to fail. Mounting API file
systems in a foreign (different arch) chroot may also be confusing for
some other tools. I don't know. 

Anyway, thanks for helping me analyze the problem.

Kind regards,
-- 
Łukasz Stelmach
Samsung R Institute Poland
Samsung Electronics


signature.asc
Description: PGP signature


Bug#962300: dmraid: dmraid fails do install in a debootstrapped chroot

2020-06-09 Thread Andreas Beckmann
Control: severity -1 normal

On 09/06/2020 10.43, Lukasz Stelmach wrote:
> I assume, however,that in case of chroot environmets running udevadm
> isn't crucial for a successful installation. I was thinking, maybe run
> udevadm only if /sys is mounted like this?

systemd/udev already uses this check in various places, there is no need
to add another one effectively doing the same:

(implementation from systemd/sid, src/basic/virt.c)
int running_in_chroot(void) {
int r;

if (getenv_bool("SYSTEMD_IGNORE_CHROOT") > 0)
return 0;

r = files_same("/proc/1/root", "/", 0);
if (r < 0)
return r;

return r == 0;
}

In my armhf chroot this chroot detection test (/ does not match
/proc/1/root (by comparing device+inode)) works fine and disables udev
operations that are usually useless in a chroot). I can also try it
manually:

# stat -L /proc/1/root /
  File: /proc/1/root
  Size: 4096Blocks: 8  IO Block: 4096   directory
Device: 10304h/66308d   Inode: 2   Links: 25
Access: (0755/drwxr-xr-x)  Uid: (0/root)   Gid: (0/root)
Access: 2020-06-09 09:27:23.0 +
Modify: 2020-05-13 13:14:36.0 +
Change: 2020-05-13 13:14:36.0 +
 Birth: -
  File: /
  Size: 420 Blocks: 0  IO Block: 4096   directory
Device: 2dh/45d Inode: 115089130   Links: 21
Access: (0755/drwxr-xr-x)  Uid: (0/root)   Gid: (0/root)
Access: 2020-06-09 19:48:43.0 +
Modify: 2020-06-09 19:48:37.0 +
Change: 2020-06-09 19:48:37.0 +
 Birth: -


Andreas



Bug#962300: dmraid: dmraid fails do install in a debootstrapped chroot

2020-06-09 Thread Lukasz Stelmach
It was <2020-06-08 pon 23:57>, when Andreas Beckmann wrote:
> Control: tag -1 moreinfo
>
> On Fri, 05 Jun 2020 21:30:50 +0200 =?utf-8?Q?=C5=81ukasz_Stelmach?= 
>  wrote:
>> On an amd64 host I created armel chroot with qemu-debootstrap. I
>> attempted to install dracut which pulled dmraid and other
>> packages. After installing all packages but dmraid apt install shows
>> following messages (with set -x added to dmraid.postinst)
>
> I have a qemu-debootstrap armhf chroot (tarball) that I use for some
> tests with pbuilder. Execution of foreign binaries happens with
> qemu-user(-static). Installing dmraid there works:
>
> # apt-get install dmraid
> Reading package lists... Done
> Building dependency tree   
> Reading state information... Done
> The following additional packages will be installed:
>   dmsetup libdevmapper1.02.1 libdmraid1.0.0.rc16 libkmod2 udev
> The following NEW packages will be installed:
>   dmraid dmsetup libdevmapper1.02.1 libdmraid1.0.0.rc16 libkmod2 udev
> 0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
> Need to get 126 kB/1845 kB of archives.
> After this operation, 9592 kB of additional disk space will be used.
> Do you want to continue? [Y/n] 
> Get:1 http://ftp.de.debian.org/debian unstable/main armhf libdmraid1.0.0.rc16 
> armhf 1.0.0.rc16-8 [90.8 kB]
> Get:2 http://ftp.de.debian.org/debian unstable/main armhf dmraid armhf 
> 1.0.0.rc16-8 [35.0 kB]
> Fetched 126 kB in 0s (606 kB/s)   
> debconf: unable to initialize frontend: Dialog
> debconf: (No usable dialog-like program is installed, so the dialog
> based frontend cannot be used. at
> /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76, <> line 6.)
> debconf: falling back to frontend: Readline
> Selecting previously unselected package libkmod2:armhf.
> (Reading database ... 13583 files and directories currently installed.)
> Preparing to unpack .../0-libkmod2_27+20200310-2_armhf.deb ...
> Unpacking libkmod2:armhf (27+20200310-2) ...
> Selecting previously unselected package udev.
> Preparing to unpack .../1-udev_245.5-3_armhf.deb ...
> Unpacking udev (245.5-3) ...
> Selecting previously unselected package dmsetup.
> Preparing to unpack .../2-dmsetup_2%3a1.02.167-1+b1_armhf.deb ...
> Unpacking dmsetup (2:1.02.167-1+b1) ...
> Selecting previously unselected package libdevmapper1.02.1:armhf.
> Preparing to unpack .../3-libdevmapper1.02.1_2%3a1.02.167-1+b1_armhf.deb ...
> Unpacking libdevmapper1.02.1:armhf (2:1.02.167-1+b1) ...
> Selecting previously unselected package libdmraid1.0.0.rc16.
> Preparing to unpack .../4-libdmraid1.0.0.rc16_1.0.0.rc16-8_armhf.deb ...
> Unpacking libdmraid1.0.0.rc16 (1.0.0.rc16-8) ...
> Selecting previously unselected package dmraid.
> Preparing to unpack .../5-dmraid_1.0.0.rc16-8_armhf.deb ...
> Unpacking dmraid (1.0.0.rc16-8) ...
> Setting up libkmod2:armhf (27+20200310-2) ...
> Setting up udev (245.5-3) ...
> A chroot environment has been detected, udev not started.
> Setting up libdevmapper1.02.1:armhf (2:1.02.167-1+b1) ...
> Setting up dmsetup (2:1.02.167-1+b1) ...
> Setting up libdmraid1.0.0.rc16 (1.0.0.rc16-8) ...
> Setting up dmraid (1.0.0.rc16-8) ...
> Running in chroot, ignoring request.
> Processing triggers for libc-bin (2.30-8) ...
>
>> Setting up dmraid (1.0.0.rc16-8) ...
>> + command -v update-initramfs
>> + udevadm trigger --subsystem-match=block --action=change
>> Failed to scan devices: No such file or directory
>> dpkg: error processing package dmraid (--configure):
>
> In your case, udev does not seem to recognice that is it running in a chroot.
> So the failure is in udev and not dmraid.
> But the error is probably somewhere in your chroot setup ...
> these foreign chroots are a bit tricky.

Indeed, it is udev that fails not dmraid as such. In particular udev
fils to find /sys/subsystem.

I assume, however,that in case of chroot environmets running udevadm
isn't crucial for a successful installation. I was thinking, maybe run
udevadm only if /sys is mounted like this?

--8<---cut here---start->8---
# Don't run udevadm if sysfs isn't mounted
if [ -d /sys/subsystem ]; then 
udevadm trigger --subsystem-match=block --action=change
fi
--8<---cut here---end--->8---


Kind regards,
-- 
Łukasz Stelmach
Samsung R Institute Poland
Samsung Electronics


signature.asc
Description: PGP signature


Bug#962300: dmraid: dmraid fails do install in a debootstrapped chroot

2020-06-08 Thread Andreas Beckmann
Control: tag -1 moreinfo

On Fri, 05 Jun 2020 21:30:50 +0200 =?utf-8?Q?=C5=81ukasz_Stelmach?= 
 wrote:
> On an amd64 host I created armel chroot with qemu-debootstrap. I
> attempted to install dracut which pulled dmraid and other
> packages. After installing all packages but dmraid apt install shows
> following messages (with set -x added to dmraid.postinst)

I have a qemu-debootstrap armhf chroot (tarball) that I use for some
tests with pbuilder. Execution of foreign binaries happens with
qemu-user(-static). Installing dmraid there works:

# apt-get install dmraid
Reading package lists... Done
Building dependency tree   
Reading state information... Done
The following additional packages will be installed:
  dmsetup libdevmapper1.02.1 libdmraid1.0.0.rc16 libkmod2 udev
The following NEW packages will be installed:
  dmraid dmsetup libdevmapper1.02.1 libdmraid1.0.0.rc16 libkmod2 udev
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 126 kB/1845 kB of archives.
After this operation, 9592 kB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://ftp.de.debian.org/debian unstable/main armhf libdmraid1.0.0.rc16 
armhf 1.0.0.rc16-8 [90.8 kB]
Get:2 http://ftp.de.debian.org/debian unstable/main armhf dmraid armhf 
1.0.0.rc16-8 [35.0 kB]
Fetched 126 kB in 0s (606 kB/s)   
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based 
frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 
76, <> line 6.)
debconf: falling back to frontend: Readline
Selecting previously unselected package libkmod2:armhf.
(Reading database ... 13583 files and directories currently installed.)
Preparing to unpack .../0-libkmod2_27+20200310-2_armhf.deb ...
Unpacking libkmod2:armhf (27+20200310-2) ...
Selecting previously unselected package udev.
Preparing to unpack .../1-udev_245.5-3_armhf.deb ...
Unpacking udev (245.5-3) ...
Selecting previously unselected package dmsetup.
Preparing to unpack .../2-dmsetup_2%3a1.02.167-1+b1_armhf.deb ...
Unpacking dmsetup (2:1.02.167-1+b1) ...
Selecting previously unselected package libdevmapper1.02.1:armhf.
Preparing to unpack .../3-libdevmapper1.02.1_2%3a1.02.167-1+b1_armhf.deb ...
Unpacking libdevmapper1.02.1:armhf (2:1.02.167-1+b1) ...
Selecting previously unselected package libdmraid1.0.0.rc16.
Preparing to unpack .../4-libdmraid1.0.0.rc16_1.0.0.rc16-8_armhf.deb ...
Unpacking libdmraid1.0.0.rc16 (1.0.0.rc16-8) ...
Selecting previously unselected package dmraid.
Preparing to unpack .../5-dmraid_1.0.0.rc16-8_armhf.deb ...
Unpacking dmraid (1.0.0.rc16-8) ...
Setting up libkmod2:armhf (27+20200310-2) ...
Setting up udev (245.5-3) ...
A chroot environment has been detected, udev not started.
Setting up libdevmapper1.02.1:armhf (2:1.02.167-1+b1) ...
Setting up dmsetup (2:1.02.167-1+b1) ...
Setting up libdmraid1.0.0.rc16 (1.0.0.rc16-8) ...
Setting up dmraid (1.0.0.rc16-8) ...
Running in chroot, ignoring request.
Processing triggers for libc-bin (2.30-8) ...

> Setting up dmraid (1.0.0.rc16-8) ...
> + command -v update-initramfs
> + udevadm trigger --subsystem-match=block --action=change
> Failed to scan devices: No such file or directory
> dpkg: error processing package dmraid (--configure):

In your case, udev does not seem to recognice that is it running in a chroot.
So the failure is in udev and not dmraid.
But the error is probably somewhere in your chroot setup ...
these foreign chroots are a bit tricky.


Andreas



Bug#962300: dmraid: dmraid fails do install in a debootstrapped chroot

2020-06-05 Thread Łukasz Stelmach
Source: dmraid
Severity: grave

Dear Maintainer,

On an amd64 host I created armel chroot with qemu-debootstrap. I
attempted to install dracut which pulled dmraid and other
packages. After installing all packages but dmraid apt install shows
following messages (with set -x added to dmraid.postinst)

--8<---cut here---start->8---
# LANG=C apt install dracut
Reading package lists... Done
Building dependency tree
Reading state information... Done
dracut is already the newest version (048+80-2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
Setting up dmraid (1.0.0.rc16-8) ...
+ command -v update-initramfs
+ udevadm trigger --subsystem-match=block --action=change
Failed to scan devices: No such file or directory
dpkg: error processing package dmraid (--configure):
installed dmraid package post-installation script subprocess returned
error exit status 1
Errors were encountered while processing:
dmraid
E: Sub-process /usr/bin/dpkg returned an error code (1)
--8<---cut here---end--->8---

I'd expect the package to install regardles of available devices.


-- System Information:
Debian Release: 10.4
  APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: armel

Kind regards,
--
Łukasz Stelmach
Samsung R Institute Poland
Samsung Electronics


signature.asc
Description: PGP signature