This repository has been archived by the owner. It is now read-only.

Berkshelf::BerksfileNotFound: No Berksfile or Berksfile.lock found at: #68

Closed
ModerationMike opened this Issue Jul 1, 2013 · 16 comments

Comments

Projects
None yet
4 participants
@ModerationMike

ModerationMike commented Jul 1, 2013

Just upgraded to Vagrant 1.2.2 with vagrant-berkshelf (1.3.2) and Berkshelf 2.0.5 although it says Berkshelf (1.4.4) with a berks -v (strange).

I've had these three working in combo with virtualbox with no issues on this machine before but since the update vagrant-berkshelf can't file the Berksfile if it's in the same directory as the Vagrantfile or if I point to it with:

config.berkshelf.berksfile_path = "/Workspace/chef-repo/Berksfile"

I get the error:

Berkshelf::BerksfileNotFound: No Berksfile or Berksfile.lock found at: /Workspace/chef-repo/virtualbox/Berksfile

Something obvious or bug?

@ModerationMike

This comment has been minimized.

Show comment
Hide comment
@ModerationMike

ModerationMike Jul 1, 2013

Not sure if this has anything today with it... install 2.0.5 but berks -v has a different version!

unknown-68-a8-6d-0b-96-ea:virtualbox Michael$ gem install berkshelf
Successfully installed berkshelf-2.0.5
Parsing documentation for berkshelf-2.0.5
1 gem installed
unknown-68-a8-6d-0b-96-ea:virtualbox Michael$ berks -v
Berkshelf (1.4.4)

Author:: Jamie Winsor (<reset@riotgames.com>)
Author:: Josiah Kiehl (<jkiehl@riotgames.com>)
Author:: Michael Ivey (<michael.ivey@riotgames.com>)
Author:: Justin Campbell (<justin.campbell@riotgames.com>)

Copyright 2012 Riot Games

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

ModerationMike commented Jul 1, 2013

Not sure if this has anything today with it... install 2.0.5 but berks -v has a different version!

unknown-68-a8-6d-0b-96-ea:virtualbox Michael$ gem install berkshelf
Successfully installed berkshelf-2.0.5
Parsing documentation for berkshelf-2.0.5
1 gem installed
unknown-68-a8-6d-0b-96-ea:virtualbox Michael$ berks -v
Berkshelf (1.4.4)

Author:: Jamie Winsor (<reset@riotgames.com>)
Author:: Josiah Kiehl (<jkiehl@riotgames.com>)
Author:: Michael Ivey (<michael.ivey@riotgames.com>)
Author:: Justin Campbell (<justin.campbell@riotgames.com>)

Copyright 2012 Riot Games

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
@sethvargo

This comment has been minimized.

Show comment
Hide comment
@sethvargo

sethvargo Jul 1, 2013

Contributor

@ModerationMike this is because you have two versions of Berkshelf installed and the older one is being chosen first.

Can you post your Berksfile and Vagrantfile please?

Contributor

sethvargo commented Jul 1, 2013

@ModerationMike this is because you have two versions of Berkshelf installed and the older one is being chosen first.

Can you post your Berksfile and Vagrantfile please?

@ModerationMike

This comment has been minimized.

Show comment
Hide comment
@ModerationMike

ModerationMike Jul 1, 2013

Berksfile:

site :opscode

cookbook 'ntp'
cookbook 'resolver'
cookbook 'chef-client'
cookbook 'newrelic'
cookbook 'haproxy'
cookbook 'nginx'
cookbook 'apache2'
cookbook 'application'
cookbook 'database'

cookbook 'timezone', path: 'cookbooks/timezoneii'
cookbook 'intro', path: 'cookbooks/intro'
cookbook 'gearman', path: 'cookbooks/gearman'

ModerationMike commented Jul 1, 2013

Berksfile:

site :opscode

cookbook 'ntp'
cookbook 'resolver'
cookbook 'chef-client'
cookbook 'newrelic'
cookbook 'haproxy'
cookbook 'nginx'
cookbook 'apache2'
cookbook 'application'
cookbook 'database'

cookbook 'timezone', path: 'cookbooks/timezoneii'
cookbook 'intro', path: 'cookbooks/intro'
cookbook 'gearman', path: 'cookbooks/gearman'
@sethvargo

This comment has been minimized.

Show comment
Hide comment
@sethvargo

sethvargo Jul 1, 2013

Contributor

@ModerationMike and your Vagrantfile? Try:

$ gem uninstall berkshelf

And select "all versions" when prompted

$ vagrant plugin uninstall vagrant-berkshelf

Make sure vagrant-berkshelf is actually gone:

$ vagrant plugin list

Install berkshelf:

$ gem install berkshelf

Install vagrant-berkshelf:

$ vagrant plugin install vagrant-berkshelf
Contributor

sethvargo commented Jul 1, 2013

@ModerationMike and your Vagrantfile? Try:

$ gem uninstall berkshelf

And select "all versions" when prompted

$ vagrant plugin uninstall vagrant-berkshelf

Make sure vagrant-berkshelf is actually gone:

$ vagrant plugin list

Install berkshelf:

$ gem install berkshelf

Install vagrant-berkshelf:

$ vagrant plugin install vagrant-berkshelf
@ModerationMike

This comment has been minimized.

Show comment
Hide comment
@ModerationMike

ModerationMike Jul 1, 2013

Vagrantfile: It seems to work if if I rip out the last three lines of the Berksfile but not with that content.

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  # All Vagrant configuration is done here. The most common configuration
  # options are documented and commented below. For a complete reference,
  # please see the online documentation at vagrantup.com.

  config.vm.hostname = "db1.gi-build.net"

  # Every Vagrant virtual environment requires a box to build off of.
  config.vm.box = "precise-server-cloudimg-vagrant-amd64-disk1"

  # The url from where the 'config.vm.box' box will be fetched if it
  # doesn't already exist on the user's system.
  config.vm.box_url = "http://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-vagrant-amd64-disk1.box"

  # Assign this VM to a host-only network IP, allowing you to access it
  # via the IP. Host-only networks can talk to the host machine as well as
  # any other machines on the same network, but cannot be accessed (through this
  # network interface) by any external networks.
  config.vm.network :private_network, ip: "33.33.33.10"

  # Create a public network, which generally matched to bridged network.
  # Bridged networks make the machine appear as another physical device on
  # your network.

  # config.vm.network :public_network

  # Create a forwarded port mapping which allows access to a specific port
  # within the machine from a port on the host machine. In the example below,
  # accessing "localhost:8080" will access port 80 on the guest machine.

  # Share an additional folder to the guest VM. The first argument is
  # the path on the host to the actual folder. The second argument is
  # the path on the guest to mount the folder. And the optional third
  # argument is a set of non-required options.
  # config.vm.synced_folder "../data", "/vagrant_data"

  # Provider-specific configuration so you can fine-tune various
  # backing providers for Vagrant. These expose provider-specific options.
  # Example for VirtualBox:
  #
  # config.vm.provider :virtualbox do |vb|
  #   # Don't boot with headless mode
  #   vb.gui = true
  #
  #   # Use VBoxManage to customize the VM. For example to change memory:
  #   vb.customize ["modifyvm", :id, "--memory", "1024"]
  # end
  #
  # View the documentation for the provider you're using for more
  # information on available options.

  config.ssh.max_tries = 40
  config.ssh.timeout   = 120

  # The path to the Berksfile to use with Vagrant Berkshelf
  # config.berkshelf.berksfile_path = "./Berksfile"

  # Enabling the Berkshelf plugin. To enable this globally, add this configuration
  # option to your ~/.vagrant.d/Vagrantfile file
  config.berkshelf.enabled = true

  config.berkshelf.berksfile_path = "~/Workspace/chef-repo/Berksfile"

  # An array of symbols representing groups of cookbook described in the Vagrantfile
  # to exclusively install and copy to Vagrant's shelf.
  # config.berkshelf.only = []

  # An array of symbols representing groups of cookbook described in the Vagrantfile
  # to skip installing and copying to Vagrant's shelf.
  # config.berkshelf.except = []

  config.vm.provision :chef_solo do |chef|
    chef.json = {
      :mysql => {
        :server_root_password => 'rootpass',
        :server_debian_password => 'debpass',
        :server_repl_password => 'replpass'
      }
    }

    chef.run_list = [
        "recipe[virtualbox::default]"
    ]
  end
end

ModerationMike commented Jul 1, 2013

Vagrantfile: It seems to work if if I rip out the last three lines of the Berksfile but not with that content.

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  # All Vagrant configuration is done here. The most common configuration
  # options are documented and commented below. For a complete reference,
  # please see the online documentation at vagrantup.com.

  config.vm.hostname = "db1.gi-build.net"

  # Every Vagrant virtual environment requires a box to build off of.
  config.vm.box = "precise-server-cloudimg-vagrant-amd64-disk1"

  # The url from where the 'config.vm.box' box will be fetched if it
  # doesn't already exist on the user's system.
  config.vm.box_url = "http://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-vagrant-amd64-disk1.box"

  # Assign this VM to a host-only network IP, allowing you to access it
  # via the IP. Host-only networks can talk to the host machine as well as
  # any other machines on the same network, but cannot be accessed (through this
  # network interface) by any external networks.
  config.vm.network :private_network, ip: "33.33.33.10"

  # Create a public network, which generally matched to bridged network.
  # Bridged networks make the machine appear as another physical device on
  # your network.

  # config.vm.network :public_network

  # Create a forwarded port mapping which allows access to a specific port
  # within the machine from a port on the host machine. In the example below,
  # accessing "localhost:8080" will access port 80 on the guest machine.

  # Share an additional folder to the guest VM. The first argument is
  # the path on the host to the actual folder. The second argument is
  # the path on the guest to mount the folder. And the optional third
  # argument is a set of non-required options.
  # config.vm.synced_folder "../data", "/vagrant_data"

  # Provider-specific configuration so you can fine-tune various
  # backing providers for Vagrant. These expose provider-specific options.
  # Example for VirtualBox:
  #
  # config.vm.provider :virtualbox do |vb|
  #   # Don't boot with headless mode
  #   vb.gui = true
  #
  #   # Use VBoxManage to customize the VM. For example to change memory:
  #   vb.customize ["modifyvm", :id, "--memory", "1024"]
  # end
  #
  # View the documentation for the provider you're using for more
  # information on available options.

  config.ssh.max_tries = 40
  config.ssh.timeout   = 120

  # The path to the Berksfile to use with Vagrant Berkshelf
  # config.berkshelf.berksfile_path = "./Berksfile"

  # Enabling the Berkshelf plugin. To enable this globally, add this configuration
  # option to your ~/.vagrant.d/Vagrantfile file
  config.berkshelf.enabled = true

  config.berkshelf.berksfile_path = "~/Workspace/chef-repo/Berksfile"

  # An array of symbols representing groups of cookbook described in the Vagrantfile
  # to exclusively install and copy to Vagrant's shelf.
  # config.berkshelf.only = []

  # An array of symbols representing groups of cookbook described in the Vagrantfile
  # to skip installing and copying to Vagrant's shelf.
  # config.berkshelf.except = []

  config.vm.provision :chef_solo do |chef|
    chef.json = {
      :mysql => {
        :server_root_password => 'rootpass',
        :server_debian_password => 'debpass',
        :server_repl_password => 'replpass'
      }
    }

    chef.run_list = [
        "recipe[virtualbox::default]"
    ]
  end
end
@ModerationMike

This comment has been minimized.

Show comment
Hide comment
@ModerationMike

ModerationMike Jul 1, 2013

OK it works with the full path to to the cookbook. Before it used to work relative to the Berksfile. Your uninstall and install seems to have cleared up the other issues. Is that the normal path to upgrade with this stuff? I'm new to this!

site :opscode

cookbook 'ntp'
cookbook 'resolver'
cookbook 'chef-client'
cookbook 'newrelic'
cookbook 'haproxy'
cookbook 'nginx'
cookbook 'apache2'
cookbook 'application'
cookbook 'database'

cookbook 'timezone', path: '/Users/Michael/Workspace/chef-repo/cookbooks/timezoneii'
cookbook 'intro',    path: '/Users/Michael/Workspace/chef-repo/cookbooks/intro'
cookbook 'gearman',  path: '/Users/Michael/Workspace/chef-repo/cookbooks/gearman'

ModerationMike commented Jul 1, 2013

OK it works with the full path to to the cookbook. Before it used to work relative to the Berksfile. Your uninstall and install seems to have cleared up the other issues. Is that the normal path to upgrade with this stuff? I'm new to this!

site :opscode

cookbook 'ntp'
cookbook 'resolver'
cookbook 'chef-client'
cookbook 'newrelic'
cookbook 'haproxy'
cookbook 'nginx'
cookbook 'apache2'
cookbook 'application'
cookbook 'database'

cookbook 'timezone', path: '/Users/Michael/Workspace/chef-repo/cookbooks/timezoneii'
cookbook 'intro',    path: '/Users/Michael/Workspace/chef-repo/cookbooks/intro'
cookbook 'gearman',  path: '/Users/Michael/Workspace/chef-repo/cookbooks/gearman'
@sethvargo

This comment has been minimized.

Show comment
Hide comment
@sethvargo

sethvargo Jul 1, 2013

Contributor

For upgrading vagrant plugins, yes, for now at least. Regarding Berkshelf, you should use gem update berkshelf in the future. I'm going to double check, but relative paths are working fine for me.

Contributor

sethvargo commented Jul 1, 2013

For upgrading vagrant plugins, yes, for now at least. Regarding Berkshelf, you should use gem update berkshelf in the future. I'm going to double check, but relative paths are working fine for me.

@sethvargo

This comment has been minimized.

Show comment
Hide comment
@sethvargo

sethvargo Jul 1, 2013

Contributor

@ModerationMike also, please try and use GHFM when posting files. Otherwise they show up kinda crazy in both email and the thread:

This will be text
This will be ruby
Contributor

sethvargo commented Jul 1, 2013

@ModerationMike also, please try and use GHFM when posting files. Otherwise they show up kinda crazy in both email and the thread:

This will be text
This will be ruby
@sethvargo

This comment has been minimized.

Show comment
Hide comment
@sethvargo

sethvargo Jul 1, 2013

Contributor

@ModerationMike from all the output logs, it looks like you are running berks and vagrant from inside a directory called "virtualbox". This would explain all your issues - relative paths are incorrect, and Berkshelf can't find a Berksfile in that directory.

Contributor

sethvargo commented Jul 1, 2013

@ModerationMike from all the output logs, it looks like you are running berks and vagrant from inside a directory called "virtualbox". This would explain all your issues - relative paths are incorrect, and Berkshelf can't find a Berksfile in that directory.

@ModerationMike

This comment has been minimized.

Show comment
Hide comment
@ModerationMike

ModerationMike Jul 1, 2013

I originally had the vagrant file in a directory called 'virtual' with a Berksfile in another location as it is now with only the short paths as initially posted. Whats the issue here? Having a directory called 'virtualbox' or having a Berksfile in another location?

ModerationMike commented Jul 1, 2013

I originally had the vagrant file in a directory called 'virtual' with a Berksfile in another location as it is now with only the short paths as initially posted. Whats the issue here? Having a directory called 'virtualbox' or having a Berksfile in another location?

@sethvargo

This comment has been minimized.

Show comment
Hide comment
@sethvargo

sethvargo Jul 1, 2013

Contributor

It's not where you put them, it's where you run berks from. Your error said:

Berkshelf::BerksfileNotFound: No Berksfile or Berksfile.lock found at: /Workspace/chef-repo/virtualbox/Berksfile

This means you're running berks from INSIDE the virtualbox directory. That's why all your relative paths are wrong as well.

Contributor

sethvargo commented Jul 1, 2013

It's not where you put them, it's where you run berks from. Your error said:

Berkshelf::BerksfileNotFound: No Berksfile or Berksfile.lock found at: /Workspace/chef-repo/virtualbox/Berksfile

This means you're running berks from INSIDE the virtualbox directory. That's why all your relative paths are wrong as well.

@ottbot

This comment has been minimized.

Show comment
Hide comment
@ottbot

ottbot Aug 2, 2013

I'm seeing this problem now, after upgrading vagrant, I've since update berkshelf and vagrant-berkshelf..

I'm on:

  • vagrant (1.2.7)
  • berkshelf (2.0.7)
  • vagrant-berkshelf (1.3.3)
~/work/fc-cookbooks/fc-base (master *) vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
Berkshelf::BerksfileNotFound: No Berksfile or Berksfile.lock found at: /home/rob/work/fc-cookbooks/fc-base/Berksfile

~/work/fc-cookbooks/fc-base (master *) ls -l /home/rob/work/fc-cookbooks/fc-base/Berksfile*
-rw-r--r-- 1 rob users  68 Jul 30 16:17 /home/rob/work/fc-cookbooks/fc-base/Berksfile
-rw-r--r-- 1 rob users 456 Aug  2 15:54 /home/rob/work/fc-cookbooks/fc-base/Berksfile.lock

~/work/fc-cookbooks/fc-base (master *) berks list
Cookbooks installed by your Berksfile:
  * chef_gem (0.1.0)
  * chef_handler (1.1.4)
  * fc-base (0.1.0)
  * java (1.12.0)
  * rvm (0.9.1)
  * windows (1.10.0)

I've tried some setting absolute path for config.berkshelf.berksfile_path, but I'm out of ideas!

ottbot commented Aug 2, 2013

I'm seeing this problem now, after upgrading vagrant, I've since update berkshelf and vagrant-berkshelf..

I'm on:

  • vagrant (1.2.7)
  • berkshelf (2.0.7)
  • vagrant-berkshelf (1.3.3)
~/work/fc-cookbooks/fc-base (master *) vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
Berkshelf::BerksfileNotFound: No Berksfile or Berksfile.lock found at: /home/rob/work/fc-cookbooks/fc-base/Berksfile

~/work/fc-cookbooks/fc-base (master *) ls -l /home/rob/work/fc-cookbooks/fc-base/Berksfile*
-rw-r--r-- 1 rob users  68 Jul 30 16:17 /home/rob/work/fc-cookbooks/fc-base/Berksfile
-rw-r--r-- 1 rob users 456 Aug  2 15:54 /home/rob/work/fc-cookbooks/fc-base/Berksfile.lock

~/work/fc-cookbooks/fc-base (master *) berks list
Cookbooks installed by your Berksfile:
  * chef_gem (0.1.0)
  * chef_handler (1.1.4)
  * fc-base (0.1.0)
  * java (1.12.0)
  * rvm (0.9.1)
  * windows (1.10.0)

I've tried some setting absolute path for config.berkshelf.berksfile_path, but I'm out of ideas!

@ottbot

This comment has been minimized.

Show comment
Hide comment
@ottbot

ottbot Aug 2, 2013

Ok.. Welp, turns out I was getting this with unsaved changes to the cookbook's README.md in emacs..

It creates a symlink like:
lrwxrwxrwx 1 rob users 25 Aug 2 16:56 .#README.md -> rob@cosmo.2392:1375430904

Very strange...

ottbot commented Aug 2, 2013

Ok.. Welp, turns out I was getting this with unsaved changes to the cookbook's README.md in emacs..

It creates a symlink like:
lrwxrwxrwx 1 rob users 25 Aug 2 16:56 .#README.md -> rob@cosmo.2392:1375430904

Very strange...

@andruby

This comment has been minimized.

Show comment
Hide comment
@andruby

andruby Aug 22, 2013

I was getting a Berkshelf::BerksfileNotFound error when adding a relative path to a cookbook in the Berksfile. After updating to the latest vagrant (1.2.7), berkshelf (2.0.8) and vagrant-berkshelf (1.3.3) the error had changed to:

Berkshelf::BerksfileReadError: An error occurred while reading the Berksfile:

  No such file or directory - /Users/andrew/path/to/repo/cookbooks/book_name/README.md

Adding that README.md file solved the issue!

@ottbot: it would indeed seem like berkshelf wants a README.md file.

andruby commented Aug 22, 2013

I was getting a Berkshelf::BerksfileNotFound error when adding a relative path to a cookbook in the Berksfile. After updating to the latest vagrant (1.2.7), berkshelf (2.0.8) and vagrant-berkshelf (1.3.3) the error had changed to:

Berkshelf::BerksfileReadError: An error occurred while reading the Berksfile:

  No such file or directory - /Users/andrew/path/to/repo/cookbooks/book_name/README.md

Adding that README.md file solved the issue!

@ottbot: it would indeed seem like berkshelf wants a README.md file.

@sethvargo

This comment has been minimized.

Show comment
Hide comment
@sethvargo

sethvargo Aug 22, 2013

Contributor

@ottbot @andruby it's not Berkshelf that wants the README, it's Chef. Look at your metadata.rb:

# ...
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))

That's why you're getting an error.

Contributor

sethvargo commented Aug 22, 2013

@ottbot @andruby it's not Berkshelf that wants the README, it's Chef. Look at your metadata.rb:

# ...
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))

That's why you're getting an error.

@sethvargo

This comment has been minimized.

Show comment
Hide comment
@sethvargo

sethvargo Aug 22, 2013

Contributor

Closing as this is fixed in 2.0.8.

Contributor

sethvargo commented Aug 22, 2013

Closing as this is fixed in 2.0.8.

@sethvargo sethvargo closed this Aug 22, 2013

@berkshelf berkshelf locked and limited conversation to collaborators Jun 16, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.