Init Enclave Failed SGX_ERROR_UNEXPECTED

I’m trying to launch the network for the first time in simulation mode with sudo ./launch.bash -t -s but I am getting SGX_ERROR_UNEXPECTED in enigma_core_1, and enigma_surface_1 stays on

enigma_surface_1: Waiting for enigma_core_1...

Here is the output of enigma_core_1:

    Finished release [optimized] target(s) in 6.77 secs
Cargo  =>  bin/app
mkdir -p ./bin
cp ./app/target/release/enigma-core-app ./bin/enigma-core-app
make -C ./enclave/
make[1]: Entering directory '/root/enigma-core/enigma-core/enclave'
cargo build --release  
   Compiling enigma-core-enclave v0.1.5 (file:///root/enigma-core/enigma-core/enclave)
    Finished release [optimized] target(s) in 9.5 secs
cp ./target/release/libenigmacoreenclave.a ../lib/libenclave.a
make[1]: Leaving directory '/root/enigma-core/enigma-core/enclave'
make -C /root/sgx/compiler-rt/ 2> /dev/null
make[1]: Entering directory '/root/sgx/compiler-rt'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/root/sgx/compiler-rt'
cp /root/sgx/compiler-rt/libcompiler-rt-patch.a ./lib
LINK =>  enclave/enclave.so
<!-- Please refer to User's Guide for the explanation of each field -->
<EnclaveConfiguration>
    <ProdID>0</ProdID>
    <ISVSVN>0</ISVSVN>
    <StackMaxSize>0x40000</StackMaxSize>
    <HeapMaxSize>0x100000</HeapMaxSize>
    <TCSNum>1</TCSNum>
    <TCSPolicy>1</TCSPolicy>
    <DisableDebug>0</DisableDebug>
    <MiscSelect>0</MiscSelect>
    <MiscMask>0xFFFFFFFF</MiscMask>
</EnclaveConfiguration>
tcs_num 1, tcs_max_num 1, tcs_min_pool 1
The required memory is 3497984B.
Succeed.
SIGN =>  bin/enclave.signed.so
[+] Home dir is /root
[+] Home dir is /root
[+] Created new .enigma folder => "/root/.enigma"
[-] Open token file /root/.enigma/enclave.token error! Will create one.
[-] Init Enclave Failed SGX_ERROR_UNEXPECTED!
root@enigma_core_1:~# aesm_service[135]: SGX Service unavailable
aesm_service[135]: Fail to start service.

Why is an enclave not intialized? My processors are AMD not Intel.

After further investigation, it seems that SGX may not run on an AMD processor, even in simulation mode. I tried the helloworld example code from the SGX package and it still did not work.

I tried to run the nodes on an Intel processor and I had no problems.

If you get the above error, make sure you are using an Intel processor, you can check with lscpu.

1 Like

Thanks @myked for reporting this error and tracking it down to the processor manufacturer, I am sure it will be of help to others that wonder if they can run it in other architectures.

I am getting this issue running simulation mode on both an AMD (AMD Ryzen 7 2700X) and Intel (Intel i7-4720Hq - lacks SGX support) processor. Does simulation mode require a machine with SGX support?

core_1      | [-] Create .enigma folder => AlreadyExists
core_1      | The current directory is /root/enigma-core/enigma-core/app
core_1      | [-] Open token file /root/.enigma/enclave.token error! Will create one.
core_1      | 15:24:14 [INFO] init_enclave_wrapper() => Err(SGX_ERROR_UNEXPECTED)
core_1      | thread 'main' panicked at '[-] Init Enclave Failed: SGX_ERROR_UNEXPECTED', src/libcore/result.rs:999:5
core_1      | stack backtrace:
core_1      |    0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
core_1      |              at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
core_1      |    1: std::sys_common::backtrace::_print
core_1      |              at src/libstd/sys_common/backtrace.rs:71
core_1      |    2: std::panicking::default_hook::{{closure}}
core_1      |              at src/libstd/sys_common/backtrace.rs:59
core_1      |              at src/libstd/panicking.rs:197
core_1      |    3: std::panicking::default_hook
core_1      |              at src/libstd/panicking.rs:211
core_1      |    4: std::panicking::rust_panic_with_hook
core_1      |              at src/libstd/panicking.rs:474
core_1      |    5: std::panicking::continue_panic_fmt
core_1      |              at src/libstd/panicking.rs:381
core_1      |    6: rust_begin_unwind
core_1      |              at src/libstd/panicking.rs:308
core_1      |    7: core::panicking::panic_fmt
core_1      |              at src/libcore/panicking.rs:85
core_1      |    8: core::result::unwrap_failed
core_1      |              at /rustc/6afcb5628523b0baae5704ad34ac1aba8ba10de6/src/libcore/macros.rs:18
core_1      |    9: core::result::Result<T,E>::expect
core_1      |              at /rustc/6afcb5628523b0baae5704ad34ac1aba8ba10de6/src/libcore/result.rs:827
core_1      |   10: enigma_core_app::main
core_1      |              at src/main.rs:27
core_1      |   11: std::rt::lang_start::{{closure}}
core_1      |              at /rustc/6afcb5628523b0baae5704ad34ac1aba8ba10de6/src/libstd/rt.rs:64
core_1      |   12: std::panicking::try::do_call
core_1      |              at src/libstd/rt.rs:49
core_1      |              at src/libstd/panicking.rs:293
core_1      |   13: __rust_maybe_catch_panic
core_1      |              at src/libpanic_unwind/lib.rs:85
core_1      |   14: std::rt::lang_start_internal
core_1      |              at src/libstd/panicking.rs:272
core_1      |              at src/libstd/panic.rs:388
core_1      |              at src/libstd/rt.rs:48
core_1      |   15: std::rt::lang_start
core_1      |              at /rustc/6afcb5628523b0baae5704ad34ac1aba8ba10de6/src/libstd/rt.rs:64
core_1      |   16: main
core_1      |   17: __libc_start_main
core_1      |   18: _start

Intel CPU makes it farther and km_1 and contract_1 starts outputting
but on both
p2p_1 | p2p_1: Waiting for core_1...

1 Like

After another look it looks like on AMD - has error

km_1        | [-] Open token file /root/.enigma/enclave.token error! Will create one.
km_1        | thread 'main' panicked at '[-] Init Enclave Failed: SGX_ERROR_UNEXPECTED', src/libcore/result.rs:999:clock5: 

but on Intel it does not

1 Like

Hi @izokay can you confirm you’re working with the latest beta release? Our MVT release is deprecated.

to your first question-- simulation mode does not require SGX support. However, HW mode is the default so you need to modify the setup to run in simulation mode (as the README describes).

Yes I was using discovery release in SW mode. I ended up using an IBM cloud bare metal server instead of my hardware.

@izokay: I’m regularly using Discovery in SW mode on my Mac laptop that does not have SGX support, but it’s an Intel machine after all.

1 Like

Probably just a mistake on my part somewhere. No error on the bare metal server with sgx support. both running ubuntu 16.04.

2 Likes