Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

testrpc doesn't run directly #380

Closed
jamesray1 opened this issue Sep 1, 2017 · 34 comments
Closed

testrpc doesn't run directly #380

jamesray1 opened this issue Sep 1, 2017 · 34 comments

Comments

@jamesray1
Copy link

jamesray1 commented Sep 1, 2017

Expected Behavior

Should display a banner with the TestRPC version, 9 account addresses, 9 private keys, HD wallet info, and "listening on localhost:8545".

Current Behavior

When entering testrpc at the home/user directory, the output is testrpc: command not found.

Possible Solution

Entering /opt/node/lib/node_modules/ethereumjs-testrpc/build/cli.node.js results in the expected behaviour.

Steps to Reproduce (for bugs)

Here is what I’ve done:

jamesray@james-ASUS-Streacom-FC8:~$ lllc — version LLLC, the Lovely Little Language Compiler Version: 0.4.16-develop.2017.8.19+commit.83b90f3e.Linux.g++

The following is omitted before $ in future code:
jamesray@james-ASUS-Streacom-FC8:~

Continuing:

$ wget https://nodejs.org/dist/v6.10.3/node-v6.10.3-linux-x64.tar.xz
--2017-09-01 13:59:05--  https://nodejs.org/dist/v6.10.3/node-v6.10.3-linux-x64.tar.xz
Resolving nodejs.org (nodejs.org)... 104.20.23.46, 104.20.22.46, 2400:cb00:2048:1::6814:162e, ...
Connecting to nodejs.org (nodejs.org)|104.20.23.46|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 9366220 (8.9M) [application/x-xz]
Saving to: 'node-v6.10.3-linux-x64.tar.xz
node-v6.10.3-linux-x64.tar.xz                      100%[================================================================================================================>]   8.93M  1.13MB/s    in 8.2s
2017-09-01 13:59:19 (1.09 MB/s) - 'node-v6.10.3-linux-x64.tar.xz’ saved [9366220/9366220]
$ tar xvf node-v6.10.3-linux-x64.tar.xz`

Following the last command I get a long list of filepaths. Then:

$ sudo chown -R root.root node-v6.10.3-linux-x64
[sudo] password for jamesray: 
$ sudo mv node-v6.10.3-linux-x64 /opt/node
$ sudo ln -s /opt/node/bin/node /usr/bin/node
ln: failed to create symbolic link ‘/usr/bin/node’: File exists
$ sudo ln -s /opt/node/lib/node_modules/npm/bin/npm-cli.js /usr/bin/npm
ln: failed to create symbolic link ‘/usr/bin/npm’: File exists
$ node -v
v6.10.3
$ npm -v
3.10.10
$ sudo npm install -g ethereumjs-testrpc
/opt/node/bin/testrpc -> /opt/node/lib/node_modules/ethereumjs-testrpc/build/cli.node.js

> [email protected] postinstall /opt/node/lib/node_modules/ethereumjs-testrpc/node_modules/uglifyjs-webpack-plugin
> node lib/post_install.js

/opt/node/lib
└─┬ [email protected] 
  └─┬ [email protected] 
    ├── [email protected] 
    ├─┬ [email protected] 
    │ └── [email protected] 
    ├─┬ [email protected] 
    │ ├── [email protected] 
    │ ├── [email protected] 
    │ ├── [email protected] 
    │ └─┬ [email protected] 
    │   └── [email protected] 
    ├── [email protected] 
    ├─┬ [email protected] 
    │ └── [email protected] 
    ├─┬ [email protected] 
    │ ├── [email protected] 
    │ └── [email protected] 
    ├─┬ [email protected] 
    │ ├─┬ [email protected] 
    │ │ ├── [email protected] 
    │ │ ├── [email protected] 
    │ │ ├── [email protected] 
    │ │ ├── [email protected] 
    │ │ ├── [email protected] 
    │ │ └── [email protected] 
    │ ├── [email protected] 
    │ ├── [email protected] 
    │ └── [email protected] 
    ├── [email protected] 
    ├── [email protected] 
    ├── [email protected] 
    ├── [email protected] 
    ├─┬ [email protected] 
    │ ├── [email protected] 
    │ └── [email protected] 
    ├─┬ [email protected] 
    │ ├─┬ [email protected] 
    │ │ └── [email protected] 
    │ └─┬ [email protected] 
    │   ├── [email protected] 
    │   ├── [email protected] 
    │   ├── [email protected] 
    │   ├── [email protected] 
    │   ├── [email protected] 
    │   ├── [email protected] 
    │   └── [email protected] 
    ├─┬ [email protected] 
    │ └── [email protected] 
    ├─┬ [email protected] 
    │ ├── [email protected] 
    │ ├─┬ [email protected] 
    │ │ └── [email protected] 
    │ ├─┬ [email protected] 
    │ │ ├── [email protected] 
    │ │ └── [email protected] 
    │ ├─┬ [email protected] 
    │ │ └── [email protected] 
    │ ├── [email protected] 
    │ ├─┬ [email protected] 
    │ │ ├─┬ [email protected] 
    │ │ │ ├─┬ [email protected] 
    │ │ │ │ └── [email protected] 
    │ │ │ ├─┬ [email protected] 
    │ │ │ │ └── [email protected] 
    │ │ │ └─┬ [email protected] 
    │ │ │   └─┬ [email protected] 
    │ │ │     └── [email protected] 
    │ │ ├─┬ [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ ├─┬ [email protected] 
    │ │ │ │ ├── [email protected] 
    │ │ │ │ ├── [email protected] 
    │ │ │ │ ├── [email protected] 
    │ │ │ │ ├── [email protected] 
    │ │ │ │ └── [email protected] 
    │ │ │ └─┬ [email protected] 
    │ │ │   └── [email protected] 
    │ │ ├── [email protected] 
    │ │ ├─┬ [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ ├─┬ [email protected] 
    │ │ │ │ └── [email protected] 
    │ │ │ └── [email protected] 
    │ │ ├── [email protected] 
    │ │ ├─┬ [email protected] 
    │ │ │ └── [email protected] 
    │ │ ├── [email protected] 
    │ │ ├── [email protected] 
    │ │ └── [email protected] 
    │ ├── [email protected] 
    │ ├── [email protected] 
    │ ├── [email protected] 
    │ ├── [email protected] 
    │ ├── [email protected] 
    │ ├── [email protected] 
    │ ├── [email protected] 
    │ ├── [email protected] 
    │ ├── [email protected] 
    │ ├─┬ [email protected] 
    │ │ ├── [email protected] 
    │ │ ├── [email protected] 
    │ │ └── [email protected] 
    │ ├── [email protected] 
    │ ├─┬ [email protected] 
    │ │ └── [email protected] 
    │ ├── [email protected] 
    │ ├─┬ [email protected] 
    │ │ ├── [email protected] 
    │ │ └── [email protected] 
    │ ├─┬ [email protected] 
    │ │ └── [email protected] 
    │ └─┬ [email protected] 
    │   └── [email protected] 
    ├── [email protected] 
    ├─┬ [email protected] 
    │ └── [email protected] 
    ├── [email protected] 
    ├─┬ [email protected] 
    │ └─┬ [email protected] 
    │   ├── [email protected] 
    │   └─┬ [email protected] 
    │     ├── [email protected] 
    │     ├─┬ [email protected] 
    │     │ ├─┬ [email protected] 
    │     │ │ ├─┬ [email protected] 
    │     │ │ │ ├── [email protected] 
    │     │ │ │ └── [email protected] 
    │     │ │ └── [email protected] 
    │     │ ├── [email protected] 
    │     │ └── [email protected] 
    │     └── [email protected] 
    ├─┬ [email protected] 
    │ └─┬ [email protected] 
    │   ├─┬ [email protected] 
    │   │ ├─┬ [email protected] 
    │   │ │ ├─┬ [email protected] 
    │   │ │ │ └── [email protected] 
    │   │ │ ├── [email protected] 
    │   │ │ ├─┬ [email protected] 
    │   │ │ │ ├─┬ [email protected] 
    │   │ │ │ │ └─┬ [email protected] 
    │   │ │ │ │   ├── [email protected] 
    │   │ │ │ │   ├── [email protected] 
    │   │ │ │ │   └─┬ [email protected] 
    │   │ │ │ │     ├─┬ [email protected] 
    │   │ │ │ │     │ └── [email protected] 
    │   │ │ │ │     └── [email protected] 
    │   │ │ │ ├── [email protected] 
    │   │ │ │ └── [email protected] 
    │   │ │ ├─┬ [email protected] 
    │   │ │ │ └── [email protected] 
    │   │ │ ├── [email protected] 
    │   │ │ ├── [email protected] 
    │   │ │ ├─┬ [email protected] 
    │   │ │ │ └── [email protected] 
    │   │ │ ├─┬ [email protected] 
    │   │ │ │ ├─┬ [email protected] 
    │   │ │ │ │ └── [email protected] 
    │   │ │ │ └── [email protected] 
    │   │ │ ├─┬ [email protected] 
    │   │ │ │ ├── [email protected] 
    │   │ │ │ └── [email protected] 
    │   │ │ └─┬ [email protected] 
    │   │ │   ├── [email protected] 
    │   │ │   └── [email protected] 
    │   │ └─┬ [email protected] 
    │   │   └── [email protected] 
    │   ├── [email protected] 
    │   ├── [email protected] 
    │   ├─┬ [email protected] 
    │   │ └── [email protected] 
    │   ├─┬ [email protected] 
    │   │ └── [email protected] 
    │   ├── [email protected] 
    │   └─┬ [email protected] 
    │     ├─┬ [email protected] 
    │     │ └─┬ [email protected] 
    │     │   ├── [email protected] 
    │     │   └── [email protected] 
    │     └── [email protected] 
    ├─┬ [email protected] 
    │ └── [email protected] 
    └─┬ [email protected] 
      ├── [email protected] 
      ├─┬ [email protected] 
      │ ├─┬ [email protected] 
      │ │ ├── [email protected] 
      │ │ └─┬ [email protected] 
      │ │   └── [email protected] 
      │ ├─┬ [email protected] 
      │ │ └── [email protected] 
      │ └─┬ [email protected] 
      │   └── [email protected] 
      ├── [email protected] 
      ├── [email protected] 
      ├─┬ [email protected] 
      │ ├─┬ [email protected] 
      │ │ ├─┬ [email protected] 
      │ │ │ ├─┬ [email protected] 
      │ │ │ │ ├── [email protected] 
      │ │ │ │ └── [email protected] 
      │ │ │ ├─┬ [email protected] 
      │ │ │ │ └── [email protected] 
      │ │ │ └─┬ [email protected] 
      │ │ │   └── [email protected] 
      │ │ ├── [email protected] 
      │ │ ├── [email protected] 
      │ │ ├─┬ [email protected] 
      │ │ │ └── [email protected] 
      │ │ ├── [email protected] 
      │ │ ├── [email protected] 
      │ │ └── [email protected] 
      │ ├─┬ [email protected] 
      │ │ └── [email protected] 
      │ └─┬ [email protected] 
      │   └── [email protected] 
      ├─┬ [email protected] 
      │ ├─┬ [email protected] 
      │ │ └─┬ [email protected] 
      │ │   ├─┬ [email protected] 
      │ │   │ └── [email protected] 
      │ │   └── [email protected] 
      │ └─┬ [email protected] 
      │   ├─┬ [email protected] 
      │   │ ├─┬ [email protected] 
      │   │ │ └─┬ [email protected] 
      │   │ │   └── [email protected] 
      │   │ ├── [email protected] 
      │   │ └── [email protected] 
      │   ├─┬ [email protected] 
      │   │ ├── [email protected] 
      │   │ ├─┬ [email protected] 
      │   │ │ └── [email protected] 
      │   │ ├── [email protected] 
      │   │ └─┬ [email protected] 
      │   │   ├─┬ [email protected] 
      │   │   │ └── [email protected] 
      │   │   └── [email protected] 
      │   └── [email protected] 
      ├── [email protected] 
      ├── [email protected] 
      ├── [email protected] 
      ├─┬ [email protected] 
      │ ├── [email protected] 
      │ └─┬ [email protected] 
      │   └── [email protected] 
      ├── [email protected] 
      ├── [email protected] 
      └─┬ [email protected] 
        └── [email protected]

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/ethereumjs-testrpc/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
$ testrpc
testrpc: command not found

Debugging

jamesray@james-ASUS-Streacom-FC8:~$ pwd
/home/jamesray
$ sudo ln -s /opt/node/lib/node_modules/ethereumjs-testrpc/bin/testrpc /usr/bin/testrpc
ln: failed to create symbolic link '/usr/bin/testrpc': File exists
$ which testrpc

No output.

$ which ls
/bin/ls
$ which node
/usr/bin/node
$ /usr/bin/testrpc
bash: /usr/bin/testrpc: No such file or directory
$ ls /opt/node/lib/node_modules/ethereumjs-testrpc/bin/
ls: cannot access '/opt/node/lib/node_modules/ethereumjs-testrpc/bin/': No such file or directory
$ ls /opt/node/lib/node_modules/ethereumjs-testrpc/build
cli.node.js  lib.node.js  provider.node.js  server.node.js
$ npm install -g ethereumjs-testrpc
npm WARN checkPermissions Missing write access to /opt/node/lib/node_modules/ethereumjs-testrpc
npm WARN checkPermissions Missing write access to /opt/node/lib/node_modules
/opt/node/lib
└── [email protected] 

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/ethereumjs-testrpc/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! Linux 4.10.0-33-generic
npm ERR! argv "/opt/node/bin/node" "/usr/bin/npm" "install" "-g" "ethereumjs-testrpc"
npm ERR! node v6.10.3
npm ERR! npm  v3.10.10
npm ERR! path /opt/node/lib/node_modules/ethereumjs-testrpc
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access

npm ERR! Error: EACCES: permission denied, access '/opt/node/lib/node_modules/ethereumjs-testrpc'
npm ERR!     at Error (native)
npm ERR!  { Error: EACCES: permission denied, access '/opt/node/lib/node_modules/ethereumjs-testrpc'
npm ERR!     at Error (native)
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/opt/node/lib/node_modules/ethereumjs-testrpc' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/jamesray/npm-debug.log
$ node -v
v6.10.3
$ npm --version
3.10.10
$ /opt/node/lib/node_modules/ethereumjs-testrpc/build/cli.node.js
EthereumJS TestRPC v4.1.1 (ganache-core: 1.1.2)
Available Accounts
==================

omitted list of 9 addresses

Private Keys
==================

omitted list of 9 keys

HD Wallet
==================
Mnemonic: 

omitted

Base HD Path:  m/44'/60'/0'/0/{account_index}
Listening on localhost:8545

Context

Going through the compiling LLL tutorial by Daniel Ellison, it instructs to install and run testrpc.

Your Environment

  • Version used: Bash with LLLC, the Lovely Little Language Compiler
    Version: 0.4.16-develop.2017.8.19+commit.83b90f3e.Linux.g++`
  • Environment name and version (e.g. PHP 5.4 on nginx 1.9.1): not sure
  • Server type and version: not sure
  • Operating System and version: Ubuntu Desktop 16.04 LTS
@jwasinger
Copy link

sudo npm install -g ethereumjs-testrpc

It appears this command executes correctly. However,

$ testrpc
testrpc: command not found

indicates that testrpc executable is not in your path.
So figure out where testrpc was installed:

sudo find / -name "testrpc"

and make sure that the location is in $PATH (and accessible by the user who is invoking the command).

@jamesray1
Copy link
Author

jamesray1 commented Sep 7, 2017

Thanks @jwasinger. I got:

jamesray@james-ASUS-Streacom-FC8:~$ sudo find / -name "testrpc"
/usr/bin/testrpc
find: ‘/run/user/1000/gvfs’: Permission denied
/opt/node/bin/testrpc

So it seems like it is not accessible by user jamesray. I'm not sure how to check whether the location is in $PATH, but usr/bin is normally in $PATH, according to here.

jamesray@james-ASUS-Streacom-FC8:~$ $PATH
bash: /home/jamesray/bin:/home/jamesray/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin: No such file or directory

$path /usr/bin/testrpc
bash: /usr/bin/testrpc: No such file or directory

Further tests

I'm not sure if any of the below testing helps, but what I've formatted in bold may be more likely to help.

I navigated to the /usr/bin/testrpc file in the files app, clicked on the link and got the error pop-up: "This link cannot be used because its target “/opt/node/lib/node_modules/ethereumjs-testrpc/bin/testrpc” doesn't exist." The files app then froze (after I copied and pasted the message, then opened Brave and then could not reopen the files app).

I opened another files window, navigated to /opt/node/lib/node_modules/ethereumjs-testrpc, which showed no bin folder:

ethereumjs-testrpc

About find: ‘/run/user/1000/gvfs’: Permission denied, I found this:

gvfs properties

I was not able to change the access permission for Group jamesray, or change the group from jamesray to another group, e.g. sudo.

There is 9.8 GB of free space on the Linux partition of my SSD.

computer ubuntu partition properties

For:

jamesray@james-ASUS-Streacom-FC8:~$ $PATH
bash: /home/jamesray/bin:/home/jamesray/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin: No such file or directory

There is no bin visible in /home/jamesray/, so it looks like it kept trying in different local locations that the user jamesray can access, and didn't find a bin, where instead there is a bin in usr/bin, which is outside of my path, and is thus not accessible. So it looks like I have identified the issue, but I'm not sure what the best way is to fix it, e.g. I can't change the permissions via the GUI for jamesray to access files outside of jamesray. Do I need to or can I change permissions as a root user in the terminal, and if so, how?

home directory


Any ideas?

Sorry, I'm new to Linux—I installed it to learn to use lllc recently.

@jamesray1 jamesray1 reopened this Sep 7, 2017
@jwasinger
Copy link

Perhaps the executable is /opt/node/bin/testrpc? Maybe try adding that to your path. E.g.

export PATH=$PATH:/opt/node/bin

in bashprofile.

It's difficult to troubleshoot when I can't reproduce the environment you are working in. I would suggest learning how to use https://www.vagrantup.com/ and start doing your development in a VM. That way:

  1. you can run as root within the VM and not worry about permissions issues
  2. If you get stuck you can post the Vagrantfile which allows others to directly reproduce the issue on their machines.

I have a vagrantfile that sets up a nodejs environment within a VM (https://github.com/jwasinger/ethereum-dev-env/tree/master/ethereumjs). So maybe you could use that as a base for setting up testrpc.

@jamesray1
Copy link
Author

jamesray1 commented Sep 7, 2017

OK, thanks again. I added /usr/bin and /opt/node/bin as you suggested, and testrpc now works! I think I'll go with the VM option anyway. I did try to use VirtualBox before but all of the options were 32 bit so I didn't think that they would work on an x64 system.

@jwasinger
Copy link

There are versions of virtualbox that are 64 bit: https://www.virtualbox.org/wiki/Linux_Downloads.
Vagrant works on top of virtualbox and makes it a lot easier to spin up VMs.

@jamesray1
Copy link
Author

OK. I've already installed VirtualBox (virtualbox-5.1_5.1.26-117224-Ubuntu-xenial_amd64.deb) and I installed Vagrant, saved your vagrantfile to /home/Ethereum-dev-env-ethereum-js, opened that folder in the terminal, and ran vagrant up:

jamesray@james-ASUS-Streacom-FC8:~/Ethereum-dev-env-ethereum-js$ vagrant up
There is a syntax error in the following Vagrantfile. The syntax error
message is reproduced below for convenience:

/home/jamesray/Ethereum-dev-env-ethereum-js/Vagrantfile:20: can't find string "SCRIPT" anywhere before EOF
/home/jamesray/Ethereum-dev-env-ethereum-js/Vagrantfile:1: syntax error, unexpected end-of-input, expecting tSTRING_CONTENT or tSTRING_DBEG or tSTRING_DVAR or tSTRING_END

@jamesray1
Copy link
Author

jamesray1 commented Sep 8, 2017

It seems like it can't find VirtualBox:

jamesray@james-ASUS-Streacom-FC8:~$ vagrant init hashicorp/precise64
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
jamesray@james-ASUS-Streacom-FC8:~$ vagrant up
No usable default provider could be found for your system.

Vagrant relies on interactions with 3rd party systems, known as
"providers", to provide Vagrant with resources to run development
environments. Examples are VirtualBox, VMware, Hyper-V.

The easiest solution to this message is to install VirtualBox, which
is available for free on all major platforms.

If you believe you already have a provider available, make sure it
is properly installed and configured. You can see more details about
why a particular provider isn't working by forcing usage with
`vagrant up --provider=PROVIDER`, which should give you a more specific
error message for that particular provider.
jamesray@james-ASUS-Streacom-FC8:~$ 

So I'll find where VirtualBox is located. I opened Oracle VM VIrtualBox Manager, went to preferences, and got the default machine folder: /home/jamesray/VirtualBox VMs, which is in my path, however there is no home/jamesray folder in the files app.

@jamesray1
Copy link
Author

jamesray1 commented Sep 8, 2017

OK, I installed VirtualBox via the Ubuntu Software app, because it wasn't showing in the installed list on that program. When I saved the file in gedit to the /home folder for convenience, it saved it as an HTML file, so I changed it back to a plain text file in the drop down menu, however it would still show in the properties as a HTML. If I changed the filename to Vagrantfile.txt to force it to be a plain text document, vagrant file still didn't work. I did get vagrant up to work at one point where I think your vagrantfile was in the ~/Ethereum-dev-env-ethereum-js folder, and there was no vagrantfile, but I can't get it working again yet.

I tried vagrant init to install a vagrant file, then CTRL+C your code, CTRL+A the code in the original file, and CTRL+V to replace it, but vagrant up didn't work.

~$ ls
Desktop    Downloads         Music         npm-debug.log  Public  Templates     tutorial.sol
Documents  examples.desktop  node_modules  Pictures       snap    tutorial.lll  Videos
jamesray@james-ASUS-Streacom-FC8:~$ vagrant init
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
jamesray@james-ASUS-Streacom-FC8:~$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'base' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Box file was not detected as metadata. Adding it directly...
==> default: Adding box 'base' (v0) for provider: virtualbox
    default: Downloading: base
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.

Couldn't open file /home/jamesray/base

There is no base folder.

What I'll do: either re-add a base folder, or reinstall Ubuntu 16.04 LTS.

@jwasinger
Copy link

Hmm. yeah reinstalling your OS might be a good option. it's hard to say. In general, I would avoid installing software using the Ubuntu software app. Things are often outdated.

@jamesray1
Copy link
Author

jamesray1 commented Sep 8, 2017

Yeah I'm just waiting for the ISO file to write to the disc, and will be installing 17.04 instead. Yeah I noticed the version for vagrant wasn't 2.0 in the software app; I will avoid using it.

@jamesray1
Copy link
Author

I'm having the same issue with Ubuntu 16.04 where the installer keeps crashing via USB, but this time I wiped 16.04 and Windows, so I can't use the computer to try other things, e.g. write to a CD/DVD, or do a memtest86+. I'll use my Windows disc to boot.

@jamesray1
Copy link
Author

OK I'm using Ubuntu 17.04 now, after I booted Windows, burnt the ISO to a DVD, and booted via try Ubuntu without installing (the install option didn't work, same with OEM install, since the keyboard and mouse didn't work in the installer).

@jamesray1
Copy link
Author

jamesray1 commented Sep 8, 2017

I installed Virtual Box via the instructions here, created a vagrant file, copied and pasted your instructions and ran vagrant up but it didn't work.

So I changed:

  • config.vm.box = "ubuntu/zesty64" (instead of trusty64)
  • the comments say: "
#   # Customize the amount of memory on the VM:
  #   vb.memory = "1024"".` 

However, your file has v.memory = 4096, but it uses do |v| rather than do |vb|. So I changed it to v.memory = "4096" (I don't know if that makes any difference).

  • replacing SCRIPT with SHELL in :
$installScript = <<SCRIPT ...
...
SCRIPT

The full changed file is (excl. comments):

$installScript = <<SHELL
sudo apt update && \
sudo apt install -y  git g++ make python-minimal silversearcher-ag && \
wget https://nodejs.org/dist/v8.3.0/node-v8.3.0-linux-x64.tar.xz && \
tar -xvf node-v8.3.0-linux-x64.tar.xz && \
sudo mv node-v8.3.0-linux-x64/bin/* /usr/bin/ && \
sudo mv node-v8.3.0-linux-x64/lib/* /usr/lib/ && \
cp /vagrant/.tmux.conf /home/vagrant/.tmux.conf && \
SHELL

Vagrant.configure("2") do |config|

  config.vm.provider "virtualbox" do |v|
    v.memory = "4096"
    v.cpus = 1
  end

  config.vm.provision "shell", "inline": $installScript
end

However, vagrant up still doesn't work. I keep getting the same error:

There is a syntax error in the following Vagrantfile. The syntax error
message is reproduced below for convenience:

/home/james/Vagrantfile:89: can't find string "SHELL" anywhere before EOF
/home/james/Vagrantfile:3: syntax error, unexpected end-of-input, expecting tSTRING_CONTENT or tSTRING_DBEG or tSTRING_DVAR or tSTRING_END

@jwasinger
Copy link

Were you able to get an example box up and running?

@jwasinger
Copy link

There is a syntax error in the Vagrantfile. Try pulling the latest version and running vagrant up.

@jamesray1
Copy link
Author

Sorry I'm not sure what needs to be done to get an example box up and running, but I'll try vagrant init and vagrant up.

@jamesray1
Copy link
Author

Same error as before reinstalling where it can't locate the base folder:

A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
james@james-Streacom:~$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'base' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Box file was not detected as metadata. Adding it directly...
==> default: Adding box 'base' (v0) for provider: virtualbox
    default: Downloading: base
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.

Couldn't open file /home/james/base

@jamesray1
Copy link
Author

I'm going to close the original issue as I did get testrpc to work.

@jamesray1
Copy link
Author

james@james-Streacom:~$ cd /home/james/base
bash: cd: /home/james/base: No such file or directory
james@james-Streacom:~$ cd /home/james
james@james-Streacom:~$ ls
Desktop    Downloads         Music     Public     Vagrantfile
Documents  examples.desktop  Pictures  Templates  Videos

@jamesray1
Copy link
Author

Time to Ask Ubuntu.

@jamesray1
Copy link
Author

jamesray1 commented Sep 9, 2017

Ah I know why it didn't work. I didn't specify anything for vagrant init.

This seems to work:

vagrant init ubuntu/zesty64
vagrant up

@jamesray1
Copy link
Author

jamesray1 commented Sep 9, 2017

I terminated the download, then used your file with the latest commit (changing to zesty64), and it also seems to work now, resuming the download from where I left off with vagrant init ubuntu/zesty64 and vagrant up. Thanks for all your help and patience Jared!

@jamesray1
Copy link
Author

Alas it seems I spoke to soon.
I got:

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'ubuntu/zesty64' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Loading metadata for box 'ubuntu/zesty64'
    default: URL: https://atlas.hashicorp.com/ubuntu/zesty64
==> default: Adding box 'ubuntu/zesty64' (v20170831.0.0) for provider: virtualbox
    default: Downloading: https://vagrantcloud.com/ubuntu/boxes/zesty64/versions/20170831.0.0/providers/virtualbox.box
==> default: Box download is resuming from prior download progress
==> default: Successfully added box 'ubuntu/zesty64' (v20170831.0.0) for 'virtualbox'!
==> default: Importing base box 'ubuntu/zesty64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/zesty64' is up to date...
==> default: Setting the name of the VM: james_default_1504917176677_87192
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["startvm", "b5460c8c-142b-4dc8-a942-176aee800148", "--type", "headless"]

Stderr: VBoxManage: error: VT-x is disabled in the BIOS for all CPU modes (VERR_VMX_MSR_ALL_VMX_DISABLED)
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component ConsoleWrap, interface IConsole

I will try this.

@jwasinger
Copy link

oh yeah. im running on a beast of a machine so you may want to tune down the number of cpus and memory used

@jamesray1
Copy link
Author

OK, I was just checking the BIOS settings, but will try that first.

@jamesray1
Copy link
Author

system details

@jamesray1
Copy link
Author

jamesray1 commented Sep 9, 2017

I'll try v.memory = 2048 and leave v.cpus = 1 as is.

With 2048 it will be slower, so I've enabled Intel Virtualisation Technology in the BIOS and changed back to v.memory = 4096, and ran vagrant up.

I got red errors in the output (non-errors in green are omitted):

==> default: cp: 
==> default: cannot stat '/vagrant/.tmux.conf'
==> default: : No such file or directory
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

I also got a long list of red errors, so the full output doesn't show in the terminal because I can't scroll up any more. They seem pretty meaningless, all of the lines are of four varieties:

==> default: ....... ...
==> default: .
==> default: . 79% 1.82M 2s
==> default:   8950K .........

@jamesray1
Copy link
Author

Here are the log files:
Logs.tar.gz

@jamesray1
Copy link
Author

I ran it again with vagrant provision since vagrant up didn't work and suggested to do that, then pressed CTRL+C to terminate to see the initial errors:

james@james-Streacom:~$ vagrant provision
==> default: Running provisioner: shell...
    default: Running: inline script
==> default: mesg: 
==> default: ttyname failed
==> default: : 
==> default: Inappropriate ioctl for device
==> default: WARNING: 
==> default: apt
==> default:  
==> default: does not have a stable CLI interface. 
==> default: Use with caution in scripts.

@jamesray1
Copy link
Author

@jamesray1
Copy link
Author

@jamesray1
Copy link
Author

hashicorp/vagrant#8956

@Thibaut-Fontaine
Copy link

I had the same problem ; maybe for some unix-based os it's not adding correctly the path to $PATH. Maybe you should correct it ! :-)

@jamesray1
Copy link
Author

No it's all good, the error I'm currently getting is an SSH no connection error. But that's happening because I haven't enabled SSH on my router gateway. I may do that after I finish reading the yellow paper.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants