Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Q: Reinstall while keeping configurations
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
solamour
l33t
l33t


Joined: 21 Dec 2004
Posts: 698
Location: San Diego, CA

PostPosted: Wed Nov 30, 2022 7:42 pm    Post subject: [Solved] Q: Reinstall while keeping configurations Reply with quote

I was trying to resurrect an old box that has been neglected for far too long, and while doing so, I somehow managed to mess up a lot of things; portage, gcc, and various other things don't seem to work correctly anymore.

I can just call it a day, back up data, and start fresh, but before I resort to the sledgehammer route, I'd like to see if there is an easier way to update to the latest while keeping all the configurations. I can boot from Gentoo CD, mount the partition, and chroot to it.
__
sol


Last edited by solamour on Sun Dec 04, 2022 6:02 am; edited 1 time in total
Back to top
View user's profile Send private message
axl
Veteran
Veteran


Joined: 11 Oct 2002
Posts: 1136
Location: Romania

PostPosted: Wed Nov 30, 2022 8:25 pm    Post subject: Reply with quote

If you have a second gentoo machine you could try to use cross-emerge (part of sys-devel/crossdev) to repair the machine. How it works is:

ARCH="arm64" CHOST=aarch64-unknown-linux-gnu CBUILD=aarch64-unknown-linux-gnu ROOT=/mnt/blanc/rootfs/pi/ PKG_CONFIG_PATH="${ROOT}/usr/lib/pkgconfig/" SYSROOT=${ROOT} cross-emerge -av sys-devel/gcc

In this example, I compiled gcc on one system for a remote mounted system over nfs located in /mnt/blanc/rootfs/pi/. It's good practice IMHO.

It would prolly be simpler to start over, but I appreciate the practice. You could also create a VM to match the broken machine and build binary packages for it. That could work too.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Wed Nov 30, 2022 9:08 pm    Post subject: Reply with quote

solamour,

You can build a "rescue install" as described by Fix My Gentoo.

You can salvage /etc/portage and your world file, which is all that is required to transplant the install.
Keep /etc too, as use as a reference. Things change, so you way not want to use it as is.
Most of /home will be reusable but beware of old application settings being used with new versions of the same application.

You mention
Quote:
... resurrect an old box that has been neglected for far too long ...
so you could set up a chroot on a more modern system, with a more CPU power an build binaries fot the old system there.

or some combination of the above.
_________________
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
solamour
l33t
l33t


Joined: 21 Dec 2004
Posts: 698
Location: San Diego, CA

PostPosted: Sun Dec 04, 2022 6:01 am    Post subject: Reply with quote

I ended up unzipping stage3.

* Pulled out the disk from the broken system and put it to a working system.

* Mounted and just unzipped state3 without wiping it out beforehand. Followed the handbook to install.

* Most configs were intact, and whatever packages I had before also worked. It's just that they weren't in "world" (/var/lib/portage/world), so I wasn't sure they'd get updated correctly later. Installed them again, just to make for the good measure.

* Some entries in "/etc/passwd" and "/etc/group" were missing (e.g. cron, nullmail, dnsmasq, etc.), and they were pulled in later when I did "emerge -vDuN world".

acct-user/cron-0
acct-user/nullmail-0
acct-user/dnsmasq-0-r1
acct-group/cron-0
acct-group/nullmail-0
acct-group/dnsmasq-0-r1

* "gcc-config -l" showed the latest gcc and the old one that no longer worked, but "emerge --depclean =sys-devel/gcc-OLD_VERSION" couldn't find it. Had to manually remove it from "/etc/env.d/gcc/" and "/usr/lib/gcc/".

* I wasn't able to build the kernel, although in hindsight, it would have worked, had I just copied the kernel config from the broken system and built, rather than running "make menuconfig", which might have changed the config based on the rescue system's architecture.


Overall, it wasn't as bad as I imagined, although if it ever happens again, I'd definitely consider "cross-emerge" or "binary package". Thanks everyone for taking time to share your suggestions.
__
sol
Back to top
View user's profile Send private message
solamour
l33t
l33t


Joined: 21 Dec 2004
Posts: 698
Location: San Diego, CA

PostPosted: Sun Dec 04, 2022 6:22 pm    Post subject: Reply with quote

axl wrote:
ARCH="arm64" CHOST=aarch64-unknown-linux-gnu CBUILD=aarch64-unknown-linux-gnu ROOT=/mnt/blanc/rootfs/pi/ PKG_CONFIG_PATH="${ROOT}/usr/lib/pkgconfig/" SYSROOT=${ROOT} cross-emerge -av sys-devel/gcc


That looks like a 64-bit Raspberry Pi's root file system is mounted at "/mnt/blanc/rootfs/pi/", and the host (that is going to build "gcc" for Pi) is x64? Where do I learn more about the option parameters?
__
sol
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo 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