# Failed Chroot after Pacstrap

**URL:** <https://forum.endeavouros.com/t/failed-chroot-after-pacstrap/33365>\
**Category:** EndeavourOS installation\
**Created:** [October 31, 2022, 2:46pm UTC](https://forum.endeavouros.com/t/failed-chroot-after-pacstrap/33365 "2022-10-31T14:46:56Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![sradjoker](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/sradjoker/32/64224_2.png) [@sradjoker](https://forum.endeavouros.com/u/sradjoker)\
**Post date:** [October 31, 2022, 2:46pm UTC](https://forum.endeavouros.com/t/failed-chroot-after-pacstrap/33365/1 "2022-10-31T14:46:56Z")

</div>

I’m trying to arch-chroot after performing a pacstrap and it is leading to a segmentation fault.  
This is happening on pacstraps on mounted folders, loop devices and even micro SD cards.  
The issue occurs on both arm and x64.  
Here are the steps to reproduce. You need the `arch-install-scripts` package to run these commands. The package provides both `pacstrap` and `arch-chroot` commands.

```auto
mkdir -p MP
sudo mount --bind MP MP
sudo pacstrap -G MP base linux
sudo arch-chroot MP

```

Here is the error message. This didn’t happen a few weeks ago.

```auto
/usr/bin/arch-chroot: line 457: 23599 Segmentation fault (core dumped) SHELL=/bin/bash $pid_unshare chroot "${chroot_args[@]}" -- "$chrootdir" "${args[@]}"

```

I’ve even tried downgrading `arch-install-scripts`, and the error still occurs.  
`arch-chroot` is still working on existing installs and chroots created via `systemd-nspawn`.

I’m looking for the reason this is occurring and any possible fixes.

---

<div class="post-metadata">

**Author:** ![dalto](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/dalto/32/5577_2.png) [@dalto](https://forum.endeavouros.com/u/dalto)\
**Post date:** [October 31, 2022, 2:54pm UTC](https://forum.endeavouros.com/t/failed-chroot-after-pacstrap/33365/2 "2022-10-31T14:54:04Z")

</div>

> [@sradjoker](#):
>
> `sr/bin/arch-chroot: line 457`

What is on this line?

---

<div class="post-metadata">

**Author:** ![sradjoker](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/sradjoker/32/64224_2.png) [@sradjoker](https://forum.endeavouros.com/u/sradjoker)\
**Post date:** [October 31, 2022, 3:04pm UTC](https://forum.endeavouros.com/t/failed-chroot-after-pacstrap/33365/3 "2022-10-31T15:04:33Z")

</div>

Line 457 starts here:

```auto
arch-chroot() {
  (( EUID == 0 )) || die 'This script must be run with root privileges'

  [[-d $chrootdir]] || die "Can't create chroot on non-directory %s" "$chrootdir"

  $setup "$chrootdir" || die "failed to setup chroot %s" "$chrootdir"
  chroot_add_resolv_conf "$chrootdir" || die "failed to setup resolv.conf"

  if ! mountpoint -q "$chrootdir"; then
    warning "$chrootdir is not a mountpoint. This may have undesirable side effects."
  fi

  chroot_args=()
  [[$userspec]] && chroot_args+=(--userspec "$userspec")

  SHELL=/bin/bash $pid_unshare chroot "${chroot_args[@]}" -- "$chrootdir" "${args[@]}"
}

```

---

<div class="post-metadata">

**Author:** ![manuel](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/manuel/32/396_2.png) [@manuel](https://forum.endeavouros.com/u/manuel)\
**Post date:** [October 31, 2022, 4:40pm UTC](https://forum.endeavouros.com/t/failed-chroot-after-pacstrap/33365/4 "2022-10-31T16:40:48Z")

</div>

I assume this line is the problem:

```auto
sudo mount --bind MP MP

```

What is it trying to do?

EDIT: I tried the commands (in a fully updated VirtualBox VM) you wrote and it does not cause core dump, but seems to work.

---

<div class="post-metadata">

**Author:** ![sradjoker](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/sradjoker/32/64224_2.png) [@sradjoker](https://forum.endeavouros.com/u/sradjoker)\
**Post date:** [October 31, 2022, 5:59pm UTC](https://forum.endeavouros.com/t/failed-chroot-after-pacstrap/33365/5 "2022-10-31T17:59:45Z")

</div>

> [@manuel](#):
>
> What is it trying to do?

You can’t chroot directly into a folder. It causes issues with pacman etc, and also throws an error when you try to do so.  
It’s to create a mount point from a folder.

I don’t think that’s the problem since I tried it on an external storage device (micro SD card) and loop device which doesn’t need that line.

> [@manuel](#):
>
> tried the commands (in a fully updated VirtualBox VM)

I did the same a few hours ago and it didn’t work and @joekamprad tried it yesterday and had the same error.  
Let me update and try again now.  
(Same error)  
Here is the output of `strace arch-chroot MP`. I don’t know how to interpret it:  
[https://0x0.st/oY3l.txt](https://0x0.st/oY3l.txt)

The error is also occurring on a fresh install in VBox VM I did on Saturday too.

---

<div class="post-metadata">

**Author:** ![sradjoker](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/sradjoker/32/64224_2.png) [@sradjoker](https://forum.endeavouros.com/u/sradjoker)\
**Post date:** [October 31, 2022, 8:19pm UTC](https://forum.endeavouros.com/t/failed-chroot-after-pacstrap/33365/6 "2022-10-31T20:19:14Z")

</div>

Could this be the issue? @dalto @manuel @joekamprad ??

> **[FS#76351 : \[readline\] 8.2.0-1 causes bash coredump when invalid locale](https://bugs.archlinux.org/task/76351?project=1&string=bash)**
>
> Flyspray, a Bug Tracking System written in PHP.

---

<div class="post-metadata">

**Author:** ![manuel](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/manuel/32/396_2.png) [@manuel](https://forum.endeavouros.com/u/manuel)\
**Post date:** [October 31, 2022, 8:22pm UTC](https://forum.endeavouros.com/t/failed-chroot-after-pacstrap/33365/7 "2022-10-31T20:22:21Z")

</div>

Maybe, and easy to test by installing it from the testing repo.

---

<div class="post-metadata">

**Author:** ![sradjoker](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/sradjoker/32/64224_2.png) [@sradjoker](https://forum.endeavouros.com/u/sradjoker)\
**Post date:** [November 1, 2022, 5:42pm UTC](https://forum.endeavouros.com/t/failed-chroot-after-pacstrap/33365/8 "2022-11-01T17:42:13Z")

</div>

Apparently the solution is this (its working for me):

```auto
sudo env LC_ALL=C arch-chroot MP     

```

---

<div class="post-metadata">

**Author:** ![joekamprad](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/joekamprad/32/139011_2.png) [@joekamprad](https://forum.endeavouros.com/u/joekamprad)\
**Post date:** [November 1, 2022, 7:18pm UTC](https://forum.endeavouros.com/t/failed-chroot-after-pacstrap/33365/9 "2022-11-01T19:18:13Z")

</div>

so only happen if you do not use en\_us?

---

<div class="post-metadata">

**Author:** ![sradjoker](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/sradjoker/32/64224_2.png) [@sradjoker](https://forum.endeavouros.com/u/sradjoker)\
**Post date:** [November 1, 2022, 8:13pm UTC](https://forum.endeavouros.com/t/failed-chroot-after-pacstrap/33365/10 "2022-11-01T20:13:25Z")

</div>

I’m confused.  
This is apparently a readline bug as I’ve mentioned before.

An update to `readline` landed on arch x64 and it fixed the issue.

---

<div class="post-metadata">

**Author:** ![sradjoker](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/sradjoker/32/64224_2.png) [@sradjoker](https://forum.endeavouros.com/u/sradjoker)\
**Post date:** [November 3, 2022, 8:13pm UTC](https://forum.endeavouros.com/t/failed-chroot-after-pacstrap/33365/11 "2022-11-03T20:13:32Z")

</div>

Closed on November 3, 2022, 8:13pm UTC

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
