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

Boot failed on macOS and (some subset of) Linux: "terminals database is inaccessible" #1369

Closed
flowerornament opened this issue Jul 23, 2019 · 32 comments
Labels

Comments

@flowerornament
Copy link

flowerornament commented Jul 23, 2019

~: sw_vers
ProductName:	Mac OS X
ProductVersion:	10.14.5
~: curl -O https://bootstrap.urbit.org/urbit-darwin-v0.8.0.tgz
~: tar xvf urbit-darwin-v0.8.0.tgz
~: mv urbit ~/bin
~: cd ~/urbit
~/urbit: urbit -c c
~
urbit 0.8.0
boot: home is /Users/morgan/code/urbit/ships/c-2019-7-22
loom: mapped 2048MB
lite: arvo formula 662bb1ce
lite: core 71a5c111
lite: final state 71a5c111
boot: downloading pill https://bootstrap.urbit.org/urbit-0.8.0.pill
boot: mining a comet. May take up to an hour.
If you want to boot faster, get an Azimuth point.
boot: found comet ~tiltep-dibfex-botdyn-lasder--bidrym-tasres-lasrym-marzod
boot: downloading azimuth snapshot from https://bootstrap.urbit.org/urbit-0.8.0.snap
boot: retrieving latest block
boot: verifying keys
boot: retrieving galaxy table
boot: retrieving network domains
loom: mapped 2048MB
terminals database is inaccessible
boot: protected loom
live: logical boot
boot: installed 263 jets
~/urbit: urbit -w ~hidrel-fabtel -k hidrel-fabtel-1.key
~
urbit 0.8.0
boot: home is /Users/morgan/code/urbit/ships/hidrel-fabtel
loom: mapped 2048MB
lite: arvo formula 662bb1ce
lite: core 71a5c111
lite: final state 71a5c111
boot: downloading pill https://bootstrap.urbit.org/urbit-0.8.0.pill
boot: downloading azimuth snapshot from https://bootstrap.urbit.org/urbit-0.8.0.snap
boot: retrieving latest block
boot: retrieving ~hidrel-fabtel's public keys
boot: verifying keys
boot: retrieving galaxy table
boot: retrieving network domains
loom: mapped 2048MB
boot: protected loom
live: logical boot
boot: installed 263 jets
terminals database is inaccessible
@matildepark
Copy link
Contributor

Can't replicate this — a comet boots fine on my macOS. Have you given it another shot? I've had times with this release where I had to just try again and it would work. Otherwise there may be more variables to troubleshoot for this.

@flowerornament
Copy link
Author

Tried three times. Trying a fourth with sh, since Google seems to indicate this might have something to do with my shell.

@flowerornament
Copy link
Author

Reproduced also with urbit -w ~hidrel-fabtel -k <key>

@flowerornament flowerornament changed the title Comet boot failed on macOS Boot failed on macOS Jul 23, 2019
@matildepark
Copy link
Contributor

Some pre-emptive Googling does seem to suggest this type of error points to a local issue ...hmm.

@flowerornament
Copy link
Author

@matildepark tried TERM=xterm urbit hidrel-fabtel and other such things which seem to fix this common problem with clear to no avail so far.

@flowerornament
Copy link
Author

This seems relevant: https://stackoverflow.com/questions/43130276/trouble-opening-ncurses-examples-in-os-x.

~/urbit: export TERMINFO=/usr/share/terminfo
~/urbit: urbit hidrel-fabtel
~
urbit 0.8.0
boot: home is /Users/morgan/code/urbit/ships/hidrel-fabtel
loom: mapped 2048MB
lite: arvo formula 662bb1ce
lite: core 71a5c111
lite: final state 71a5c111
loom: mapped 2048MB
boot: protected loom
live: logical boot
boot: installed 263 jets
'xterm-256color': unknown terminal type.

@flowerornament
Copy link
Author

Ah, turns out booting with sh worked.

~/urbit: sh
sh-3.2$ ~/bin/urbit -c c3
~
urbit 0.8.0
boot: home is /Users/morgan/code/urbit/ships/c3
loom: mapped 2048MB
lite: arvo formula 662bb1ce
lite: core 71a5c111
lite: final state 71a5c111
boot: downloading pill https://bootstrap.urbit.org/urbit-0.8.0.pill
boot: mining a comet. May take up to an hour.
If you want to boot faster, get an Azimuth point.
boot: found comet ~mitrym-nomfyl-narseg-sappem--libfun-matmeb-fintyl-marzod
boot: downloading azimuth snapshot from https://bootstrap.urbit.org/urbit-0.8.0.snap
boot: retrieving latest block
boot: verifying keys
boot: retrieving galaxy table
boot: retrieving network domains
loom: mapped 2048MB
boot: protected loom
live: logical boot
boot: installed 263 jets
work: play 1
boot: ship: ~mitrym-nomfyl-narseg-sappem--libfun-matmeb-fintyl-marzod
work: (1)| boot
work: (2)| boot
work: (3)| boot
work: (4)| boot
work: (5)| boot
work: (5)| pill: 579d17c7
1-b
1-c (compiling compiler, wait a few minutes)
ride-parsing
ride-compiling
ride-compiled
1-d
1-e
ride-parsing
ride-compiling
ride-compiled
1-f
ride-parsing
ride-compiling
ride-compiled
1-g
%arvo-assembly
%arvo-assembled
work: (5)| core: 531f8929
[%tang /~zod/home/~2019.7.22..18.55.46..83a3/sys/zuse ~harsur-marpeg]
arvo: metamorphosis
%hoon-load
[%vane %a /~zod/home/~2019.7.22..18.55.46..83a3/sys/vane/ames ~tirryx-polden]
[%vane-parsed ~nolrex-togrus]
[%vane-compiled ~rocryc-fanteb]
[%vane %b /~zod/home/~2019.7.22..18.55.46..83a3/sys/vane/behn ~sovwyd-simfen]
[%vane-parsed ~tolduc-dorpem]
[%vane-compiled ~faltus-latryn]
[%vane %c /~zod/home/~2019.7.22..18.55.46..83a3/sys/vane/clay ~worrel-panlug]
[%vane-parsed ~hapnul-wolsep]
[%vane-compiled ~dovrup-lishec]
[%vane %d /~zod/home/~2019.7.22..18.55.46..83a3/sys/vane/dill ~rivhes-matmel]
[%vane-parsed ~lander-sarnut]
[%vane-compiled ~lomweb-bacnyx]
[%vane %e /~zod/home/~2019.7.22..18.55.46..83a3/sys/vane/eyre ~rabfes-tilnys]
[%vane-parsed ~lacwen-fonner]
[%vane-compiled ~dinmut-botneb]
[%vane %f /~zod/home/~2019.7.22..18.55.46..83a3/sys/vane/ford ~lisdun-pitmyr]
[%vane-parsed ~ravryp-mintun]
[%vane-compiled ~rilruc-todmel]
[%vane %g /~zod/home/~2019.7.22..18.55.46..83a3/sys/vane/gall ~pagsel-natsef]
[%vane-parsed ~wicrel-labnep]
[%vane-compiled ~timnyr-falmec]
[%vane %i /~zod/home/~2019.7.22..18.55.46..83a3/sys/vane/iris ~dalmel-podpur]
[%vane-parsed ~ticlux-samsyx]
[%vane-compiled ~lodduc-hodbud]
[%vane %j /~zod/home/~2019.7.22..18.55.46..83a3/sys/vane/jael ~libser-harput]
[%vane-parsed ~pandel-bostyc]
[%vane-compiled ~tiptyp-linlys]
pier: boot complete
clay: committed initial filesystem (hoon)
http: live (insecure, public) on 80
http: live (insecure, loopback) on 12321
clay: committed initial filesystem (all)
ames: czar zod.urbit.org: ip .35.185.212.189
[%dill-init ~mitrym-nomfyl-narseg-sappem--libfun-matmeb-fintyl-marzod %hood]
[%dill-mere ~mitrym-nomfyl-narseg-sappem--libfun-matmeb-fintyl-marzod %hood]
finding ship and desk from %base on ~mitrym-nomfyl-narseg-sappem--libfun-matmeb-fintyl-marzod to %home
>> [%mo-not-running %dojo %peer]
>> [%mo-not-running %talk %peer]
>> [%mo-not-running %hall %peer]
>> [%mo-not-running %hall %peer]
[~mitrym-nomfyl-narseg-sappem--libfun-matmeb-fintyl-marzod, driving ~mitrym-nomfyl-narseg-sappem--libfun-matmeb-fintyl-marzod]
activated app base/dojo
activated app base/hall
activated app base/modulo
activated app base/talk
activated app home/lens
[linked to [p=~mitrym-nomfyl-narseg-sappem--libfun-matmeb-fintyl-marzod q=%talk]]
[linked to [p=~mitrym-nomfyl-narseg-sappem--libfun-matmeb-fintyl-marzod q=%dojo]]
activated sync from %base on ~mitrym-nomfyl-narseg-sappem--libfun-matmeb-fintyl-marzod to %home
sync succeeded from %base on ~mitrym-nomfyl-narseg-sappem--libfun-matmeb-fintyl-marzod to %home
; ~zod is your neighbor
; ~marzod not responding still trying
; ~marzod is ok
; ~marzod is your neighbor
~mitrym_marzod:dojo> 

@joemfb
Copy link
Member

joemfb commented Jul 23, 2019

I get this if I try to resolve the urbit binary out of my $PATH, not if I reference it with a relative path. I thought using the release binaries via $PATH had specifically been tested, but that appears not to be the case.

Context: we're shipping a terminfo database in the release tarball due to what might be called "deficiencies" in our ncurses cross-compilation build.

/cc @benjamin-tlon

@flowerornament
Copy link
Author

flowerornament commented Jul 23, 2019

OK, I eventually solved this in a pretty complicated way.

First, I had tried running export TERMINFO=/usr/share/terminfo, tipped off by this StackOverflow post, which changed the error to 'xterm-256color': unknown terminal type.

I then got the idea that my terminfo directory was "corrupted" from this other StackOverflow post. Turns out it looks like this:

/usr/share/terminfo: ls
31	33	35	37	39	45	4d	50	58	62	64	66	68	6a	6c	6e	70	72	74	76	7a
32	34	36	38	41	4c	4e	51	61	63	65	67	69	6b	6d	6f	71	73	75	77	78

From another answer somewhere, I learned those directory names, I think, should be the first letter of the terminfo files they contain. In this case, the directory 78 should be x, since it contains xterm-256color, the one my Terminal uses.

Unfortunately, System Integrity Protection prevents me from modifying this folder, so I had to turn it off by rebooting into recovery mode (CMD+R on reboot) and running csrutil disable.

After rebooting, I was able to change 78 to x, which resolved the issue. (EDIT: this broke vim and other things. I ended up copying the folder and keeping duplicates, one called 78 and one called x.)

If I understand correctly, this means I need to add export TERMINFO=/usr/share/terminfo to my bash profile, which seems sub-optimal.

@flowerornament
Copy link
Author

I should also mention, this sunk my ship:

~
urbit 0.8.0
boot: home is /Users/morgan/code/urbit/ships/hidrel-fabtel
loom: mapped 2048MB
lite: arvo formula 662bb1ce
lite: core 71a5c111
lite: final state 71a5c111
loom: mapped 2048MB
boot: protected loom
live: logical boot
boot: installed 263 jets
work: play 1
Assertion '0 != log_u->com_d' failed in vere/pier.c:1618

bail: oops
bailing out
Assertion failed: (0), function u3m_bail, file noun/manage.c, line 663.
                                                                       Abort trap: 6 (core dumped)

@joemfb
Copy link
Member

joemfb commented Jul 23, 2019

That's not sunk!

@joemfb
Copy link
Member

joemfb commented Jul 23, 2019

You hadn't computed anything, let alone communicated with anyone else. (Admittedly, this is not obvious criteria)

@flowerornament
Copy link
Author

flowerornament commented Jul 23, 2019

OK – crashed. Anyhow, being conservative, I cycled keys, and now I'm getting key mismatches :)

~/urbit: urbit -w ~hidrel-fabtel -k hidrel-fabtel-2.key                                                                                                                 
~
urbit 0.8.0
boot: home is /Users/morgan/code/urbit/ships/hidrel-fabtel
loom: mapped 2048MB
lite: arvo formula 662bb1ce
lite: core 71a5c111
lite: final state 71a5c111
boot: downloading pill https://bootstrap.urbit.org/urbit-0.8.0.pill
boot: downloading azimuth snapshot from https://bootstrap.urbit.org/urbit-0.8.0.snap
boot: retrieving latest block
boot: retrieving ~hidrel-fabtel's public keys
boot: verifying keys
[ %key-mismatch
  \/349.187.856.326.866.811.103.197.737.268.023.226.701.086.993.827.261.027.75\/
    7.892.910.094.458.081.847.594.655.147.248.063.280.365.725.700.031.762.611.
    282.585.711.245.921.326.078.530.666.744.682.718.123.468.898
  \/                                                                          \/
  \/2.805.714.037.444.198.819.106.787.875.778.626.888.566.111.986.022.238.615.\/
    697.572.771.679.958.544.784.302.203.530.682.768.983.631.431.002.824.308.94
    4.262.937.679.030.973.513.507.765.894.708.055.313.556.832.866
  \/                                                                          \/
]
boot: invalid keys for planet '~hidrel-fabtel'
pre-boot error: %key-mismatch

#1370

@joemfb
Copy link
Member

joemfb commented Jul 23, 2019

This complicated way (and various variations on it) is precisely what we're trying to avoid by shipping the terminfo database in our release tarball. And all that works if you run urbit with a relative/full path, instead of just urbit, which is looked up in $PATH.

The reason it doesn't work is that we're setting $TERMINFO_DIRS, but just based on the string we used to run urbit (ie, argv[0]). For this to work in all situations, we need to be finding the full path to ourselves (the moral equivalent of lsof -p $PID | grep REG | head -n 1).

@joemfb
Copy link
Member

joemfb commented Jul 23, 2019

Presumably our ethereum node hasn't caught up to your configureKeys transaction. But that's just a guess, sorry.

@flowerornament
Copy link
Author

@joemfb it's a wild new world

@philipcmonk
Copy link
Contributor

philipcmonk commented Jul 23, 2019 via email

@flowerornament flowerornament changed the title Boot failed on macOS Boot failed on macOS: "terminals database is inaccessible" Jul 23, 2019
@flowerornament
Copy link
Author

flowerornament commented Jul 23, 2019

@philipcmonk I did. As you mentioned in urbit-help, I wonder if Bridge has a bug where it will download the old key with a new name. That said, when I downloaded it, I checked to make sure Bridge was telling me I was on revision 2.

For sure I was using hidrel-fabtel-2.key, and I tried once with the old key hidrel-fabtel-1.key after cycling keys just for kicks.

@flowerornament
Copy link
Author

Quick note, it looks like, if @joemfb is correct, I was able to boot a comet with sh because I used the absolute path (~/bin/urbit -c c3), not anything to do with using a different shell.

@eglaysher
Copy link
Contributor

@joemfb This, btw, is why I wrote the ssl certificates to a temp file on startup. If you're going the static binary route, you really can't make any assumptions about paths, how the binary will be invoked, etc.

@joemfb
Copy link
Member

joemfb commented Jul 23, 2019

I understand that, and was part of the discussion around those tradeoffs. How does that translate to a terminfo database? Do you think we should embed a tarball of the $TERMINFO_DIR in the binary?

I think that this is all just avoiding the problem of actually correctly cross-compiling ncurses. I believe all our target platforms already have a terminfo database at a predictable location, and we just need to build in such away as to be compatible with said database. But I haven't verified these things, and I don't know how, other than just diving in.

@eglaysher
Copy link
Contributor

Oh crap, I didn't realize the database wasn't a single file. Sorry for the noise. (But embedding libtar and a tar file is an option, I suppose.)

Also, there's a person on Twitter running into this same issue.

@benjamin-tlon
Copy link
Contributor

benjamin-tlon commented Jul 23, 2019 via email

@benjamin-tlon
Copy link
Contributor

benjamin-tlon commented Jul 23, 2019 via email

@vvisigoth
Copy link
Contributor

vvisigoth commented Jul 30, 2019 via email

@famousj
Copy link
Contributor

famousj commented Jul 30, 2019

I got this issue having untar-ed urbit to $HOME/bin. When I untar-ed to the same directory as my new pier and ran ./urbit it worked like a charm.

It might be worth adding some instructions to the docs to suggest booting the ship in the same place you extracted the urbit binaries.

@techanon
Copy link

My solution is via aliases. Here's how I have setup mine on my ubuntu server:

First, I have 2 shell scripts to handle the wrapping. One is for normal urbit runs, the other is a simple update manager.

urbit.sh

#!/usr/bin/env bash
cd -P ~/urbit/latest
./urbit $@

urbit-install.sh

#!/usr/bin/env bash
if [ "$1" = "" ]
then
        # missing version number argument
        echo 'Must provide a version number (eg. 0.8.1)'
        exit 1
fi
if [ ! -d ~/urbit/$1 ]
then
        # version directory doesn't exist, attempt to download
        mkdir -p ~/urbit/$1
        cd ~/urbit/$1
        curl -O https://bootstrap.urbit.org/urbit-linux64-v$1.tgz
        tar xzf urbit-linux64-v$1.tgz
        if [ ! -e ~/urbit/$1/urbit ]
        then
                # tarball failed, clean up files
                echo Failed to get Urbit v$1
                rm -rf ~/urbit/$1
                exit 1
        fi
        echo Installation complete for version $1
else
        echo Version $1 is already installed.
fi
# update symlink
ln -sf ~/urbit/$1 ~/urbit/latest
echo Active version set to: $1

I have stored these in my ~/bin folder for keeping.
Then in my ~/.profile I have added the following at the end of the file:

alias urbit="sh ~/bin/urbit.sh $@"
alias install-urbit="sh ~/bin/urbit-install.sh $@"

These in combination will use the ~/urbit directory for referencing all the things. The ~/urbit/latest points to the active version
And then I can do the following to boot up a dev ship on 0.8.1:

install-urbit 0.8.1
urbit -F zod

And it boots for me just fine.

@jtobin jtobin added the build label Aug 14, 2019
@drbeefsupreme
Copy link
Contributor

I ran into the same issue just now booting my ship for the first time, running Linux 64-bit (Manjaro) with the latest updates. Navigating bash into the directory that the urbit binary was located in ended up working.

@vvisigoth
Copy link
Contributor

@benjamin-tlon what is the status on this fix?

@drbeefsupreme
Copy link
Contributor

drbeefsupreme commented Sep 9, 2019

I messed around with this a bit more and realize my comment above was inaccurate. Here's 5 possible cases and their outcome. A fake zod already exists.

Context 1: urbit binary and /urbit-terminfo/ are in the same folder.
Case 1a: Bash is navigated to the same folder as the above. Then urbit zod works fine.
Case 1b: Bash is navigated to a different folder. Then urbit zod results in the terminals database is inaccessible error.

Context 2: urbit binary is in $PATH but a different folder from /urbit-terminfo/.
Case 2a: Bash is navigated to the same folder as /urbit-terminfo/. Then urbit zod works fine.
Case 2b: Bash is navigated to the same folder as urbit. Then urbit zod attempts to mine a comet.
Case 2c: Base is navigated to a different folder from both urbit and /urbit-terminfo/. Then urbit zod attempts to mine a comet.

The second context seems related but I can't know for sure. There doesn't seem to be an issue open for it that I can see.

EDIT: Realized I wasn't being clear saying "bash is in" - the bash binary is in usr/bin. I was speaking of what directory it is pointed to.

@flowerornament
Copy link
Author

Was just checking on NixOS/nixpkgs#65301 and noticed it was closed pending resolution of this issue.

@benjamin-tlon @jtobin @vvisigoth bump

@drbeefsupreme drbeefsupreme changed the title Boot failed on macOS: "terminals database is inaccessible" Boot failed on macOS and (some subset of) Linux: "terminals database is inaccessible" Sep 9, 2019
@joemfb
Copy link
Member

joemfb commented Jul 1, 2020

This is fixed in #3064.

@joemfb joemfb closed this as completed Jul 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests