You are not logged in.

#26 2019-01-06 20:10:39

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [Solved] chroot: failed to run command "/bin/bash": Input/output error

I'd definitely go with pacman-static, it is useful both inside the chroot and outside to have a binary that has no dependencies. It's also a useful replacement for pacman when using pacstrap on the host, since Debian doesn't have a pacman package.

Instructions for downloading and verifying the binary can be found here: https://aur.archlinux.org/packages/pacman-static


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#27 2019-01-06 20:14:49

magiusche
Member
Registered: 2008-12-05
Posts: 37

Re: [Solved] chroot: failed to run command "/bin/bash": Input/output error

Trilby wrote:

I meant the libs linked to by bash, not just all of them, but I can find them in the list and it confirms my suspicion:

/mnt/sdb1/usr/lib/libdl-2.28.so:                            empty
/mnt/sdb1/usr/lib/libc-2.28.so:                             empty
/mnt/sdb1/usr/lib/ld-2.28.so:                               empty

Many of your essential libs are totally borked.  Ncurses being "ASCII text" is particularly odd.

You'll need to manually copy over the appropriate libs for *at least* these libs before you can even chroot to use bash.  But from there you will not be able to do much else.  I didn't check all the libs pacman links to, for example.

EDIT: I removed libncurses from the list, apparently `file` reads it as ASCII text on my system too, so that may be fine (edit 3: yup, it just reads in libncursesw).  So glibc seems borked at least.

EDIT 2: your borked packages seem to be limted to glibc, libunwind, python, and slang.  Only glibc is critical to get back into your system and run pacman.  So manually download and extract the glibc package and copy it's contents over to the appropriate locations in sdb1.  Then you should be able to chroot and run pacman ensuring to reinstall the other three broken packages.

Well i've downloaded and extracted https://ind.mirror.pkgbuild.com/core/os … pkg.tar.xz

I've copied all files usr and var and missing etc or zero ones.
here the output of

file /mnt/sdb1/usr/lib/*

  https://pastebin.com/NTZhcQvX

But chroot ddnt go..

cd /mnt/sdb1
mount -t proc /proc proc/
mount --rbind /sys sys/
mount --rbind /dev dev/
chroot /mnt/sdb1 /bin/bash

results: https://pastebin.com/vQ6U112P


Hope i help you!
and
VICE.VERSA

Offline

#28 2019-01-06 20:20:51

seth
Member
Registered: 2012-09-03
Posts: 50,970

Re: [Solved] chroot: failed to run command "/bin/bash": Input/output error

/usr/lib/ld-2.28.so:                               ASCII text, with no line terminators

Something went wrong on that copying. Use pacman-static.

Offline

#29 2019-01-06 20:36:09

loqs
Member
Registered: 2014-03-06
Posts: 17,315

Re: [Solved] chroot: failed to run command "/bin/bash": Input/output error

pacman-static --sysroot /mnt -Qkk &> pacman.log

Then post the contents of pacman.log please
Edit:
The above might fail with a chroot related error and need adjustment but please try it.

Last edited by loqs (2019-01-06 20:37:07)

Offline

#30 2019-01-06 20:44:10

magiusche
Member
Registered: 2008-12-05
Posts: 37

Re: [Solved] chroot: failed to run command "/bin/bash": Input/output error

seth wrote:
/usr/lib/ld-2.28.so:                               ASCII text, with no line terminators

Something went wrong on that copying. Use pacman-static.

Ok Something strange while i'm using cp -vr..... using rsync it seems file is copied better.

I've now copied all and when i run chroot now i got "Permission denied" of something... (it is italian)... but i'm ROOT!!!!

like dat:

 /mnt/sdb1/home/arch/arch-chroot /mnt/sdb1 /bin/bash
chroot: impossibile eseguire il comando "/bin/bash": Permesso negato

Here the strace: https://pastebin.com/HFiva326

About pacman-static: i've downloaded the bin but when i call it from debian it want pacman.conf and pacman.d and maybe other.... should i copy theese files into debian or should i use something like this:

pacman-static --root /mnt/sdb1 --cachedir /mnt/sdb1/var/cache/pacman/pkg --config /mnt/sdb1/pacman.conf -Sy

Hope i help you!
and
VICE.VERSA

Offline

#31 2019-01-06 20:48:14

magiusche
Member
Registered: 2008-12-05
Posts: 37

Re: [Solved] chroot: failed to run command "/bin/bash": Input/output error

loqs wrote:
pacman-static --sysroot /mnt -Qkk &> pacman.log

Then post the contents of pacman.log please
Edit:
The above might fail with a chroot related error and need adjustment but please try it.

root@rescue-pro:~# /mnt/sdb1/home/arch/pacman-static --sysroot /mnt/sdb1 -Qkk
error: failed to initialize alpm library
(could not find or read directory: /var/lib/pacman/)

Edit: i've tried this:

/mnt/sdb1/home/arch/pacman-static --root /mnt/sdb1 --cachedir /mnt/sdb1/var/cache/pacman/pkg --config /mnt/sdb1/etc/pacman.conf -Qkk

results are: https://pastebin.com/18xpRuYH

Last edited by magiusche (2019-01-06 20:58:47)


Hope i help you!
and
VICE.VERSA

Offline

#32 2019-01-06 20:55:33

loqs
Member
Registered: 2014-03-06
Posts: 17,315

Re: [Solved] chroot: failed to run command "/bin/bash": Input/output error

ls -la /mnt/sdb1/var/lib/pacman/ /mnt/sdb1/var/lib/pacman/local /mnt/sdb1/var/lib/pacman/sync

Offline

#33 2019-01-06 20:59:20

magiusche
Member
Registered: 2008-12-05
Posts: 37

Re: [Solved] chroot: failed to run command "/bin/bash": Input/output error

loqs wrote:
ls -la /mnt/sdb1/var/lib/pacman/ /mnt/sdb1/var/lib/pacman/local /mnt/sdb1/var/lib/pacman/sync

i've edited previuos message... plz read it! (and thx for all)


Hope i help you!
and
VICE.VERSA

Offline

#34 2019-01-06 21:08:39

loqs
Member
Registered: 2014-03-06
Posts: 17,315

Re: [Solved] chroot: failed to run command "/bin/bash": Input/output error

elfutils: no mtree file
glibc: no mtree file
iotop: no mtree file
libunwind: no mtree file
lsof: no mtree file
perf: no mtree file
python: no mtree file
python2-requests: no mtree file
slang: no mtree file

Hmm no mtree so --overwrite?

Offline

#35 2019-01-06 21:21:36

seth
Member
Registered: 2012-09-03
Posts: 50,970

Re: [Solved] chroot: failed to run command "/bin/bash": Input/output error

About the EACCES: /mnt/sdb1/usr/lib/ld-2.28.so or /mnt/sdb1/bin/bash lack the executable bit:

stat /mnt/sdb1/usr/lib/ld-2.28.so /mnt/sdb1/usr/bin/bash

Offline

#36 2019-01-06 21:22:49

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,521
Website

Re: [Solved] chroot: failed to run command "/bin/bash": Input/output error

Likely the ld-2.28.so as that's what was "copied" in, perhaps without preserving ownership and/or permissions.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#37 2019-01-06 21:23:53

magiusche
Member
Registered: 2008-12-05
Posts: 37

Re: [Solved] chroot: failed to run command "/bin/bash": Input/output error

seth wrote:

About the EACCES: /mnt/sdb1/usr/lib/ld-2.28.so or /mnt/sdb1/bin/bash lack the executable bit:

stat /mnt/sdb1/usr/lib/ld-2.28.so /mnt/sdb1/usr/bin/bash
root@rescue-pro:~# stat /mnt/sdb1/usr/lib/ld-2.28.so /mnt/sdb1/usr/bin/bash
  File: /mnt/sdb1/usr/lib/ld-2.28.so
  Dim.: 193688          Blocchi: 384        Blocco di IO: 4096   file regolare
Device: 811h/2065d      Inode: 3073        Coll.: 1
Accesso: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Accesso  : 2019-01-06 21:20:17.522808831 +0000
Modifica : 2018-10-11 08:18:28.000000000 +0000
Cambio   : 2019-01-06 21:17:39.894280549 +0000
Creazione: -
  File: /mnt/sdb1/usr/bin/bash
  Dim.: 866600          Blocchi: 1696       Blocco di IO: 4096   file regolare
Device: 811h/2065d      Inode: 6680        Coll.: 1
Accesso: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Accesso  : 2019-01-06 21:20:17.614809234 +0000
Modifica : 2018-06-04 08:54:11.000000000 +0000
Cambio   : 2019-01-06 21:16:41.718149202 +0000
Creazione: -
root@rescue-pro:~#

Hope i help you!
and
VICE.VERSA

Offline

#38 2019-01-06 21:27:33

magiusche
Member
Registered: 2008-12-05
Posts: 37

Re: [Solved] chroot: failed to run command "/bin/bash": Input/output error

Ok but now pacman static works!:

/mnt/sdb1/home/arch/pacman-static --root /mnt/sdb1 --cachedir /mnt/sdb1/var/cache/pacman/pkg --config /mnt/sdb1/etc/pacman.conf -S pacman

i tried to reinstalla pacman into /mnt/sdb1 but now i got this:

https://pastebin.com/MRxaBTaG

can i fix automatically all premission using pacman? in order to reinstall all packages?


Hope i help you!
and
VICE.VERSA

Offline

#39 2019-01-06 21:33:56

magiusche
Member
Registered: 2008-12-05
Posts: 37

Re: [Solved] chroot: failed to run command "/bin/bash": Input/output error

WTF!!!! DONE!!!!

I've used

/mnt/sdb1/home/arch/pacman-static --root /mnt/sdb1 --cachedir /mnt/sdb1/var/cache/pacman/pkg --config /mnt/sdb1/etc/pacman.conf -S glibc --force

and now arch-chroot works!!!!!!!!

Now i'll go for reinstalla all...

thx to all!!!!

(i'll leave this topic not solved until i finish reinstall... ok? )


Hope i help you!
and
VICE.VERSA

Offline

#40 2019-01-06 21:39:35

loqs
Member
Registered: 2014-03-06
Posts: 17,315

Re: [Solved] chroot: failed to run command "/bin/bash": Input/output error

Please do not add --force to the full system update.

Offline

#41 2019-01-06 21:40:15

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [Solved] chroot: failed to run command "/bin/bash": Input/output error

There should be no need to use --force, but anyway the mentioned warnings are pretty bad news.

warning: directory permissions differ on /mnt/sdb1/usr/share/
filesystem: 700  package: 755

This indicates that the entire directory /usr/share within the chroot is only readable root, and thus many programs will not run as another user. You'll need to find and fix directory permission mismatch errors, since pacman will not modify existing directory permissions.

The ldconfig errors are because those packages still need to be reinstalled.

pacman -Qkk will report these for you as:

warning: ${pkgname}: ${filename} (Permissions mismatch)

Last edited by eschwartz (2019-01-06 21:41:51)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#42 2019-01-06 21:42:55

loqs
Member
Registered: 2014-03-06
Posts: 17,315

Re: [Solved] chroot: failed to run command "/bin/bash": Input/output error

What about the packages with missing mtree would those need --force or --overwrite?

Offline

#43 2019-01-06 21:47:17

magiusche
Member
Registered: 2008-12-05
Posts: 37

Re: [Solved] chroot: failed to run command "/bin/bash": Input/output error

After restone vitals parts and rebooted into normal arch ssystem, can i use this https://aur.archlinux.org/packages/pacm … rmissions/ ? to fix all permissions?


Hope i help you!
and
VICE.VERSA

Offline

#44 2019-01-06 23:34:49

magiusche
Member
Registered: 2008-12-05
Posts: 37

Re: [Solved] chroot: failed to run command "/bin/bash": Input/output error

ok done.... my site is online again! http://magius.it

Ty all and just to summarize:

chroot fails couse there are some filesystem error.
After restoring it using pacman-static, chroot works again and i can restore all pacman packages.
Thx all again!

Solved!


Hope i help you!
and
VICE.VERSA

Offline

Board footer

Powered by FluxBB