4

After executing

cap deploy:setup

I get this error

failed: "sh -c 'sudo -p '\\''sudo password: '\\'' mkdir -p /u/apps/blog /u/apps/blog/releases /u/apps/blog/shared /u/apps/blog/shared/system /u/apps/blog/shared/log /u/apps/blog/shared/pids'" on foobar.com

Here is the content of my deploy.rb

require 'capistrano'


    # Account Settings
    set :user, "user"
    set :password, "pass"
    set :domain, "foobar.com"
    set :mount_path, "/"
    set :application, "blog"

    set :repository, "/Users/me/Desktop/project"
    set :local_repository, "/Users/me/Desktop/project"
    set :scm, :git
    set :deploy_via, :copy

    role :app, 'foobar.com'
role :web, 'foobar.com'

What could be the problem ?

//EDIT

*** [err :: foobar.com] stdin: is not a tty
*** [err :: foobar.com] sudo:
*** [err :: foobar.com] can't mkdir /var/db/sudo: No such file or directory
*** [err :: foobar.com] sudo:
*** [err :: foobar.com] no tty present and no askpass program specified
failed: "sh -c 'sudo -p '\\''sudo password: '\\'' mkdir -p /u/apps/blog /u/apps/blog/releases /u/apps/blog/shared /u/apps/blog/shared/system /u/apps/blog/shared/log /u/apps/blog/shared/pids'" on foobar.com
mojodro
  • 65
  • 1
  • 4

2 Answers2

24

Add this line to your deploy.rb (for example after set :application, "blog")

default_run_options[:pty] = true

And now run:

cap -v deploy:setup

If you don't have sudo privileges add this line to deploy.rb:

set :use_sudo, false

You must have permissions to create /u/apps/blog directory or change deploy folder with:

set :deploy_to, "/home/user_name/apps/blog"
rogal111
  • 5,874
  • 2
  • 27
  • 33
  • Already did that but looks like capistrano want sudo access. But I don't have a such. – mojodro Jul 19 '12 at 14:19
  • I get mkdir: cannot create directory `/u': Permission denied – mojodro Jul 19 '12 at 14:31
  • 1
    add this line `set :deploy_to, "/home/youtuser/apps/blog"` – rogal111 Jul 19 '12 at 14:32
  • Thank you thank you thank you! The `set :deploy_to` line is missing in Webfaction's documentation. Added that in and it works like a charm. – Siobhán Oct 31 '12 at 17:50
  • I was getting the same error because - `set :application, "blog"` and `set :deploy_to, "/home/youtuser/apps/blog"` where not same, meaning i was using a different name instead of application name in `:deploy_to` – poorva Sep 23 '14 at 13:05
  • This no longer works in Capistrano 3 as the `:use_sudo` config option has been removed. See http://stackoverflow.com/a/21336645/83743 for alternatives. – Chris Bloom Dec 09 '14 at 13:34
1
# Default value for :pty is false
set :pty, true
gavit
  • 509
  • 3
  • 6