Keep having to start ElasticSearch on Ubuntu start up - ruby-on-rails

I am using the latest Ubuntu build 15.10 and have gone through the install of ElasticSearch here: https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-service.html
However, even after executing the command that adds the service to the start up process.
sudo update-rc.d elasticsearch defaults 95 10
sudo /etc/init.d/elasticsearch start
Rebooting the computer, then going to localhost:9200 gives a 404.
And every single morning I run the sudo /etc/init.d/elasticsearch start, then the sudo update-rc.d elasticsearch defaults 95 10 in hopes that tomorrow will be a different day, to find my machine in the exact same state as yesterday.
On a side note, my machine at work uses the same version of Ubuntu and the steps described above worked on the first try.
If anyone has overcome this issue, your insight would be very appreciated!
Thanks you!

Ubuntu, since version 15.04, is using systemd by default instead of the older upstart for handling services and init scripts. I think you need to initialize elasticsearch differently, as described in the ES docs.
Something like:
sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.service
sudo /bin/systemctl start elasticsearch.service

Related

Cannot update snap namespace: cannot create symlink in "/etc/docker": existing file in the way

The Docker command is not working after restarting (using sudo reboot) the Ubuntu (20.04) server.
Now, for any command with docker, it gives me an error. For example,
$ docker --help
cannot update snap namespace: cannot create symlink in "/etc/docker": existing file in the way
snap-update-ns failed with code 1
When I manually check, there is a file called key.json in the /etc/docker folder which has a json dictionary.
Before restarting, I have had few docker containers running in the background with volume connected. When I run systemctl start docker as mentioned in one StackOverflow answer, I am getting
Failed to start docker.service: Unit docker.service not found.
It would be great at least to recover the docker images that were there before restarting.
-- Edit --
For some reason, docker is working now. I have restarted once again after the initial restart which resulted in the error. But there was no improvement. However, it is working fine now. I do not know what solved the issue, maybe the cmd journalctl -u docker.service (as suggested in a comment) help in some way, or some other reason.
So, It would be great if someone can answer what was the initial reason for the trouble? It might help us to avoid this in the future.
It looks like a Snap-related Issue.
I Found a fix on the SnapCraft forum here :
https://forum.snapcraft.io/t/layouts-still-brittle-when-refreshing-snaps/26252/5
sudo rm -rf /etc/docker
sudo snap refresh
Works in both Ubuntu 18.04.5 and 20.04.5 LTS.

Neo4j can be started, but it can't be stopped by regular 'neo4j stop' command

I am using DigitalOceans' Ubuntu 16.04 and I am having trouble understanding of why I can successfully start Neo4j by typing sudo neo4j start, but I can not stop it by sudo neo4j stop: it is always writing for me that neo4j is not running. I did ps aux command and figured out that neo4j is run under the name java:
So, I can restart neo4j by doing kill -15 31905, and then sudo neo4j start. Could anyone explain in detail what is going on here? Why sudo neo4j stop is not working?
You know, I've looked at the code to do stop, and I can't figure out how it ever worked, at least in 3.X. But then Java isn't my best language. Could I suggest an alternative? Assuming you installed with the Debian Neo4j package, it includes the proper control files to start under systemd. This is the recommended way to start neo4j. So to start it, use
sudo systemctl start neo4j
to make sure it restarts after a boot:
sudo systemctl enable neo4j
to stop:
sudo systemctl stop neo4j
and finally, to make sure it doesn't restart after a boot,
sudo systemctl disable neo4j
Should work far better than the neo4j start/stop interface, and give you the advantages of systemd, like being able to examine the standard output, query the current status, etc. This also restarts neo4j if it dies for any reason.

InfluxDB on Windows Subsystem for Linux "cannot allocate memory"

On Windows Subsystem for Linux running Ubuntu 16.04, I've installed InfluxDB 1.4.2 according to the Influx documentation. I can't run it as a service or with systemctl, probably because WSL doesn't support that (see GitHub issues 994 and 1579), so neither of these work:
$ sudo service influxdb start
influxdb: unrecognized service
$ sudo systemctl start influxdb
Failed to connect to bus: No such file or directory
If I run $ sudo influxd, Influx starts, but then crashes with the message
run: open server: open tsdb store: cannot allocate memory
How do I fix the "cannot allocate memory" error?
On Win10 Spring 2018 Update, I ran the following:
sudo apt install influxdb influxdb-client -y
Installed fine.
As per the docs …
… started the service using:
sudo service influxdb start
Started fine:
Let's connect, examine and create a database:
Please let me know if I've done anything wrong here to repro, otherwise, looks like this issue has been resolved.
I just had this problem when installing in WSL but systemd was installed. When installing the influxdb package it registered a systemd unit so I was unable to start it using init.d. I solved this using this guide. Instead of the dead link to the init.sh script i searched for an older version and found this.
Steps to get InfluxDB working in WSL (at least when systemd is installed):
Install influxdb using sudo apt install influxdb
Copy the content of this file into a new file at location /etc/init.d/influxdb
You can now start influxdb using sudo service influxdb start.
For me it showed an error message while starting but it still started correctly.

Error while starting docker daemon

I get following error when starting Docker daemon from command line:
Error starting daemon: error while opening volume store metadata database: timeout
OS is Linux.
Any pointer how can I resolve this?
(Google search didn't yield anything)
It depends on your exact Linux distro, and docker version.
See for instance issue 26022: it has the same error message on Fedora after a
yum -y install docker-engine-1.13.1-1.el7.centos
Try and follow again the full installation procedure for your exact distro.
After investigating a lot and trying many commands, this has worked for me:
*Do not use '&&' to make the most compact command or otherwise it will not work.
sudo rm /var/run/docker.pid
sudo systemctl stop docker.socket
sudo systemctl stop docker
systemctl start docker
systemctl enable docker
sudo systemctl start docker
If this error appears ( running $ docker [command] ):
Cannot connect to the Docker daemon at unix:///home/mg/.docker/desktop/docker.sock. Is the docker daemon running?
The first thing you should do is to have Docker Desktop installed on your pc, of which you can get here https://docs.docker.com/desktop/windows/wsl/
You should also enable wsl2, Just going through the documentation from the link above should be enough.
Also make sure Settings > General > Use the WSL 2 based engine... box is checked.
REFERENCE https://stackoverflow.com/a/72890783/21061651

Jenkins Setup Wizard Blank Page

I have just installed Jenkins on my RHEL 6.0 server via npm:
npm -ivh jenkins-2.7.2-1.1.noarch.rpm
I have also configured my port to be 9917 to avoid clashing with my Tomcat server, allowing me to access the Jenkins page at ipaddress:9917. After entering the initial admin password at the Unlock Jenkins page, I am presented with a blank page, with the header "SetupWizard [Jenkins]".
Anyone knows why am I getting a blank page, and how do I solve it?
I experienced the same problem but a simple restart fixed it .
Just try this :-
sudo service jenkins stop
sudo service jenkins start
targeting the url to https://../jenkins/index
appeared to solve the problem in most cases.
even if the first time, Browser's back button once on the blank page after the wizard finished sent me to the working page: http//:websiteDomain/login?from=%2
In my case I used (jenkins/jenkins lts) the official docker image
After getting Jenkins Setup Wizard Blank Page http://localhost:8080/index works for me.
I was having the same issue, but I am using the default port 8080. I installed jenkins in this way: yum install jenkins
Then I executed:
systemctl start.jenkins
systemctl enable.jenkins
then allow 8080 on the firewall:
sudo firewall-cmd --zone=public --permanent --add-port=8080/tcp
sudo firewall-cmd --reload
And the part that was missing (at least for me) was :
systemctl daemon-reload
After that the installation came normally. I Hope this can be usefull for someone else.
cheers
I had same issue on macOS Sierra 10.12 and just had to restart the daemon.
sudo launchctl unload -w /Library/LaunchDaemons/org.jenkins-ci.plist
sudo launchctl load -w /Library/LaunchDaemons/org.jenkins-ci.plist
I too had same problem. But I'm using jenkins in docker container. So i did below after that it started to work.
docker stop my_container_name
docker start my_container_name
For your case, you should restart your jenkins if you are using linux
sudo service jenkins stop
sudo service jenkins start
Stopping and starting jenkins service made it work for me in windows.
I found out that after I opened the port 9917 in my firewall,the blank pages error stopped and I can continue with the setup just fine.
I had the same issue on Windows. I went to the Windows Services and found Jenkins there as a service. I stopped the service and started again and then I could see the page.
I also faced this problem
Restarting the service fixed it
sudo systemctl stop jenkins
sudo systemctl start jenkins
sudo systemctl status jenkins
Try with make a request to you jenkins url
curl http://<your jenkins host>:<your port>
Managed to fixe it by changing the port.(windows10)
First you open the command line and proceed to:
cd ..
cd ..
cd "Program Files (x86)" (or wherever you have the jenkins folder)
cd jenkins
dir
java -jar jenkins.war --httpPort=8081
by doing this you´re changing jenkins localhost port from 8080 to 8081 avoiding any conflits.
Warning :do not close the command line after its done , make sure its open before you enter localhost:8081
On macOS, same as Linux, I had to stop/start jenkins service to make it work
sudo launchctl unload /Library/LaunchDaemons/my.jenkins.plist
sudo launchctl load -w /Library/LaunchDaemons/my.jenkins.plist
If you happened to run Jenkins using generic Java war file, a restart will be required after finishing installation. Stop the java (using Ctrl+C if you on shell), then start again using
$ java -jar jenkins.war --httpPort=3001
Note: My jenkins run on port 3001
For the record, this problem was corrected in 2.195, thanks to Bogdan Sukonnov in https://issues.jenkins-ci.org/browse/JENKINS-59017.

Resources