Mercurial/Redmine - 404 Error When Accessing Repository - mercurial

Hopefully this is a quick fix for those with experience!
I just finished up installing Mercurial and Redmine on my shared hostgator server to the tee from Redmine and Mercurial documentation, but have run in to a small problem. Mercurial works pefectly, I was able to create a repo, clone it, and sync to it without any issues, except when I add the repo to Redmine and go to the repository tab, I get a 404 error. I made sure to double check that I set the directory beginning from the root and it didn't work. I tried multiple different kinds of ways of writing out the directory but still No luck. I ended up opening my production.log, and this is the entry written every time I get the 404 error.
Processing RepositoriesController#show (for 74.56.***.*** at 2012-01-10 13:59:43) [GET]
Parameters: {"action"=>"show", "id"=>"testhg1", "controller"=>"repositories"}
hg: error during getting info: hg exited with non-zero status: 255
hg: error during getting info: hg exited with non-zero status: 255
Rendering template within layouts/base
Rendering common/error (404)
Completed in 280ms (View: 12, DB: 2) | 404 Not Found [http://redmine.mydomain.org/projects/testhg1/repository]
Any help on this would be greatly appreciated! Thank you!

We ran into the same error on a Centos 6.3 server.
In our case, we were also getting the following error in /var/log/httpd/error_log:
abort: requirement 'dotencode' not supported!
We were creating our repositories using RhodeCode which was using a much newer version of mercurial (2.3.2) than the one that comes with CentOS 6.3 (1.4). Updating the version of mercurial on the system using a pre-built RPM from repoforge solved the problem. The extremely old version of mercurial available from yum on CentOS did not support the dotencode capability that the newer 2.3.2 Mercurial was using.

Went into development mode to get some better logging:
Processing RepositoriesController#show (for ***.***.***.*** at 2012-03-15 22:54:47) [GET]
Parameters: {"action"=>"show", "id"=>"go", "controller"=>"repositories"}
Setting Columns (0.9ms) SHOW FIELDS FROM `settings`
... more unimportant queries ...
Repository::Mercurial Columns (0.7ms) SHOW FIELDS FROM `repositories`
Shelling out: '/usr/bin/hg' '-R' '/var/lib/hg/godc' '--encoding' 'utf-8' '--config' 'extensions.redminehelper=/var/www/corp/redmine/lib/redmine/scm/adapters/mercurial/redminehelper.py' '--config' 'diff.git=false' 'rhsummary'
hg: error during getting info: hg exited with non-zero status: 255
Shelling out: '/usr/bin/hg' '-R' '/var/lib/hg/godc' '--encoding' 'utf-8' '--config' 'extensions.redminehelper=/var/www/corp/redmine/lib/redmine/scm/adapters/mercurial/redminehelper.py' '--config' 'diff.git=false' 'rhmanifest' '-r' 'tip' ''
Rendering template within layouts/base
Rendering common/error (404)
so the error seems to be with this command:
'/usr/bin/hg' '-R' '/var/lib/hg/godc' '--encoding' 'utf-8' '--config' 'extensions.redminehelper=/var/www/corp/redmine/lib/redmine/scm/adapters/mercurial/redminehelper.py' '--config' 'diff.git=false' 'rhsummary'
which works fine when I run is as root
root#redacted:/var/www/corp/redmine# '/usr/bin/hg' '-R' '/var/lib/hg/godc' '--encoding' 'utf-8' '--config' 'extensions.redminehelper=/var/www/corp/redmine/lib/redmine/scm/adapters/mercurial/redminehelper.py' '--config' 'diff.git=false' 'rhsummary'
... returns XML that S. O. doesn't want to show ...
(if you know how to fix this, please edit)
but my webserver runs as www-data which doesn't have access to the hg dir
root#redacted:/var/www/corp/redmine# sudo su - www-data
$ '/usr/bin/hg' '-R' '/var/lib/hg/godc' '--encoding' 'utf-8' '--config' 'extensions.redminehelper=/var/www/corp/redmine/lib/redmine/scm/adapters/mercurial/redminehelper.py' '--config' 'diff.git=false' 'rhsummary'
abort: repository /var/lib/hg/godc not found!
$ ls -l /var/lib/hg
ls: cannot open directory /var/lib/hg: Permission denied
$
give my www-data user access to the repo and the command now works:
$ groups
www-data hg
$ '/usr/bin/hg' '-R' '/var/lib/hg/godc' '--encoding' 'utf-8' '--config' 'extensions.redminehelper=/var/www/corp/redmine/lib/redmine/scm/adapters/mercurial/redminehelper.py' '--config' 'diff.git=false' 'rhsummary'
... returns XML that S. O. doesn't want to show ...
$
Tested it on redmine and still got the error but when I restarted apache everything was as it should be.
(I'm using phusion passenger.)
The upgrade turned out to be a red herring, the actual thing that caused this was the change from running with script/server as my user (which had repo access) to running as a properly installed phusion passenger production instance.
In your case, with your presumably $7/month hostgator shared server install, I'm sure you don't have access to modify permissions but you can at lest use the process I described to try and determine the problem. I don't know much about hostgator's install but it seems likely that you might be having the same issue.

Related

`jekyll build` has error but gitlab ci still continues

I have a Jekyll website running on Gitlab Pages, and one of my pages contained an error.
This error is found and reported by Jekyll, but the website is still deployed, just without that page.
In Gitlab's job output I see the following:
$ jekyll build -d public
...
Bundle complete! 5 Gemfile dependencies, 29 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux-musl]
Configuration file: /builds/TheOddler/mjb/_config.yml
Source: /builds/TheOddler/mjb
Destination: /builds/TheOddler/mjb/public
Incremental build: disabled. Enable with --incremental
Generating...
Error: YAML Exception reading /builds/TheOddler/mjb/_work/immaculate.md: (<unknown>): did not find expected key while parsing a block mapping at line 2 column 1
Jekyll Feed: Generating feed for posts
done in 1.104 seconds.
Auto-regeneration: disabled. Use --watch to enable.
Uploading artifacts for successful job 00:09
Uploading artifacts...
So it shows Error: YAML Exception ... but then still continues as if everything is OK.
The job in my .gitlab-ci.yml file looks like this:
build-jekyll:
stage: build
image: jekyll/jekyll:4.2.0
script:
- jekyll build -d public
artifacts:
paths:
- public
only:
- master
Why does this happen? And is there a way to make the process fail, or at least report this as a warning so I know something went wrong?
Thanks!
This happens because Jekyll, dispite the error in the output, returns with exit code 0. You could try to add the --strict_front_matter option to let Jekyll return a non-zero exit code.

The gitache-populate step of cmake configure gives the error: fatal: ambiguous argument 'stable': unknown revision or path not in the working tree

While configuring a project that uses aicxx and gitache, I get the following error:
...
[ 11%] Performing update step for 'gitache-populate'
cd /home/carlo/projects/aicxx/linuxviewer/linuxviewer-objdir/_deps/gitache-src && /usr/bin/cmake -P /home/carlo/projects/aicxx/linuxviewer/linuxviewer-objdir/_deps/gitache-subbuild/gitache-populate-prefix/tmp/gitache-populate-gitupdate.cmake
fatal: ambiguous argument 'stable': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
From https://github.com/CarloWood/gitache
bef7d0d..5c68f7b stable -> origin/stable
CMake Error at /home/carlo/projects/aicxx/linuxviewer/linuxviewer-objdir/_deps/gitache-subbuild/gitache-populate-prefix/tmp/gitache-populate-gitupdate.cmake:121 (message):
....
How can I fix this?
The reason for this error is probably that you just pulled a CMakeLists.txt change
that switched from using one gitache branch to another (from master to stable in this case).
The easiest way to recover is to entirely clean the project and configure from scratch.
For example, remove the cmake build directoy:
rm -rf /home/carlo/projects/aicxx/linuxviewer/linuxviewer-objdir
Then rerun ./autogen.sh and configure and build as usual.
Technically running autogen.sh is only necessary after running make maintainer-clean, if the project supports that (normally cmake doesn't, so it would have to be manually added by the project), but it never hurts.

PM2 keeps getting killed every 90 seconds on centos 8

I just installed CentOS 8 and added nodejs (tried v12 & v14) And then I installed pm2 using npm install pm2#latest (so at the time of posting it uses v4.4.0). I did try an older version (v3.5.0), but it does the exact same thing.
and after pm2 got installed, i ran the command "pm2 startup"
after a restart, pm2 does start, but gets killed after 90 seconds and then restarts giving this message
"pm2 has been killed by signal, dumping process list before exit..."
First, I thought it was because of my app (the one that pm2 is supposed to manage), but i removed it from pm2, so it's practically empty, but it does the same thing
Running the following command as root worked for me:
pm2 update
I had the same issue and I tried several solutions online but none worked for me.
However, I completely removed pm2, restarted the server, and reinstalled pm2 and that does it for me.
1- Stop and remove pm2
pm2 kill
sudo npm remove pm2 -g
2- Restart the server
sudo reboot
3- Log in again, then reinstall pm2
sudo npm install -g pm2
I did not disable SE Linux (I think it's not safe to disable it), but the following method helped me:
Edit file: /etc/systemd/system/pm2-root.service
Add new line: Environment=PM2_PID_FILE_PATH=/run/pm2.pid
And replace: PIDFile=/root/.pm2/pm2.pid to: PIDFile=/run/pm2.pid
Versions:
CentOS 8.3.2011
Node.js 14.16.0
NPM 7.7.5
PM2 4.5.5
Original answer. Thanks Alec!
Later update. For those who are facing the same issues. It's an issue related to SE Linux. Known workarounds (the ones I discovered).
Disabling SE Linux (obviously, not recommended)
go to /etc/systemd/system/pm2-root.service - comment PIDFile=... (add a # in front of that line)
Audit and trace - use following commands:
# dnf install policycoreutils-python-utils setroubleshoot-server -y
# journalctl -f
At ths point, you should see the solution in the output (the log)
it should be something like:
# ausearch -c 'systemd' --raw | audit2allow -M my-systemd
# semodule -i my-systemd.pp
You need to do the last step (ausearch... and semodule...) twice - I did it once, restarted the machine and noticed the same issue after 90 seconds. But if you read the log carefully, you will notice that the issue seems to be outputed twice. (looks the same). Probably two things are trying to write to that file (pm2-root.service).
Still waiting for the perfect solution (done by the person that really knows how to fix this in a proper manner), but for those that have this issue, any of these options seem to work just fine.
I've had this problem (on Debian), when for some reason two "PM2 God Daemon" processes (not threads) were launched, so they conflicting with each other.
Killing one of them solved the issue.

ERROR: Preparation failed: Getwd: getwd: no such file or directory

Gitlab runner throw ERROR: Preparation failed: Getwd: getwd: no such file or directory?
gitlab version is: GitLab Community Edition 8.6.4
gitlab-runner version: 1.11.5
My CI throw ERROR: Preparation failed: Getwd: getwd frequently,
but sometimes we commit is work fine. So we didn't know what the final reason cause this problem.
We only know about one thing that is this error shows after we moved the build directory.
In my case that was because of residual gitlab-runner processes still executing. I resolved it by identifying guilty pids then killed them:
$ ps -ax | grep gitlab-runner
27034 ? Ssl 0:06 /usr/bin/gitlab-runner run --working-directory /home/gitlab-runner --config /etc/gitlab-runner/config.toml --service gitlab-runner --syslog --user gitlab-runner
$ sudo kill -9 27034
I got the same error and solved by restarting gitlab-runner
gitlab-runner restart
The Gitlab Runner checks out a copy of your repository into CI_PROJECT_DIR. You can check its value by adding the following to your .gitlab-ci.yml:
script:
- echo $CI_PROJECT_DIR
I received the "getwd: no such file or directory" error because:
I had changed my working directory to /var/www/mysite (I am using a docker container with gitlab-runner installed inside it, but I think that's beside the point)
one of my deploy script lines moves /var/www/mysite to /var/www/old-mysite.
I'm used to the Gitlab Runner checking out its build inside /home/gitlab-runner/build. When I changed the docker working directory this caused the runner to check it out at /var/www/mysite/build.
After my script moved /var/www/mysite to /var/www/old-mysite, on second and subsequent runs, gitlab runner still expected to find (/var/www/mysite) but it no longer existed, hence the error.
Given the above, I can't explain why the runner works the first time ever, when that directory also doesn't exist, but hopefully my answer might at least prompt something useful for someone! :)

Configure ejabberd with Mysql , Error p1_mysql.app not found

I am trying to configure ejabberd with mysql database. After changes into the yml file i got this error while starting node.
2017-01-09 13:07:27.386 [critical] <0.38.0>#ejabberd:exit_or_halt:133 failed to start application 'p1_mysql': {error,
{"no such file or directory",
"p1_mysql.app"}}
Searching for solutions encountered with a step to hit './configure'
But i cannot locate the directory.
Tried it in /var/lib/ejabberd as well. says "not found"
Installed on Ubuntu using apt-get install ejabberd
How do i hit configure to do the needful.
If you're building from source, you should enable mysql support via configure script, e.g.
$ ./autogen.sh # Only needed if building directly from github repo
$ ./configure --enable-mysql
$ make