LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   /bin/bash: permission denied(after / partition moved) (https://www.linuxquestions.org/questions/linux-general-1/bin-bash-permission-denied-after-partition-moved-649518/)

xbuffalo 06-15-2008 08:32 PM

/bin/bash: permission denied(after / partition moved)
 
I install Fedora 9 in a partition of 6.3G. Here is the result of 'fdisk -l'
Code:

Disk /dev/sda: 40.0 GB, 40007761920 bytes
255 heads, 63 sectors/track, 4864 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x3af63af5

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          1        892    7164958+  b  W95 FAT32
/dev/sda2            893        2167    10241437+  c  W95 FAT32 (LBA)
/dev/sda3            2168        4079    15358140    c  W95 FAT32 (LBA)
/dev/sda4            4080        4864    6305512+  5  Extended
/dev/sda5            4080        4092      104391  83  Linux
/dev/sda6            4093        4222    1044193+  82  Linux swap / Solaris
/dev/sda7            4223        4864    5156833+  83  Linux

Because the '/' is growing bigger and bigger, I decide to get more space for my fedora. But the free space(/dev/sda3) is not adjacent to '/'(/dev/sda7), so i can't merge these two partitions using fdisk.
So I decide to move the '/' to /dev/sda3.
here is my steps:
(0) liveCD...
(1) mkfs.ext3 /dev/sda3
(2) mount -t ext3 /dev/sda3 /mnt/sda3/;mount -t ext3 /dev/sda7 /mnt/sda7/
(3) cp -a /mnt/sda7/* /mnt/sda3/
(4) modify /mnt/sda3/etc/fstab to change the location of ‘/’
(5) modify /boot/grub/grub.conf, add something as follows:
Code:

title NewFedora (2.6.25.3-18.fc9.i686)
        root (hd0,4)
        kernel /vmlinuz-2.6.25.3-18.fc9.i686 ro root=/dev/sda3 rhgb quiet
        initrd /initrd-2.6.25.3-18.fc9.i686.img
title Fedora (2.6.25.3-18.fc9.i686)
        root (hd0,4)
        kernel /vmlinuz-2.6.25.3-18.fc9.i686 ro root=/dev/sda7 rhgb quiet
        initrd /initrd-2.6.25.3-18.fc9.i686.img

The first title is all about of my 'new' system location. And I can login the original one.
(6) rebbot
I choose the NewFedora(/dev/sda3) and I can see the Fedora9 GUI login interface, I try login as root or other user, all failed. I switch to VT (using Ctrl+Alt+F1) to login in, failed. I try the ssh-client from other computer, got this:
Code:

last login.....
/bin/bash: permission denied.

I google the "/bin/bash: permission denied" and discover this land. I have read all title with '/bin/bash: permission denied', and I check the file system access mode.

here is the /dev/sda3:
Code:

[...]$ ll -a /mnt/sda3/
Total 96
drwxr-xr-x  19 root root 4096 06-15 22:28 .
drwxr-xr-x  5 root root 4096 05-17 21:57 ..
drwxr-xr-x  2 root root 4096 05-28 10:12 bin
drwxr-xr-x  2 root root 4096 05-17 18:15 boot
drwxr-xr-x  2 root root 4096 05-17 18:18 dev
drwxr-xr-x 124 root root 8192 06-15 22:28 etc
drwxr-xr-x  3 root root 4096 06-15 13:41 home
drwxr-xr-x  15 root root 8192 05-26 09:34 lib
drwx------  2 root root 4096 05-17 18:15 lost+found
drwxr-xr-x  2 root root 4096 06-15 22:25 media
drwxr-xr-x  5 root root 4096 05-17 21:57 mnt
drwxr-xr-x  2 root root 4096 05-17 18:15 proc
drwxr-x---  36 root root 4096 06-15 16:16 root
drwxr-xr-x  2 root root 8192 05-28 10:12 sbin
drwxr-xr-x  2 root root 4096 05-17 18:18 selinux
drwxr-xr-x  2 root root 4096 05-17 18:15 sys
drwxrwxrwt 129 root root 4096 06-15 22:27 tmp
drwxr-xr-x  13 root root 4096 06-01 14:38 usr
drwxr-xr-x  23 root root 4096 05-17 16:01 var

here is my 'new' system's fstab:
Code:

UUID=bea271e0-5490-4701-9039-3e2e432b87f5 /                      ext3    defaults        1 1
UUID=ff4b53a9-a43e-4e0f-8159-d39ad8b0a51d /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=eff25086-826d-4d3e-9694-27cc0cc497f6 swap                    swap    defaults        0 0

I can't login in this 'new' system, so I can't use strace to debug this problem.
I hate reinstall system. I need your help. Any suggestion will be appreciate. :)

bigrigdriver 06-16-2008 09:10 AM

You moved the root partition, but did you run grub-install to tell grub the new location.

xbuffalo 06-17-2008 01:01 AM

Quote:

Originally Posted by bigrigdriver (Post 3186247)
You moved the root partition, but did you run grub-install to tell grub the new location.

Thank u for reply.
I didn't do grub-install.
I have modified /boot/grub/grub.conf to tell the location of my new '/' partition, and when system boot up, it works.
The key problem is 'bash' permission error, but the sshd and login are ok.
I don't know why.

CSIG 06-17-2008 01:23 AM

link /usr and /var
 
In the past I have solved similar situations (more space needed for root partition) by moving the /usr and /var directory to the new partition, creating softlinks to these new locations in the root partition. In that case GRUB settings are unchanged and only /etc/fstab has to be modified to auto-mount the new partition.

As for your current problem I would suggest to either copy back everything and see if you can restore the system that way before proceeding with any alternatives.

I'm also curious what user account from the LiveCD was in charge when you copied everything. You should check what user ID's are involved, the displayed names can be misleading. I suspect that there is really some permission problem involved, somehow.

JZL240I-U 06-17-2008 04:31 AM

Why don't you use (g)parted?

xbuffalo 06-18-2008 01:04 AM

I did 'cp -a' as root in liveCD.
"creating softlinks to these new locations in the root partition" is a nice try.

xbuffalo 06-18-2008 01:13 AM

Quote:

Originally Posted by JZL240I-U (Post 3187166)
Why don't you use (g)parted?

Sorry, I hadn't heard about (g)parted.
I gonna have a try.

JZL240I-U 06-19-2008 01:18 AM

Umm, parted is the program there are at least two frontends. You can either use gparted (gnome) or KDE's qtparted. I simply forgot to mention that, so please do not search for the program with the brackets still contained in its name.


All times are GMT -5. The time now is 09:11 PM.