« first day (1830 days earlier)   

12:37 AM
This looks like a clear VTC:
Q: Disable eth0 for the current session

AaronIs there a way to disconnect eth0 (wired connection) for just until I reboot? Or even a way to just bring it down then up again before I shut the computer down? I want to do this because sometimes I want to be on Wi-Fi and when the signal gets low, it hops back to eth0, even if I manually disconn...

Seems to me to be a dupe of
Q: How can I restart a network interface?

user20672How can I restart a network interface? I have a vm that doesn't update its IP address correctly when switching between home and work. The vm runs Ubuntu server and uses a bridged network adapter.

But there are other candidates.
While I'm about it, I also VTC
Q: How to change configuration of eth0 without restarting other interface (CentOS, Redhat)

PetrI need to setup a static IP for eth0, my server has multiple network interfaces and I don't want to bring any of them, except for eth0 down. I found lot of guides like https://www.howtoforge.com/linux-basics-set-a-static-ip-on-centos but all of them ends with "now restart networking" or "now reb...

as a dupe of the same 2012 question.
6 hours later…
6:26 AM
Just a reminder of the existence of:
Q: Getting to know you: who are you and why do spend time on unix.sx?

Faheem MithaI thought it would be a nice idea if we could have a question thread where everyone posts an answer where they introduce themselves, talk about themselves a little bit, and tell the community their motivation for participating on this site (unix.stackexchange.com). Some SE sites don't have much ...

in case anyone wants to add an answer.
12 hours later…
6:42 PM
is anyone willing to help me get tomcat to install properly? I have been trying various tutorial instructions, but they seem to cause failures:
Q: tomcat 8 will not start after initial install

CodeMedI am trying to install tomcat on a new CentOS 7 virtual machine. I successfully unstalled apache httpd, and am able to get the apache test page when I type the ip of the virtual machine into a web browser on another computer in the network. But I am getting the following error message when I ty...

@CodeMed suggestion for a quick-edit -- "I successfully unstalled apache httpd" should be "...installed" or "uninstalled"
also, I'm not too familiar with systemd; did you include the output of "journalctl -xn" ?
@JeffSchaller Thank you. Done. I installed httpd and httpd works.
# journalctl -xn
No journal files were found.
might be worth adding, just for completeness. also, the systemd config file has a piece that I'm not sure about "Environment=JAVA_HOME=/usr/lib/jvm/jre" -- does that directory exist for you?
(because above in the java install, you have "export JAVA_HOME=/opt/jdk1.8.0_60")
# cd /usr/lib/jvm/jre
-bash: cd: /usr/lib/jvm/jre: No such file or directory
that could be a stumbling block, if tomcat can't find java. last I knew, there was a tomcat startup script; have you tried starting it manually, outside of systemd? I would get that working before trying systemd.
6:51 PM
# java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
/opt/tomcat/bin/startup.sh looks like it might be the startup script I'm thinking of, although I thought it was called catalina.sh; anyway, it should be setting its own java-type variables and starting on its own.
i have always used startup.sh and shutdown.sh, but I thought i would try the approach in the tutorial because it seemed more linux
in the config file, I changed JAVA_HOME to /opt/jdk1.8.0_60 but am still getting a start error
well, I don't want to derail you, but just in the interest of simplifying to troubleshoot the failure, I was curious to see if tomcat would start on its own or not, apart from systemd
[user@localhost java]$ cd /opt/tomcat
[user@localhost tomcat]$ startup.sh
-bash: startup.sh: command not found
./startup.sh ?
6:57 PM
[user@localhost tomcat]$ ./startup.sh
-bash: ./startup.sh: No such file or directory
ahh - apparently it's in the bin/ subdirectory -- ExecStart=/opt/tomcat/bin/startup.sh
how do i translate that into an action?
[user@localhost tomcat]$ sudo /opt/tomcat/bin/startup.sh
Using CATALINA_BASE: /opt/tomcat
Using CATALINA_HOME: /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME: /
Using CLASSPATH: /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar
Tomcat started.
[user@localhost tomcat]$
excellent! so tomcat itself starts -- and stays running, I assume? (ps -ef | grep tomcat)
if so, then you've narrowed it down to a systemd issue, which I am pretty ignorant of
also, take this with a grain of salt, but seeing JRE_HOME being " / " seems odd to me.
I would have expected something more java-ish, like what you had after the java install, of /opt/jdk1.8.0_60/jre
7:08 PM
# ps -ef | grep tomcat
root 21018 1 0 12:02 pts/0 00:00:02 //bin/java -Djava.util.logging.config.file=/opt/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/opt/tomcat/endorsed -classpath /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar -Dcatalina.base=/opt/tomcat -Dcatalina.home=/opt/tomcat -Djava.io.tmpdir=/opt/tomcat/temp org.apache.catalina.startup.Bootstrap start
trees_g+ 21045 20719 0 12:06 pts/0 00:00:00 grep --color=auto tomcat
so I guess ignore my comment on JRE_HOME, and now the problem seems to be systemd -- maybe shut tomcat down and try systemd again?
@CodeMed, sorry, this link is about Arch, but it has some specific tomcat + systemd instructions that might be helpful. wiki.archlinux.org/index.php/Tomcat
specifically: "Apart from installing the desired JRE/JDK, the only requirement is to set the TOMCAT_JAVA_HOME variable in Tomcat's systemd service file"
@JeffSchaller The essence of the tomcat logs is permission denied stuff when tomcat is turned off and i try to use systemctl. sorry for the delay, but the logs from the failed login are long and it took a while to cut and paste;
java.util.logging.ErrorManager: 4
java.io.FileNotFoundException: /opt/tomcat/logs/catalina.2015-10-13.log (Permission denied)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
at org.apache.juli.FileHandler.openWriter(FileHandler.java:384)
at org.apache.juli.FileHandler.<init>(FileHandler.java:96)
at org.apache.juli.AsyncFileHandler.<init>(AsyncFileHandler.java:71)
at org.apache.juli.AsyncFileHandler.<init>(AsyncFileHandler.java:67)
7:23 PM
maybe the manual startup used one user (root?) and the systemctl is using a different user (tomcat?) that can't write there? what's the output of: ls -l /opt/tomcat/logs/catalina.2015-10-13.log
# ls -l /opt/tomcat/logs/catalina.2015-10-13.log
-rw-r--r--. 1 root root 6550 Oct 13 12:14 /opt/tomcat/logs/catalina.2015-10-13.log
both startup commands are sudo from the same sudoer
hmm! I wonder if systemd is switching the user to tomcat, which then wouldn't have permissions on that file. quick fix: sudo chown tomcat /opt/tomcat/logs/catalina.2015-10-13.log
the logs directory itself should probably have tomcat ownership or group-writability too
hmm - your tomcat install transcript says you did it: "# sudo chown -R tomcat work/ temp/ logs/
I would re-run that command, at least for the logs portion ---- sudo chown -R tomcat /opt/tomcat/logs
i will do what you suggested now. but here is what i just did. for kicks, i opened port 8080 in firewalld then typed cm.ip.addr;8080 in the browser from a different computer on the network, and it gave me:
HTTP Status 500 - java.lang.IllegalStateException: No output folder

type Exception report

message java.lang.IllegalStateException: No output folder

description The server encountered an internal error that prevented it from fulfilling this request.


org.apache.jasper.JasperException: java.lang.IllegalStateException: No output folder
unix.stackexchange.com/questions/235899/… ← for some reason, very tempted to put a BS answer on that.
I think something like....
all: server
    echo -e "#!/bin/sh\nwhile true; do echo 'Hello, this is a simple server' | nc -l -p 1237; done" > "$@"
    chmod +x "$@"
ok. then i started tomcat using the sudo /path/to/startup.sh (DOH!) and tomcat gives a 404 in the browser.
7:36 PM
... I believe that Makefile (well, once you put tabs in there instead of spaces) satisfies all requirements of the homework assignment, while also receiving a 0.
@CodeMed does your distro not provide Tomcat packages you could use? Though a 404 error could just mean you don't have your webapp configured correctly...
@derobert I am sending a war over to the server now to test
@derobert part of that Q asks "Could anybody help me with understanding what do I have to do?" which reminds me of a phrase I heard recently: "I can explain it for you, but I cannot understand it for you"
@JeffSchaller Hah, yeah. I tried in a comment there. But it sounds like a homework assignment, which would hopefully mean there is a teacher who can spend some time actually explaining it, in person, answering questions, etc... That teacher would have a much better time at it than we do.
i put a war in /opt/tomcat/webapps, but when i type the ip of the vm in the browser of another computer on the network, i get a 404, then i refresh and get a 500. then i refresh and get a 404. and so on as the cycle repeats
I would suspect permissions again, @CodeMed
7:48 PM
@CodeMed You'd need to check the tomcat logs. Hopefully there is something there. Probably 10 pages of exceptions, as is the Java tradition.
here is the theme:
13-Oct-2015 12:41:13.150 SEVERE [main] org.apache.coyote.AbstractProtocol.init Failed to initialize end point associated with ProtocolHandler ["http-nio-8080"]
java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:340)
address already in use/failed-to-connect. or permission denied, depending on the circumstances.
i could resort to installing tomcat as root, and bypassing systemd altogether. that would work. i guess i am reaching out for a more elegant linux approach without the security risk of running it as root.
"address already in use" implies to me that there's already a tomcat running
@JeffSchaller Yes. I typed systemctl stop tomcat.service and got no error. then i typed /opt/tomcat/bin/shutdown.sh and got an error indicating it was already shut down. then i typed /opt/tomcat/startup.sh and got a startup success message. then i typed the server ip address:8080 in browser from a different computer on the network and got the tomcat manager app homepage. ...
i did all this as root.
i was reaching out to avoid having to resort to running tomcat as root.
success! insecure success, but at least the pieces all connected. given that it started as root, though, I suspect you'll have to re-do ownerships & permissions before it'll work cleanly as tomcat
(since tomcat won't be able to append to log files, as you saw, or re-deploy war files)
8:03 PM
you gave three commands above that i have not typed yet:
chown tomcat /opt/tomcat/logs/catalina.2015-10-13.log
chown -R tomcat work/ temp/ logs/
chown -R tomcat /opt/tomcat/log
they were in your question as (implied) commands that you had run?!?
yes i ran the commands in the OP, but not again when you said to. i just ran them now again.
right; since tomcat-the-app started as root, I'm sure root owns several files and/or directories now -- ones that tomcat will want to write to
what a mess
is there a clean easy way to clean it up?
it seems to me that those are reasonable commands:
# cd /opt/tomcat
# sudo chgrp -R tomcat conf
# sudo chmod g+rwx conf
# sudo chmod g+r conf/*
# sudo chown -R tomcat work/ temp/ logs/
(after shutting down tomcat)
8:16 PM
ok. so now i can sudo systemctl start tomcat
and the tomcat manager app shows up in the browser when when a user on a different computer in the network calls the vm ip
but to me that seems i am running tomcat as root.
we may have resolved the problem by rerunning the commands as you suggested, in conjunction with changing the java home property in the config, but i would like to understand how it works.
ps -ef | grep tomcat ## and see if it's root or tomcat that owns the process
ps -ef | grep tomcat ##
user_na+ 21691 20719 0 13:26 pts/0 00:00:00 grep --color=auto tomcat
does this mean that user_name owns tomcat instead of root or tomcat?
you found your own grep instead of the tomcat process
was there any other output?
ps -ef | grep '[t]omcat' # get around grep finding itself. just a random tip.
I think we have a question about that, there are some other tricks too. And of course things like pgrep
8:31 PM
probably pgrep java
thought I forget how to tell it to show more args, to distinguish from other random java apps running
that is the only output. and then ps -ef | grep '[t]omcat' # gives no output at all, just another command prompt
then I'm not sure how tomcat is running :)
tomcat had stopped. i just did systemctl start tomcat to get it going again.
ps -ef | grep tomcat ##
tomcat 21714 1 21 13:34 ? 00:00:01 /opt/jdk1.8.0_60/bin/java -Djava.util.logging.config.file=/opt/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom -Xms512M -Xmx1024M -server -XX:+UseParallelGC -Djava.endorsed.dirs=/opt/tomcat/endorsed -classpath /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar -Dcatalina.base=/opt/tomcat -Dcatalina.home=/opt/tomcat -Djava.io.tmpdir=/opt/tomcat/temp org.apache.catalina.startup.Bootstrap start
ps -ef | grep '[t]omcat' #
tomcat 21714 1 2 13:34 ? 00:00:01 /opt/jdk1.8.0_60/bin/java -Djava.util.logging.config.file=/opt/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom -Xms512M -Xmx1024M -server -XX:+UseParallelGC -Djava.endorsed.dirs=/opt/tomcat/endorsed -classpath /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar -Dcatalina.base=/opt/tomcat -Dcatalina.home=/opt/tomcat -Djava.io.tmpdir=/opt/tomcat/temp org.apache.catalina.startup.Bootstrap start
do these results tell us who owns tomcat?
yep! tomcat does! column 1
the ##'s at the end were just my lazy way of putting a comment at the end of a command
ok. so, the instructions in the op set tomcat so no one can log in as tomcat, and we need sudo to start and stop tomcat, then how does tomcat work? is the tomcat program itself like an AI artifificial user?
9:01 PM
it's what people will sometimes call an application-user or daemon-user; it exists as a "user" but not an interactive one.
Thank you. I have read about that, but this exercise of building another server is another chance to see it. I think the question is answered. Thank you very much. If you feel like writing up an answer, I would be happy to mark it accepted and +1. a couple additional steps were required in addition to what the other person wrote in their answer.
9:13 PM
no need to wait for me -- feel free to capture it yourself and self-answer. I tend to get my reputation in 2-point bundles (reviewing/editing) and less in actual answers.
heading offline - have a good night!
9:51 PM
@CodeMed Why are you not using your distribution's binary package for Tomcat?
10:16 PM
@FaheemMitha because i googled install tomcat in centos 7 and followed tutorials. is there a more centos-friendly way that you can suggest?
@CodeMed Check if there is a tomcat package for centos.
If there is, use it. If there isn't, you could check for a compatible RH tomcat rpm and use that.
You might have to rebuild it on your system, but hopefully that wouldn't be a problem.
Doing a local installation for a system thing is not usually optimal.
@CodeMed See for example rpmfind.net/linux/rpm2html/…
I don't know pkgs.org, but searching there gives some hits.
Or maybe better - pkgs.org/download/tomcat
The CentOS rpms appear to come from something called "CentOS Updates".
10:53 PM
I am in virsh. When I type list --all, four virtual machines are listed. when I type shutdown vm-name, the response is a message saying that vm-name is being shut down. but then even 20 minutes later, the results of list --all are the same, showing all four virtual machines running. i am googling this, but the solution is not clear. does anyone know a fast way to kill a vm is shutdown does not work?
rebooting the physical serverbox shut them all down. but that is not a complete solution.

« first day (1830 days earlier)