No manual entry for any command - linux

I get the below response on trying to view manual for any command
No manual entry for <<command>>
On $ echo $MANPATH, It says
.:/usr/local/man:/usr/man
$ echo $PATH gives the following result
/usr/local/bin:/mis/TREE/bin:/usr/bin:/bin:/usr/ucb:/proj/blade/tools/bin
and on $MANPATH= man -w man it says
MANPATH=: Command not found.
What could be the issue? How to resolve this?
I am on Enterprise Linux 7 (Maipo).

if you have installed man-pages by
sudo yum install man-pages
, then do
sudo yum update

Related

Error while trying to install Kops on Ubuntu 20 EC2 Instance

I went through the steps listed here: https://kubernetes.io/docs/setup/production-environment/tools/kops/
After moving the kops file to /usr/local/bin/ and renaming to kops, I tried to confirm if it was in fact installed and executable by trying 'kops --help' and 'kops --version'/'kops version' and neither command worked. Any idea what the issue might be?
Edit: Here's what I did step by step
curl -LO https://github.com/kubernetes/kops/releases/download/$(curl -s https://api.github.com/repos/kubernetes/kops/releases/latest | grep tag_name | cut -d '"' -f 4)/kops-darwin-amd64
sudo chmod +x kops-darwin-amd64
sudo mv kops-darwin-amd64 /usr/local/bin/kops
It's a t2.micro Ubuntu 20.04 EC2 Instance.
Tried to confirm if kops was properly installed and executable by entering 'kops --help' and 'kops --version' and also 'kops version' but they all return this error:
-bash: /usr/local/bin/kops: cannot execute binary file: Exec format error
I think its because you are using kops-darwin-amd64. This is for mac. I think you should be using kops-linux-amd64 instead for linux.

Sudo prevents the following command from executing

I have been facing inconsistent behaviour between two versions of sudo for the following scenario:
$ sudo sleep 5
echo "hi" # during the 5 seconds
On one system, with sudo version 1.8.21p2, this buffers the second command and runs it afterwards -- but on a newer version (1.9.9), it doesn't:
$ sudo --version
Sudo version 1.9.9
...
$ sudo sleep 5
echo 'hi'
$
$ sudo --version
Sudo version 1.8.21p2
...
$ sudo sleep 5
echo 'hi'
$ echo 'hi'
hi
I found this bug which is relevant: https://bugzilla.sudo.ws/show_bug.cgi?id=786, however the discussion there suggests that this was fixed in version 1.8.20. Has it possibly been reintroduced between 1.8.20 and 1.9.9? If so, what could be a workaround?
Edit: to clarify, both of those were run after running a sudo command and providing the user password
In Ubuntu 22.04, the use_pty option is on in supplied /etc/sudoers file, which has this effect.

"sudo: k0s: command not found": even though its script is executable and its location is in the path

What I am trying to do is:
To play with K0s. So, first I download the K0s scrips and make it executable:
$ curl -sSLf https://get.k0s.sh | sudo sh
.. and here is the terminal output:
> Downloading k0s from URL:
> https://github.com/k0sproject/k0s/releases/download/v1.20.6+k0s.0/k0s-v1.20.6+k0s.0-amd64
> k0s is now executable in /usr/local/bin`
At this point, when I type k0s in the terminal, I get the help page. Also, when I run type k0s, I get the /usr/local/bin/k0s
Again, when I run $ echo $PATH, I see that /usr/local/bin/ is included in the path variables.
The problem is:
When I try to run:
$ sudo k0s install controller --single
I get:
> sudo: k0s: command not found
But it works when I put the full path of the k0s:
$ sudo /usr/local/bin/k0s install controller --single
I tried this answer and this answer but both did not work. Both suggest changing the mode and erload the shell hash-table.
The question is:
what is the probelm, and how to fix it ?

Syntax error when running .sh script on linux. What am I doing wrong?

I've been attempting to write a shell script to detect composer and git on a virtual linux = Ubuntu 16.0.4 machine and then install them if needed. + clone the required repository if the machine is ready for it.
Now this is my first attempt to write any kind of script and also sorry if somehow I messed up the question itself, I'm quite now on stackoverflow as well.
Any help is appreciated, thanks in advance.
Here's the original task specification I received initially:
-check if git is installed on server
if so, clone repo with codebase
-check if composer is installed on server
if so, composer install in the root directory of the laravel application
-finally, php artisan migrate --seed
Now this is how I was trying to achieve this:
#!/bin/bash
echo "The installation process is about the begin..."
if ! which git;
then echo "Git has been located on the destination system. Cloning begins..."
git clone <link to the gitlabe repo>
else echo "There is no Git installed on the system. Git installation commences..."
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install git
echo "Cloning begins..."
git clone <link to the gitlabe repo>
fi
if ! which composer;
then
echo "Composer has been located on the destination system."
else
echo "There is no Composer installed on the system. Composer installation commences..."
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install composer
fi
sudo apt-get update
sudo apt-get install curl php5-cli git
curl -sS https://getcomposer.org/installer | sudo php -- --install- dir=/usr/local/bin --filename=composer
composer global require "laravel/installer"
sudo apt-get update
'Now the preferred version in the vagrantfile has to be edited to be 1.8.1 instead of 1.9'
'Generate a ssh key'
ssh-keygen -t rsa -b 4096 -C "< e-mail adress that I used >"
'Start ssh agent eval $'
ssh-agent -s
'Add your SSH private key to the ssh-agent'
ssh-add -K ~/.ssh/id_rsa
php artisan migrate --seed
The error message I recieve:
sudo sh ./testscript.sh
[sudo] password for linuxtest:
The installation process is about the begin...
: not foundt.sh: 3: ./testscript.sh:
: not foundt.sh: 4: ./testscript.sh:
: not foundt.sh: 5: ./testscript.sh:
./testscript.sh: 72: ./testscript.sh: Syntax error: end of file unexpected (expecting "then")
The answer that helped me solve my problem was posted by Charles Duffy in a comment:
This looks like your file has DOS rather than UNIX newlines. This will prevent syntax like fi from being recognized, because it's read as fi$'\r', which isn't a keyword.
#!/bin/bash
echo "The installation process is about the begin...";
if [ -x "$(command -v git)" ]; then
echo "Git has been located on the destination system. Cloning; begins..."
git clone <link to the gitlabe repo>;
else
echo "There is no Git installed on the system. Git installation commences...";
sudo apt-get update && sudo apt-get upgrade && sudo apt-get install git;
echo "Cloning begins...";
git clone <link to the gitlabe repo>;
fi
if [ -x "$(command -v composer)" ]; then
echo "Composer has been located on the destination system.";
else
echo "There is no Composer installed on the system. Composer installation commences...";
sudo apt-get update && sudo apt-get upgrade && sudo apt-get install composer;
fi
Hey there
I think this should fix your If condition problem. If you want to know more about how you should check for the case that a programm exists, look here:
Check if a program exists from a Bash script
Its the second answer for a quickfix.
Always remember to chain commands which are depending on the success of the preceding command via "&&". This secures that the next command will just be executed if the preceding doesn't fail.
I recommend doing it the same way with the ssh commands.
#edit
also make sure that you end each command with a semicolon.
hope I could help.

Windows Bash (WSL) - sudo: no tty present and no askpass program specified

After following this tutroial I get the following error when trying to run the commands as user or even sudo:
sudo: no tty present and no askpass program specified
The comments from Lurdan in this article state that you need to run
sudo -S <YOUR_COMMAND>
chmod 0666 /dev/tty
chmod doesn't work but sudo -S does, but surely there's another fix?
So silly, after looking further down I see a solution from Beorat:
To avoid the sudo tty issue and others, run these commands just before running do-release-upgrade:
sudo -S apt-mark hold sudo
sudo -S apt-mark hold procps
sudo -S apt-mark hold strace
If you've already upgraded, run the above commands, then manually downgrade to the Trusty packages:
sudo -S wget http://mirrors.kernel.org/ubuntu/pool/main/s/sudo/sudo_1.8.9p5-1ubuntu1.1_amd64.deb
sudo -S wget http://mirrors.kernel.org/ubuntu/pool/main/p/procps/procps_3.3.9-1ubuntu2_amd64.deb
sudo -S wget http://mirrors.kernel.org/ubuntu/pool/main/s/strace/strace_4.8-1ubuntu5_amd64.deb
sudo -S dpkg -i sudo_1.8.9p5-1ubuntu1.1_amd64.deb
sudo -S dpkg -i procps_3.3.9-1ubuntu2_amd64.deb
sudo -S dpkg -i strace_4.8-1ubuntu5_amd64.deb
More info here: https://github.com/Microsoft/BashOnWindows/issues/482
WSL uses the lxrun executable for management from Windows:
lxrun -h
Usage:
/install - Installs the subsystem
Optional arguments:
/y - Do not prompt user to accept
/uninstall - Uninstalls the subsystem
Optional arguments:
/full - Perform a full uninstall
/y - Do not prompt user to accept
/setdefaultuser - Configures the subsystem user that bash will be launched as. If the user does not exist it will be created.
Optional arguments:
username - Supply the username
/y - If username is supplied, do not prompt to create a password
/update - Updates the subsystem's package index
Given that, you can use lxrun /setdefaultuser root. Just thought I'd point out this side of it since it was required when I ran into the same issue as you after trying to upgrade to Xenial. I can confirm that running this command, then the wget / dpkg commands my issues were resolved.
The commands I used:
wget http://mirrors.kernel.org/ubuntu/pool/main/s/sudo/sudo_1.8.9p5-1ubuntu1.4_amd64.deb
wget http://mirrors.kernel.org/ubuntu/pool/main/p/procps/procps_3.3.9-1ubuntu2_amd64.deb
wget http://mirrors.kernel.org/ubuntu/pool/main/s/strace/strace_4.8-1ubuntu5_amd64.deb
dpkg -i sudo_1.8.9p5-1ubuntu1.4_amd64.deb
dpkg -i procps_3.3.9-1ubuntu2_amd64.deb
dpkg -i strace_4.8-1ubuntu5_amd64.deb
Finally, you might need to run sudo apt-get install -f in case you get The following packages have unmet dependencies [xxx] but it is not going to be installed
I got rid of the error by moving /etc/hosts to /etc/hosts.bu. After closing the shell en opening again, /etc/hosts is recreated and your computer name is added. The error is gone (for me.)

Resources