Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED]chroot /mnt/gentoo /bin/bash and source /etc/profile
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
Bobbbay
n00b
n00b


Joined: 15 Jul 2020
Posts: 65
Location: Mordor

PostPosted: Wed Jul 15, 2020 2:14 pm    Post subject: [SOLVED]chroot /mnt/gentoo /bin/bash and source /etc/profile Reply with quote

Hello all,

First off sorry for my horrible title, the limit of characters is daunting :). Second, I'm following [this Guide to (dual booting) Gentoo](https://wiki.gentoo.org/wiki/Sakaki%27s_EFI_Install_Guide). I'm on [this step](https://wiki.gentoo.org/wiki/Sakaki%27s_EFI_Install_Guide/Building_the_Gentoo_Base_System_Minus_Kernel), more specifically at "Entering the Chroot". I issued the following commands:

Code:

chroot /mnt/gentoo /bin/bash
source /etc/profile


And BOOM
Code:
/etc/profile
does not exist. "Huh", I thought, "that's strange." If I don't chroot and execute that command it doesn't throw an error (but then again I get no
Code:
stdout
, so I only presume). But then the next command is
Code:
emaint
, which does not exist (I mean, duh, the point of
Code:
chroot
is to change my root an therefore my
Code:
bin
).

Something I also found funny is that in
Code:
chroot
backspace works as a space. I dunno, sounds weird to me, thought I'd include it here.

The only thing I'm doing different from the tutorial is that I'm not using ssh/screen, because I really don't have a suitable device for it, and I enjoy working on the bare metal.

So I understand that
Code:
chroot
is changing my root, so how can I make this command work? Also, if I skip that and go ahead to
Code:
emaint sync --auto
in
Code:
chroot
, it gives an error of
Code:
portage: 'portage' user or group missing
.

So now, my question: WAT is happening, how come the Guide is all right while I'm not, and how can I fix it?

Thank you, and cheers!

P.S. this specific quote from the Guide might be important:

Quote:
Remember that if you subsequently use the target machine directly at its keyboard (rather than through the ssh/screen combination as here), you'll be working outside of the chroot, and all your paths will be incorrect (e.g. the new system will still appear at /mnt/gentoo/). It's an easy mistake to make, hence the renaming of the prompts. Once the kernel is built and the machine rebooted, we'll be 'natively' inside the new system, at which point this path issue will disappear.


But to be honest I don't understand what it means 100% :)))))

P.P.S. I'm on i686, ask for any more info and I will supply :))


Last edited by Bobbbay on Wed Jul 15, 2020 6:48 pm; edited 1 time in total
Back to top
View user's profile Send private message
Tony0945
Watchman
Watchman


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

PostPosted: Wed Jul 15, 2020 4:01 pm    Post subject: Reply with quote

It sounds to me like you didn't install the base system and/or the portage snapshot.

The emaint you will be executing is /mnt/gentoo/usr/sbin/emaint before the chroot. Make sure it exists before you chroot.
Another possibility is downloading the wrong base system.

Tell us a little more about your new system (in particular the CPU) and your boot media.

EDIT:
Code:
 ~ $ equery b `which emaint`
 * Searching for /usr/sbin/emaint ...
sys-apps/portage-2.3.99-r2 (/usr/sbin/emaint -> ../lib/python-exec/python-exec2)
Sounds like portage isn't installed!

EDIT2:
Quote:
P.P.S. I'm on i686, ...
Soory, still drinking my morning coffee and I missed that!
But still, before you chroot, examine the contents of /mnt/gentoo
Back to top
View user's profile Send private message
Bobbbay
n00b
n00b


Joined: 15 Jul 2020
Posts: 65
Location: Mordor

PostPosted: Wed Jul 15, 2020 5:16 pm    Post subject: Reply with quote

Tony0945 wrote:
It sounds to me like you didn't install the base system and/or the portage snapshot.

The emaint you will be executing is /mnt/gentoo/usr/sbin/emaint before the chroot. Make sure it exists before you chroot.
Another possibility is downloading the wrong base system.

Tell us a little more about your new system (in particular the CPU) and your boot media.

EDIT:
Code:
 ~ $ equery b `which emaint`
 * Searching for /usr/sbin/emaint ...
sys-apps/portage-2.3.99-r2 (/usr/sbin/emaint -> ../lib/python-exec/python-exec2)
Sounds like portage isn't installed!

EDIT2:
Quote:
P.P.S. I'm on i686, ...
Soory, still drinking my morning coffee and I missed that!
But still, before you chroot, examine the contents of /mnt/gentoo


So sorry for my late reply! /mnt/gentoo/usr/sbin/emaint exists, here's a small head -n 15:
Code:

#!/usr/bin/python-exec2c
# vim:fileencoding=utf-8:ft=python
# (c) 2012-2016 Micha□ Gorny
# Released under the terms of the 2-clause BSD license
#
# This is not the script you are looking for. This is just a wrapper
# The actual scripts of this application were installed
# in subdirectories od /usr/lib/python-exec.
# You are most likely looking for one of those.

from __future__ import with_statement

# prepare a clean globals for exec()
new_globals = dict(globals())
# we have to keep the import top, so delete it from globals


Looks strange but correct (I had no idea they use Python :))) ).

Quote:
downloading the wrong base system

Do you by any chance mean i686, etc.? This could be possible, as I wasn't sure and an answer on RetroComputing (StackExchange network) said that my PC (the [HP Pavilion Slim](https://support.hp.com/ca-en/document/c03791266)) would work with it.

CPU is in said link, a good old Intel Pentium. I'm just revitalizing her and I thought I'd give Gentoo a go.

Quote:
But still, before you chroot, examine the contents of /mnt/gentoo


Code:
bin  boot  dev  etc  home  lib  lost+found  media  mnt  opt  proc  root  run  sbin  sys


Seem like an average system to me, but I could be wrong.

Thanks a lot!

P.S. I tried running your equery both in and out of chroot and it wasn't found, could this be related to your remarks about portage?

EDIT: formatting issues :))))
Back to top
View user's profile Send private message
halcon
l33t
l33t


Joined: 15 Dec 2019
Posts: 629

PostPosted: Wed Jul 15, 2020 5:33 pm    Post subject: Reply with quote

Bobbbay wrote:
Code:
bin  boot  dev  etc  home  lib  lost+found  media  mnt  opt  proc  root  run  sbin  sys


And no usr there?

I am not familiar with the tutorial that you linked, but usually the portage snapshot is being unpacked to /usr, like that:
Code:
tar -C /mnt/gentoo/usr -xvjf portage-latest.tar.bz2
Back to top
View user's profile Send private message
Bobbbay
n00b
n00b


Joined: 15 Jul 2020
Posts: 65
Location: Mordor

PostPosted: Wed Jul 15, 2020 5:43 pm    Post subject: Reply with quote

halcon wrote:
Bobbbay wrote:
Code:
bin  boot  dev  etc  home  lib  lost+found  media  mnt  opt  proc  root  run  sbin  sys


And no usr there?

I am not familiar with the tutorial that you linked, but usually the portage snapshot is being unpacked to /usr, like that:
Code:
tar -C /mnt/gentoo/usr -xvjf portage-latest.tar.bz2


Huh, I must be blind... Here you go everyone, this one's correct: [https://imgur.com/a/3ieWlf2](https://imgur.com/a/3ieWlf2)

Sorry for that :)))

EDIT/P.S.: Was I supposed to manually run that tar command? This is what I recall doing:

Code:
cd /mnt/gentoo
tar xvJpf stage3-i686-*.tar.xz --xattrs-include='*.*' --numeric-owner
Back to top
View user's profile Send private message
halcon
l33t
l33t


Joined: 15 Dec 2019
Posts: 629

PostPosted: Wed Jul 15, 2020 5:57 pm    Post subject: Reply with quote

1. What is in /mnt/gentoo/etc?
Code:
ls -al /mnt/gentoo/etc
Code:
file /mnt/gentoo/etc/profile


2. The following command will show the value of PORTDIR variable:
Code:
cat /mnt/gentoo/etc/portage/make.conf | grep PORTDIR

Then, run
    ls -al /mnt/gentoothat-path
where that-path is the value of PORTDIR.

There must be a looong tree, beginning with acct-group, acct-user. If it exists, then the portage snapshot is downloaded and unpacked.
Back to top
View user's profile Send private message
Bobbbay
n00b
n00b


Joined: 15 Jul 2020
Posts: 65
Location: Mordor

PostPosted: Wed Jul 15, 2020 6:07 pm    Post subject: Reply with quote

halcon wrote:
1. What is in /mnt/gentoo/etc?
Code:
ls -al /mnt/gentoo/etc
Code:
file /mnt/gentoo/etc/profile


2. The following command will show the value of PORTDIR variable:
Code:
cat /mnt/gentoo/etc/portage/make.conf | grep PORTDIR

Then, run
    ls -al /mnt/gentoothat-path
where that-path is the value of PORTDIR.

There must be a looong tree, beginning with acct-group, acct-user. If it exists, then the portage snapshot is downloaded and unpacked.


[https://imgur.com/a/BXQcKv3](https://imgur.com/a/BXQcKv3)

Sorry for the unconventional images :)))

From this I assume that portage isn't installed...

EDIT: [here](https://wiki.gentoo.org/wiki/Sakaki%27s_EFI_Install_Guide/Installing_the_Gentoo_Stage_3_Files#Portage.27s_Configuration_Files) it is also mentioned that portage config files are in /etc/portage. There is a /etc/portage/make.conf, and PORTDIR is /var/db/repos/gentoo. Just so you know!


Last edited by Bobbbay on Wed Jul 15, 2020 6:10 pm; edited 1 time in total
Back to top
View user's profile Send private message
halcon
l33t
l33t


Joined: 15 Dec 2019
Posts: 629

PostPosted: Wed Jul 15, 2020 6:09 pm    Post subject: Reply with quote

From this I assume that you mixed up proc and etc when you were preparing the chroot environment. That listing is normal for /proc!
Back to top
View user's profile Send private message
Bobbbay
n00b
n00b


Joined: 15 Jul 2020
Posts: 65
Location: Mordor

PostPosted: Wed Jul 15, 2020 6:11 pm    Post subject: Reply with quote

halcon wrote:
From this I assume that you mixed up proc and etc when you were preparing the chroot environment. That listing is normal for /proc!


Oh! Hehe alright. I don't think you've seen this yet though :)))):

Quote:
EDIT: [here](https://wiki.gentoo.org/wiki/Sakaki%27s_EFI_Install_Guide/Installing_the_Gentoo_Stage_3_Files#Portage.27s_Configuration_Files) it is also mentioned that portage config files are in /etc/portage. There is a /etc/portage/make.conf, and PORTDIR is /var/db/repos/gentoo. Just so you know!


Does anything change from this?
Back to top
View user's profile Send private message
halcon
l33t
l33t


Joined: 15 Dec 2019
Posts: 629

PostPosted: Wed Jul 15, 2020 6:14 pm    Post subject: Reply with quote

/var/db/repos/gentoo is OK. It's a new standard for PORTDIR.
Back to top
View user's profile Send private message
Bobbbay
n00b
n00b


Joined: 15 Jul 2020
Posts: 65
Location: Mordor

PostPosted: Wed Jul 15, 2020 6:16 pm    Post subject: Reply with quote

halcon wrote:
/var/db/repos/gentoo is OK. It's a new standard for PORTDIR.


Ok phew. So what exactly should I do now to revert it? Also, out of pure curiosity, which commands did I mess up on? Maybe
Code:
livecd ~ #mount -v -t proc none /mnt/gentoo/proc
livecd ~ #mount -v --rbind /sys /mnt/gentoo/sys
livecd ~ #mount -v --rbind /dev /mnt/gentoo/dev
? Thanks lots!
Back to top
View user's profile Send private message
halcon
l33t
l33t


Joined: 15 Dec 2019
Posts: 629

PostPosted: Wed Jul 15, 2020 6:19 pm    Post subject: Reply with quote

I suppose that instead of that
Bobbbay wrote:
Code:
mount -v -t proc none /mnt/gentoo/proc

you might type this
Code:
mount -v -t proc none /mnt/gentoo/etc

If not, then I have no idea how that could happen.

EDIT: Try first
Code:
umount /mnt/gentoo/etc
Then
Code:
mount -v -t proc none /mnt/gentoo/proc
as is needed.

Last edited by halcon on Wed Jul 15, 2020 6:30 pm; edited 3 times in total
Back to top
View user's profile Send private message
Bobbbay
n00b
n00b


Joined: 15 Jul 2020
Posts: 65
Location: Mordor

PostPosted: Wed Jul 15, 2020 6:25 pm    Post subject: Reply with quote

halcon wrote:
I suppose that instead of that
Bobbbay wrote:
Code:
mount -v -t proc none /mnt/gentoo/proc

you might type this
Code:
mount -v -t proc none /mnt/gentoo/etc

If not, then I have no idea how that could happen.


Huh, oh well, maybe I did :))). What exactly can I do to revert these? Would i have to umount and then mount again?
Back to top
View user's profile Send private message
halcon
l33t
l33t


Joined: 15 Dec 2019
Posts: 629

PostPosted: Wed Jul 15, 2020 6:28 pm    Post subject: Reply with quote

umount /mnt/gentoo/etc
umount /mnt/gentoo/proc (just in case)
mount -v -t proc none /mnt/gentoo/proc
Back to top
View user's profile Send private message
Bobbbay
n00b
n00b


Joined: 15 Jul 2020
Posts: 65
Location: Mordor

PostPosted: Wed Jul 15, 2020 6:34 pm    Post subject: Reply with quote

halcon wrote:
umount /mnt/gentoo/etc
umount /mnt/gentoo/proc (just in case)
mount -v -t proc none /mnt/gentoo/proc


Thank you so, so much! It's all good and it worked! Cheers to you @halcon!
Back to top
View user's profile Send private message
halcon
l33t
l33t


Joined: 15 Dec 2019
Posts: 629

PostPosted: Wed Jul 15, 2020 6:40 pm    Post subject: Reply with quote

You're welcome, @Bobbbay!

Don't forget to mark the topic as solved (editing the first message header).
Back to top
View user's profile Send private message
Bobbbay
n00b
n00b


Joined: 15 Jul 2020
Posts: 65
Location: Mordor

PostPosted: Wed Jul 15, 2020 6:50 pm    Post subject: Reply with quote

halcon wrote:
You're welcome, @Bobbbay!

Don't forget to mark the topic as solved (editing the first message header).


I hope I did this right :)))

Also, while I'm at it, the next step says that I must have 17.1 in my eselect profiles, but I don't. Strange thing is that I downloaded the newest stage3 tarballs (for x86_64). I assume that the x86_64 17.1 has not yet been released (the tutorial goes by amd64)? Or I'm doing something horribly wrong again 8).

Thank you very much again! Cheers!
Back to top
View user's profile Send private message
Tony0945
Watchman
Watchman


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

PostPosted: Wed Jul 15, 2020 7:39 pm    Post subject: Reply with quote

Whew! it's an Ivy Bridge. I feared it was an actual Pentium, i586.
You seem to be in good hands now. I'll just add that as an aid to chrooting I always put this little script in my root partition as an aid to chrooting from rescue media:
Code:
tony@Casti ~ $ cat /chroot.sh
set -e
mount --rbind /dev /mnt/gentoo/dev
mount -t proc proc /mnt/gentoo/proc
mount --rbind /sys /mnt/gentoo/sys
mount --rbind /tmp /mnt/gentoo/tmp
cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
That way I don't have to lookup and type all those4 commands.
The script would have a few more lines if you run systemd. I don't.

Purists would say that I'm polluting the root directory. You could also put it in say /usr/local, but then you would have to invoke it as
"/mnt/gentoo/usr/local/chroot.sh" which is a lot of typing.
Back to top
View user's profile Send private message
halcon
l33t
l33t


Joined: 15 Dec 2019
Posts: 629

PostPosted: Wed Jul 15, 2020 7:41 pm    Post subject: Reply with quote

Bobbbay wrote:
the next step says that I must have 17.1 in my eselect profiles, but I don't. Strange thing is that I downloaded the newest stage3 tarballs (for x86_64). I assume that the x86_64 17.1 has not yet been released (the tutorial goes by amd64)?

The profile 17.1 has already been released. When I was installing Gentoo last time, in October 2019, 17.1 was installed by default (if I remember well; anyway, I didn't migrate). I am not aware of what could have changed later.

EDIT: Sorry, I didn't read x86. I can't say for sure about x86! I haven't dealt with it for a long time.

EDIT2: I think 17.1 can be only for amd64 (not for x86_64). In that message, Michał Górny wrote: except for x32 profiles that have been using the correct layout already.
Back to top
View user's profile Send private message
Bobbbay
n00b
n00b


Joined: 15 Jul 2020
Posts: 65
Location: Mordor

PostPosted: Thu Jul 16, 2020 6:05 pm    Post subject: Reply with quote

halcon wrote:
Bobbbay wrote:
the next step says that I must have 17.1 in my eselect profiles, but I don't. Strange thing is that I downloaded the newest stage3 tarballs (for x86_64). I assume that the x86_64 17.1 has not yet been released (the tutorial goes by amd64)?

The profile 17.1 has already been released. When I was installing Gentoo last time, in October 2019, 17.1 was installed by default (if I remember well; anyway, I didn't migrate). I am not aware of what could have changed later.

EDIT: Sorry, I didn't read x86. I can't say for sure about x86! I haven't dealt with it for a long time.

EDIT2: I think 17.1 can be only for amd64 (not for x86_64). In that message, Michał Górny wrote: except for x32 profiles that have been using the correct layout already.


Ah, ok. I've proceeded with the installation using 17.0, hopefully it'll work. If not, I'll restart using amd64. I've been having a couple problems, CONFIG_PROJECT is empty, INVALID ACCEPT_KEYWORDS: i686, and some huge problems in bootstrap.sh with zlib (unable to read SONAMEfrom libz.so). So I don't think it's going too smooth :wink:
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 21706

PostPosted: Fri Jul 17, 2020 1:57 am    Post subject: Reply with quote

Generally, if you can use amd64, you should. It is the more common choice these days, and some upstream projects have lost interest in having their code work well, or even at all, on i686.

If you need help with a specific problem, you're welcome to post here. The brief bit you wrote immediately preceding my post is too vague for us to help you. We need more details about the problem, such as what program reported it and how you configured the affected environment.
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Fri Jul 17, 2020 5:47 am    Post subject: Reply with quote

You're attempting to do a stage1 install in 2020? Good luck with that. Hasn't been supported since the mid-2000s.
Back to top
View user's profile Send private message
Bobbbay
n00b
n00b


Joined: 15 Jul 2020
Posts: 65
Location: Mordor

PostPosted: Sat Jul 18, 2020 2:23 am    Post subject: Reply with quote

Hu wrote:
Generally, if you can use amd64, you should. It is the more common choice these days, and some upstream projects have lost interest in having their code work well, or even at all, on i686.

If you need help with a specific problem, you're welcome to post here. The brief bit you wrote immediately preceding my post is too vague for us to help you. We need more details about the problem, such as what program reported it and how you configured the affected environment.


Heyo, yeah sorry I was for sure not explaining that. I decided to ditch the x86 because it seems Gentoo doesn't love x86 too much :))). I'm redoing the install process with amd64 right now.

Ant P. wrote:
You're attempting to do a stage1 install in 2020? Good luck with that. Hasn't been supported since the mid-2000s.


Heh. I was not at all doing a stage1 install :PPP. It was a stage3 tarball for sure. Where can I even find stage1 tars 8)?

Thank you for the support everyone! So many people say Arch has the best community but I've got to admit you guys blew me away! Also, I've noticed some forums for other distros get a bit... Mad at each other. I absolutely love nobody told me I'm the stupidest person in the world here! Cheers to you allllll!!!
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