Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Networking & Security
  • Search

[SOLVED] OpenRC: /bin/sh: bad interpreter: Permission denied

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
Advanced search
10 posts • Page 1 of 1
Author
Message
autofyrsto
n00b
n00b
Posts: 11
Joined: Sat Aug 16, 2014 4:24 pm

[SOLVED] OpenRC: /bin/sh: bad interpreter: Permission denied

  • Quote

Post by autofyrsto » Sat Jan 02, 2021 8:34 pm

I was messing around with the authentications on a hobby server, and I removed PAM after viewing this thread on the topic. [Edited to add hyperlink.] I did this by adding "-pam" to make.conf and running an @world update. Upon reboot, I could not log in at the prompt :oops:, but I was able to chroot into the system. I tried some things that I neglected in the thread, like running revdep-rebuild and re-emerging sys-apps/shadow and sys-process/audit. Still no luck at the log-in prompt. I then replaced the "pam" use flag and updated @world to re-install PAM and dependencies. Still no luck logging in. After all of my experiments, the situation is that OpenRC runs into a permission problem early in the boot process.

The error message is as follows:

Code: Select all

 OpenRC 0.42.1 is starting up Gentoo Linux (i686)

* /proc is already mounted
* /run/openrc: creating directory
* /run/lock: creating directory
* /run/lock: correcting owner
* Caching service dependencies ...
sh: /lib/rc/sh/gendepends.sh: /bin/sh: bad interpreter: Permission denied [ok]
INIT: Entering runlevel: 3
The machine then moves quickly to a non-functional log-in screen. Before I wipe the system and start over, I would like to know if there is a way to restore the boot process so I can log in again, with or without PAM. Thanks in advance for any advice. :oops:
Last edited by autofyrsto on Mon Jan 04, 2021 1:20 am, edited 1 time in total.
Top
eccerr0r
Watchman
Watchman
Posts: 10239
Joined: Thu Jul 01, 2004 6:51 pm
Location: almost Mile High in the USA
Contact:
Contact eccerr0r
Website

  • Quote

Post by eccerr0r » Sat Jan 02, 2021 10:24 pm

I have to go facepalm whenever I hear someone building for a desktop machine that removes pam. *sigh*

For the gendepends problem, usually bad interpreter means the script had a problem with the interpreter. What does

Code: Select all

$ ls -ld /bin/sh /bin/bash
return?

The for your login problem I don't know if you ran into the pam upgrade issue people have been having lately...
Intel Core i7 2700K/Radeon Firepro W2100/24GB DDR3/800GB SSD
What am I supposed watching?
Top
autofyrsto
n00b
n00b
Posts: 11
Joined: Sat Aug 16, 2014 4:24 pm

  • Quote

Post by autofyrsto » Sun Jan 03, 2021 12:07 am

Thanks, eccerr0r. I appreciate your expertise. I'll read through the PAM upgrade issue tonight. In the meantime, here is the return of the ls command:

Code: Select all

# ls -ld /bin/sh /bin/bash
-rwxr-xr-x. 1 root root 880604 Aug 29 17:12 /bin/bash
lrwxrwxrwx. 1 root root      4 Aug 29 17:12 /bin/sh -> bash
Top
Hu
Administrator
Administrator
Posts: 24403
Joined: Tue Mar 06, 2007 5:38 am

  • Quote

Post by Hu » Sun Jan 03, 2021 1:12 am

That looks reasonable. What about ls -ld / /bin /lib*?
Top
Buffoon
Veteran
Veteran
User avatar
Posts: 1369
Joined: Wed Jun 17, 2015 2:22 pm
Location: EU or US

  • Quote

Post by Buffoon » Sun Jan 03, 2021 2:38 am

CRLF line terminators can cause this kind of error, what does 'file /lib/rc/sh/gendepends.sh' tell? Just my 2¢.
Top
eccerr0r
Watchman
Watchman
Posts: 10239
Joined: Thu Jul 01, 2004 6:51 pm
Location: almost Mile High in the USA
Contact:
Contact eccerr0r
Website

  • Quote

Post by eccerr0r » Sun Jan 03, 2021 4:34 am

Bad file EOL delimiters tend to give the even more perplexing "file not found" error instead of a permission error.

Currently I also wonder about extended attributes on your filesystem as well as whether a hardened or grsec kernel versus plain/gentoo-sources kernel is being used but I have no experience in any of those.
Intel Core i7 2700K/Radeon Firepro W2100/24GB DDR3/800GB SSD
What am I supposed watching?
Top
GDH-gentoo
Advocate
Advocate
User avatar
Posts: 2115
Joined: Sat Jul 20, 2019 7:02 pm
Location: South America

  • Quote

Post by GDH-gentoo » Sun Jan 03, 2021 6:56 pm

autofyrsto wrote:

Code: Select all

# ls -ld /bin/sh /bin/bash
-rwxr-xr-x. 1 root root 880604 Aug 29 17:12 /bin/bash
lrwxrwxrwx. 1 root root      4 Aug 29 17:12 /bin/sh -> bash
Easy to miss, but there is a period after the file mode bits:
GNU Coreutils Manual wrote:Following the file mode bits is a single character that specifies whether an alternate access method such as an access control list applies to the file. [...]
GNU ‘ls’ uses a ‘.’ character to indicate a file with a security context, but no other alternate access method.
Are you using a hardened profile or something like that?
Top
autofyrsto
n00b
n00b
Posts: 11
Joined: Sat Aug 16, 2014 4:24 pm

  • Quote

Post by autofyrsto » Sun Jan 03, 2021 7:09 pm

Here are the outputs:

Code: Select all

# ls -ld / /bin /lib*
drwxr-xr-x. 20 root root 4096 Jul 14 20:14 /
drwxr-xr-x.  2 root root 4096 Jan  1 22:32 /bin
drwxr-xr-x. 13 root root 4096 Jan  1 20:49 /lib

Code: Select all

# file /lib/rc/sh/gendepends.sh
/lib/rc/sh/gendepends.sh: POSIX shell script, ASCII text executable
The kernel is sys-kernel/gentoo-sources-5.4.80-r1.
The profile is [4] default/linux/x86/17.0/hardened/selinux (stable).
I was running SELinux on the machine.

I don't have knowledge about extended attributes on the filesystem, other than to report that the packages libarchive, rsync, shadow, and patch all have the "xattr" use flag enabled.
Top
Hu
Administrator
Administrator
Posts: 24403
Joined: Tue Mar 06, 2007 5:38 am

  • Quote

Post by Hu » Sun Jan 03, 2021 8:53 pm

If you are using SELinux, and you encounter a permission problem that cannot be explained by file modes, you should suspect SELinux. Also, you should mention in the opening post that SELinux is in use. If you temporarily switch SELinux to permissive mode, does the problem go away? If yes, you need to find why your SELinux configuration is blocking this access.
Top
autofyrsto
n00b
n00b
Posts: 11
Joined: Sat Aug 16, 2014 4:24 pm

  • Quote

Post by autofyrsto » Mon Jan 04, 2021 1:18 am

Hi all. Thanks for suggesting SELinux. I didn't consider that because I didn't mess with it specifically before the breakage occurred, but re-installing PAM and re-labeling the system got me the result I was after:

Code: Select all

# rlpkg -a -r
I am now logged back in and hopefully a little wiser. I can mark as solved. Best regards! :)
Top
Post Reply

10 posts • Page 1 of 1

Return to “Networking & Security”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic