LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-24-2013, 12:00 PM   #16
EDDY1
LQ Addict
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,841

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649

Quote:
Originally Posted by Linux Newbee View Post
Yes when using knoppix I chose linux single linux single at the boot prompt. I changed the root password but when rebooting the server I end up at a login prompt and it does not recognize the password. Also, grub does not have any hidden entries or passwords. I set the timeout to 10 seconds and now get a blank screen for 10 seconds.
Try at the login window the commands from previous post, or edit with live-cd.
Check out 1.4
http://www.gentoo.org/doc/en/handboo...?part=2&chap=4
You will set to single user then reboot & make changes then set it back to boot to gui.

Last edited by EDDY1; 05-24-2013 at 12:02 PM.
 
Old 05-24-2013, 12:11 PM   #17
Linux Newbee
LQ Newbie
 
Registered: Jul 2008
Posts: 27

Original Poster
Rep: Reputation: 0
Sorry meant linux single, mnt sda and changed password, eited grub all cli.
 
Old 05-24-2013, 01:45 PM   #18
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
That sounds like you were changing things in the LiveCD working image(s), not in things on your HD. To make changes to your HD, you have to mount the HD's filesystem(s), and work with them, not the LiveCD file systems.

Assuming you're using the SystemRescue livecd, you can boot to a Gentoo GUI interface, with a terminal window open. Or you can choose to just stay with the rescue console. The suggestions below should all work with both choices, except for the last command (geany which is a GUI editor, so it need a running X-windows system.

In the terminal, enter the following commands (Anything from a # to the end of a line is a comment):
Code:
fdisk -l /dev/sd? # This will list all the partitions on all your hard drives
# Here's a sample output with comments
#Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes, 3907029168 sectors #Hard drive a represented symbolically a sda, sdb, ...; disk drives as sdr, sdro, stc.
#Units = sectors of 1 * 512 = 512 bytes                 # These three lines are the description of the physical layout of the drive
#Sector size (logical/physical): 512 bytes / 512 bytes
#I/O size (minimum/optimal): 512 bytes / 512 bytes
#Disk label type: dos                                   # The "label" is the partition method use for the drive
#Disk identifier: 0x767f9c5a
#
#   Device Boot      Start         End      Blocks   Id  System                  # This is the description of each partition
#/dev/sdb1   *       16065   902435309   451209622+  83  Linux                   # The first partition (/dev/sda1) is a Linux partition
#/dev/sdb2       902436864  1926443007   512003072   fd  Linux raid autodetect   # The second one is a special use Linx one
#/dev/sdb3      1926443008  3907028991   990292992    7  HPFS/NTFS/exFAT         # The third is a Windows partition
#
# Review your output to identify your Linux partitions.
#
# ASSUMING that one of them is /dev/sda1 try this (Note: Unless only one partition is a Linux one,
# the most likely partition is one not flagged as a "boot" partition.)
mount /dev/sda1 /mnt
ls /mnt/etc
# If this command fails, try another Linux partition.
# enter these commands to do that:
# exit # To quit the chroot process
# umount /mnt # To unmount the partition. (No "n" after the "u.")
# mount /dev/sda2 # To mount the second partition.
# and try the ls command again.
cat /etc/issue # To see what flavor of Linux is on the HD.
# You should see something like this
# cat /etc/issue
#Fedora release 19 (Schrödinger’s Cat)
#Kernel \r on an \m (\l)
#
# Now change your base file system to be the partition you identified on your HD
chroot /mnt
passwd # To change the "root" password
sync   # To make sure that the changes are written to the HD
# Now, at this point you've change the root password, so you can reboot and see if you can proceed from there
# or you can try to edit the grub files.
# To do that, using the SysRescue tools do this:
exit # To close the chroot session
ls /mnt/boot # To see if the HD's boot directory is mounted.
# If the directory listing is empty, your distribution may use a separate boot partition.
# Try mounting any other Linux partitions you identified as /mnt/boot 
# mount /dev/sda1 /mnt/boot
# And, once again, try the ls /mnt/boot
#Once the /mnt/boot directory contains a grub subdirectory, look in it to find the GRUB 
# boot file.
ls /mnt/boot/grub/
# And edit it
geany /mnt/boot/grub/menu.lst
 
Old 05-24-2013, 01:57 PM   #19
Linux Newbee
LQ Newbie
 
Registered: Jul 2008
Posts: 27

Original Poster
Rep: Reputation: 0
thanks ptrenholme thats very detail i appreciate that. bad weather being force to leave work early and i will not get a chance to try till the 28th, please don't close this post.
 
Old 05-30-2013, 01:13 PM   #20
Linux Newbee
LQ Newbie
 
Registered: Jul 2008
Posts: 27

Original Poster
Rep: Reputation: 0
Ok guys I tried SystemRescue and Knoppix live cd and both gave me an error when running the command:

chroot /mnt (SystemRescue)

chroot /media/sda2/ (Knoppix)

I get a "failed to run command /bin/bash...there seems to be various remedies as a work around.
 
Old 05-30-2013, 03:03 PM   #21
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Hum. That usually works.

Do a ls /mnt to verify that you've mounted the correct file system. It should look a little like this:
Code:
Backups  boot  etc   ISO  lib64       media   Mirror  opt       proc  run    sbin  sys  usr  Wallpapers
bin      dev   home  lib  lost+found  MiniSD  mnt     Passport  root  Samba  srv   tmp  var  Win7
(Note that anything in that list that starts with a capital letter is NOT something you should expect to see.)

If that looks OK, try this (as "root," of course):
Code:
mount --bind /proc /mnt/proc
mount --bind /dev  /mnt/dev
mount --bind /sys  /mnt/sys
chroot /mnt
(What that does is make the kernel files (/proc, etc.) from the kernel you're running available to the new root you're setting.)
 
Old 05-30-2013, 03:26 PM   #22
Linux Newbee
LQ Newbie
 
Registered: Jul 2008
Posts: 27

Original Poster
Rep: Reputation: 0
root@microknoppix:/# ls /mnt
sda2 sda3 sr0

mount --bind /proc /mnt/proc
mount: mount point /mnt/proc does not exist

mount --bind /dev /mnt/dev
mount: mount point /mnt/proc does not exist

mount --bind /sys /mnt/sys
mount: mount point /mnt/proc does not exist

chroot /mnt
failed to run command /bin/bash
 
Old 05-30-2013, 03:32 PM   #23
Linux Newbee
LQ Newbie
 
Registered: Jul 2008
Posts: 27

Original Poster
Rep: Reputation: 0
meant:
mount --bind /dev /mnt/dev
mount: mount point /mnt/dev does not exist

mount --bind /sys /mnt/sys
mount: mount point /mnt/sys does not exist

Should not be difficult to change root password. I have vi passwd and shadow and rebooted to still end up at some login that does not accept root/password. Following both ptrenholme (above) and various knoppix online user instructions. I have tried the gui and started a terminal and cli boot#linux single, mounted sda2 which fdisk -l shows as boot partition.
 
Old 05-30-2013, 11:39 PM   #24
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Quote:
Originally Posted by Linux Newbee View Post
root@microknoppix:/# ls /mnt
sda2 sda3 sr0[...]
This is NOT what you want to see. Try a ls /mnt/sda2 or a ls /mnt/sda3 and look for something like I posted above.

I suspect that /mnt/sda2 will have your /boot files in it, and /mnt/sda3 will have the rest of you system
in it, so the ls /mnt/sda3 output will look similar to what I posted.

ASSUMING that is correct do the following:
Code:
umount /dev/sda2
mount /dev/sda2 /mnt/sda3/boot
mount --bind /dev/proc /dev/sda3/proc
mount --bind /dev/sys  /dev/sda3/sys
chroot /mnt/sda3
Here's an example using an older Fedora system mounted as /Mirror (I.e., /dev/sda3 on your system if my ASSUMPTION is correct)

I've added comments in red to this example.
Code:
$ ls -1 /Mirror/ # Check that this looks like a linux base (/) file system.
bin
boot
coda
dev
etc
home
lib
lib64
lost+found
media
mnt
opt
proc
root
run
sbin
selinux
srv
sys
tmp
usr
var
$ ls /Mirror/boot/ # If my assumption is correct, you should see something like this after mounting /dev/sda2 as /mnt/sda3/boot
boot-isos                      initramfs-3.8.11-200.fc18.x86_64.img  ubnfilel.txt
config-3.8.11-200.fc18.x86_64  initramfs-3.8.8-202.fc18.x86_64.img   ubnpathl.txt
config-3.8.8-202.fc18.x86_64   initramfs-3.8.9-200.fc18.x86_64.img   vmlinuz-3.8.11-200.fc18.x86_64
config-3.8.9-200.fc18.x86_64   initrd-plymouth.img                   vmlinuz-3.8.8-202.fc18.x86_64
custom.cfg.new                 System.map-3.8.11-200.fc18.x86_64     vmlinuz-3.8.9-200.fc18.x86_64
extlinux                       System.map-3.8.8-202.fc18.x86_64
grub2                          System.map-3.8.9-200.fc18.x86_64
$ ls /Mirror/proc # Since the kernel creates this, it should be empty if the system is not running
$ sudo mount --bind /proc /Mirror/proc
$ sudo mount --bind /sys /Mirror/sys
$ sudo chroot /Mirror/ # This moves the root fs and starts a root login session on /mirror
# cat /etc/issue # Just so you can see that the root fs was moved
Fedora release 18 (Spherical Cow)
Kernel \r on an \m (\l)

## I didn't execute this block of commands since haven't lost my passwords . . .
# passswd # To change the root password
# /home/ # To see which home directories (users) are defined.
Peter
# passwd Peter # To change a user's password.
##
# exit # This exits the root shell.
exit
$ cat /etc/issue # To show that we're back
Fedora release 19 (Schrödinger’s Cat)
Kernel \r on an \m (\l)

$ sudo umount /Mirror/proc /Mirror/sys # Housekeeping: No reason to keep the mounts after I'm done

Last edited by PTrenholme; 05-30-2013 at 11:41 PM.
 
Old 06-04-2013, 09:55 AM   #25
Linux Newbee
LQ Newbie
 
Registered: Jul 2008
Posts: 27

Original Poster
Rep: Reputation: 0
OK at it again PTrenholme, on the GUI and opened a terminal and did a root@microknoppix:ls /mnt
got bin grub kernel.h lib lost&found old_system recover system

probably what was expected...however, the mount --bind /proc /mnt/proc commands do not exist nor does ls -l /Mirror/.

fdisk -l
device boot start end blocks id system
sda2 * 1 194 195520+ 83 linux
sda3 195 250 56448 83 linux

mount /dev/sda2 /mnt...worked
ls /mnt/etc..did not

umount /mnt
exit

mounted /dev/sda3 and ls and only got desktop.

root@microknoppix:/home/knkoppix# chroot /mnt andI get ...chroot:failed to run command bin/bash: no such file or directory
 
Old 06-04-2013, 02:21 PM   #26
Linux Newbee
LQ Newbie
 
Registered: Jul 2008
Posts: 27

Original Poster
Rep: Reputation: 0
I was able to vi passwd and shadow, bring up eth0 and assign ip, netmask and route. I can ping it from another subnet now. Is there anyway to test both the root/new password and ip addressing "took" before I close this terminal and restart the server?
 
  


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
Freenode webchat invalid password msg - How to reset freenode password? codeslayer2010 General 1 02-01-2013 06:31 PM
Linux 2.6.15.1 The password lost , RESET PASSWORD ANDYCHAN Linux - General 2 08-18-2012 08:05 AM
Reset password bino25 Linux - Newbie 8 07-07-2012 02:36 AM
How to retrieve( or reset) root password in Mandrake Linux, as I forgot my password? Reghunath Linux - Software 4 05-08-2008 04:11 AM
Password reset hongman Linux - Newbie 2 07-11-2005 05:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:21 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