Rough Book

random musings of just another computer nerd

Tag: ubuntu

Getting artifactory running on Ubuntu 18.04

I was trying to get the Artifactory OSS 6.3.3 running on Ubuntu 18.04 and ran into issues described in RTFACT-16909. The issue is that there are systemd changes in 18.04 that make the handling of PID files much stricter. When Artifactory starts up as a service, systemd runs /opt/jfrog/artifactory/bin/artifactoryManage.sh as root. But the script then starts up Tomcat as the artifactory user. The PID of the Tomcat process is then written to the PID file in /var/opt/jfrog/run/artifactory.pid. When control comes back to systemd, it sees that the PID file is not owned by root and refuses to deal with it. The errors look like this:

Sep 26 19:04:33 ip-172-31-41-254 artifactoryManage.sh[13784]: Max number of open files: 1024
Sep 26 19:04:33 ip-172-31-41-254 artifactoryManage.sh[13784]: Using ARTIFACTORY_HOME: /var/opt/jfrog/artifactory
Sep 26 19:04:33 ip-172-31-41-254 artifactoryManage.sh[13784]: Using ARTIFACTORY_PID: /var/opt/jfrog/run/artifactory.pid
Sep 26 19:04:33 ip-172-31-41-254 artifactoryManage.sh[13784]: Tomcat started.
Sep 26 19:05:02 ip-172-31-41-254 systemd[1]: Started Session 211 of user ubuntu.
Sep 26 19:05:12 ip-172-31-41-254 artifactoryManage.sh[13784]: Artifactory Tomcat started in normal mode
Sep 26 19:05:12 ip-172-31-41-254 systemd[1]: artifactory.service: New main PID 13844 does not belong to service, and PID file is not owned by root. Refusing.
Sep 26 19:05:12 ip-172-31-41-254 systemd[1]: artifactory.service: New main PID 13844 does not belong to service, and PID file is not owned by root. Refusing.
Sep 26 19:05:12 ip-172-31-41-254 systemd[1]: artifactory.service: Failed with result 'protocol'.
Sep 26 19:05:12 ip-172-31-41-254 systemd[1]: Failed to start Setup Systemd script for Artifactory in Tomcat Servlet Engine.
Sep 26 19:05:17 ip-172-31-41-254 systemd[1]: artifactory.service: Service hold-off time over, scheduling restart.
Sep 26 19:05:17 ip-172-31-41-254 systemd[1]: artifactory.service: Scheduled restart job, restart counter is at 201.
Sep 26 19:05:17 ip-172-31-41-254 systemd[1]: Stopped Setup Systemd script for Artifactory in Tomcat Servlet Engine.
Sep 26 19:05:17 ip-172-31-41-254 systemd[1]: Starting Setup Systemd script for Artifactory in Tomcat Servlet Engine...
Sep 26 19:05:17 ip-172-31-41-254 artifactoryManage.sh[14254]: found java executable in JAVA_HOME
Sep 26 19:05:17 ip-172-31-41-254 artifactoryManage.sh[14254]: Artifactory Tomcat already started
Sep 26 19:05:17 ip-172-31-41-254 systemd[1]: artifactory.service: Can't open PID file /var/opt/jfrog/run/artifactory.pid (yet?) after start: No such file or directory
Sep 26 19:05:17 ip-172-31-41-254 systemd[1]: artifactory.service: Failed with result 'protocol'.
Sep 26 19:05:17 ip-172-31-41-254 systemd[1]: Failed to start Setup Systemd script for Artifactory in Tomcat Servlet Engine.
Sep 26 19:05:23 ip-172-31-41-254 systemd[1]: artifactory.service: Service hold-off time over, scheduling restart.
Sep 26 19:05:23 ip-172-31-41-254 systemd[1]: artifactory.service: Scheduled restart job, restart counter is at 202.
Sep 26 19:05:23 ip-172-31-41-254 systemd[1]: Stopped Setup Systemd script for Artifactory in Tomcat Servlet Engine.

To work around this issue, you have to do the following. First, in /lib/systemd/system/artifactory.service add the following lines under the [Service] section:

User=artifactory   # change if your artifactory user is different
Group=artifactory  # change if your artifactory group is different

This will now run artifactoryManage.sh as the artifactory user. But the script assumes that it is to be run as root, and so there are some changes you will need to make. First, the script uses ulimit to change the limits on the number of open files. This will fail because the artifactory user will not have permissions to set the hard limit. You can get around that by adding the following to /etc/security/limits.conf:

artifactory soft nofile 32000  # change if your artifactory user is different
artifactory hard nofile 32000  # change if your artifactory user is different

Note: The actual numbers may be different for your system. To find out what they are, manually run artifactoryManage.sh start as the artifactory user before you make the above changes. The script should spit out lines similar to the ones above.

Finally, you will need to change some lines in /opt/jfrog/artifactory/bin/artifactoryManage.sh. In the snippet below, the commented-out line is the code as it originally appears and the modification is just below that:

#su -s "/bin/sh" ${ARTIFACTORY_USER} -c "${replicatorScript} start"
${replicatorScript} start

...

#su -s "/bin/sh" ${ARTIFACTORY_USER} -c "${replicatorScript} start"
${replicatorScript} stop

...

#su -s "/bin/sh" $ARTIFACTORY_USER -c "export JAVA_HOME='$JAVA_HOME'; $TOMCAT_HOME/bin/startup.sh"
$TOMCAT_HOME/bin/startup.sh

...

#su -s "/bin/sh" $ARTIFACTORY_USER -c "export JAVA_HOME='$JAVA_HOME'; $TOMCAT_HOME/bin/shutdown.sh"
$TOMCAT_HOME/bin/shutdown.sh

Note: I also made these exact changes to /opt/jfrog/artifactory/misc/service/artifactory for the sake of consistency, but I have not verified that it is strictly necessary.

We have to make these changes because artifactoryManage.sh is being run as the artifactory user now and so there is no need to explicitly run the other scripts as the same user. Once you make these changes, you should be able to start artifactory via systemctl start artifactory.service successfully.

Ubuntu 9.04 (Jaunty Jackalope) and Windows 7 dual-boot

In my previous post I talked about the problems I had while installing Ubuntu and Windows 7 on my Alienware m7700 laptop. It took me about three days of hair-pulling before I was finally able to get it to work. First, I burnt a new copy of the ISO for Ubuntu 9.04. Then, I enabled RAID on my system. I put the disks into stripe mode (the FastTrak Promise 378 does not support JBOD). This time, I got past the COMRESET error (ata3: COMRESET failed (errno=-16)) and was able to boot into the LiveCD. However, my joy was short-lived. The install would terminate (around the 40% mark) with the following message:

[Errno 5] Input/output error

This is often due to a faulty CD/DVD disk or drive, or a faulty hard disk. It may help to clean the CD/DVD, to burn the CD/DVD at a lower speed, to clean the CD/DVD drive lens (cleaning kits are often available from electronics suppliers), to check whether the hard disk is old and in need of replacement, or to move the system to a cooler environment.

Read the rest of this entry »

Ubuntu and Win7 problems

Yesterday I decided to reformat my Alienware m7700 Area-51 machine. It’s supposedly a laptop, but it’s actually a beast and it has a power supply that emits as much power as a small nuclear plant. Anyway, I put in a 500Gb and a 120Gb drive, with the 120Gb as a slave. The machine comes with a RAID controller (Promise SATA 378 TX2), but I have it turned off and in ATA mode. Win7 installed fine; the only problem I have is with the sound. My front speakers in my quadraphonic setup refuse to work. It’s strange. I even have the latest drivers from Creative for my Audigy2 ZS Notebook. It used to work fine before.

I figured I’d solve that problem later and decided to install Ubuntu 9.04 (Jaunty) on the 500Gb drive. The LiveCD boots up fine, but when I try to actually try out the LiveCD or even try to install Ubuntu, it fails. Everything hangs after this message:

ata3: COMRESET failed (errno=-16)

After searching on the internets, it seems to be a RAID controller issue and a fix exists in the kernel. So I don’t know why I still have the problem. If anyone knows of a solution, please let me know! I’m going to keep working on the problem and see if I can solve it.

Apache2 and .htaccess with mod_rewrite on Ubuntu 8.04 (Hardy Heron)

Apparently the default settings for .htaccess files and URL rewrites in Ubuntu (8.04 anyway) is kinda jacked. Apache wasn’t seeing my .htaccess files, and even after setting up the configuration correctly, I was getting Internal Server (500) errors from .htaccess files.

The default setting for Apache2 on Ubuntu for .htaccess is “ignore it”. You need to enable it by going to /etc/apache2/sites-available/default and changing the AllowOverride directive, which you can find inside the <Directory> … </Directory> tags:

AllowOverride ALL

If you want to enable URL rewrites, you need to enable the mod_rewrite module as it is not enabled by default:

[11:31:14] [email protected] ~/Projects/www/skyblue
$ sudo a2enmod rewrite
Module rewrite installed; run /etc/init.d/apache2 force-reload to enable.

[11:31:20] [email protected] ~/Projects/www/skyblue
$ sudo /etc/init.d/apache2 force-reload
 * Reloading web server config apache2     

There is no Windows 7

Here is a first look at the Windows 7 beta. All I could really get from the review was that “it’s done”, and that it “feels snappier” and that it is “more responsive”. In the screenshots it still looks like Vista. The taskbar reminds me of KDE. A bunch of torrent sites have the beta up for download. Microsoft is expected to announce the build’s public availability in January. So you can get a copy of it and try it out, but to do so might be “breaking the law”. But that hasn’t deterred a bunch of people who’re out downloading it. Right now, piratebay‘s torrent for the beta is showing 2,503 seeds and 8,137 peers.

On another note though. People seem to think that this is a new operating system from Microsoft. It isn’t. It’s just Vista Service Pack 3, in my opinion. I mean, how long did it take Microsoft to come up with Vista after XP? I seriously doubt they got a brand new operating system out in about a year and a half. The name is just a PR campaign to bury the name “Vista”. There is so much bad press and publicity surrounding the name that Microsoft has to get away from it, if they want the Vista codebase to be successful.

I had Vista on my laptop. It was alright; I didn’t use it long enough to run into too many issues. The UAC prompts were pretty annoying though. Also, compiling anything on it took forever. I’m running Ubuntu on it now, and it’s way faster. My sister and my dad both run Vista, but I haven’t heard of them having any problems. If Windows 7 really is good, then I might actually consider running it. I currently have only one Windows machine and that’s running XP. Everything else is either running FreeBSD or Linux.

All original content on these pages is fingerprinted and certified by Digiprove
%d bloggers like this: