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

Notices

Reply
 
Search this Thread
Old 10-01-2008, 11:41 PM   #1
Bob Barrett
LQ Newbie
 
Registered: Jan 2008
Posts: 7

Rep: Reputation: 0
Copied Fedora 8 to new drive: boots, but no login


Laptop: HP 9225, 2 GB RAM, 160 GB HD

Fedora 8 was installed to /dev/sda3 on the original 160 GB hard drive. A
second, 200 GB hard drive was later installed. Using Knoppix, I mounted
/dev/sda3 and /dev/sdb2 on /media/sda3 and /media/sdb2. I changed into
the /media/sda3 directory and issued "cp -a * /media/sdb2", still
running on Knoppix. I checked the copy while still in Knoppix with
"diff -r etc/ /media/sdb2/etc/", etc. It seems that I have a good copy
of Fedora 8 on /dev/sdb2, and after setting up fstab and grub, it boots
with no errors.

The problem: I cannot log in. Error message:

vega login: root
Password:
Last login: Wed Oct 1 11:04:21 on tty1
login: no shell: Permission denied.

I tried again, almost immediately:

vega login: root
Password:
Last login: Wed Oct 1 11:04:35 on tty1
login: no shell: Permission denied.

Notice the time of last login. It is keeping track of the time of
logins, as if they are successful. Both the original and the copy of
/bin/login are identical, according to diff.

According to "diff /etc/passwd /mnt/f8/etc/passwd", as well as shadow
and group, those files are all the same.

I thought I would have to rebuild /boot/initrd, but it appears to be
working. There are no errors or warnings in /var/log/messages. The
reference to initrd in the log is the usual:

Oct 1 22:42:15 vega kernel: Freeing initrd memory: 2997k freed

According to /var/log/secure, my login are successful, then nothing
happens, so, I issue a CTL-ALT-DEL:

Oct 1 23:00:48 vega login: pam_unix(login:session): session opened for
user root by LOGIN(uid=0)
Oct 1 23:00:48 vega login: ROOT LOGIN ON tty1
Oct 1 23:00:48 vega login: pam_unix(login:session): session closed for
user root
Oct 1 23:00:57 vega sshd[2134]: Received signal 15; terminating.

Anyone have any ideas?

Bob
 
Old 10-02-2008, 04:23 PM   #2
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,147

Rep: Reputation: 330Reputation: 330Reputation: 330Reputation: 330
Well, a few things:

1) A default Fedora installation would have had /boot on one partition and swap and / inside a LV in a second partition. Unless you overrode those defaults, you can't get a working installation from a cp * on a mounted fs. You'd need, at a minimum, to use dd to do the copy of the whole disk.

2) The cp -a * should recursively copy everything. That includes /dev which, on almost all systems, contains /dev/random and /dev/zero. A cp of any of those special devices should have filled your destination device with either random numbers or zeros, and I'm not sure what copying /dev/null would have accomplished. Again, dd would, I think, have been a better choice.

3) The initial RAM Disk (initrd) is just that: a small Linux shell used to boot the "real" system from the HD. So you seldom need to make changes in it. About the only time I've needed to change it was when I change the name of the VG and LV where Fedora resides.
 
Old 10-03-2008, 09:09 PM   #3
Bob Barrett
LQ Newbie
 
Registered: Jan 2008
Posts: 7

Original Poster
Rep: Reputation: 0
Copied Fedora 8 to new drive: boots, but no login

PTrenholme,

Thanks for the help.

The computer was running on Knoppix. Fedora 8 (/dev/sda3/) was mounted,
read only, on Knoppix /media/sda3. The target (/dev/sdb2/) was mounted
on Knoppix /media/sdb2/.

As reported by parted, the hard drives are partitioned as follows:

Model: ATA ST9160821AS (scsi)
Disk /dev/sda: 160GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

No. Start End Size Type F/S Flags Use
1 32.3kB 30.1GB 30.1GB primary ntfs boot MS Vista
2 30.1GB 32.3GB 2246MB primary linux-swap linux-swap
3 32.3GB 96.6GB 64.3GB primary ext3 Fedora 8
4 96.6GB 160GB 63.4GB primary ext2 (not in use)

Model: ATA ST9200420ASG (scsi)
Disk /dev/sdb: 200GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

No. Start End Size Type F/S Flags Use
1 32.3kB 2254MB 2254MB primary linux-swap linux-swap
2 2254MB 15.1GB 12.9GB primary ext3
3 15.1GB 67.8GB 52.6GB primary ext3
4 67.8GB 200GB 132GB extended
5 67.8GB 80.6GB 12.9GB logical ext3 Slackware /
6 80.6GB 133GB 52.6GB logical ext3 Slk /home
7 133GB 146GB 12.9GB logical ext3 Debian /
8 146GB 200GB 53.9GB logical ext3 Debian /home

I am retired. This is a home, hobby machine. I am System Admin. for
the three computers sitting in front of me at home. This is a laptop,
the other two are desktops, setup much like this one. I have no exper-
ience with logical volumes. I don't think an LV would be useful to me.
If I'm wrong, please enlighten me. Since F8 was not running, /dev/ was
empty.

If dd makes a block by block image of the partition, I can't use it to
move a 5.9GB system from a 64.3GB partition to a 12.9GB partition.
Sorry I didn't give that much information in the first post.

I want to move Fedora 8, and replace it with F10 soon, rearrange the
partitions on /dev/sda, get rid of Vista (I've booted it once in the
year I've had it), and install Scientific Linux and Arch Linux on sda.
That will leave about 40GB open on sda.

I want to copy all of Fedora but /home/ to sdb2, and put /home/ on sdb3.
I ran diff on each directory (but not immediately), and found some
expected differences. I also tried:

star -copy -p -xdot -V pat=home/\* -C /media/sda3 . /media/sdb2

It copied only 1/3 of the directories (233MB). With 2GB of RAM and a
2GB swap partition on each drive, it seems like star could stream less
than 6GB between two partitions in the copy mode.

I've done some reading about the various GUI software. The ones I've
looked at so far that say that they only copy used blocks, seem to use
dd to make images. They say that they only copy used blocks, but when
you get into their tutorials, you find that you cannot transfer to a
smaller partition, and if you transfer to a larger partition, you
loose space. That means that they are creating an image of the entire
drive. I guess they copy only blocks used by the file system. I didn't
want to try to grow sdb2 with the later partitions in use. Gparted is
well done, but I'm not sure it's that good. I've used tar for files and
directories, but I've never been able to make it do this either.

I'm sure you know more about this than I. What would you suggest I do
next? Of course, I could reinstall, but that's giving up, and there
should be a way to simply copy all the system files to any file system
that's big enough to hold the files. It still seems that "cp -a *"
ought to do it.

Thanks again,
Bob Barrett

Last edited by Bob Barrett; 10-03-2008 at 09:13 PM.
 
Old 10-04-2008, 10:46 AM   #4
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,147

Rep: Reputation: 330Reputation: 330Reputation: 330Reputation: 330
From your fdisk it seems you didn't use the Fedora defaults when you installed. (And I agree that LVM is probably over-kill for a simple laptop. It's the default in Fedora simply because Fedora is the Beta platform for RHEL, and RHEL installations will typically fine LVM a very useful tool.) I have it running on my laptop just because, as a mathematician, I like abstraction, so adding another layer of abstraction to the system's drives strikes me as fun.

So, one thing to check is if the entries in /etc/fstab or correct for the new system location, and if your system boot setup is pointing to the correct location and file. Entries in fstab can refer to files by physical device, label, uuid, etc., as can RUB boot entries.

The initial RAM disk should automatically locate and use any swap partitions on you system, but fstab often specifies a swap partition location, so verify that it, too, is correct.

The error message you're getting -- "no shell" -- is telling you that the login command could not locate /bin/bash in your attached file system. I.e., You had logged in (hence the time change), but the login process could not start the shell program. That's why I suspect that fstab may be mounting the wrong device or partition as /.

But the cp you ran should have moved everything correctly for you.
 
Old 10-04-2008, 09:09 PM   #5
Bob Barrett
LQ Newbie
 
Registered: Jan 2008
Posts: 7

Original Poster
Rep: Reputation: 0
Copied Fedora 8 to new drive: boots, but no login

PTrenholme,

Some more basic info:

[F8:root@vega ~]# grep '/dev/sdb2' /boot/grub/grub.conf
title Fedora 8 (2.6.25.11-60.fc8) (/dev/sdb2)
kernel /boot/vmlinuz-2.6.25.11-60.fc8 ro root=/dev/sdb2 vga=0x317


[F8:root@vega ~]# mount -t auto -o rw /dev/sdb2 /mnt/f8-2/


[F8:root@vega ~]# cat /mnt/f8-2/etc/fstab

/dev/sdb2 / ext3 defaults 1 1
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/dvd /media/dvd auto noauto,users,rw,exec 0 0
/dev/sda2 swap swap pri=1,defaults 0 0
/dev/sdb1 swap swap defaults 0 0


After first seeing the error message, I listed bash, login, and
login.defs and ran diff on them:

[F8:root@vega ~]# l /bin/bash /mnt/f8-2/bin/bash
-rwxr-xr-x 1 root root 735144 2008-01-15 09:31 /bin/bash*
-rwxr-xr-x 1 root root 735144 2008-01-15 09:31 /mnt/f8-2/bin/bash*


[F8:root@vega ~]# diff /bin/bash /mnt/f8-2/bin/bash
[F8:root@vega ~]#


[F8:root@vega ~]# l /bin/login /mnt/f8-2/bin/login
-rwxr-xr-x 1 root root 25876 2008-04-22 16:24 /bin/login*
-rwxr-xr-x 1 root root 25876 2008-04-22 16:24 /mnt/f8-2/bin/login*


[F8:root@vega ~]# l /etc/login.defs /mnt/f8-2/etc/login.defs
-rw-r--r-- 1 root root 1503 2006-12-06 11:00 /etc/login.defs
-rw-r--r-- 1 root root 1503 2006-12-06 11:00 /mnt/f8-2/etc/login.defs


[F8:root@vega ~]# diff /etc/login.defs /mnt/f8-2/etc/login.defs
[F8:root@vega ~]#


All obtained from Fedora running on /dev/dsa3.

I mentioned initrd because I thought I remembered reading somewhere
that initrd included a reference to the boot partition, since it's job
is to mount a temporary root file system. But that is unloaded long
before login.

Everything is working, through /etc/rc.d/rc.local (ten key number pad
is activated). As a mathematician, I'm sure you appreciate the idea
that the number pad should always be on, and to turn it off should
should require extreme effort.

I've found something! I had just booted into single user mode, and
was poking around in /var/log/messages. A reference to Selinux got
my attention. There was no warning, or error, but I decided to turn
off Selinux and try it. That did it. No problem logging in. I booted
and logged in three times. Then I changed it back. Tried it again.
A message came up while booting announcing that Selinux had to relabel
the drive, and that it would take a long time. It took a couple of
minutes. I expected to not be able to login, but that didn't happen.

So now I have logged in for the fifth time, even with Selinux enforcing,
and yum is updating.

Thank you, I couldn't have done it without you. Now we know that
"cp -a" can do it.

Thanks again,

Bob Barrett
 
Old 10-05-2008, 11:45 AM   #6
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,147

Rep: Reputation: 330Reputation: 330Reputation: 330Reputation: 330
Great!

Looking at your fstab, I note that you're using the /dev/sd?? form to reference your file systems. While that form will often work, it does make the assumption the device names are static. This can be a problem since many loaders (e.g., GRUB) may "re-order" the BIOS assignment of device locations.

It's safer, in most cases, to use the LABEL= or UUID= forms. Here, for example is my laptop's fstab
Code:
$ cat /etc/fstab
/dev/Fedora/Base        /                       ext3    defaults        1 1
UUID=92ff1a1e-9e16-4828-953e-fbdfde536452 /boot ext3    defaults        1 2
#/dev/sdb1		/boot			ext3	defaults	1 2
#LABEL=/boot		/boot			ext3	defaults	1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
UUID=22b2553f-6199-4b82-b20c-6ad7c7b6688f swap  swap    defaults        0 0
/dev/Fedora/Swap        swap                    swap    defaults        0 0
# Other drives
UUID=17841f9e-fa3a-4850-aa52-0e6d0ba242e3 /Ubuntu ext3	defaults	0 2
UUID=342D7D7923AC4107	/Vista			ntfs-3g	rw,defaults	0 0
UUID=2C88743C8874071C	/Vista/Recovery		ntfs-3g	rw,defaults	0 0
# Removable Drives
UUID=48A7-175E		/Kingston		vfat	defaults,noauto 0 0
/dev/USB_Fedora/Base	/USB_Fedora		ext3	defaults,noauto 0 0
UUID=85d4ec8b-3199-4819-a7c3-0f23d7d42aa6 /USB_Fedora/boot ext3 defaults,noauto 0 0
Note that I have three different distribution on this laptop, each with it's own /boot directory. I usually only attach one of them as "/boot," which is why the other two are commented out in this (my F9) fstab.

If you do a ls -l of /dev/disk/by-uuid or /dev/disk/by-label you can see the label and UUID of all the physical devices on you system. Oh, the /dev/vg_name/lv_name stuff is for logical volumes after dm has has been called by udev to attach them to /dev.

By way of contrast, here's the fstab from the Kubuntu distribution on the same laptop. Ubuntu, like your F9 installation, uses a single file system instead of a boot partition and a root in a different partition.
Code:
$ cat /Ubuntu/etc/fstab
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
# /dev/sda5
UUID=17841f9e-fa3a-4850-aa52-0e6d0ba242e3 /               ext3    relatime,errors=remount-ro 0       1
# /dev/sda6
UUID=22b2553f-6199-4b82-b20c-6ad7c7b6688f none            swap    sw              0       0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto,exec,utf8 0       0
# /dev/sda1
UUID=342D7D7923AC4107 /Vista    ntfs-3g rw,defaults 0 0
# Fedora on sdb
/dev/Fedora/Base /Fedora        ext3     defaults,errors=remount-ro 0 1
#UUID=92ff1a1e-9e16-4828-953e-fbdfde536452 /Fedora/boot ext3 defaults 0 1
# Kingston 1GB stick
UUID=48A7-175E   /Kingston      vfat     defaults,noauto 0 0
# USB HD
/dev/USB_Fedora/Base /USB_Fedora ext3	 defaults,noauto 0 0
UUID=85d4ec8b-3199-4819-a7c3-0f23d7d42aa6 /USB_Fedora/boot ext3 defaults,noauto 0 0
Note that the laptop has two HD installed in it, and GRUB can (logically) swap them, so I need an fstab that's independent of the logical drive order.
 
Old 10-09-2008, 10:06 AM   #7
Bob Barrett
LQ Newbie
 
Registered: Jan 2008
Posts: 7

Original Poster
Rep: Reputation: 0
Copied Fedora 8 to new drive: boots, but no login

PTrenholme,

I see my last reply did not arrive. There must be some secret to using the "Quick Reply" that I'm not aware of.

Yes. That fstab was meant to be temporary. /home has been moved to
/dev/sdb3. That and UUIDs have been added. It's working fine now.

I've never had any trouble with Selinux, and I don't consider this
"trouble", but I'll think about it sooner next time.

Bob
 
Old 10-09-2008, 12:06 PM   #8
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,147

Rep: Reputation: 330Reputation: 330Reputation: 330Reputation: 330
Re SELinux, what I've done is set it to "permissive" mode, so it only generates warning messages. I review them every once and a while, but, so far, all I've seen is problems caused by updating my system. (Several RPMs check "locked" areas for error messages. If active, SELinux would have prevented those checks.)

Of course I have almost all access to the laptop blocked at my router's firewall, and then at the laptop's firewall, and all accounts on the system are password protected. And, since I've been retired for several years now, there's nothing on my system but a few personal files of no significance if lost. (No CC information, etc., is ever stored on the system.) So, for me, SELinux in permissive mode is "good enough."
 
  


Reply

Tags
fedora, linux, login


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
Fedora 9 boots (long delay) as single core if I go to GRUB menu, otherwise boots fine saravkrish Fedora 1 05-27-2008 07:59 AM
cannot access installation source copied to Hard drive todman Suse/Novell 1 02-22-2006 06:14 AM
Can LFS be copied from 1 hard drive to another after the build? rblythe Linux From Scratch 3 06-18-2005 11:40 AM
copied hard drive install not completely recognized theFez Linux - Hardware 2 05-14-2005 10:41 AM
file get renamed when copied to external hard drive pgajeski21 Linux - Hardware 11 04-15-2004 10:33 AM


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