LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 06-03-2013, 10:26 PM   #1
DavidLee1A
Member
 
Registered: Dec 2012
Distribution: Debian Wheezy amd64
Posts: 123
Blog Entries: 12

Rep: Reputation: 5
symlinking /bin/sh to bash question


I am trying to ensure this situation:
Quote:
/bin/sh should be a symbolic or hard link to bash
When I tried to do that i got:
Code:
david@DavidLee1A:~$ ln -s /bin/bash /bin/sh
ln: failed to create symbolic link `/bin/sh': File exists
david@DavidLee1A:~$ ln /bin/bash /bin/sh
ln: failed to create hard link `/bin/sh': File exists
How do I ensure that /bin/sh is properly liked to bash?
To be honest I don't exactly understand the point of this (something to do with how scripts execute in each shell?) and never really think about inodes.
Maybe this will give additional info:
Code:
david@DavidLee1A:~$ ls -ali
total 224
   262 drwxr-xr-x 30 david david  4096 Jun  3 19:58 .
   261 drwxr-xr-x  3 root  root   4096 May 28 09:49 ..
  4610 -rw-------  1 david david  1222 Jun  3 16:00 .bash_history
   265 -rw-r--r--  1 david david   220 May 28 09:49 .bash_logout
   263 -rw-r--r--  1 david david  3392 May 28 09:49 .bashrc
   278 drwx------  8 david david  4096 Jun  3 19:53 .cache
   275 drwx------ 14 david david  4096 Jun  3 18:34 .config
   281 drwx------  3 david david  4096 May 28 09:51 .dbus
   267 drwxr-xr-x  2 david david  4096 May 28 09:51 Desktop
   271 drwxr-xr-x  4 david david  4096 Jun  1 07:41 Documents
   268 drwxr-xr-x  8 david david  4096 Jun  3 13:10 Downloads
393235 drwxr-xr-x  2 david david  4096 May 29 07:32 .fontconfig
   289 drwx------  3 david david  4096 Jun  3 19:53 .gconf
  4598 -rw-r-----  1 david david     0 Jun  1 14:50 .gksu.lock
262826 drwx------  3 david david  4096 May 28 11:46 .gnash
   290 drwx------  5 david david  4096 May 31 14:10 .gnome2
262167 drwx------  2 david david  4096 May 28 10:10 .gnome2_private
263267 drwx------  2 david david  4096 May 29 08:00 .gnupg
262842 drwxr-xr-x  2 david david  4096 May 28 12:40 .gstreamer-0.10
   266 -rw-r--r--  1 david david   137 Jun  3 19:53 .gtk-bookmarks
   292 drwx------  2 david david  4096 May 28 09:51 .gvfs
393618 drwxr-----  2 david david  4096 Jun  3 19:54 .hplip
   285 -rw-------  1 david david  4008 Jun  3 19:53 .ICEauthority
393247 drwx------  3 david david  4096 May 29 07:47 .kde
   299 drwxr-xr-x  3 david david  4096 May 28 09:51 .local
  4609 -rw-r--r--  1 david david    40 May 28 12:41 Mary_Jones.letter
   309 drwx------  3 david david  4096 May 28 09:51 .mission-control
262169 drwx------  4 david david  4096 May 28 10:10 .mozilla
   272 drwxr-xr-x  2 david david  4096 May 28 09:51 Music
   273 drwxr-xr-x  3 david david  4096 Jun  2 08:18 Pictures
   264 -rw-r--r--  1 david david   675 May 28 09:49 .profile
   270 drwxr-xr-x  2 david david  4096 May 28 09:51 Public
   294 drwx------  2 david david  4096 Jun  3 19:53 .pulse
   293 -rw-------  1 david david   256 May 28 09:51 .pulse-cookie
266735 drwx------  2 david david  4096 May 29 07:06 .ssh
   269 drwxr-xr-x  2 david david  4096 May 28 09:51 Templates
263063 drwx------  4 david david  4096 Jun  3 18:34 .thumbnails
   341 -rw-r--r--  1 david david  1257 Jun  3 19:58 version-check.sh
   274 drwxr-xr-x  2 david david  4096 May 28 09:51 Videos
  4676 -rw-------  1 david david  1171 Jun  3 16:00 .viminfo
395061 drwxr-xr-x  5 david david  4096 Jun  2 14:43 WindowsDocuments
   250 -rw-------  1 david david  3866 Jun  3 20:58 .xsession-errors
   251 -rw-------  1 david david 54240 Jun  3 18:53 .xsession-errors.old
 
Old 06-03-2013, 10:56 PM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,654

Rep: Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255
If /bin/sh exists, leave it alone.

If it doesn't exist, then you can create it.

Normally /bin/sh is used during system boot... so tampering with it could be a problem, or cause a serious problem.

On MOST linux systems /bin/sh is either the bash binary ( and /bin/bash a link to it) or the other way around. As long as /bin/sh exists, system boot will work.
 
Old 06-03-2013, 11:15 PM   #3
DavidLee1A
Member
 
Registered: Dec 2012
Distribution: Debian Wheezy amd64
Posts: 123
Blog Entries: 12

Original Poster
Rep: Reputation: 5
Thank you jpollard for replying but I am trying to avoid issues somewhere else:
Oh, by the way, I noticed the link goes to dash:
Code:
david@DavidLee1A:~$ readlink -f /bin/sh
/bin/dash
I thought this was a general question but I should have put this in the LFS thread, consider the manual entry located at http://www.linuxfromscratch.org/lfs/.../hostreqs.html which says:
Quote:
Symlinks that point to other software (such as dash, mawk, etc.) may work, but are not tested or supported by the LFS development team, and may require either deviation from the instructions or additional patches to some packages.
 
Old 06-04-2013, 02:45 AM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Quote:
Originally Posted by DavidLee1A View Post
I thought this was a general question but I should have put this in the LFS thread, consider the manual entry located at http://www.linuxfromscratch.org/lfs/.../hostreqs.html which says:
Quote:
Symlinks that point to other software (such as dash, mawk, etc.) may work, but are not tested or supported by the LFS development team, and may require either deviation from the instructions or additional patches to some packages.
You can delete the current link to dash and create a new one by hand that points to bash (as root):
Code:
$ rm /bin/sh
$ ln -s /bin/bash /bin/sh
About mawk: Once you install gawk the link is also changed to reflect this.

Do make sure that your distro is compliant with the Host System Requirements if you are going to try building LFS, otherwise you'll encounter problems along the way and might need to start from scratch again.

BTW: Do post your LFS related questions in the LFS sub-forum
 
Old 06-04-2013, 12:31 PM   #5
DavidLee1A
Member
 
Registered: Dec 2012
Distribution: Debian Wheezy amd64
Posts: 123
Blog Entries: 12

Original Poster
Rep: Reputation: 5
I marked this solved and continued it here: http://www.linuxquestions.org/questi...49#post4965249
 
Old 06-04-2013, 01:25 PM   #6
DavidLee1A
Member
 
Registered: Dec 2012
Distribution: Debian Wheezy amd64
Posts: 123
Blog Entries: 12

Original Poster
Rep: Reputation: 5
Done. Thank you. If there are no issues then I'll mark this solved in a few hours.
Code:
root@DavidLee1A:/home/david# rm /bin/sh
root@DavidLee1A:/home/david# ln -s /bin/bash /bin/sh
root@DavidLee1A:/home/david# readlink -f /bin/sh
/bin/bash
 
  


Reply

Tags
bash, symbolic link


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
[SOLVED] /usr/bin/xterm: Could not exec /bin/bash: Permission Denied suheng Linux - Newbie 2 09-24-2010 06:31 PM
[SOLVED] #!/bin/sh vs #!/bin/bash -- script executes differently; each way = different bugs GrapefruiTgirl Programming 21 12-16-2009 06:30 PM
How to add paths to sbin, bin/bash, bin sh for users gopi.d Fedora 3 12-07-2007 01:47 AM
why did bash 2.05b install delete /bin/bash & "/bin/sh -> bash"? johnpipe Linux - Software 2 06-06-2004 07:42 PM
question, new to #!/bin/bash. jobesd Programming 4 03-16-2003 08:37 PM


All times are GMT -5. The time now is 07:44 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration