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 07-09-2014, 09:41 PM   #1
lmohammeed
Member
 
Registered: Sep 2013
Posts: 61

Rep: Reputation: Disabled
Why bash-4.2$?


Dear respected users,

A problem that I encounter before. I think I did something wrong. My terminal suddenly turn to bash-4.2$. Almost all my folders are now empty.
I need your help please.

Kind regards
Lawal
 
Old 07-09-2014, 09:43 PM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,

a couple of things to check:
- Are you logged in as a different user (or a different machine)?
- Did you delete your home directory?
- Is /home mounted?

Evo2.
 
Old 07-09-2014, 10:20 PM   #3
lmohammeed
Member
 
Registered: Sep 2013
Posts: 61

Original Poster
Rep: Reputation: Disabled
Dear evo2,
Thank you.

-No, I didn't log as a different user.
-I suspect that I deleted my home directory. When I run in root
Code:
who am I
, I got
PHP Code:
mohammed pts/0.
.
-Home is mounted only in root
Code:
cd /home
I got
Code:
root@mohammed home
. However, all folders are empty.

Kind regards
Lawal
 
Old 07-09-2014, 10:45 PM   #4
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
The terminal string is set by the PS1 environment variable, which is usually populated by one of the shell start up scripts. The fact that it has not been set indicates that the normal start up scripts did not run correctly, possibly because they no longer exist.Do you remember what you were doing when this problem first occurred? Have you received any messages from Linux or from your BIOS indicating a potential hard disk problem? Any warning or error messages about mounting certain partitions on boot?

Can yiou please post the output of the following commands:

Code:
fdisk -l
cat /etc/fstab
mount
df -h
These will allow us to see what partitions are mounted and the state your hard drive is in.
 
Old 07-09-2014, 11:42 PM   #5
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,
Quote:
Originally Posted by lmohammeed View Post
-No, I didn't log as a different user.
ok.
Quote:
Originally Posted by lmohammeed View Post

-Home is mounted only in root
Code:
cd /home
I got
Code:
root@mohammed home
. However, all folders are empty.
Just because /home exists doesn't mean it is mounted. Do you have a separated home partition that is not mounted?

To help us understand please post the output of the commands given in btmiller's post, along with
Code:
ls -l /home/
Evo2.
 
Old 07-10-2014, 12:01 AM   #6
lmohammeed
Member
 
Registered: Sep 2013
Posts: 61

Original Poster
Rep: Reputation: Disabled
Dear btmiller,

Yes, I remember, I was running a program called wien2k in root, then instead of deleting a newly created directory, I did a mistake by deleting the home directory.
Code:
fdisk -l
PHP Code:
WARNINGGPT (GUID Partition Tabledetected on '/dev/sda'The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sda: 750.2 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders, total 1465149168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1  1465149167   732574583+  ee  GPT
Partition 1 does not start on physical sector boundary.

Disk /dev/mapper/vg_mohammed-lv_swap: 10.4 GB, 10435428352 bytes
255 heads, 63 sectors/track, 1268 cylinders, total 20381696 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/vg_mohammed-lv_swap doesn'
t contain a valid partition table

Disk 
/dev/mapper/vg_mohammed-lv_root53.7 GB53687091200 bytes
255 heads
63 sectors/track6527 cylinderstotal 104857600 sectors
Units 
sectors of 1 512 512 bytes
Sector size 
(logical/physical): 512 bytes 4096 bytes
I
/O size (minimum/optimal): 4096 bytes 4096 bytes
Disk identifier
0x00000000

Disk 
/dev/mapper/vg_mohammed-lv_root doesn't contain a valid partition table

Disk /dev/mapper/vg_mohammed-lv_home: 685.5 GB, 685483491328 bytes
255 heads, 63 sectors/track, 83338 cylinders, total 1338834944 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/vg_mohammed-lv_home doesn'
t contain a valid partition table 
Code:
cat /etc/fstab
PHP Code:
# /etc/fstab
# Created by anaconda on Mon Jul  1 22:44:04 2013
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/vg_mohammed-lv_root /                       ext4    defaults        1 1
UUID
=ab72f7a2-7a91-455c-bd56-34904e00c04e /boot                   ext4    defaults        1 2
/dev/mapper/vg_mohammed-lv_home /home                   ext4    defaults        1 2
/dev/mapper/vg_mohammed-lv_swap swap                    swap    defaults        0 0 
Code:
mount
PHP Code:
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
devtmpfs on /dev type devtmpfs (rw,nosuid,size=4028244k,nr_inodes=1007061,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)
/
dev/mapper/vg_mohammed-lv_root on type ext4 (rw,relatime,data=ordered)
tmpfs on /sys/fs/cgroup type tmpfs (rw,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct,cpu)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=24,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
tmpfs on /media type tmpfs (rw,nosuid,nodev,noexec,relatime,mode=755)
configfs on /sys/kernel/config type configfs (rw,relatime)
securityfs on /sys/kernel/security type securityfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,relatime)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw,relatime)
/
dev/sda2 on /boot type ext4 (rw,relatime,stripe=4,data=ordered)
/
dev/mapper/vg_mohammed-lv_home on /home type ext4 (rw,relatime,data=ordered
Code:
df -h
PHP Code:
Filesystem                       Size  Used Avail Use% Mounted on
devtmpfs                         3.9G     0  3.9G   0
% /dev
tmpfs                            3.9G  1.4M  3.9G   1
% /dev/shm
tmpfs                            3.9G  784K  3.9G   1
% /run
/dev/mapper/vg_mohammed-lv_root   50G  5.5G   44G  12% /
tmpfs                            3.9G     0  3.9G   0% /sys/fs/cgroup
tmpfs                            3.9G     0  3.9G   0
% /media
/dev/sda2                        485M   62M  399M  14% /boot
/dev/mapper/vg_mohammed-lv_home  629G  222M  597G   1% /home 
Kind regards
Lawal
 
Old 07-10-2014, 12:04 AM   #7
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,

ok /home is a separate partition (under lvm) and it is mounted.
Can you please do the ls and a stat for good measure? Eg
Code:
ls -al /home
stat /home
Evo2.
 
Old 07-10-2014, 12:41 AM   #8
lmohammeed
Member
 
Registered: Sep 2013
Posts: 61

Original Poster
Rep: Reputation: Disabled
Hi,
Thanks

Code:
ls -al /home
PHP Code:
total 12
drwxr
-xr-x.  3 root     root     4096 Jul  9 20:07 .
dr-xr-xr-x24 root     root     4096 Jul  9 20:18 ..
drwx------. 18 mohammed mohammed 4096 Jul  9 20:19 mohammed 
Code:
stat /home
PHP Code:
File: `/home'
  Size: 4096            Blocks: 8          IO Block: 4096   directory
Device: fd02h/64770d    Inode: 2           Links: 3
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2014-07-09 20:09:11.218683049 +0800
Modify: 2014-07-09 20:07:37.258597949 +0800
Change: 2014-07-09 20:07:37.258597949 +0800
 Birth: - 
Kind regards
Lawal
 
Old 07-10-2014, 01:11 AM   #9
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,
Quote:
Originally Posted by lmohammeed View Post
Code:
ls -al /home
total 12
drwxr-xr-x.  3 root     root     4096 Jul  9 20:07 .
dr-xr-xr-x. 24 root     root     4096 Jul  9 20:18 ..
drwx------. 18 mohammed mohammed 4096 Jul  9 20:19 mohammed
So it looks like your home directory exists. But it does not contain the files you expect?
But there is no l/home/lost+found directory as I would expect for a mounted ext4 file system. I wonder if you have mounted your home partition on a non-empty /home directory. Can you unmount /home and see if there is anything in /home ? You'll need to drop (or boot) to single user mode.

Evo2.
 
Old 07-10-2014, 01:22 AM   #10
lmohammeed
Member
 
Registered: Sep 2013
Posts: 61

Original Poster
Rep: Reputation: Disabled
Hi,
Thanks
Code:
unmount /home
PHP Code:
bashunmountcommand not found 
Kind regards
Lawal
 
Old 07-10-2014, 01:44 AM   #11
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,

the command is umount.

Evo2.
 
Old 07-10-2014, 02:02 AM   #12
lmohammeed
Member
 
Registered: Sep 2013
Posts: 61

Original Poster
Rep: Reputation: Disabled
Hi,

Sorry
Code:
umount
PHP Code:
Usageumount -| -V
       umount 
-[-d] [-f] [-r] [-n] [-v] [-t vfstypes] [-O opts]
       
umount [-d] [-f] [-r] [-n] [-vspecial node... 
Kind regards
Lawal
 
Old 07-10-2014, 02:12 AM   #13
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,

yes, it needs the mount point as an argument...
Code:
umount /home
Evo2.
 
Old 07-10-2014, 02:21 AM   #14
lmohammeed
Member
 
Registered: Sep 2013
Posts: 61

Original Poster
Rep: Reputation: Disabled
oops!
Code:
umount /home
PHP Code:
umount: /homedevice is busy.
        (
In some cases useful info about processes that use
         
the device is found by lsof(8) or fuser(1)) 
Kind regards
Lawal
 
Old 07-10-2014, 02:36 AM   #15
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,

you need to go to single user mode like I said in post #9.

Evo2.
 
  


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
[SOLVED] Bash Script - Reading User Input while Processing output from Command within Bash cleeky Linux - General 5 05-27-2014 02:57 PM
[SOLVED] Converting Script from Linux (GNU) Bash 4 to Solaris Bash 2.05 - Any cheat sheet? oly_r Solaris / OpenSolaris 6 05-03-2013 08:25 AM
Bash problem : -bash: [: /bin/bash: unary operator expected J.A.X Linux - Software 1 09-22-2011 05:52 AM
[SOLVED] Using a long Bash command including single quotes and pipes in a Bash script antcore Linux - General 9 07-22-2009 11:10 AM
why did bash 2.05b install delete /bin/bash & "/bin/sh -> bash"? johnpipe Linux - Software 2 06-06-2004 06:42 PM

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

All times are GMT -5. The time now is 05:32 PM.

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