Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hab won't install packages if /hab/cache/artifacts isn't present #1291

Closed
smacfarlane opened this issue Sep 27, 2016 · 13 comments
Closed

hab won't install packages if /hab/cache/artifacts isn't present #1291

smacfarlane opened this issue Sep 27, 2016 · 13 comments
Labels
Type: Bug Issues that describe broken functionality

Comments

@smacfarlane
Copy link
Contributor

On CentOS 6.8, while trying to install a hab package from disk, I received the following error:

>hab pkg install uafgina-gdmp-0.1.0-20160927202639-x86_64-linux.hart
✗✗✗
✗✗✗ No such file or directory (os error 2)
✗✗✗

I found that installing core/busybox-static first would allow the package to be installed.

I've been able to reproduce this in the studio with this minimal plan

To reproduce:

Build the package, leave the studio, re-enter and attempt to install.

Studio Output

RUST_DEBUG Output

@bookshelfdave
Copy link
Contributor

so it looks like local vs remote install behaves differently. Did you install core/busybox-static with sudo? Does /hab exist and is it writable before you run hab pkg install uafgina-gdmp-0.1.0-20160927202639-x86_64-linux.hart?

@bookshelfdave
Copy link
Contributor

In a new Centos 6.8 container, I'm getting this:

[root@77a3d50fd381 hab-0.9.3-20160916191534-x86_64-linux]# ./hab studio build .
   hab-studio: Destroying Studio at /hab/studios/hab-0.9.3-20160916191534-x86_64-linux (unknown)
   hab-studio: Creating Studio at /hab/studios/hab-0.9.3-20160916191534-x86_64-linux (default)
mount: permission denied (are you root?)

(I'm definitely root)

@juliandunn
Copy link
Contributor

@metadave did you start that container with --privileged? Docker's root isn't really root unless you start it that way

@bookshelfdave
Copy link
Contributor

good call @juliandunn, that stung me a few months ago as well. --privileged helped with my first error.

I run the following commands and the package installs without error:

docker run -it --privileged centos:6 /bin/bash

yum -y install wget
wget -O hab.tar.gz https://api.bintray.com/content/habitat/stable/linux/x86_64/hab-%24latest-x86_64-linux.tar.gz?bt_package=hab-x86_64-linux
tar xvzf ./hab.tar.gz
export PATH=$PATH:/hab-0.9.3-20160916191534-x86_64-linux/
hab origin key generate foo
export HAB_ORIGIN=foo
wget -O plan.sh https://gist.githubusercontent.com/smacfarlane/2fb36546142f2f03b26937b1ebe5309b/raw/46cbbe13188e6b47f78844cce78afa72d051864e/plan.sh
hab studio build .
hab pkg install ./results/foo-demo-0.0.1-*.hart
✓ Installed foo/demo/0.0.1/20160928163754
★ Install of foo/demo/0.0.1/20160928163754 complete with 1 new packages installed.

@smacfarlane
Copy link
Contributor Author

Sorry, I should have been more specific. The CentOS 6.8 in question is a bento/centos-6.8 VM. The studio I'm running on my Mac laptop.

I tried pre-creating the /hab directory:

(hab studio enter on Mac)

[1][default:/src:0]# mkdir /hab
mkdir: cannot create directory '/hab': File exists
[2][default:/src:1]# mkdir -p /hab/pkgs/uafgina
[3][default:/src:0]# hab pkg install results/uafgina-gdmp-0.1.0-20160927202639-x86_64-linux.hart
✗✗✗
✗✗✗ No such file or directory (os error 2)
✗✗✗

bento/centos-6.8 vm

vagrant@gis-test:~$ sudo mkdir /hab
vagrant@gis-test:~$ sudo hab pkg install uafgina-gdmp-0.1.0-20160927202639-x86_64-linux.hart
✗✗✗
✗✗✗ No such file or directory (os error 2)
✗✗✗
vagrant@gis-test:~$ sudo mkdir -p /hab/pkgs/uafgina
vagrant@gis-test:~$ sudo hab pkg install uafgina-gdmp-0.1.0-20160927202639-x86_64-linux.hart
✗✗✗
✗✗✗ No such file or directory (os error 2)
✗✗✗

I've also tried installing other packages, and found that that wasn't sufficient unless they had core/busybox-static as a dependency. Following that, I tried setting pkg_deps=(core/busybox-static) but was still unable to install the package.

@smacfarlane
Copy link
Contributor Author

I've done some more testing, and found that it's expecting /hab/cache/artifacts to be present before installing a local package.

root@gis-test:~# mkdir /hab
root@gis-test:~# ll /hab
total 8
drwxr-xr-x  2 root root 4096 Sep 28 18:37 ./
drwxr-xr-x 24 root root 4096 Sep 28 18:37 ../
root@gis-test:~# hab pkg install uafgina-gdmp-0.1.0-20160927202639-x86_64-linux.hart
✗✗✗
✗✗✗ No such file or directory (os error 2)
✗✗✗
root@gis-test:~# ll /hab
total 12
drwxr-xr-x  3 root root 4096 Sep 28 18:37 ./
drwxr-xr-x 24 root root 4096 Sep 28 18:37 ../
drwxr-xr-x  3 root root 4096 Sep 28 18:37 cache/
root@gis-test:~# ll /hab/cache
total 12
drwxr-xr-x 3 root root 4096 Sep 28 18:37 ./
drwxr-xr-x 3 root root 4096 Sep 28 18:37 ../
drwxr-xr-x 2 root root 4096 Sep 28 18:37 ssl/
root@gis-test:~# mkdir /hab/cache/artifacts
root@gis-test:~# hab pkg install uafgina-gdmp-0.1.0-20160927202639-x86_64-linux.hart
↓ Downloading uafgina-20160627171940 public origin key
    78 B / 78 B | [=====================================================================================================================] 100.00 % 3.47 MB/s
☑ Cached uafgina-20160627171940 public origin key
↓ Downloading core/acl/2.2.52/20160612075215
    181.20 KB / 181.20 KB - [===========================================================================================================] 100.00 % 1.49 MB/s
↓ Downloading core-20160612031944 public origin key
    75 B / 75 B | [=====================================================================================================================] 100.00 % 2.79 MB/s
☑ Cached core-20160612031944 public origin key
↓ Downloading core/attr/2.4.47/20160612075207
    105.01 KB / 105.01 KB - [==========================================================================================================] 100.00 % 34.96 MB/s
↓ Downloading core/bash/4.3.42/20160729192720
    1.07 MB / 1.07 MB | [===============================================================================================================] 100.00 % 6.72 MB/s
↓ Downloading core/bzip2/1.0.6/20160612075040
    141.05 KB / 141.05 KB - [==========================================================================================================] 100.00 % 41.58 MB/s
↓ Downloading core/coreutils/8.25/20160729192409
    2.18 MB / 2.18 MB - [==============================================================================================================] 100.00 % 21.38 MB/s
↓ Downloading core/db/5.3.28/20160729192915
    18.64 MB / 18.64 MB - [============================================================================================================] 100.00 % 23.85 MB/s
↓ Downloading core/gcc-libs/5.2.0/20160612075020
    2.06 MB / 2.06 MB | [==============================================================================================================] 100.00 % 22.86 MB/s
↓ Downloading core/gdbm/1.11/20160729192905
    137.69 KB / 137.69 KB / [==========================================================================================================] 100.00 % 16.94 MB/s
↓ Downloading core/glibc/2.22/20160612063629
    16.21 MB / 16.21 MB \ [============================================================================================================] 100.00 % 22.99 MB/s
↓ Downloading core/gmp/6.1.0/20160612064724
    373.35 KB / 373.35 KB - [==========================================================================================================] 100.00 % 35.44 MB/s
↓ Downloading core/less/481/20160729193028
    93.75 KB / 93.75 KB \ [============================================================================================================] 100.00 % 17.90 MB/s
↓ Downloading core/libcap/2.24/20160612075226
    68.01 KB / 68.01 KB | [============================================================================================================] 100.00 % 27.71 MB/s
↓ Downloading core/linux-headers/4.3/20160612063537
    798.92 KB / 798.92 KB | [==========================================================================================================] 100.00 % 38.18 MB/s
↓ Downloading core/ncurses/6.0/20160612075116
    920.18 KB / 920.18 KB | [==========================================================================================================] 100.00 % 28.08 MB/s
↓ Downloading core/pcre/8.38/20160729192620
    725.00 KB / 725.00 KB / [==========================================================================================================] 100.00 % 33.67 MB/s
↓ Downloading core/perl/5.22.1/20160729193035
    10.34 MB / 10.34 MB | [============================================================================================================] 100.00 % 23.43 MB/s
↓ Downloading core/readline/6.3.8/20160729192706
    273.29 KB / 273.29 KB - [==========================================================================================================] 100.00 % 36.60 MB/s
↓ Downloading core/rsync/3.1.2/20160729224439
    259.56 KB / 259.56 KB / [==========================================================================================================] 100.00 % 32.79 MB/s
↓ Downloading core/zlib/1.2.8/20160612064520
    73.06 KB / 73.06 KB - [============================================================================================================] 100.00 % 30.74 MB/s
✓ Installed core/acl/2.2.52/20160612075215
✓ Installed core/attr/2.4.47/20160612075207
✓ Installed core/bash/4.3.42/20160729192720
✓ Installed core/bzip2/1.0.6/20160612075040
✓ Installed core/coreutils/8.25/20160729192409
✓ Installed core/db/5.3.28/20160729192915
✓ Installed core/gcc-libs/5.2.0/20160612075020
✓ Installed core/gdbm/1.11/20160729192905
✓ Installed core/glibc/2.22/20160612063629
✓ Installed core/gmp/6.1.0/20160612064724
✓ Installed core/less/481/20160729193028
✓ Installed core/libcap/2.24/20160612075226
✓ Installed core/linux-headers/4.3/20160612063537
✓ Installed core/ncurses/6.0/20160612075116
✓ Installed core/pcre/8.38/20160729192620
✓ Installed core/perl/5.22.1/20160729193035
✓ Installed core/readline/6.3.8/20160729192706
✓ Installed core/rsync/3.1.2/20160729224439
✓ Installed core/zlib/1.2.8/20160612064520
✓ Installed uafgina/gdmp/0.1.0/20160927202639
★ Install of uafgina/gdmp/0.1.0/20160927202639 complete with 20 new packages installed.

Not sure how I got fixated on busybox, probably end-of-day fried brain.

@bookshelfdave
Copy link
Contributor

ah, good catch. I've noticed other issues with directories being missing wrt keys etc, so we should probably address all of these at once.

@juliandunn juliandunn changed the title Unable to install local package without pre-installing core/busybox-static hab won't install packages if /hab/cache/artifacts isn't present Sep 28, 2016
@smacfarlane
Copy link
Contributor Author

I went digging around in the source last night to see if this was an easy fix I could contribute, and it looks like @fnichol was reading minds: 624866a

I built hab from master this morning and was able to install a local package without /hab/cache/artifacts present.

@juliandunn
Copy link
Contributor

Nice! Are we ok to close it then?

@smacfarlane
Copy link
Contributor Author

👍 I think so. Thanks everyone!

@reset
Copy link
Collaborator

reset commented Sep 29, 2016

@smacfarlane ❤️

@reset reset closed this as completed Sep 29, 2016
@reset reset removed the Discussing label Sep 29, 2016
@fnichol
Copy link
Collaborator

fnichol commented Oct 5, 2016

@smacfarlane haha, right on! We found this very much incidentally a week or so ago which existed as a bug probably ever since I refactored the install logic.

@fnichol
Copy link
Collaborator

fnichol commented Oct 5, 2016

Closed by #1287

@eeyun eeyun added C-bug and removed Bug labels Jun 6, 2017
@christophermaier christophermaier added Type: Bug Issues that describe broken functionality and removed C-bug labels Jul 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issues that describe broken functionality
Projects
None yet
Development

No branches or pull requests

7 participants