The officially official Devuan Forum!

You are not logged in.

#1 2020-06-06 13:15:54

devur
Member
From: Denmark
Registered: 2017-05-29
Posts: 73  

[ SOLVED ] cant run command from commandsline

cant run commands

fdisk -l

and other, but

--help and pwd

runs find
what is my problem ?

Last edited by devur (2020-06-06 16:31:03)


Laptop lenovo
Desktop XFCE
Os Devuan GNU/Linux

Offline

#2 2020-06-06 13:24:12

larsH
Member
Registered: 2020-05-05
Posts: 184  

Re: [ SOLVED ] cant run command from commandsline

Hi

Hopefully you can log in as root ;-)). If not try "sudo passwd root" to get access.

The behavior of su to root has changed in bewulf (se the releasse notes!!). To get full path you need "su -" or "su root". It is supposed to be more secure.

Have a nice day
Lars H

Offline

#3 2020-06-06 15:11:17

devur
Member
From: Denmark
Registered: 2017-05-29
Posts: 73  

Re: [ SOLVED ] cant run command from commandsline

hi and thank for your answer, it dos not get me all the way I haw root but still no commands?

 
su
Adgangskode: 
root@devuan:/home/hans# fdisk -l
bash: fdisk: kommand not found
root@devuan:/home/hans# 

Laptop lenovo
Desktop XFCE
Os Devuan GNU/Linux

Offline

#4 2020-06-06 15:36:03

climbingturtle
Member
From: Sweden
Registered: 2019-03-13
Posts: 11  

Re: [ SOLVED ] cant run command from commandsline

I'm a bit confused.. Is is only fdisk you cannot run? Or is there other commands as well that does not work?

Maybe this is related to fdisk for you:
https://dev1galaxy.org/viewtopic.php?id=3547

Could you do apt-get install fdisk and post what it says?

Last edited by climbingturtle (2020-06-06 15:36:23)

Offline

#5 2020-06-06 15:49:26

larsH
Member
Registered: 2020-05-05
Posts: 184  

Re: [ SOLVED ] cant run command from commandsline

Hej

Du får det på dansk. Du skal ikke kun skrive su men "su -" ellers har du kun adgang til bruger rettigeheder ikke login som root.

Hello

Written in danish. To get full root access you need to write not just "su" but "su -"

Have a nice day
Lars H

Offline

#6 2020-06-06 16:23:15

devur
Member
From: Denmark
Registered: 2017-05-29
Posts: 73  

Re: [ SOLVED ] cant run command from commandsline

Could you do apt-get install fdisk and post what it says?

fdisk is up to date

fdisk er allerede den nyeste version (2.33.1-0.1+devuan1~beowulf2).
0 opgraderes, 0 nyinstalleres, 0 afinstalleres og 0 opgraderes ikke.

and the use of login

"su -"

gets me all the way

thanks for your help


Laptop lenovo
Desktop XFCE
Os Devuan GNU/Linux

Offline

#7 2020-06-26 08:43:59

roluan17
Member
Registered: 2019-04-01
Posts: 43  

Re: [ SOLVED ] cant run command from commandsline

Can't reproduce this "su -" thing

su-
bash: su-: Kommando nicht gefunden.

command not found

su -
-bash: ash: Kommando nicht gefunden.

command not found

Man-pages say:

Es wird empfohlen, stets die  Option  --login  (statt  deren
Kurzform  -)  zu verwenden

means"--login" recommended instead of shortform "-"
BUT
if I use

su --login


I get a root-shell without filling in my password!

Passwort: 
-bash: ash: Kommando nicht gefunden

Sic!

 ~# whoami
root

I would suggest to put the thread again to

not solved

and inform security
smile

Offline

#8 2020-06-26 09:03:48

larsH
Member
Registered: 2020-05-05
Posts: 184  

Re: [ SOLVED ] cant run command from commandsline

Hi

When you login (su) as root you need to login with "su -" su + empty space and then - to get root with full path. It is not a bug but a deliberate change from debian.

Have an nice day
Lars H

Last edited by larsH (2020-06-26 09:05:51)

Offline

#9 2020-06-26 09:12:16

roluan17
Member
Registered: 2019-04-01
Posts: 43  

Re: [ SOLVED ] cant run command from commandsline

btw
I had similar problems with installed programs (since Beowulf) as i.e.  "dmidecode"

invoking "dmidecode" led to "program not found".
But

apt-get install dmidecode

led to

dmidecode ist schon die neueste Version (3.2-1)

meaning "is already the newest version"

Here's the kicker:
after updating no difference

but after reboot dmidecode worked as it should!
Bug or feature?
smile

Offline

#10 2020-06-26 09:26:44

roluan17
Member
Registered: 2019-04-01
Posts: 43  

Re: [ SOLVED ] cant run command from commandsline

Hi LarsH,

well if you read my post, you can see that

su -

is not working on my Beowulf.

Distro: Devuan GNU/Linux 3 (beowulf) 

If I use the recommended long form

su --login

I even get a root-shell without a password.
And you are writing:"it is not a bug but a deliberate change from debian."
Well if that is so it must be changed again!
I don't want debian stuff of that nature!
Last not least: "su" ist still working on my PC as usual!
Warmest regards

Offline

#11 2020-06-26 09:50:11

ralph.ronnquist
Administrator
From: Battery Point, Tasmania, AUS
Registered: 2016-11-30
Posts: 1,251  

Re: [ SOLVED ] cant run command from commandsline

In your post #7, it looks like your attempts with "su" fails because "ash" is not found, which suggests that "ash" is wanted to be used by the initial file(s) that are loaded at login, but is found missing. It looks odd, and maybe you should check up on that first, i.e. specifically why do you get the output:

bash: ash: Kommando nicht gefunden

Just in parenthesis, regardless of your recent experiences, the program su works perfectly fine in beowulf, and it is directly brought in from debian buster. Though, it works differently from how it worked some time period ago, when its juggling of environment variables was different.

Online

#12 2020-06-26 10:06:34

roluan17
Member
Registered: 2019-04-01
Posts: 43  

Re: [ SOLVED ] cant run command from commandsline

Hi Ralph,
thanks for the answer!
1)
Well my "su" still works fine. I was a bit of confused that I should work from now on with "su -". But I tried it with "command not found" result.
Why should I check up why "su -" is not working, when "su" is working as usual? Btw I have no idea how to check up why I get that "ash" output.
Any suggestions?

2)
Being able as normal user to get a root-shell by just typing su "--login" without need for a password  makes me a little nervous.
Not you?
greetings

Offline

#13 2020-06-26 10:48:18

steve_v
Member
Registered: 2018-01-11
Posts: 381  

Re: [ SOLVED ] cant run command from commandsline

roluan17 wrote:

I was a bit of confused that I should work from now on with "su -".

It's just another upstream solution in search of a problem. roll

'su' no longer adds /sbin and /usr/sbin to your $PATH, so you will get "command not found" for any binaries that live there.
'su -' or 'su --login' will read root's profile, so you get root's $PATH, which does include /sbin and /usr/sbin.

Stick alias su='su -' in your ~/.bash_aliases and forget about it.

roluan17 wrote:

I have no idea how to check up why I get that "ash" output.
Any suggestions?

Sounds like some cruft in root's .profile / .bashrc etc?

What does env say after you su to root, and what's in root's .bashrc, .profile, .bash_profile and .bash_aliases (if they exist)?

roluan17 wrote:

Being able as normal user to get a root-shell by just typing su "--login" without need for a password  makes me a little nervous.
Not you?

Smells like a pam screwup to me (assuming it's not some new and wonderful default).
What do /etc/pam.d/su and /etc/pam.d/su-l contain?

You should not be able to su of any kind without a password unless you are already root, or you have something like "auth       sufficient pam_<something>.so trust" in your pam su config, which would be very silly.

Last edited by steve_v (2020-06-26 11:01:01)


Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.

Offline

#14 2020-06-26 15:08:46

roluan17
Member
Registered: 2019-04-01
Posts: 43  

Re: [ SOLVED ] cant run command from commandsline

Hi Steve, ptmy!

~# printenv
SHELL=/bin/bash
PWD=/root
LOGNAME=root
HOME=/root
LANG=de_DE.UTF-8
TERM=xterm-256color
USER=root
SHLVL=1
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
MAIL=/var/mail/root
_=/usr/bin/printenv

.bashrc:

HISTSIZE=100
HISTCONTROL=ignoredups:erasedups

.profile

if [ "$BASH" ]; then
  if [ -f ~/.bashrc ]; then
    . ~/.bashrc
  fi
fi

mesg n || true

.bash_profile does not exist

.bash_aliases

alias su='su -'

smile

/etc/pam.d/su

@include common-auth
@include common-account
@include common-session

/etc/pam.d/su-l

#%PAM-1.0
auth		include		su
account		include		su
password	include		su
session		optional	pam_keyinit.so force revoke
session		include		su

Thanks
greetings

Offline

#15 2020-06-26 22:23:07

ralph.ronnquist
Administrator
From: Battery Point, Tasmania, AUS
Registered: 2016-11-30
Posts: 1,251  

Re: [ SOLVED ] cant run command from commandsline

Firstly you might test by using ctrl-alt-f1 to shift to VT-1 and log in as root. Does that result in the same experience as your su --login, i.e. blank password is fine, and then bash complains about ash?

Online

#16 2020-06-27 04:37:54

steve_v
Member
Registered: 2018-01-11
Posts: 381  

Re: [ SOLVED ] cant run command from commandsline

roluan17 wrote:

Hi Steve
...

Well that all looks fine. Rats.

Does the root account actually have a password?


Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.

Offline

#17 2020-06-28 10:44:54

roluan17
Member
Registered: 2019-04-01
Posts: 43  

Re: [ SOLVED ] cant run command from commandsline

@steve
yes, there is a root password!

@ralph
I can't reproduce the problem anymore (puuh, saved)

su -
su --login

and

su

all demand a password. (Everywhere, also on a non grafic console. "ctrl-alt-f1").
Sent securrity home again.
-----------------------------------

su -

and

su --login

with output

-bash: ash: Kommando nicht gefunden.

(command not found)

-----------------------------------------------------
Only

su

(after setting alias)

alias su='su -'

does NOT output

-bash: ash: Kommando nicht gefunden.

but silently opens a root-shell

root@someone:/home/someone# 

------------------------------------------------------
Remains the "ash output".
Couldn't find much in the web:
https://en.wikipedia.org/wiki/Almquist_shell
https://www.in-ulm.de/~mascheck/various/ash/
which leaves me as ignorant as before.

greetings

Offline

#18 2020-06-28 13:55:20

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Re: [ SOLVED ] cant run command from commandsline

FWIW, /bin/ash can be symlinked to /usr/bin/busybox to use the provided shell for that tool.

Are you sure the posted .bashrc & .profile were from /root/? The alias would suggest that they were from your user's home directory, which would not be read for a root login.


Brianna Ghey — Rest In Power

Offline

#19 2020-06-28 15:35:31

roluan17
Member
Registered: 2019-04-01
Posts: 43  

Re: [ SOLVED ] cant run command from commandsline

@Head_on_a_Stick:

"su" without argument

works fine

Yes .bashrc and .bash_aliases are those from root

GNU nano 3.2                     /root/.bashrc                                

# eval "`dircolors`"
# alias ls='ls $LS_OPTIONS'
# alias ll='ls $LS_OPTIONS -l'
# alias l='ls $LS_OPTIONS -lA'
#
# Some more alias to avoid making mistakes:
# alias rm='rm -i'
# alias cp='cp -i'
# alias mv='mv -i'
HISTSIZE=1000
HISTCONTROL=ignoredups:erasedups
GNU nano 3.2                  /root/.bash_aliases                             

alias su='su -'

But I overlooked three lines out commented in /etc/pam.d/su:
sad

# This allows root to su without passwords (normal operation)
auth       sufficient pam_rootok.so

session       required   pam_env.so readenv=1 envfile=/etc/default/locale

session    optional   pam_mail.so nopen

session    required   pam_limits.so

greetings

Offline

#20 2020-08-02 13:31:12

roluan17
Member
Registered: 2019-04-01
Posts: 43  

Re: [ SOLVED ] cant run command from commandsline

To finish that

bash:ash: command not found

thing:
I just added an empty  "ash"-file in /bin.

Since then there are no more errors like

bash:ash: command not found

If anyone has an better idea or just can explain to me where that error message came/comes from;
you are very welcome!

I found no hint in .bashrc of any script or program that needs ash.
greetings

Offline

#21 2020-08-02 14:03:15

fsmithred
Administrator
Registered: 2016-11-25
Posts: 2,486  

Re: [ SOLVED ] cant run command from commandsline

roluan17 wrote:

To finish that

bash:ash: command not found

thing:
I just added an empty  "ash"-file in /bin.

Since then there are no more errors like

bash:ash: command not found

If anyone has an better idea or just can explain to me where that error message came/comes from;
you are very welcome!

I found no hint in .bashrc of any script or program that needs ash.
greetings

The error message is coming from bash - the command providing the error is the first word in the error message. You get 'command not found' if ash is not installed. If you're sure you installed it, then something weird is going on or you didn't notice when it got removed.

If you create an empty /bin/ash, you should then get 'permission denied' because it's not executable. If you make it executable, then the error messages go away, but of course it does nothing.

A few messages above, you said 'ash' gives you a root shell after aliasing 'su'. The prompt that you pasted is a bash prompt. The ash prompt is just # or $ for root or user, respectively.

Note: You can also get 'command not found' with the new default su setup if the command you're trying to run is in an sbin directory and you used 'su' instead of 'su -'. Your alias works around this.

Offline

#22 2020-08-02 15:49:40

roluan17
Member
Registered: 2019-04-01
Posts: 43  

Re: [ SOLVED ] cant run command from commandsline

@fsmithred
thanks for answering ...
sorry, I found out that ash was NOT installed. So I installed it (again? I am really not quite shure)
I don't remember exactly what kind of prompt-behaviour I had, before I did that su alias.
Before installing ash I deleted that empty ash file.
/bin looks like this now:

ls -l *ash
lrwxrwxrwx 1 root root       4 Jan 17  2019 ash -> dash
-rwxr-xr-x 1 root root 1168776 Apr 18  2019 bash
-rwxr-xr-x 1 root root  121464 Jan 17  2019 dash
lrwxrwxrwx 1 root root       4 Apr 18  2019 rbash -> bash

NOW opening a console, I get:

ash: 0: Can't open completion 

Offline

#23 2020-08-02 19:25:07

rolfie
Member
Registered: 2017-11-25
Posts: 1,171  

Re: [ SOLVED ] cant run command from commandsline

I m sitting on fresh installed Beowulf. No ash, just bash, dash and bash-completion. No problems.

Have you got bash-completion installed?

I am not using the alias.

rolfie

Offline

#24 2020-08-03 07:04:59

roluan17
Member
Registered: 2019-04-01
Posts: 43  

Re: [ SOLVED ] cant run command from commandsline

bash-completion ist schon die neueste Version (1:2.8-6).

is already newest version
greetings

Offline

#25 2020-08-03 14:31:20

fsmithred
Administrator
Registered: 2016-11-25
Posts: 2,486  

Re: [ SOLVED ] cant run command from commandsline

My /bin/*ash looks the same as yours after I install ash. I don't get an error message when I start an ash shell. I'm starting the shell by running 'ash' in xfce4 terminal. How are you doing it? How did you install the system? What did you do that's different from everyone else?

I'm not finding that error message on a web search. (Can't open completion)

Offline

Board footer