LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   ash instead of bash -- getting it to work by hand after installation (http://www.linuxquestions.org/questions/slackware-14/ash-instead-of-bash-getting-it-to-work-by-hand-after-installation-4175502351/)

scmaccal 04-20-2014 06:29 AM

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?

Didier Spaier 04-20-2014 06:51 AM

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".

ReaperX7 04-20-2014 08:44 AM

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.

scmaccal 04-20-2014 08:55 AM

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. :cool:

Didier Spaier 04-20-2014 09:43 AM

Quote:

Originally Posted by scmaccal (Post 5155977)
... 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 (Post 5155977)
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.

genss 04-20-2014 10:33 AM

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

metaschima 04-20-2014 10:50 AM

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.

scmaccal 04-20-2014 11:01 AM

Quote:

Originally Posted by metaschima (Post 5156045)
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 (Post 5156045)
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.

scmaccal 04-20-2014 11:07 AM

Quote:

Originally Posted by Didier Spaier (Post 5156004)
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. :twocents:

scmaccal 04-20-2014 11:08 AM

Quote:

Originally Posted by genss (Post 5156035)
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.

genss 04-20-2014 11:15 AM

Quote:

Originally Posted by scmaccal (Post 5156053)
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)

scmaccal 04-20-2014 11:21 AM

Quote:

Originally Posted by Didier Spaier (Post 5156004)
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 (Post 5156004)
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?

Didier Spaier 04-20-2014 11:48 AM

[QUOTE=scmaccal;5156056]
Quote:

Originally Posted by Didier Spaier (Post 5156004)
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. :twocents:

Then why not design your own distribution ;)
Quote:

Originally Posted by scmaccal (Post 5156064)
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.

metaschima 04-20-2014 12:35 PM

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/

gnashley 04-20-2014 01:03 PM

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.


All times are GMT -5. The time now is 09:42 AM.