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

System has not been booted with systemd as init system (PID 1). Can't operate. #2486

Closed
DogAttack3713 opened this issue Jul 3, 2022 · 13 comments
Labels
Question Stale Used to mark issues with inactivity

Comments

@DogAttack3713
Copy link

First Steps

  1. Confirm that your issue has not been posted previously by searching here: https://github.com/beefproject/beef/issues
  2. Confirm that the wiki does not contain the answers you seek: https://github.com/beefproject/beef/wiki
  3. BeEF Version: 1.2.0-1
  4. Ruby Version: 3.0.0157
  5. Browser Details (e.g. Chrome v81.0): firefox, chrome
  6. Operating System (e.g. OSX Catalina): Kali linux latest, using wsl2

Configuration

  1. Have you made any changes to your BeEF configuration? No
  2. Have you enabled or disabled any BeEF extensions? No

Steps to Reproduce

  1. IO installed beef successfully, and when i run the command sudo beef-xss and copy the web ui link, the page does not load.
  2. The same thing happens when i load beef start directly from the kali linux applications gui
  3. i get the message:
  4. [i] GeoIP database is missing
    [i] Run geoipupdate to download / update Maxmind GeoIP database
    [] Please wait for the BeEF service to start.
    [
    ]
    [] You might need to refresh your browser once it opens.
    [
    ]
    [] Web UI: http://127.0.0.1:3000/ui/panel
    [
    ] Hook: <script src="http://:3000/hook.js"></script>
    [*] Example: <script src="http://127.0.0.1:3000/hook.js"></script>

System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

[*] Opening Web UI (http://127.0.0.1:3000/ui/panel) in: 5... 4... 3... 2... 1...

Please can i have some suggestions as how to fix this, Thanks

@bcoles bcoles added the Question label Jul 3, 2022
@bcoles
Copy link
Collaborator

bcoles commented Jul 3, 2022

Presumably you are using WSL which does not use Systemd as an init system. If so, you cannot use the beef-xss wrapper because it uses systemd.

You can try running BeEFF manually.

cd /usr/share/beef-xss/
./beef

The beef-xss executable is part of the beef-xss package for your operating system.

It doesn't do anything particularly complicated. Simply checks if you're using the default password (which must be changed to start BeEF), checks if the geoip database is installed (geoip is optional), starts BeEF, and opens a web browser.

The systemd service (default: /lib/systemd/system/beef-xss.service) is simple. All it does is run /usr/share/beef-xss/beef.

You can open a browser yourself. BeEF prints the appropriate URLs to the terminal when started. It also runs on the loopback interface by default, so you can simply browse to http://127.0.0.1:3000/ui/panel.

@bcoles bcoles changed the title Cannot connect to beEF Web Ui server System has not been booted with systemd as init system (PID 1). Can't operate. Jul 3, 2022
@DogAttack3713
Copy link
Author

DogAttack3713 commented Jul 3, 2022 via email

@DogAttack3713
Copy link
Author

I tried the cd /usr/share/beef-xss/
./beef but it just says no such file or directory. Beef is 100% installed so im not sure why it does this. Any other suggestions? Thank you for your help

@bcoles
Copy link
Collaborator

bcoles commented Jul 3, 2022

I tried the cd /usr/share/beef-xss/ ./beef but it just says no such file or directory. Beef is 100% installed so im not sure why it does this. Any other suggestions? Thank you for your help

The beef-xss executable should be in your PATH. Find it and take a look at the source. Find the line that starts BeEF. It should look something like this:

[2022-07-03 10:27:56] root@kali:/# which beef-xss
/usr/bin/beef-xss
[2022-07-03 10:27:58] root@kali:/# grep "/usr/share/beef-xss" /usr/bin/beef-xss
       ruby2.7 /usr/share/beef-xss/set-new-pass.rb $config_file $PASSWD
[2022-07-03 10:28:02] root@kali:/# 

On my system it is installed in /usr/share/beef-xss.

@github-actions
Copy link
Contributor

This issue as been marked as stale due to inactivity and will be closed in 7 days

@github-actions github-actions bot added Stale Used to mark issues with inactivity and removed Stale Used to mark issues with inactivity labels Jul 10, 2022
@github-actions
Copy link
Contributor

This issue as been marked as stale due to inactivity and will be closed in 7 days

@github-actions github-actions bot added the Stale Used to mark issues with inactivity label Jul 22, 2022
@bcoles bcoles closed this as completed Jul 28, 2022
@Archilla1
Copy link

Hi! I do have the same issue!

[i] GeoIP database is missing
[i] Run geoipupdate to download / update Maxmind GeoIP database
[] Please wait for the BeEF service to start.
[
]
[] You might need to refresh your browser once it opens.
[
]
[] Web UI: http://127.0.0.1:3000/ui/panel
[
] Hook: <script src="http://:3000/hook.js"></script>
[*] Example: <script src="http://127.0.0.1:3000/hook.js"></script>

System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

[*] Opening Web UI (http://127.0.0.1:3000/ui/panel) in: 5... 4... 3... 2... 1...

opens browser and it says unable to connect. tried in Edge and chrome and nothing
After that, I went and located the file to run ./beef like @becoles said and it says this:

./beef
[17:11:03][!] Fatal Error: cannot load configuration file '/usr/share/beef-xss/./config.yaml' : uninitialized class variable @@instance in BeEF::Core::Configuration
Did you mean? instance_of?
[17:11:03][!] ["/usr/share/beef-xss/core/main/configuration.rb:16:in instance'", "/usr/share/beef-xss/core/ruby/print.rb:38:in print_debug'", "/usr/share/beef-xss/core/main/configuration.rb:48:in rescue in load'", "/usr/share/beef-xss/core/main/configuration.rb:43:in load'", "/usr/share/beef-xss/core/main/configuration.rb:28:in initialize'", "./beef:82:in new'", "./beef:82:in <main>'"] Traceback (most recent call last): 4: from ./beef:90:in

'
3: from /usr/share/beef-xss/core/main/configuration.rb:200:in get' 2: from /usr/share/beef-xss/core/main/configuration.rb:200:in inject'
1: from /usr/share/beef-xss/core/main/configuration.rb:200:in each' /usr/share/beef-xss/core/main/configuration.rb:201:in block in get': undefined method `[]' for nil:NilClass (NoMethodError)

@bcoles
Copy link
Collaborator

bcoles commented Aug 9, 2022

Hi! I do have the same issue!

#2486 (comment)

Fatal Error: cannot load configuration file '/usr/share/beef-xss/./config.yaml'

Looks like it is trying to load the configuration file from the same location as the executable.

The lazy option is to copy the config file to that directory. Although I wouldn't recommend it. It may be easier to simply clone from GitHub and install.

@Archilla1
Copy link

ok! so I tried doing :
sudo apt-get purge --auto-remove beef-xss
git clone https://github.com/beefproject/beef
cd beef
mkdir build
cd build
cmake ../
make
make install

Somehow it did not let me do cmake.. . it even asked me to download it no even knowing why because I used it for ettercap. This is the output:

cmake..
bash: cmake..: command not found

┌──(andre㉿Archilla-PC)-[~/beef/build]
└─$ cmake../
bash: cmake../: No such file or directory

┌──(andre㉿Archilla-PC)-[~/beef/build]
└─$ ls

┌──(andre㉿Archilla-PC)-[~/beef/build]
└─$ cd ..

┌──(andre㉿Archilla-PC)-[~/beef]
└─$ ls
arerules beef_key.pem config.yaml core docs Gemfile.lock install package.json README.md spec update-beef
beef BeEF.postman_environment.json _config.yml doc extensions generate-certificate INSTALL.txt package-lock.json RESTful-API.postman_collection.json test VERSION
beef_cert.pem build

it worked fine when I used it on ettercap, but no idea now. Should I try cmake in a different file such as install?

@bcoles
Copy link
Collaborator

bcoles commented Aug 10, 2022

git clone https://github.com/beefproject/beef/
cd beef
bundle install

@Archilla1
Copy link

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /tmp/bundler20220810-15045-rmuv7lsqlite3-1.4.4/gems/sqlite3-1.4.4/ext/sqlite3

/usr/bin/ruby3.0 -I /usr/lib/ruby/vendor_ruby -r ./siteconf20220810-15045-vz6rpq.rb extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'brew install sqlite3',
'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
and check your shared library search path (the
location where your sqlite3 shared library is located).
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/$(RUBY_BASE_NAME)3.0
--with-sqlcipher
--without-sqlcipher
--with-sqlite3-config
--without-sqlite3-config
--with-pkg-config
--without-pkg-config
--with-sqlcipher
--without-sqlcipher
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib

To see why this extension failed to compile, please check the mkmf.log which can be found here:

/tmp/bundler20220810-15045-rmuv7lsqlite3-1.4.4/extensions/x86_64-linux/3.0.0/sqlite3-1.4.4/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /tmp/bundler20220810-15045-rmuv7lsqlite3-1.4.4/gems/sqlite3-1.4.4 for
inspection.
Results logged to
/tmp/bundler20220810-15045-rmuv7lsqlite3-1.4.4/extensions/x86_64-linux/3.0.0/sqlite3-1.4.4/gem_make.out

/usr/lib/ruby/vendor_ruby/rubygems/ext/builder.rb:95:in run' /usr/lib/ruby/vendor_ruby/rubygems/ext/ext_conf_builder.rb:47:in block in build'
/usr/lib/ruby/3.0.0/tempfile.rb:317:in open' /usr/lib/ruby/vendor_ruby/rubygems/ext/ext_conf_builder.rb:26:in build'
/usr/lib/ruby/vendor_ruby/rubygems/ext/builder.rb:164:in build_extension' /usr/lib/ruby/vendor_ruby/rubygems/ext/builder.rb:198:in block in build_extensions'
/usr/lib/ruby/vendor_ruby/rubygems/ext/builder.rb:195:in each' /usr/lib/ruby/vendor_ruby/rubygems/ext/builder.rb:195:in build_extensions'
/usr/lib/ruby/vendor_ruby/rubygems/installer.rb:851:in build_extensions' /var/lib/gems/3.0.0/gems/bundler-2.3.14/lib/bundler/rubygems_gem_installer.rb:71:in build_extensions'
/var/lib/gems/3.0.0/gems/bundler-2.3.14/lib/bundler/rubygems_gem_installer.rb:28:in install' /var/lib/gems/3.0.0/gems/bundler-2.3.14/lib/bundler/source/rubygems.rb:204:in install'
/var/lib/gems/3.0.0/gems/bundler-2.3.14/lib/bundler/installer/gem_installer.rb:54:in install' /var/lib/gems/3.0.0/gems/bundler-2.3.14/lib/bundler/installer/gem_installer.rb:16:in install_from_spec'
/var/lib/gems/3.0.0/gems/bundler-2.3.14/lib/bundler/installer/parallel_installer.rb:186:in do_install' /var/lib/gems/3.0.0/gems/bundler-2.3.14/lib/bundler/installer/parallel_installer.rb:177:in block in
worker_pool'
/var/lib/gems/3.0.0/gems/bundler-2.3.14/lib/bundler/worker.rb:62:in apply_func' /var/lib/gems/3.0.0/gems/bundler-2.3.14/lib/bundler/worker.rb:57:in block in process_queue'
/var/lib/gems/3.0.0/gems/bundler-2.3.14/lib/bundler/worker.rb:54:in loop' /var/lib/gems/3.0.0/gems/bundler-2.3.14/lib/bundler/worker.rb:54:in process_queue'
/var/lib/gems/3.0.0/gems/bundler-2.3.14/lib/bundler/worker.rb:91:in `block (2 levels) in create_threads'

An error occurred while installing sqlite3 (1.4.4), and Bundler cannot continue.

In Gemfile:
sqlite3

Bundler::GemNotFound: Could not find xmlrpc-0.3.2.gem for installation
/var/lib/gems/3.0.0/gems/bundler-2.3.14/lib/bundler/source/rubygems.rb:181:in install' /var/lib/gems/3.0.0/gems/bundler-2.3.14/lib/bundler/installer/gem_installer.rb:54:in install'
/var/lib/gems/3.0.0/gems/bundler-2.3.14/lib/bundler/installer/gem_installer.rb:16:in install_from_spec' /var/lib/gems/3.0.0/gems/bundler-2.3.14/lib/bundler/installer/parallel_installer.rb:186:in do_install'
/var/lib/gems/3.0.0/gems/bundler-2.3.14/lib/bundler/installer/parallel_installer.rb:177:in block in worker_pool' /var/lib/gems/3.0.0/gems/bundler-2.3.14/lib/bundler/worker.rb:62:in apply_func'
/var/lib/gems/3.0.0/gems/bundler-2.3.14/lib/bundler/worker.rb:57:in block in process_queue' /var/lib/gems/3.0.0/gems/bundler-2.3.14/lib/bundler/worker.rb:54:in loop'
/var/lib/gems/3.0.0/gems/bundler-2.3.14/lib/bundler/worker.rb:54:in process_queue' /var/lib/gems/3.0.0/gems/bundler-2.3.14/lib/bundler/worker.rb:91:in block (2 levels) in create_threads'

An error occurred while installing xmlrpc (0.3.2), and Bundler cannot continue.

In Gemfile:
xmlrpc

Im sorry for this mess

@bcoles
Copy link
Collaborator

bcoles commented Aug 10, 2022

You'll need to install some operating system packages.

Likely these:

sudo apt-get install curl git build-essential openssl libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev autoconf libc6-dev libncurses5-dev automake libtool bison nodejs libcurl4-openssl-dev

And these:

sudo apt-get install ruby ruby-dev

@bcoles
Copy link
Collaborator

bcoles commented Aug 10, 2022

This issue is about systemd error on WSL. #2486 (comment)

Closing.

@beefproject beefproject locked as resolved and limited conversation to collaborators Aug 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Question Stale Used to mark issues with inactivity
Projects
None yet
Development

No branches or pull requests

3 participants