LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 10-01-2012, 05:45 AM   #1
clifford227
Member
 
Registered: Dec 2009
Distribution: Slackware 14
Posts: 282

Rep: Reputation: 64
'chroot'ing into the system


Hello,

Following on from my thread about a boot problem with my notebook computer, which suddenly make's the screen go black while running through the boot messages, other LQ members suspected that it may be due to an unsupported graphics chip (the Intel GMA 3600) in the stock slackware 14 3.2x kernel.

It was suggested that if I use the huge kernel 3.5.4 config file from /testing, and built a kernel from that config file and source, the correct drivers are available to make my notebook work.

It was also suggested that I 'chroot' into the system to do this. But Im not sure how involved it is. I've read some things about chroot, but I dont seem to fully understand it or how it works.

I was hoping that LQ members might try to explain chroot, what it is, and at the end of it maybe some practical advice to allow me chroot into my system to allow me to build a new kernel (which I can do already) to try and resolve the boot problem.

(*EDIT* I should say that when I attempted to resolve this problem a few days ago, I wasnt very well at all, and it was late at night, but the enthusiasm to try Slack 14 on my notebook should have waited untill I was feeling better. My apologies for the previous thread, I do however feel better this morning to attempt to resolve this problem, so any help will be appreciated and acted on)

Last edited by clifford227; 10-01-2012 at 05:49 AM.
 
Old 10-01-2012, 06:03 AM   #2
BlackRider
Member
 
Registered: Aug 2011
Distribution: Slackware
Posts: 261

Rep: Reputation: 82
Chrooting basically means entering in a turned off system while you are running another active system. Very, very roughly speaking :-)

For successfully chrooting into a system (for example, when you have installed a system and want to chroot to it form a Live CD), you usually have to perform these steps:

Code:
#Mount the filesystem you want to chroot into.
mount /dev/whatever /mnt/wherever

#Mount critical stuff in the filesystem you want to chroot into.
#A system will usually work badly without these.
mount -o bind /sys /mnt/wherever/sys
mount -o bind /dev /mnt/wherever/dev
mount -o bind /proc /mnt/wherever/proc

#Chroot into the system.
chroot /mnt/wherever
This should give you a root shell in the turned off system.

Last edited by BlackRider; 10-01-2012 at 06:05 AM.
 
2 members found this post helpful.
Old 10-01-2012, 06:19 AM   #3
clifford227
Member
 
Registered: Dec 2009
Distribution: Slackware 14
Posts: 282

Original Poster
Rep: Reputation: 64
BlackRider, so chroot allows you to get into the turned off system and to use directories that are needed for repairs or other work. Correct?

But why do would you need to mount further directories, sys, dev and proc, when you have already mounted the filesystem as a whole?
 
Old 10-01-2012, 06:29 AM   #4
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,592
Blog Entries: 2

Rep: Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046
If you have to have access to the hardware or kernel interface from within the chrooted system you first need to make them accessible. For example, Grub will complain if you want to install it and doesn't have access to those directories.
 
1 members found this post helpful.
Old 10-01-2012, 06:46 AM   #5
clifford227
Member
 
Registered: Dec 2009
Distribution: Slackware 14
Posts: 282

Original Poster
Rep: Reputation: 64
Thankyou Tobi,

So when you first mount the filesystem as in BlackRiders example:

Code:
#Mount the filesystem you want to chroot into.
mount /dev/whatever /mnt/wherever
It only mounts the root, to attach the filesystem and no directories below it, so you have to then attach further directories which are needed. I understand.

To ask a further question, again using BlackRiders example

Code:
/mnt/wherever
wherever becomes root, and the other necessary area's of the system:

Code:
sys /mnt/wherever/sys
/dev /mnt/wherever/dev
/proc /mnt/wherever/proc
are mounted onto that root directory.

What is the correct label for '/mnt/wherever'? Does it need to be '/mnt/root'?

Last edited by clifford227; 10-01-2012 at 06:51 AM.
 
Old 10-01-2012, 07:08 AM   #6
BlackRider
Member
 
Registered: Aug 2011
Distribution: Slackware
Posts: 261

Rep: Reputation: 82
Quote:
But why do would you need to mount further directories, sys, dev and proc, when you have already mounted the filesystem as a whole?
TobISGD has mostly explained it. What is contained in sys, dev and proc is volatile ware, because it exist not in a turned off system. These folders contain kernel and hardware stuff that is generated by the kernel on boot and destroyed on shutdown, so an inactive system has not access to them.

That's why you provide the inactive system with "copies" of the stuff generated by your running system. Because the inactive system cannot generate everything by itself.

Quote:
(...)It only mounts the root, to attach the filesystem and no directories below it, so you have to then attach further directories which are needed.
Yes, if you use a multi-partition system, you have to track and mount every stuff inside the root of the inactive system.

For example, if your / is in /dev/sda1 and your /home is in /dev/sda2, you would do something like:
Code:
mount /dev/sda1 /mnt/whatever
mount /dev/sda2 /mnt/whatever/home
and so on.

Quote:
What is the correct label for '/mnt/wherever'?
That's irrelevant. Any existent directory will do. You can make a folder called "chroot", "orange", or "sdfsdf" and mount everything there if you want. It does not even have to be inside of /mnt (although the purpose or /mnt is precisely to mount this kind of things inside of it).
 
1 members found this post helpful.
Old 10-01-2012, 07:27 AM   #7
clifford227
Member
 
Registered: Dec 2009
Distribution: Slackware 14
Posts: 282

Original Poster
Rep: Reputation: 64
Thanks BlackRider and TobiSGD.

I now have a better understanding of chroot, and I am able to use the make command to build the new kernel.

Last edited by clifford227; 10-01-2012 at 07:28 AM.
 
Old 10-01-2012, 12:52 PM   #8
clifford227
Member
 
Registered: Dec 2009
Distribution: Slackware 14
Posts: 282

Original Poster
Rep: Reputation: 64
To update, I have built and installed the new 3.5.4 kernel and modified the lilo bootloader.

Do I need to logout of chroot somehow? and then unmount sys, dev and proc, then finally the root filesystem?
 
Old 10-01-2012, 12:56 PM   #9
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,592
Blog Entries: 2

Rep: Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046
To logout from the chroot just type exit, the filesystems should be unmounted automatically when you rebbot, but to be sure you can do that manually.
 
1 members found this post helpful.
Old 10-01-2012, 01:27 PM   #10
clifford227
Member
 
Registered: Dec 2009
Distribution: Slackware 14
Posts: 282

Original Poster
Rep: Reputation: 64
Thanks Toby.

I unmounted the filesystems and rebooted.

I chose the new kernel in the Lilo screen, and managed to get through all of the boot messages (although some of the new modules failed), I got to the login console, and logged in as root. Unfortunately when I did startx, in the fluxbox screen there is no keyboard or touchscreen input (although fluxbox time in bottom right is still working!)

But thats for another day.

Thanks again
 
  


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
grep'ing and sed'ing chunks in bash... need help on speeding up a log parser. elinenbe Programming 4 04-22-2009 10:17 AM
"chroot"ing a script knockout_artist Linux - Newbie 1 02-05-2009 03:45 PM
chroot'ing gives a bash segmentation fault chrisyc Linux - Software 1 04-19-2006 03:06 AM
chroot'ing problem in Gentoo Stage 1 Install logosys Linux - Distributions 6 07-18-2005 12:10 PM
need help with tar'ing and bz2'ing a file surfbass Linux - General 4 06-01-2005 05:07 PM


All times are GMT -5. The time now is 02:06 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration