Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Copy Gentoo installation to different hardware
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
vovan47
n00b
n00b


Joined: 21 Nov 2018
Posts: 41

PostPosted: Sun Dec 09, 2018 4:27 pm    Post subject: [SOLVED] Copy Gentoo installation to different hardware Reply with quote

Hello everyone! If that question is already covered then pardon me & please give a link.

So let's imagine that I have a relatively "complete" Gentoo installation that I like to use and I want to move it to a different hardware or another computer.
It consists of Xorg, XFCE and set of programs that I use.
I have
Code:
-march=native
in CFLAGS and of course I understand that all packages will be re-emerged and ready for that.
How do I do that exactly? Is there a program or script for this?

Or, for example, I upgraded my PC with a new CPU and motherboard, I understand that system built with "-march native" might not even boot if I just plug in my disk and try.

If I'd had to to it now, I imagine this:
1) Backing up /etc/portage, (or maybe whole /etc) and other user configs
2) Installing basic Gentoo from scratch
3) After that overwrite /etc/portage, adjust CFLAGS and USE flags and "emerge @world"

Is that correct?

Again, sorry for noobish question but I'm a noob :D


Last edited by vovan47 on Sun Dec 09, 2018 6:16 pm; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Sun Dec 09, 2018 4:56 pm    Post subject: Reply with quote

vovan47,

It all depends how much breakage you will tolerate when you move and to some extent, what the from and to CPU are.
Taking the simplistic approach, you rebuild everything with -march unset and -mtune=generic to get a run anywhere install.
Don't forget to build the kernel to support both sets of hardware and reinstall you boot loader.
You need -mtune=generic everywhere.

Move to your new home any everything works, or almost.
We forgot about CPU_FLAGS_X86=. That only affects a small number of packages.

If you really want to do that fix your CFLAGS then
Code:
emerge -e @world
to build everything so that its portable.
Do it again once you go back to -march=native on the new hardware.

If all you care about is getting a working command line in the new hardware
Code:
emerge -e @system
is enough.
Don't forget about your kernel and boot loader too.

Your step 2) Installing basic Gentoo from scratch, can be simplified by copying your /var/lib/portage/world from your working install to the 'empty' install.
then running
Code:
emerge -e @world
to build everything in the @world set and all the dependencies too.

Everything else is good.
_________________
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
vovan47
n00b
n00b


Joined: 21 Nov 2018
Posts: 41

PostPosted: Sun Dec 09, 2018 5:10 pm    Post subject: Reply with quote

Hi NeddySeagoon, thanks for such quick and sensible answer.
Yeah that totally makes sense, I did not think of such simple approach.

Quote:
Don't forget to build the kernel to support both sets of hardware and reinstall you boot loader.

Unfortunately I used genkernel which I regret now. Next time I plan to use
Code:
make localmodconfig
.

Quote:
If all you care about is getting a working command line in the new hardware
Code:
emerge -e @system

is enough.


Small question about this: so if I'm moving to a new faster hardware, this will let me emerge rest of my packages on a new system?

Oh, and I did not set any CPU_FLAGS_X86, that's fine I guess.

Quote:
It all depends how much breakage you will tolerate when you move and to some extent, what the from and to CPU are.

I guess moving system from my current AMD processor to Intel one will break everything, but if I will migrate to a newer AMD CPU such as Ryzen it might not break at all? I have AMD A8-6500
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Sun Dec 09, 2018 5:57 pm    Post subject: Reply with quote

vovan47,

vovan47 wrote:
I guess moving system from my current AMD processor to Intel one will break everything, but if I will migrate to a newer AMD CPU such as Ryzen it might not break at all? I have AMD A8-6500


-march=whatever gives gcc permissions to use all the instructions that whatever arch supports.
gcc is not compelled to use any of them.

The more differences you have between CPUs the more likely that you get an Illegal Instruction Exception if you just plug in your old install.
AMD and Intel have been bitter enemies in the CPU world since AMD licenced Intels design, then made a faster CPU than Intel, so swapping between AMD and Intel will have more breakage than staying with the same CPU vendor.

genkernel will have built hardware support for almost everything, so no worries about hardware support being missing.
_________________
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
vovan47
n00b
n00b


Joined: 21 Nov 2018
Posts: 41

PostPosted: Mon Mar 04, 2019 5:48 pm    Post subject: Reply with quote

Hi Neddy!
I made a mistake and forgot to emerge @system on my old box and carelessly moved disk to a new Ryzen box. :lol:
Of course I got illegal instruction.
I've read this thread where guy had exactly same situation.
You were suggesting installing packages from BINHOST with tar and trying to chroot/emerge.
But as I've read further, that guy had no success and had to do new installation.
So my question is, is there a simple way to fix my installation? Some time passed since that thread, maybe some guide was created :)
Back to top
View user's profile Send private message
vovan47
n00b
n00b


Joined: 21 Nov 2018
Posts: 41

PostPosted: Mon Mar 04, 2019 6:42 pm    Post subject: Reply with quote

This thread makes more sense to me.

Just one thing I don't understand:
Quote:
cd /mnt/gentoo/usr/portage/packages
tar -xjpf sys-apps/portage-2.1.6.13.tbz2 -C /mnt/gentoo
tar -xjpf app-shells/bash-4.0_p28.tbz2 -C /mnt/gentoo
tar -xjpf sys-libs/glibc-2.9_p20081201-r2.tbz2 -C /mnt/gentoo
tar -xjpf dev-lang/python-2.6.2-r1.tbz2 -C /mnt/gentoo
tar -xjpf sys-libs/ncurses-5.6-r2.tbz2 -C /mnt/gentoo
tar -xjpf sys-libs/zlib-1.2.3-r1.tbz2 -C /mnt/gentoo
tar -xjpf sys-apps/coreutils-7.4.tbz2 -C /mnt/gentoo
tar -xjpf app-arch/bzip2-1.05-r1.tbz2 -C /mnt/gentoo
tar -xjpf app-arch/tar-1.20.tbz2 -C /mnt/gentoo
tar -xjpf sys-apps/acl-2.2.47.tbz2 -C /mnt/gentoo
tar -xjpf sys-apps/sed-4.2.tbz2 -C /mnt/gentoo
tar -xjpf sys-apps/attr-2.4.43.tbz2 -C /mnt/gentoo


If /mnt/gentoo/ is the old installation, where do all those tarballs come from? Shouldn't I get them with wget first?
Back to top
View user's profile Send private message
vovan47
n00b
n00b


Joined: 21 Nov 2018
Posts: 41

PostPosted: Mon Mar 04, 2019 6:50 pm    Post subject: Reply with quote

This post also makes sense.
Ok, now I understand, I have just go through Fix My Gentoo page and in the "The Rescue Install" step there is a
Code:
root #mount -o bind /mnt/gentoo/usr/portage /mnt/gentoo/home/rescue/usr/portage

Which will make those packages appear in a broken system.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things 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