|Home||Switchboard||Unix Administration||Red Hat||TCP/IP Networks||Neoliberalism||Toxic Managers|
May the source be with you, but remember the KISS principle ;-)
Bigger doesn't imply better. Bigger often is a sign of obesity, of lost control, of overcomplexity, of cancerous cells
|Recommended Links||Grub||Boot Directly into a Shell||Runlevels||mount command||Serial console|
|Troubleshooting Errors in /etc/fstab||Mounting partitions with chroot||Linux root password recovery||/etc/inittab||/etc/fstab/||Filesystem mount options||Reverting permissions in etc to redhat defaults||Mounting Linux filesystems|
|Resetting root password on MySQL||Minimalistic and Rescue Linux Distributions||Humor||Etc|
You need to "transplant" /proc pseudo filesystem
mount --bind /proc /chrooted/proc
--bind is for mount an already mounted filesystem to another mount point. i got
it from here. i can't find
it in my man page either, but i know i've read about it somewhere. i just can't find it.
Set Root Password
If you've lost your root password, you might be able to recover it using the steps below. However, some systems are protected with boot loader passwords that will not let you do that without THAT password. If the boot loader is password protected, you need to boot from other media Like the OpenSUSE CD/DVD/mini-boot. OpenSUSE install CD is probably the best one to use.
CD/DVD Recovery Mode
If using CD/DVD boot media, You need to choose Rescue System. You enter root and then mount the disk manually. For example, a Compaq raid controller will probably be /dev/ida/c0d0 or an IDE drive will be /dev/hda1. Find the partitions by using fdisk /dev/ida/c0d0 or fdisk /dev/hda (just "p" and quit) and then mount what you need.mount -o remount,rw /dev/sda2 /mnt# cd /mnt # chroot /mnt # passwd
For 10.3, you need somemore steps:
Start the rescue system. Find the disk root partition, then, assuming its hdxy (or probably sdxy):mount /dev/hdxy /mnt mount -o bind /proc /mnt/proc mount -o bind /sys /mnt/sys mount -o bind /dev /mnt/dev chroot /mnt
you are root in the installed sytem, with all at hand: passwd, but also YaST...
"bind" allow using two mount points for system virtual folders.
If all fails, consider that you can pull this drive (or install another drive in this machine) and mount it from another running Linux. Then recover the root password as explained above.
Single User Mode
The first thing to try is to boot to single user mode. This MIGHT not work for you, because your system might be configured to still ask for a root password to get to single user mode. If that's the case, we'll use another trick that replaces init with /bin/bash.
First, try single user. If you don't see either a LILO or GRUB boot screen, try hitting CTRL-X to get one. If it's LILO, just type "linux single" and that should do it (assuming that "linux" is the lilo label). If GRUB, hit 'e", then select the "kernel" line, hit "e" again, and add " single" (or just " 1") to the end of the line. Press ENTER, and then "b" to boot. (Newer version of grub uses "a" to append to the boot line)
You should get a fairly normal looking boot sequence except that it terminates a little early at a bash prompt. If you get a "Give root password for system maintenance", this isn't going to work, so see the "init or /bin/bash" version below.
If you do get the prompt, the / filesystem may not be mounted rw (although "mount" may say it is). Domount -o remount,rw /
If that doesn't work (it might not), just type "mount" to find out where "/" is mounted. Let's say it is on /dev/sda2. You'd then type:mount -o remount,rw /dev/sda2
If you can do this, just type "passwd" once you are in and change it to whatever you like. Or just edit /etc/shadow to remove the password field: move to just beyond the first ":" and remove everything up to the next ":". With vi, that would be "/:" to move to the first ":", space bar once, then "d/:" and ENTER. You'll get a warning about changing a read-only file; that's normal. Before you do this, /etc/shadow might look like:root:$1$8NFmV6tr$rT.INHxDBWn1VvU5gjGzi/:12209:0:99999:7:-1:-1:1074970543 bin:*:12187:0:99999:7::: daemon:*:12187:0:99999:7::: adm:*:12187:0:99999:7:::
and after, the first few lines should be:root::12209:0:99999:7:-1:-1:1074970543 bin:*:12187:0:99999:7::: daemon:*:12187:0:99999:7::: adm:*:12187:0:99999:7:::
You'll need to force the write: with vi, ":wq!". (If that still doesn't work, you needed to do the -o remount,rw, above).
INIT or /bin/bash Mode
Another trick is to add "init=/bin/bash" (LILO "linux init=/bin/bash" or add it to the Grub "kernel" line). This will dump you to a bash prompt much earlier than single user mode, and a lot less has been initialised, mounted, etc. You'll definitely need the "-o remount,rw" here. Also note that other filesystems aren't mounted at all, so you may need to mount them manually if you need them. Look in /etc/fstab for the device names.
Keep this in mind if you have a Linux machine in a publically accessible place : without more protection, it's not usually hard to recover a lost root password, which means it's just as easy for someone to CHANGE it, or access root without your knowledge.
Another way to do this is to remove the password from /etc/shadow. Just in case you screw up, I'd copy it somewhere safe first. You want to end up with the root line looking something like this:
If you are having trouble with editing (you really do have to learn vi one of these days), you could just (after making a copy, of course) justecho "root::12832:0:::::" > /mnt/etc/shadow
or, if you were in single user modeecho "root::12832:0:::::" > /etc/shadow
and then fix things up when rebooted.
Google matched content
USING A RESCUE CD to restore GRUB to MBR
Posted by johnlange on September 22, 2009 06:45 pm under SUSE, Tech TipSUSE hasn’t let me down very often but recently I had a bad experience while applying some updates to an OpenSUSE laptop. There were quite a few updates so I undocked the laptop so I could relax while they downloaded.
For reasons that I have not yet resolved, the wirless networking became unstable and as a result, the updates had to be aborted.
Unfortunately, a new kernel was part of the updates and when the laptop rebooted it was in a bad state. X windows wouldn’t start and critically, there were no network drivers for the new kernel. To make matters worse, OpenSUSE does not keep the old kernels in /boot (why is that?) so there was nothing to fall back on.
With nothing left to do, it was time to try rescue mode and in a few short steps I had the system fully working again. Here is what I did:
Step 1: boot to rescue mode (duh).
Step 2: mount your hard disk partitions under /mnt in the same layout they would be normally. For example:# mount /dev/sda2 /mnt# mount /dev/sda1 /mnt/boot
Step 3: Next we need to make sure we have acess to all the important system resources.# mount --bind /proc /mnt/proc # mount --bind /sys /mnt/sys # mount --bind /dev /mnt/dev
Step 4: We’re ready to chroot into our new environment.# chroot /mnt
Step 5: We are now running on our system just as if we had booted to it and we can perform repairs. In my case all I needed to do was complete the updates:# zypper up
I rebooted and everything was back to normal.
problem trying to chroot from liveCD to fix system - openSUSE Forums
|My 11.3 install boots to a white screen. I have
tried booting to runlevel 3 but I get the same screen there also. It is
mostly white with some garbage at the top. So I am trying to chroot into
it to update the system and I am getting the following error. What am I
linux@linux:~> su - linux:~ # mkdir /mnt/suse5 linux:~ # mount /dev/sda5 /mnt/suse5 linux:~ # mount --bind /proc /mnt/suse5/proc linux:~ # mount --bind /dev /mnt/suse5/dev linux:~ # mount --bind /dev/pts /mnt/suse5/dev/pts linux:~ # mount --bind /sys /mnt/suse5/sys linux:~ # mount --bind /etc/resolv.conf /mnt/suse5/etc/resolv.conf linux:~ # chroot /mnt/suse5 /bin/bash linux:/ # zypper up zypper: error while loading shared libraries: librpm.so.0: cannot open shared object file: No such file or directory linux:/ #
Running grub-install block device while being chrooted after booting into the rescue mode causes the error:
block device: Not found or not a block device.
While in chroot mode issuing lsscsi reports:
error: Unable to open /proc/mounts for reading Unable to locate sysfsroot. If kernel>= 2.6.0 Try something like 'mount -t sysfs none /sys'.
Before changing environment to root the following commands needs to be issued:
mount --bind /proc /CurrentMountPointofRootPartition/proc
mount --bind /dev /CurrentMountPointofRootPartition/dev
mount --bind /sys /CurrentMountPointofRootPartition/sys
After that the command chroot /CurrentMountPointofRootPartition can be issued and the virtual proc, sys and dev filesystems will be available from within the chroot environment so that commands like grub-install can function.
Document ID: 3141099 Creation Date: 02-14-2007 Modified Date: 12-24-2008 Novell Product: SUSE Linux Enterprise Desktop Novell Product: SUSE Linux Enterprise Server
mount in chroot environment not possible
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto | Site FAQ | Sitemap | Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies. 12-05-2004, 02:39 PM
LQ NewbieRegistered: Jun 2004
mount in chroot environment not possible
[Log in to get rid of this advertisement]Hi,
I am trying to clone a running Suse 9.2 system.
Back with Suse 8.2 all I had to do was:
1.) copy / to the new location
2.) add a new entry for the cloned system in /boot/grub/menu.lst
3.) chroot to the cloned system
4.) modify /etc/fstab of the cloned system
5.) mount /boot Partition
6.) create a new initrd
7.) exit chroot and reboot
At Suse 9.2 step 5.) does not work.
venus:/# mount -t ext3 /dev/hda5 /boot
mount: special device /dev/hda5 does not exist
Displaying /dev shows that /dev/hda5 is non-existent
venus:/# ls /dev
. .. .udev.tdb null
I suppose this is because udev is not running in chroot-Environment...but how can i start it manually?
What about sysfs - i read somewhere that sysfs is needed by udev - do i have to start sysfs too?
Thanks in advance for the help
moskito01 View Public Profile View LQ Blog View Bookmarks View Review Entries View HCL Entries Find More Posts by moskito01
12-05-2004, 02:57 PM #2 mikeyt_333
Registered: Jun 2001Location: Up in the clouds
Distribution: Fedora et al.Posts: 353
what does fdisk's partition table say about your /dev/hda?
mikeyt_333 View Public Profile View LQ Blog View Bookmarks View Review Entries View HCL Entries Find More Posts by mikeyt_333
12-06-2004, 03:48 AM #3 abisko00
Registered: Mar 2004Location: Munich
Distribution: SuSE 11.2Posts: 3,505
Maybe this is easier if you'd use a distro that also uses udev, e.g. KNOPPIX with kernel 2.6
abisko00 View Public Profile View LQ Blog View Bookmarks View Review Entries View HCL Entries Find More Posts by abisko00
12-06-2004, 03:04 PM #4 moskito01
Registered: Jun 2004Posts: 22
my partition table:
Device Boot Start End Blocks Id System
/dev/hda1 * 1 26902 13558576+ 7 HPFS/NTFS
/dev/hda2 146041 155055 4543560 12 Compaq diagnostics
/dev/hda3 26903 146040 60045552 f W95 Ext'd (LBA)
/dev/hda5 92439 92601 82120+ 83 Linux
/dev/hda6 26903 47708 10486161 83 Linux
/dev/hda7 92602 95722 1572952+ 82 Linux swap / Solaris
/dev/hda8 95723 116528 10486192+ 83 Linux
/dev/hda9 47709 58111 5243080+ 8e Linux LVM
/dev/hda10 58112 80997 11534512+ 8e Linux LVM
Partition table entries are not in disk order
-> the system i want to clone resides on /dev/hda6
-> target for clonig ist /dev/hda10 (via LVM2)
The Suse 9.2 from which i try to do the cloning also uses udev, so why should i switch to KNOPPIX 2.6?
I tried the steps with KNOPPIX 2.6 but did not manage to load LVM-Module.
Is dm_mod (LVM2) not included in KNOPPIX 2.6?
moskito01 View Public Profile View LQ Blog View Bookmarks View Review Entries View HCL Entries Find More Posts by moskito01
12-06-2004, 03:08 PM #5 electronique
Registered: Mar 2004Location: Menomonie, WI
Distribution: SuSE 9.2, Slackware Current, Arch Linux 0.7Posts: 119
before you chroot try
mount -o bind /dev /dir/of/new/dev
that command I had to use when installing Gentoo linux in order to get it to properly read my Promise FastTrack Raid chips.
mount -o bind /dev /mnt/gentoo/dev
12-06-2004, 04:06 PM
electronique View Public Profile View LQ Blog View Bookmarks View Review Entries View HCL Entries Visit electronique's homepage! Find More Posts by electronique
Registered: Jun 2004Posts: 22
thanks, that worked!
but now i ran in a new problem.
I built the new initrd and rebooted.
The cloned system starts, all the messages rush by - i can't see errors - perhaps because my eyes are too slow
I can see loading of lvm modules as well as filesystem modules (reiser, ext3)...
After loading of USB-Driver (before init starts) something like
md: stopping all md devices appears
md: restarting system
i have no chance to really check the startup output for errors...
i don't use md at all ?! so can't imagine what that means...
Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers : Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism : The Iron Law of Oligarchy : Libertarian Philosophy
War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda : SE quotes : Language Design and Programming Quotes : Random IT-related quotes : Somerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose Bierce : Bernard Shaw : Mark Twain Quotes
Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 : Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law
Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds : Larry Wall : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOS : Programming Languages History : PL/1 : Simula 67 : C : History of GCC development : Scripting Languages : Perl history : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history
The Peter Principle : Parkinson Law : 1984 : The Mythical Man-Month : How to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Hater’s Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite
Most popular humor pages:
Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor
The Last but not Least
Copyright © 1996-2018 by Dr. Nikolai Bezroukov. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) in the author free time and without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.
FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.
This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...
You can use PayPal to make a contribution, supporting development of this site and speed up access. In case softpanorama.org is down you can use the at softpanorama.info
The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the author present and former employers, SDNP or any other organization the author may be associated with. We do not warrant the correctness of the information provided or its fitness for any purpose.
Last modified: March, 08, 2018