LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-20-2014, 07:29 AM   #1
scmaccal
LQ Newbie
 
Registered: Apr 2014
Distribution: Slackware, Trisquel and Ubuntu
Posts: 8

Rep: Reputation: Disabled
ash instead of bash -- getting it to work by hand after installation


Greetings,

I just finished a Slackware 14.1 install but instead of installing bash I installed ash. When my I booted my finished system I was unable to login because the OS had been incorrectly configured to look for bash. I know that one can change their shell using the chsh command once they have logged into their system but this does not help me.

I'm totally comfortable with booting the installation DVD, mounting the hard drive and editing the necessary files by hand but I don't know which ones I should. Does someone happen to know?

Last edited by scmaccal; 04-20-2014 at 07:31 AM. Reason: Bad text formating
 
Old 04-20-2014, 07:51 AM   #2
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,255

Rep: Reputation: Disabled
Welcome to LQ and to the Slackware sub forum.

ash is included in Slackware as is bash, furthermore ash, not bash, is used during installation.

But in Slackware, /bin/sh is a symlink to /bin/bash.

So, if you want to use ash in your own scripts, just use the good shebang:
#!/bin/ash
or call you script like
ash <my_script>

You can also change the aforementioned symlink to point to /bin/ash, but then you'll have to take care yourself of the bashisms that could be used in the existing scripts you want to run.

PS

Oh, and in any case you should install bash. This doesn't prevent you to use another shell, of course. Moreover, it is highly recommended that newcomers in Slackland make a full installation of Slackware.

Of course you can set the default shell of every user as you see fit. The "adduser" script comes handy for these settings. This notwithstanding you can specify another shell for logins setting the FAKE_SHELL parameter in /etc/login.defs, see "man login.defs".

Last edited by Didier Spaier; 04-20-2014 at 08:30 AM. Reason: PS added.
 
Old 04-20-2014, 09:44 AM   #3
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,564
Blog Entries: 15

Rep: Reputation: 2117Reputation: 2117Reputation: 2117Reputation: 2117Reputation: 2117Reputation: 2117Reputation: 2117Reputation: 2117Reputation: 2117Reputation: 2117Reputation: 2117
Bash is more formally used for system low-level administration due to its functionality abilities than other shells. Some shells lack abilities Bash does, which is why scripting is often termed as Bash Shell Scripting. You can use ash, dash, zsh, csh, or any other Posix or compatible shell for basic stuff and daily usage, but Bash is just different.
 
Old 04-20-2014, 09:55 AM   #4
scmaccal
LQ Newbie
 
Registered: Apr 2014
Distribution: Slackware, Trisquel and Ubuntu
Posts: 8

Original Poster
Rep: Reputation: Disabled
Didier,

Thanks for the reply but before I read it, I modified the /etc/passwd file and changed my users shell from bash to ash. After doing that I was able to log into my system but I got the following error:
version 2.88 booting
cannot execute “/etc/rc.d/rc.S”
Entering runlevel: 3
cannot execute “/etc/rc.d/rc.M”
Proc related stuff was not functional too. I did some reading online and I learned that many of the RC scripts break without bash being at least installed (as you mentioned). I definitely consider this a bug because one should not have to install two shells just to use another. In any case, I will make sure bash is installed and change my shell to ash using the chsh command.

BTW, I'm not a GNU/Linux beginner. I've been using a UNIX-like operating system since 1999 and MSDOS before that. I go through phases when I want to get my hands dirty and leave the comfort of those other GNU/Linux distributions.
 
Old 04-20-2014, 10:43 AM   #5
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,255

Rep: Reputation: Disabled
Quote:
Originally Posted by scmaccal View Post
... I did some reading online and I learned that many of the RC scripts break without bash being at least installed (as you mentioned).
This is clearly stated here
Code:
Bash must be present for the system to boot properly.
Quote:
Originally Posted by scmaccal View Post
I definitely consider this a bug because one should not have to install two shells just to use another.
I disagree:
  • Of course any distribution should include, just to work, a lot of stuff that maybe you won't use directly.
  • Slackware is not designed to fit only your needs, but that of many users.
Also, bear in mind that Slackware doesn't include data and tools for automatic dependencies' resolution, that's why a full installation is recommended at least for people not yet acquainted with it.

Nevertheless, using Slackware you are much more in control of what's included in your own system than with other distributions, IMO. For instance, each packages series includes a "tagfile" indicating which packages are considered by Slackware's maintainer as mandatory (tag ADD, as is the case for bash), recommended (tag REC) or fully optional (tag OPT) and you can customize yourself these tagfiles so that you can for instance easily clone a customized installation.

PS IIRC there have been efforts to "de-bashify" Slackware init scripts, if you're interested you could try to find a thread about that in this forum. It could be many years old.

Last edited by Didier Spaier; 04-20-2014 at 11:07 AM. Reason: PS added.
 
Old 04-20-2014, 11:33 AM   #6
genss
Member
 
Registered: Nov 2013
Posts: 746

Rep: Reputation: Disabled
i got it booting with ash once

don't remember rc.S/M problems, but inet script i'm sure didn't work so try without it

Last edited by genss; 04-20-2014 at 11:41 AM.
 
Old 04-20-2014, 11:50 AM   #7
metaschima
Senior Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 1,982

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
You would have to edit all the rc.d scripts to make them run with ash and update the scripts with new slackware versions. Overall, it isn't worth the effort, so just install bash and use ash for your personal scripts.
 
Old 04-20-2014, 12:01 PM   #8
scmaccal
LQ Newbie
 
Registered: Apr 2014
Distribution: Slackware, Trisquel and Ubuntu
Posts: 8

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by metaschima View Post
You would have to edit all the rc.d scripts to make them run with ash and update the scripts with new slackware versions.
Do you happen to know of an URL that desribes how this is done?

Quote:
Originally Posted by metaschima View Post
Overall, it isn't worth the effort, so just install bash and use ash for your personal scripts.
Well it's worth the effort to me becase it's a learning experience.
 
Old 04-20-2014, 12:07 PM   #9
scmaccal
LQ Newbie
 
Registered: Apr 2014
Distribution: Slackware, Trisquel and Ubuntu
Posts: 8

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Didier Spaier View Post
This is clearly stated here
Code:
Bash must be present for the system to boot properly.
Yes, I was aware of this statement. I don't agree with that design decision however.

Last edited by scmaccal; 04-20-2014 at 05:02 PM. Reason: Broken quote tag
 
Old 04-20-2014, 12:08 PM   #10
scmaccal
LQ Newbie
 
Registered: Apr 2014
Distribution: Slackware, Trisquel and Ubuntu
Posts: 8

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by genss View Post
i got it booting with ash once

don't remember rc.S/M problems, but inet script i'm sure didn't work so try without it
Thanks for the suggestion but I'm not running inet.
 
Old 04-20-2014, 12:15 PM   #11
genss
Member
 
Registered: Nov 2013
Posts: 746

Rep: Reputation: Disabled
Quote:
Originally Posted by scmaccal View Post
Well it's worth the effort to me becase it's a learning experience.
that's the spirit
i think what i did was something like:
go to http://pubs.opengroup.org/onlinepubs...cu_chap02.html
go through rc.S line by line and check what is not POSIX (ash is only posix)
boot to single user first, rc.M can wait
(lies; i commented out parts till it worked then backtraced, but this is a more proper way)

bdw i learned shell scripts from slackware ones (y)

Last edited by genss; 04-20-2014 at 12:16 PM.
 
Old 04-20-2014, 12:21 PM   #12
scmaccal
LQ Newbie
 
Registered: Apr 2014
Distribution: Slackware, Trisquel and Ubuntu
Posts: 8

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Didier Spaier View Post
Of course any distribution should include, just to work, a lot of stuff that maybe you won't use directly.
My goal is to minimize what is installed as much as possible for low memory and hard drive space needs.

Quote:
Originally Posted by Didier Spaier View Post
PS IIRC there have been efforts to "de-bashify" Slackware init scripts, if you're interested you could try to find a thread about that in this forum. It could be many years old.
I'm not familiar with IIRC, can you please provide me with an URL?

Last edited by scmaccal; 04-20-2014 at 12:23 PM. Reason: Fixed quote tags
 
Old 04-20-2014, 12:48 PM   #13
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,255

Rep: Reputation: Disabled
[QUOTE=scmaccal;5156056]
Quote:
Originally Posted by Didier Spaier View Post
This is clearly stated here
Code:
Bash must be present for the system to boot properly.
Yes, I was aware of this statement. I don't agree with that design decision however.
Then why not design your own distribution
Quote:
Originally Posted by scmaccal View Post
My goal is to minimize what is installed as much as possible for low memory and hard drive space needs.
Well, I'm not sure that ash uses less memory than bash. Did you check? And uncompressed package size of the bash package is 4.1M. Are you sure that you can't afford that? (I've used a computer with 64K RAM and 10M hard disk space, but that was more than 35 years ago :-)
Quote:
I'm not familiar with IIRC, can you please provide me with an URL?
IIRC=If I Remember Correctly. Oh, and by the way, I do. If you want to modify the init scripts so that they be ash-compliant, you'll need to well know ash's specification, of course.

Last edited by Didier Spaier; 04-20-2014 at 01:10 PM.
 
Old 04-20-2014, 01:35 PM   #14
metaschima
Senior Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 1,982

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Some useful links, but note that these are old attempts:
http://www.linuxquestions.org/questi...13-0-a-778084/
https://github.com/tuxdev/slackware-scripts
http://sourceforge.net/projects/checkbaskisms/
 
Old 04-20-2014, 02:03 PM   #15
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 613Reputation: 613Reputation: 613Reputation: 613Reputation: 613Reputation: 613
Here's a link to a pretty-complete set of POSIX-compatible scripts available which would work for you:
sysvinit-scripts_1.7-i586-1.tpkg
Change the suffix of the file from .tpkg to .tar.xz and then unpack it to see the scripts.

Those are a result of hy-briding some of the code linked to earlier from tuxdev and grapefruitgirl which I combined, replaced or added to for my own system. The "accessory" rc scripts which come separately with their own package are found in the same source/package tree as above.

I am using a bit later version of the package here, but that should give you enough to start with. Note that some of the 'advanced' accessory scripts may still require bash and my set there is by no means complete. I use the scripts with the dash shell, which I would recommend over the ash shell. In the scripts, the shell shebang actually is /bin/initsh, with /bin/initsh being a link to dash. The link could also point to /bin/bash -and they surely would work at least partially, with the link pointing to /bin/ash.

My scripts are not direct translations of the Slackware rc scripts. They are mostly re-written from scratch, but generally follow a similar boot scheme as the normal slack boot process. They do contain lots of usable snippets for anyone wanting to use a POSIX shell for init. My method of having /bin/initsh allows me to still have /bin/sh linked to /bin/bash so 'normal' shell scripts run as expected. And I don't use dash as my login shell.
 
2 members found this post helpful.
  


Reply


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
A bash-script question: parameter hand up thomas2004ch Linux - Software 2 03-01-2012 07:46 AM
[SOLVED] Bash to ash: Help converting a script? Mouse750 Programming 7 09-08-2011 02:32 PM
bash programming question - hand over variables to another script ppr:kut Linux - General 5 02-09-2008 11:00 AM
Use bash as an alternative to ash? J_Szucs Linux - General 3 05-30-2005 05:44 AM
Sarge - only ASH in shell no BASH jriis Debian 1 12-25-2003 04:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

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