packages icon indicating copy to clipboard operation
packages copied to clipboard

schroot: Chroot setup failed: stage=setup-start

Open alex9434 opened this issue 3 months ago • 7 comments

Maintainer: @jmarcet @ptpt52 @neheb Environment: OpenWrt 23.05.2 on Arm64 (Raspberry Pi 4B)

Description: Unable to start schroot environment: Chroot setup failed: stage=setup-start

  1. Create chroot with debootstrap --no-check-gpg --arch=arm64 bullseye /srv/chroot/debian
  2. Create file in /etc/schroot/chroot.d
[debian]
description=Debian environment
directory=/srv/chroot/debian
aliases=bullseye
type=directory
users=root
groups=root
root-groups=root
  1. Start with schroot -c debian
E: 20copyfiles: /etc/schroot/setup.d/20copyfiles: line 42: /bin/stat: not found
E: 70services: /etc/schroot/setup.d/70services: line 48: tac: not found
E: debian-1711263744-18335: Chroot setup failed: stage=setup-start

alex9434 avatar Mar 24 '24 07:03 alex9434

Install coreutils-stat and coreutils-tac as hinted by those messages.

brada4 avatar Mar 29 '24 08:03 brada4

@alex9434 Can you confirm it works well with both coreutils-stat & coreutils-tac packages installed? I'm the maintainer of schroot but I've always tested the package in a box where I have all of coreutils installed.

jmarcet avatar Apr 01 '24 09:04 jmarcet

@jmarcet Apologies for the delay in getting back. Yes, installing coreutils-stat & coreutils-tac solved the issue. Since I am building from source I was thinking about just using stat and tac from busybox. Would that also work?

I only now get an error message because ash is not included in the debian setup.

W: Shell ‘/bin/ash’ not available: /bin/ash: Failed to stat file: No such file or directory
W: Falling back to shell ‘/bin/bash’

shell=/bin/bash in the config solved the issue. You might want to include that in the package.

There is an additional dependency on coreutils-realpath when exiting the schroot:

E: 15killprocs: /etc/schroot/setup.d/15killprocs: line 42: realpath: not found
E: android-1712316017-2771: Chroot setup failed: stage=setup-stop

Installing coreutils-realpath solved the issue.

The only question would be whether to include in the Makefile the dependency on Busybox or coreutils. I think we can close the issue now.

alex9434 avatar Apr 05 '24 11:04 alex9434

@jmarcet Apologies for the delay in getting back. Yes, installing coreutils-stat & coreutils-tac solved the issue. Since I am building from source I was thinking about just using stat and tac from busybox. Would that also work?

@alex9434 See the PR I've opened, it includes an updated 01-openwrt.patch which brings compatibility with busybox's stat (built with BUSYBOX_CONFIG_FEATURE_STAT_FORMAT option).

I only now get an error message because ash is not included in the debian setup.

W: Shell ‘/bin/ash’ not available: /bin/ash: Failed to stat file: No such file or directory
W: Falling back to shell ‘/bin/bash’

shell=/bin/bash in the config solved the issue. You might want to include that in the package.

Where does that ash come from? I can't find it within /etc/schroot or any other of the files in the schroot ipk package, which is what I could check now.

There is an additional dependency on coreutils-realpath when exiting the schroot:

E: 15killprocs: /etc/schroot/setup.d/15killprocs: line 42: realpath: not found
E: android-1712316017-2771: Chroot setup failed: stage=setup-stop

Installing coreutils-realpath solved the issue.

Great! Thanks for the feedback :) I had missed that one.

The only question would be whether to include in the Makefile the dependency on Busybox or coreutils. I think we can close the issue now.

In the PR I've added both as options, it is missing realpath ATM though.

jmarcet avatar Apr 05 '24 11:04 jmarcet

Where does that ash come from? I can't find it within /etc/schroot or any other of the files in the schroot ipk package, which is what I could check now.

ash is the default shell in OpenWrt. I think schroot tries to call the same shell. However, debootstrap installs only bash by default hence the error message.

BTW: realpath is also available in Busybox

alex9434 avatar Apr 05 '24 13:04 alex9434

SHELL=/bin/sh chroot bootstrap

brada4 avatar Apr 05 '24 14:04 brada4

Where does that ash come from? I can't find it within /etc/schroot or any other of the files in the schroot ipk package, which is what I could check now.

ash is the default shell in OpenWrt. I think schroot tries to call the same shell. However, debootstrap installs only bash by default hence the error message.

I'm used to specify which command I want to execute with schroot, be it a shell or any other command. I was not remembering it defaults to the host's $SHELL.

BTW: realpath is also available in Busybox

I've updated the PR to also include realpath, whether from busybox or from coreutils.

jmarcet avatar Apr 06 '24 06:04 jmarcet