:: Re: [DNG] Beowulf on RPI2 login pro…
Etusivu
Poista viesti
Vastaa
Lähettäjä: Ralph Ronnquist
Päiväys:  
Vastaanottaja: dng
Aihe: Re: [DNG] Beowulf on RPI2 login problem
On Sun, Jan 15, 2023 at 09:28:12PM -0700, Fred wrote:
> ...
> I haven't used chroot before and the man page doesn't seem very helpful. Do
> you mean to boot the image in a chroot directory? Would it not just ask for
> the password again? Long ago, on Solaris 2.6 I had to regain a root
> password by deleting a field in maybe /etc/shadow or something I don't
> remember.


Ok.

First you may need to make youru system "multi-arch" so that you can
seamlessly run armhf binaries. This one is good info:
https://wiki.debian.org/Multiarch/HOWTO

1# dpkg --add-architecture armhf
2# apt-get update

Next you mount the filesystem, which you can do in different ways,
E.g., find out the sector offset for the partition and use that as an
offset for a loop mount command:

3# mkdir FS
4# fdisk -l devuan_beowulf_3.1.0_armhf_rpi2.img
...
Device                               Boot  Start     End Sectors  Size Id Type
devuan_beowulf_3.1.0_armhf_rpi2.img1 *      2048  524287  522240  255M  b W95 FAT32
devuan_beowulf_3.1.0_armhf_rpi2.img2      524288 3808592 3284305  1.6G 83 Linux


5# mount -ooffset=$((524288&*512)) devuan_beowulf_3.1.0_armhf_rpi2.img FS

Now you can chroot and execute the passwd program for root within that
filesystem:

6# chroot FS passwd

(set the password to your liking)

The last step would be to unmount the filesystem:

7# umount FS

Now that filesystem has your password. You may of course do other
things at #6, e.g. add users etc. If you run "chroot FS /bin/bash" it
gives you a shell in the context of that filesystem.
Dont forget to exit and unmount when done.

Ralph.