Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
chroot from x86_64 to arm64?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM
View previous topic :: View next topic  
Author Message
erg_samowzbudnik
Tux's lil' helper
Tux's lil' helper


Joined: 09 Sep 2011
Posts: 124
Location: uk/sticks

PostPosted: Thu Jan 16, 2020 12:05 pm    Post subject: chroot from x86_64 to arm64? Reply with quote

Case of a lost password... trying to chroot to RPi (aarch64) from a laptop (x86_64) gives me this:

chroot: failed to run command ‘/bin/bash’: Exec format error

guess I just can't do that, can I, chroot to a different architecture.
Back to top
View user's profile Send private message
erg_samowzbudnik
Tux's lil' helper
Tux's lil' helper


Joined: 09 Sep 2011
Posts: 124
Location: uk/sticks

PostPosted: Thu Jan 16, 2020 12:19 pm    Post subject: Reply with quote

That's right, no shortcuts, going the qemu way, for posterity:

https://wiki.gentoo.org/wiki/Embedded_Handbook/General/Compiling_with_qemu_user_chroot
Back to top
View user's profile Send private message
erg_samowzbudnik
Tux's lil' helper
Tux's lil' helper


Joined: 09 Sep 2011
Posts: 124
Location: uk/sticks

PostPosted: Thu Jan 16, 2020 1:31 pm    Post subject: Reply with quote

Down the rabbit hole: I've followed this guide:

https://wiki.gentoo.org/wiki/Embedded_Handbook/General/Compiling_with_qemu_user_chroot

mounted what's needed, chrooted into that environment, but when I'm trying to now chroot to the target system I'm getting that:

/usr/bin/chroot: failed to run command ‘/bin/bash’: No such file or directory
Back to top
View user's profile Send private message
erg_samowzbudnik
Tux's lil' helper
Tux's lil' helper


Joined: 09 Sep 2011
Posts: 124
Location: uk/sticks

PostPosted: Thu Jan 16, 2020 4:57 pm    Post subject: Reply with quote

Sorted by copying /usr/bin/qemu-aarch64 into the system I'm chrooting into.
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 7799
Location: Saint Amant, Acadiana

PostPosted: Thu Jan 16, 2020 5:21 pm    Post subject: Reply with quote

For those who happen to read this thread and are looking for password recovery there are following ways.

1. Boot in single user mode and set new root password.
2. Or, use a external boot media, mount the root filesystem and delete root password form /etc/passwd and /etc/shadow. Then reboot and set new password.
3. Or, use same arch external boot media and chroot.
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 47163
Location: 56N 3W

PostPosted: Thu Jan 16, 2020 5:55 pm    Post subject: Reply with quote

erg_samowzbudnik,

You don't need to chroot to fix a Pi lost password. You need a known password and hash pair.
Mount the Pi root partition somewhere and edit its /etc/shadow.

You can copy a hash from your own system if you don't like mine :)
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Tony0945
Advocate
Advocate


Joined: 25 Jul 2006
Posts: 4516
Location: Illinois, USA

PostPosted: Thu Jan 16, 2020 7:52 pm    Post subject: Re: chroot from x86_64 to arm64? Reply with quote

erg_samowzbudnik wrote:
Case of a lost password... trying to chroot to RPi (aarch64) from a laptop (x86_64) gives me this:

chroot: failed to run command ‘/bin/bash’: Exec format error

guess I just can't do that, can I, chroot to a different architecture.

Trying to execute aarch64 code from an x86 computer - incompatable op codes. Different architecture.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 47163
Location: 56N 3W

PostPosted: Thu Jan 16, 2020 11:20 pm    Post subject: Reply with quote

Tony0945,

That's what QEMU-User is for built with USE=static.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
erg_samowzbudnik
Tux's lil' helper
Tux's lil' helper


Joined: 09 Sep 2011
Posts: 124
Location: uk/sticks

PostPosted: Mon Jan 20, 2020 6:10 pm    Post subject: Reply with quote

NeddySeagoon,

Quote:
Mount the Pi root partition somewhere and edit its /etc/shadow.


late reply, didn't see your post, that's what I figured at the end, booted password less and set a new password, thanks
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum