Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Chroot: illegal instruction
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
avdb
n00b
n00b


Joined: 16 Aug 2020
Posts: 65
Location: Netherlands

PostPosted: Sat Jan 02, 2021 8:00 am    Post subject: Chroot: illegal instruction Reply with quote

I know what the problem is, I compiled my entire system for a certain micro-architecture with really specific CPU flags, I switched to a different micro-architecture which is incompatible with my old system and now I can't boot nor chroot anymore (meaning I can't look what packages I have installed).

My question is, how do I reinstall everything again without losing any data? I know that I'm going to have to recompile everything but I don't want to lose any configuration files.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9709
Location: almost Mile High in the USA

PostPosted: Sat Jan 02, 2021 8:31 am    Post subject: Reply with quote

Conundrum.

Well you can always grab your world file in /var/lib/portage/world to get your package list to rebuild as well as grab your /etc files.

If you still have your old machine you could rebuild world with a common denominator architecture and then do it again with the new one.

You could setup another disk with an emulator to rebuild the system...

Still got some options but not very pleasant.
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Buffoon
Veteran
Veteran


Joined: 17 Jun 2015
Posts: 1369
Location: EU or US

PostPosted: Sat Jan 02, 2021 12:17 pm    Post subject: Reply with quote

Gentoo is no different from any other *nix system, system cofiguration files are in /etc, users have their configuration files in their home directories. World file was already mentioned above. All this should be part of your backups anyway.
Back to top
View user's profile Send private message
Tony0945
Watchman
Watchman


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

PostPosted: Sat Jan 02, 2021 4:24 pm    Post subject: Reply with quote

I think this will work:

1. boot a rescue mediaum, mount your Gentoo root as /mnt/gentoo
2. backup world and extract a stage3 tarball over your /mnt/gentoo from the recue medium. AFAIK this is just @system
3. Now you should be able to chroot, change -march and emerge -e @world
4. After it's all up and running, emerge -a --depclean to cleanup anything from the tarball that you don't need.

Comments, anyone?
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 21842

PostPosted: Sat Jan 02, 2021 6:12 pm    Post subject: Reply with quote

I think Tony's method has the potential to leave behind orphaned files. Consider the case that a package app-example/tool-1 is installed on the system, and is part of the stage3. Further, suppose that if built with USE=foo, it installs /usr/bin/foo-tool; if built with USE=-foo, then it does not. Suppose that the installed copy was built with USE=foo, and the stage3 is built with USE=-foo. Extracting the stage3 will overwrite the CONTENTS file, but not remove foo-tool. Now foo-tool exists, and Portage has no record of what owns it. Future upgrades/removals of app-example/tool will not know to touch it. Attempting to reinstall app-example/tool with USE=foo will trigger a collision because the file is not recorded as part of the old version. With the right FEATURES, Portage can ignore collisions where the to-be-replaced file is an orphan, which might clean this up if step 3 runs to completion.
Back to top
View user's profile Send private message
Tony0945
Watchman
Watchman


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

PostPosted: Sat Jan 02, 2021 6:39 pm    Post subject: Reply with quote

Good analysis, Hu. I suppose the safest way is to backup /home, /etc and /usr/local and wipe the rest and reinstall. There would still be work to do to ensure that numerical users were the same.

Best of all (I did this going from bulldozer to ryzen): First emerge -e @world with -march=generic, then remove the drive, put it in the new machine and emerge -e @world with -march=native.
Back to top
View user's profile Send private message
Buffoon
Veteran
Veteran


Joined: 17 Jun 2015
Posts: 1369
Location: EU or US

PostPosted: Sat Jan 02, 2021 6:45 pm    Post subject: Reply with quote

revdep-rebuild can find orphans, just to keep your system clean.
Back to top
View user's profile Send private message
avdb
n00b
n00b


Joined: 16 Aug 2020
Posts: 65
Location: Netherlands

PostPosted: Sat Jan 02, 2021 6:55 pm    Post subject: Reply with quote

Reinstalling went well, last issue I have to deal with is how do I force Portage to use locally fetched sources when compiling overnight? I noticed that after a few hours it refuses to compile your package with locally fetched sources unless it can confirm that it's the latest version which is pretty annoying since I turn my router off at night to save electricity.
Back to top
View user's profile Send private message
avdb
n00b
n00b


Joined: 16 Aug 2020
Posts: 65
Location: Netherlands

PostPosted: Sat Jan 02, 2021 6:57 pm    Post subject: Reply with quote

Oh and another thing, I have a qcow2 image that I want to copy over to my new root partition but Linux thinks that it's 100GB (didn't do that myself) when in reality it's only like 2GB. Any way I can resize these files without losing their contents when copying them over?
Back to top
View user's profile Send private message
Tony0945
Watchman
Watchman


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

PostPosted: Sat Jan 02, 2021 7:12 pm    Post subject: Reply with quote

avdb wrote:
since I turn my router off at night to save electricity.

How much electricity can a router take? I leave my server on 24/7. It's plugged into a Kill-A-Watt meter. 30W when idle. Like a night light. Surely a router can't take more than that.

Not sure what you mean by "locally fetch". If you mean everything is in distfiles, maybe portage has a command to do that. "portage -ef @world"? Possibly the "e" (emptytree) overrides the "f" (fetchonly).
Back to top
View user's profile Send private message
Buffoon
Veteran
Veteran


Joined: 17 Jun 2015
Posts: 1369
Location: EU or US

PostPosted: Sat Jan 02, 2021 7:14 pm    Post subject: Reply with quote

I have replaced hard drives many times for my Gentoo boxes, never used anything else than 'cp -a'. I know, there is no poetry in this. Just plain boring, fast command. It probably is much greater feeling to use some bloated sophisticated application for this ... With 'cp -a' you can use different filesystem, different size of partition, no limitations.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9709
Location: almost Mile High in the USA

PostPosted: Sat Jan 02, 2021 7:26 pm    Post subject: Reply with quote

I've found that emerge -f sometimes misses files, which is annoying. Best is to leave it connected to the internet.
Heck I have multiple regular desktop machines powered up 24/7 like my PVR, not really that big a deal.

But portage will automatically use whatever's already downloaded, just make sure you don't emerge --sync and tell portage a new version is possibly available. Just make sure you do your upgrades and downloaded files promptly, don't wait a week.
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
avdb
n00b
n00b


Joined: 16 Aug 2020
Posts: 65
Location: Netherlands

PostPosted: Sat Jan 02, 2021 7:27 pm    Post subject: Reply with quote

Tony0945 wrote:
avdb wrote:
since I turn my router off at night to save electricity.

How much electricity can a router take? I leave my server on 24/7. It's plugged into a Kill-A-Watt meter. 30W when idle. Like a night light. Surely a router can't take more than that.

It's more about personal preference (I'm not a fan of environmental pollution) than about cost ... leaving a server on is a valid reason since somebody on the other side of the globe might be trying to reach your server while you're asleep but there's no reason for my router to be on at night.
Back to top
View user's profile Send private message
Tony0945
Watchman
Watchman


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

PostPosted: Sat Jan 02, 2021 7:49 pm    Post subject: Reply with quote

avdb wrote:
but there's no reason for my router to be on at night.
Except for this one night.

Anyway "emerge -af @world" seems to work. I'm running it right now. 1,233 packages. Luckily most of them are already fetched (it will skip them). The fact that there is something to download is a surprise as I just finished a world update.
EDIT: It's done already. Maybe a dozen packages. I'm surprised there were any. I think tonight I'll rebuild world. Seems like revdep-rebuild didn't find everything.
Back to top
View user's profile Send private message
apiaio
Guru
Guru


Joined: 04 Dec 2008
Posts: 419

PostPosted: Sat Jan 02, 2021 8:00 pm    Post subject: Reply with quote

avdb wrote:

It's more about personal preference (I'm not a fan of environmental pollution) than about cost ... leaving a server on is a valid reason since somebody on the other side of the globe might be trying to reach your server while you're asleep but there's no reason for my router to be on at night.


Correct. I am able to reach and break weak passwords of the neighbors routers via wifi. I do not practise that.
But I know, that it is not necessary to have router switched on all the time.
Back to top
View user's profile Send private message
Buffoon
Veteran
Veteran


Joined: 17 Jun 2015
Posts: 1369
Location: EU or US

PostPosted: Sat Jan 02, 2021 8:14 pm    Post subject: Reply with quote

Router and wifi access point do not operate in same OSI layer, they have nothing to do with each other. :roll:
I turn often off my access point, I have everything wired and although it takes less than 10 W of power keeping it on is not justified, but I turn never off my router.
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 21842

PostPosted: Sat Jan 02, 2021 8:24 pm    Post subject: Reply with quote

Buffoon wrote:
revdep-rebuild can find orphans, just to keep your system clean.
I knew that it would report orphans when it tries to rebuild a broken file and cannot find the package to rebuild. Are you saying it can also find orphaned files even when they are not broken? For example, if /bin/true were copied to a new name, the new one would be found and reported, even though it is not missing any libraries?
Back to top
View user's profile Send private message
apiaio
Guru
Guru


Joined: 04 Dec 2008
Posts: 419

PostPosted: Sat Jan 02, 2021 8:43 pm    Post subject: Reply with quote

Buffoon wrote:
Router and wifi access point do not operate in same OSI layer, they have nothing to do with each other. :roll:
I turn often off my access point, I have everything wired and although it takes less than 10 W of power keeping it on is not justified, but I turn never off my router.

You are right. But every access point is reachable. Wired or wireless.
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