Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is sudo: bundle command not found?

Why is command "bundle" not found when using sudo:

[root@desktop gitlab]# sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production
sudo: bundle: command not found
[root@desktop gitlab]#

but does exist when not using sudo:

[root@desktop gitlab]# bundle exec rake gitlab:setup RAILS_ENV=production
 Warning
  You are running as user root, we hope you know what you are doing.
  Things may work/fail for the wrong reasons.
  For correct results you should run this as user git.

This will create the necessary database tables and seed the database.
You will lose any previous data stored in the database.
Do you want to continue (yes/no)? no
Quitting...
[root@desktop gitlab]#

The reason I ask is I am following https://github.com/gitlabhq/gitlab-recipes/tree/master/install/centos, and it states to use sudo.

I've tried adding a -i flag as described by Using $ sudo bundle exec ... raises 'bundle: command not found' error, but get "This account is currently not available.".

like image 229
user1032531 Avatar asked Mar 17 '14 14:03

user1032531


People also ask

What is the bundle command?

The bundle exec command ensures that executable programs installed by Gems don't interfere with your app's requirements. For instance, if your app needs a specific version of rake but the default version of rake differs, bundle exec ensures that you can still run the specific rake version compatible with your app.

What is bundle command Linux?

You can use Linux bundles to install, upgrade, or remove RPM packages, install or remove files, or perform various management actions such as running scripts, editing files, or launching applications on the device. The various Linux bundles types can be created by using the zman utility or from ZENworks Control Center.


2 Answers

I had this issue I thought that my gitlab installed from source and I got same error. but after try Omnibus method for backup my issue solved with this command:

sudo gitlab-rake gitlab:backup:create

like image 127
Mohammad Ravanbakhsh Avatar answered Oct 22 '22 02:10

Mohammad Ravanbakhsh


Check if the PATH has the same values both with and without sudo. Apparently it cannot find bundle just because it is not listed in PATH

You can compare the outputs of following two lines

$ echo 'echo $PATH' | sh
$ echo 'echo $PATH' | sudo sh

Ideally sudo is supposed to leave PATH untouched. But this might be a side issue of your hosting distribution.

Edit by original poster. Output is:

[root@desktop etc]# echo 'echo $PATH' | sh
/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
[root@desktop etc]# echo 'echo $PATH' | sudo sh
/sbin:/bin:/usr/sbin:/usr/bin:/user/local/bin
[root@desktop etc]#
like image 28
deimus Avatar answered Oct 22 '22 02:10

deimus