LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 08-14-2016, 04:11 AM   #1
AlbertPG
LQ Newbie
 
Registered: Jul 2016
Location: Barcelona
Distribution: Xubuntu 16.04.1 LTS
Posts: 12

Rep: Reputation: Disabled
Question Entering the chroot environtment


Hello

I'm currently in the section 6.4 of the LFS book (7.9 version) and I have to enter the chroot environtment. It said me that as a "root" user I have to type the following code:

chroot "$LFS" /tools/bin/env -i \
HOME=/root \
TERM="$TERM" \
PS1='\u:\w\$ ' \
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
/tools/bin/bash --login +h


After it is done, the ~# that appears next yo the the root username becomes a /#. Moreover, in the book it says that the bash prompt would say "I have no name!" which do not appear.

My questions are:

1. Am I doing everything ok?
2. How I can check if I am in the chroot environtment?
3. Is it normal that the bash don't say "I have no name"?

Thanks in advance.

Using: UBUNTU 16.04 in a VM
 
Old 08-14-2016, 05:36 AM   #2
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,562
Blog Entries: 19

Rep: Reputation: 4445Reputation: 4445Reputation: 4445Reputation: 4445Reputation: 4445Reputation: 4445Reputation: 4445Reputation: 4445Reputation: 4445Reputation: 4445Reputation: 4445
It says "I have no name" if there is no root account listed in your chroot environment's /etc/passwd file. That would normally be the case at this stage, since /etc/passwd is created within the chroot environment. Did you perhaps copy an existing passwd file into your new setup?

How do you know you are in chroot? Just list some top-level directories. For example ls /bin will show an empty or almost empty directory in your new environment. If you are still in the old one, the directory will be full of files.

You do know that you need to be root (or use sudo) to chroot?
 
Old 08-17-2016, 09:55 AM   #3
AlbertPG
LQ Newbie
 
Registered: Jul 2016
Location: Barcelona
Distribution: Xubuntu 16.04.1 LTS
Posts: 12

Original Poster
Rep: Reputation: Disabled
Hi again.

I do not why but the /etc/passwd file was already created. I think it might be because of the kernel I'm using, but I am not sure. I deleted the file and then, following the instructions in the book, I re-create it and it worked.

Thank you
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
entering blfs using chroot spiky0011 Linux From Scratch 4 07-03-2012 07:35 AM
Shell Script - entering the chroot environment solo9300 Programming 1 07-19-2010 09:32 AM
problem with env while entering chroot'ed environment trurl23 Linux From Scratch 1 06-15-2008 03:12 PM
LXer: Entering A Safe Mirror When Logging In With Unionfs And Chroot LXer Syndicated Linux News 0 06-29-2007 11:01 AM
Problem entering chroot environment. mullog Linux From Scratch 1 06-05-2004 08:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 08:26 PM.

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