Just to be certain: if you write a fresh image using the rpi imager, that will boot ok - right?
a) No. Hardware.
b) Yes. Your img is corrupt.
If it's (b) then you're looking at reinstalling all those packages on a fresh image and fishing the settings out of the img. Remember only ever 'dd' on a non running system! At least you can do that in future with the rpi sdcard attached to your laptop via the card reader.
Things you might need to install on the fresh image..The former builds a database of all files on the system. The latter allows you to find which package is responsible for installing a file.
On my PC, say I wanted to know about 'qemu-img'....found the package.
Another thing you can do with a fresh image is 'dpkg --get-selections' and save it...the 'diff' between "old.dpkg" and "new.dpkg" is what you installed.
The OS is "unimportant". Slap a new one on the disk, install the packages and restore the settings. For most purposes you can get away with copying a file before you edit it....then edit away. Doesn't always work because sometimes everything(*) in a folder gets scanned. It does mostly though. "sudo updatedb" followed by 'locate ".ORIGINAL"' shows you what you changed.
(*) "init.d" type folders. I have a script 'sd-nano' which solves this: it makes a copy of the original elsewhere than calls 'nano'. Trouble is most of my systems pre-date 'sd-nano' and I'm a bugger for forgetting to use it. ;-|
This will make you feel better. I took out a 64Gb sdcard and 'dd''d it to a 128Gb sdcard (two sdcard readers on PC). Put the 128Gb sdcard back in the rpi and it booted. All was not well under the hood though. It needed 'parted' to fix a problem and now it's fine. So many things can go wrong with 'dd'.
a) No. Hardware.
b) Yes. Your img is corrupt.
If it's (b) then you're looking at reinstalling all those packages on a fresh image and fishing the settings out of the img. Remember only ever 'dd' on a non running system! At least you can do that in future with the rpi sdcard attached to your laptop via the card reader.
Things you might need to install on the fresh image..
Code:
$ sudo apt-get install mlocate apt-file$ sudo updatedb #do this just before using 'locate' if disk contents have changed.$ sudo apt-file update #do this after an 'apt-get upgrade' (etc).
On my PC, say I wanted to know about 'qemu-img'..
Code:
foo@sdu:~$ locate -i qemu | egrep bin/qemu/usr/bin/qemu-img/usr/bin/qemu-io/usr/bin/qemu-nbd/usr/bin/qemu-pr-helper/usr/bin/qemu-storage-daemon/usr/bin/qemu-system-aarch64/usr/bin/qemu-system-arm/usr/bin/qemu-system-i386/usr/bin/qemu-system-x86_64/usr/bin/qemu-system-x86_64-microvm/usr/bin/qemu-system-x86_64-spice/usr/sbin/qemu-make-debian-rootfoo@sdu:~$ apt-file search qemu-img | egrep bin/qemu-imgqemu-utils: /usr/bin/qemu-img
Another thing you can do with a fresh image is 'dpkg --get-selections' and save it.
Code:
$ sudo mkdir /wrk$ sudo chmod 01777 /wrk$foo@sdu:~$ dpkg --get-selections >/wrk/old.dpkg#each time you install stuff..foo@sdu:~$ dpkg --get-selections >/wrk/new.dpkg
The OS is "unimportant". Slap a new one on the disk, install the packages and restore the settings. For most purposes you can get away with copying a file before you edit it..
Code:
# cd /etc# cp -vp bash.bashrc bash.bashrc.ORIGINAL
(*) "init.d" type folders. I have a script 'sd-nano' which solves this: it makes a copy of the original elsewhere than calls 'nano'. Trouble is most of my systems pre-date 'sd-nano' and I'm a bugger for forgetting to use it. ;-|
This will make you feel better. I took out a 64Gb sdcard and 'dd''d it to a 128Gb sdcard (two sdcard readers on PC). Put the 128Gb sdcard back in the rpi and it booted. All was not well under the hood though. It needed 'parted' to fix a problem and now it's fine. So many things can go wrong with 'dd'.
Statistics: Posted by swampdog — Wed Jul 24, 2024 6:08 pm