LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Gentoo
User Name
Password
Gentoo This forum is for the discussion of Gentoo Linux.

Notices


Reply
  Search this Thread
Old 10-14-2017, 02:25 PM   #1
bsth123
Member
 
Registered: Feb 2017
Distribution: Kubuntu, Debian, FreeBSD
Posts: 195

Rep: Reputation: Disabled
can't su to root after chroot


My install was going fine. I has just chrooted and was working on flags when I decided to add my user I su to my user to make sure all was well. My user was in the wheel group and I know the first thing I did was add my root passwd for my install. In most of the posts I read it said use sudo su which doesn't work. I don't want to start over. suggestions please.
 
Old 10-15-2017, 10:43 AM   #2
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,677
Blog Entries: 19

Rep: Reputation: 4491Reputation: 4491Reputation: 4491Reputation: 4491Reputation: 4491Reputation: 4491Reputation: 4491Reputation: 4491Reputation: 4491Reputation: 4491Reputation: 4491
You mean you were root and then you su'd to another user? Then you can get back to your original root shell by typing exit.
 
Old 10-15-2017, 10:47 AM   #3
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,448

Rep: Reputation: 2342Reputation: 2342Reputation: 2342Reputation: 2342Reputation: 2342Reputation: 2342Reputation: 2342Reputation: 2342Reputation: 2342Reputation: 2342Reputation: 2342
I would say use sudo OR su, not both.
* sudo executes one command with root owner, but your group
* su changes you to root:<group> where <group> is your user's group
* su - changes you to root:root

EDIT: * chroot <location> changes the location of / from that terminal's perspective. It's usually a major PITA, as if you try to go doing stuff you need a working /proc, /sys, & /var which are written up as the kernel goes along. But it can be useful.

Last edited by business_kid; 10-15-2017 at 10:53 AM.
 
Old 10-15-2017, 11:46 AM   #4
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,677
Blog Entries: 19

Rep: Reputation: 4491Reputation: 4491Reputation: 4491Reputation: 4491Reputation: 4491Reputation: 4491Reputation: 4491Reputation: 4491Reputation: 4491Reputation: 4491Reputation: 4491
Quote:
Originally Posted by business_kid View Post
su - changes you to root:root
It also changes your environment to root's, which su doesn't.
Quote:
EDIT: * chroot <location> changes the location of / from that terminal's perspective. It's usually a major PITA, as if you try to go doing stuff you need a working /proc, /sys, & /var which are written up as the kernel goes along. But it can be useful.
It's essential when installing Gentoo. Gentoo comes as a skeleton filesystem tarball which you unpack on a mounted partition. You have to create the dynamic directories by binding them to the ones on your host system. Then you chroot across to carry out the rest of the installation. Now that I come to think of it, it's not unlike the way you build LFS.
 
Old 10-16-2017, 06:23 PM   #5
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
Quote:
Originally Posted by hazel View Post
It also changes your environment to root's, which su doesn't.

It's essential when installing Gentoo. Gentoo comes as a skeleton filesystem tarball which you unpack on a mounted partition. You have to create the dynamic directories by binding them to the ones on your host system. Then you chroot across to carry out the rest of the installation. Now that I come to think of it, it's not unlike the way you build LFS.
This changed a bit. You only have to mount '/' somewhere on the running system (i mounted mine under '/gentoo') and when you follow the document for Gentoo install it creates the directories underneath '/' for you.

@OP: follow the document. Simple pick the type of system you are installing on and it will get you to a bare bone system that boots. I just finished install Gentoo and it's running nicely. One tip I will give you is is you plan on booting UEFI then make sure you booted the system using UEFI. Makes life a lot easier.
 
Old 10-17-2017, 10:25 AM   #6
bsth123
Member
 
Registered: Feb 2017
Distribution: Kubuntu, Debian, FreeBSD
Posts: 195

Original Poster
Rep: Reputation: Disabled
Thanks I'll keep that in mind. But su didn't work because it wanted my root passwd which it wasn't accepting. Since I was so far along I just had to mount my file systems and go from there.
 
Old 10-17-2017, 04:11 PM   #7
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
What do you need su for you should already be root.
 
Old 12-02-2017, 11:51 AM   #8
_roman_
Member
 
Registered: Dec 2017
Location: _Austro_Bavaria_
Distribution: gentoo / linux mint
Posts: 433

Rep: Reputation: 29
Quote:
Originally Posted by bsth123 View Post
My install was going fine. I has just chrooted and was working on flags when I decided to add my user I su to my user to make sure all was well. My user was in the wheel group and I know the first thing I did was add my root passwd for my install. In most of the posts I read it said use sudo su which doesn't work. I don't want to start over. suggestions please.
In a chroot environment, e.g. sysrescue-cd, you are already user root.

Just use the gentoo handbook just as a recommendation. It has many flaws, many incorrect things. also gentoo wiki has many typos. The advanced user sees it quite fast

You just need to do the necessary steps. The user creation is just the same as it always was. When you are unable to enter your box after reboot, just chroot again and redo the part of creating the users.

the gentoo handbook is quite wrong on mount -rebind options and such, filesystems, swap, and such. Endless topic

--

sudo su, is for linux mint based distros, not for gentoo. it gives you a permanent superuser shell, because su does not work properly on linux mint, it enforces sudo. sudo is very very very very bad.

in gentoo it's enough to login as user root, or use su as your user to get privilege
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Android Chroot Archlinux no internet except as root nguyeng Linux - Newbie 1 09-18-2023 02:30 AM
chroot to debian root from fedora icegood Linux - General 1 05-04-2014 04:05 AM
Failed to change real root to fake root using chroot. Aswathy Linux - Newbie 1 06-29-2011 03:34 AM
chroot cannot change the root directory alkaff Linux From Scratch 3 05-11-2008 04:31 PM
chroot like program for non-root users xowl Linux - Security 12 12-10-2007 06:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Gentoo

All times are GMT -5. The time now is 08:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration