Apache: Error writing httpd-userdir.conf: Permission denied - apache

I'm following this guide so that I can run websites on a local server using Apache on OS-X El Capitan. I'm trying to edit my httpd-userdir.conf file but when I try to save it gives me the error:
Error writing httpd-userdir.conf: Permission denied
Terminal shows that the permissions for my httpd-userdir.conf file is -rw-r--r-- , so I don't understand why I wouldn't be allowed to write?
drwxr-xr-x 15 root wheel 510B Feb 24 13:35 ./
drwxr-xr-x 11 root wheel 374B Feb 24 13:27 ../
-rw-r--r-- 1 root wheel 2.8K Jul 31 2015 httpd-autoindex.conf
-rw-r--r-- 1 root wheel 1.7K Jul 31 2015 httpd-dav.conf
-rw-r--r-- 1 root wheel 2.9K Jul 31 2015 httpd-default.conf
-rw-r--r-- 1 root wheel 1.1K Jul 31 2015 httpd-info.conf
-rw-r--r-- 1 root wheel 5.0K Jul 31 2015 httpd-languages.conf
-rw-r--r-- 1 root wheel 1.0K Jul 31 2015 httpd-manual.conf
-rw-r--r-- 1 root wheel 4.4K Jul 31 2015 httpd-mpm.conf
-rw-r--r-- 1 root wheel 2.2K Jul 31 2015 httpd-multilang-errordoc.conf
-rw-r--r-- 1 root wheel 13K Jul 31 2015 httpd-ssl.conf
-rw-r--r-- 1 root wheel 607B Jul 31 2015 httpd-userdir.conf
-rw-r--r-- 1 root wheel 607B Feb 24 13:35 httpd-userdir.conf.bak
-rw-r--r-- 1 root wheel 1.5K Jul 31 2015 httpd-vhosts.conf
-rw-r--r-- 1 root wheel 3.1K Jul 31 2015 proxy-html.conf

#erapert was correct, I just had to do sudo vi /etc/apache2/extra/httpd-userdir.conf and that allowed me to edit the file.

Related

apache2.service: Control process exited, code=exited status=139

I install apache2 on ubuntu 18.04. This is fresh install with all default configuration.
I tried to start apache2 but failed. And this is what I see.
# systemctl status apache2.service
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: failed (Result: exit-code) since Wed 2020-03-11 23:17:35 WIB; 13s ago
Process: 9151 ExecStart=/usr/sbin/apachectl start (code=exited, status=139)
Mar 11 23:17:35 xdn.id systemd[1]: Starting The Apache HTTP Server...
Mar 11 23:17:35 xdn.id apachectl[9151]: Segmentation fault
Mar 11 23:17:35 xdn.id apachectl[9151]: Action 'start' failed.
Mar 11 23:17:35 xdn.id apachectl[9151]: The Apache error log may have more information.
Mar 11 23:17:35 xdn.id systemd[1]: apache2.service: Control process exited, code=exited status=139
Mar 11 23:17:35 xdn.id systemd[1]: apache2.service: Failed with result 'exit-code'.
Mar 11 23:17:35 xdn.id systemd[1]: Failed to start The Apache HTTP Server.
When I check /var/log/apache2/error.log, there is empty.
What's wrong with this error?
The "status=139" error must have something to do with having multiple, conflicting versions of PHP enabled.
I am running 18.04 and an old PHP site I run only locally ceased to work. I am guessing aptitude installed and enabled php7.2, possibly when I installed kubuntu-desktop a few weeks back.
Regardless, I had two versions of PHP enabled:
$ cd /etc/apache2/
$ l mods-*/php*
-rw-r--r-- 1 root root 867 Jun 9 2017 mods-available/php5.6.conf
-rw-r--r-- 1 root root 102 Jun 9 2017 mods-available/php5.6.load
-rw-r--r-- 1 root root 867 Mar 2 2017 mods-available/php7.0.conf
-rw-r--r-- 1 root root 102 Oct 1 2018 mods-available/php7.0.load
-rw-r--r-- 1 root root 855 Jul 7 2017 mods-available/php7.1.conf
-rw-r--r-- 1 root root 102 Jul 7 2017 mods-available/php7.1.load
-rw-r--r-- 1 root root 855 Feb 8 2019 mods-available/php7.2.conf
-rw-r--r-- 1 root root 102 Feb 8 2019 mods-available/php7.2.load
lrwxrwxrwx 1 root root 29 Jul 1 2017 mods-enabled/php5.6.conf -> ../mods-available/php5.6.conf
lrwxrwxrwx 1 root root 29 Jul 1 2017 mods-enabled/php5.6.load -> ../mods-available/php5.6.load
lrwxrwxrwx 1 root root 29 May 28 06:05 mods-enabled/php7.2.conf -> ../mods-available/php7.2.conf
lrwxrwxrwx 1 root root 29 May 28 06:05 mods-enabled/php7.2.load -> ../mods-available/php7.2.load
In my case, I am fine with using php5.6, because the site is not online and is purely for my local use only. So disabling 7.2 did the trick:
sudo a2dismod php7.2
Now my php mods-enabled are less confusing to apache3:
$ l mods-*/php*
-rw-r--r-- 1 root root 867 Jun 9 2017 mods-available/php5.6.conf
-rw-r--r-- 1 root root 102 Jun 9 2017 mods-available/php5.6.load
-rw-r--r-- 1 root root 867 Mar 2 2017 mods-available/php7.0.conf
-rw-r--r-- 1 root root 102 Oct 1 2018 mods-available/php7.0.load
-rw-r--r-- 1 root root 855 Jul 7 2017 mods-available/php7.1.conf
-rw-r--r-- 1 root root 102 Jul 7 2017 mods-available/php7.1.load
-rw-r--r-- 1 root root 855 Feb 8 2019 mods-available/php7.2.conf
-rw-r--r-- 1 root root 102 Feb 8 2019 mods-available/php7.2.load
lrwxrwxrwx 1 root root 29 Jul 1 2017 mods-enabled/php5.6.conf -> ../mods-available/php5.6.conf
lrwxrwxrwx 1 root root 29 Jul 1 2017 mods-enabled/php5.6.load -> ../mods-available/php5.6.load
Naturally for a live site one would want to disable php-5.6 and leave the php7.2 enabled, because you should run the newer version in real life.
sudo a2dismod php5.6
sudo a2enmod php7.2
Then the php mods should look like this:
$ l mods-*/php*
-rw-r--r-- 1 root root 867 Jun 9 2017 mods-available/php5.6.conf
-rw-r--r-- 1 root root 102 Jun 9 2017 mods-available/php5.6.load
-rw-r--r-- 1 root root 867 Mar 2 2017 mods-available/php7.0.conf
-rw-r--r-- 1 root root 102 Oct 1 2018 mods-available/php7.0.load
-rw-r--r-- 1 root root 855 Jul 7 2017 mods-available/php7.1.conf
-rw-r--r-- 1 root root 102 Jul 7 2017 mods-available/php7.1.load
-rw-r--r-- 1 root root 855 Feb 8 2019 mods-available/php7.2.conf
-rw-r--r-- 1 root root 102 Feb 8 2019 mods-available/php7.2.load
lrwxrwxrwx 1 root root 29 May 29 17:43 mods-enabled/php7.2.conf -> ../mods-available/php7.2.conf
lrwxrwxrwx 1 root root 29 May 29 17:43 mods-enabled/php7.2.load -> ../mods-available/php7.2.load
Don't forget to resatart the server!
systemctl restart apache2
Thanks to Pavel's comment for inspiring this line of research!
I got this error and I fixed it by enabling PHP version 8.0 (current stable) and disabling PHP version 7.4 (old) in my ubuntu 20.04 by these commands:
sudo a2dismod php7.4
sudo a2enmod php8.0
sudo service apache2 restart
After doing these check your apache status by:
sudo systemctl status apache2.service
It has to be green and must show you active (running).
NOTE: You can do this to any PHP version that you have and want to
change.

Perl6 script on MSYS2 causes 'failed to stat file' error

When I try to run a simple perl6 script on MSYS2-64 (bash.exe) on Windows 7 it says:
Could not open my-perl6-script.pl. Failed to stat file: no such file or directory
The same script runs perfectly fine on CMD.exe so I guess it's some incompatibility between perl6 and MSYS2.
$ perl6 -v returns:
This is Rakudo Star version 2018.04.1 built on MoarVM version 2018.04.1 implementing Perl 6.c.
The bin folder of perl6 is:
-rwxr-xr-x 1 win7 None 537938 May 11 2015 libgcc_s_sjlj-1.dll
-rw-r--r-- 1 win7 None 130262 May 7 2018 libmoar.dll.a
-rwxr-xr-x 1 win7 None 57681 May 11 2015 libwinpthread-1.dll
-rwxr-xr-x 1 win7 None 6633702 May 7 2018 moar.dll
-rwxr-xr-x 1 win7 None 57225 May 7 2018 moar.exe
-rw-r--r-- 1 win7 None 104 May 7 2018 nqp.bat
-rw-r--r-- 1 win7 None 104 May 7 2018 nqp-m.bat
lrwxrwxrwx 1 win7 None 23 Jun 19 2018 perl6 -> /c/rakudo/bin/perl6.exe
-rw-r--r-- 1 win7 None 242 May 7 2018 perl6.bat
lrwxrwxrwx 1 win7 None 23 Jun 19 2018 perl6.exe -> /c/rakudo/bin/perl6.bat
-rw-r--r-- 1 win7 None 248 May 7 2018 perl6-debug-m.bat
-rw-r--r-- 1 win7 None 242 May 7 2018 perl6-m.bat
It doesn't matter if I run the script using perl6, perl6.exe or perl6.bat; they all give the same error. I'd like to run perl6 scripts on MSYS2-64. What should I do? Thanks
I installed Rakudo for Windows and made a custom perl6 shell script:
#!/bin/sh
/c/rakudo/bin/moar --execname="$0" --libpath='C:\rakudo\share\nqp\lib' --libpath='C:\rakudo\share\nqp\lib' --libpath='C:\rakudo\share/perl6/lib' --libpath='C:\rakudo\share/perl6/runtime' 'C:\rakudo\share\perl6\runtime\perl6.moarvm' "$#"
I copied perl6.bat to perl6, changed the initial path to moar to an MSYS-style path, and changed from cmd to sh quoting and arugment conventions.
Example run, from cmd:
C:\Users\cxw>perl6 -v
This is Rakudo Star version 2019.03.1 built on MoarVM version 2019.03
implementing Perl 6.d.
From the shell opened by msys2_shell.cmd:
$ uname -a
MSYS_NT-6.1-7601 Desktop 3.0.7-338.x86_64 2019-07-03 08:42 UTC x86_64 Msys
$ export PATH="$PATH":~/bin
$ cat foo.p6
use v6;
(2+2).say;
$ perl6 foo.p6
4
For what it's worth, my Rakudo bin dir:
$ ls -l /c/rakudo/bin
total 8033
-rwxr-xr-x 1 cxw None 930663 May 11 2017 libgcc_s_seh-1.dll
-rw-r--r-- 1 cxw None 136146 Mar 30 21:55 libmoar.dll.a
-rwxr-xr-x 1 cxw None 56978 May 11 2017 libwinpthread-1.dll
-rwxr-xr-x 1 cxw None 7021172 Mar 30 21:55 moar.dll
-rwxr-xr-x 1 cxw None 64066 Mar 30 21:55 moar.exe
-rw-r--r-- 1 cxw None 126 Mar 30 21:56 nqp.bat
-rw-r--r-- 1 cxw None 126 Mar 30 21:56 nqp-m.bat
-rw-r--r-- 1 cxw None 242 Mar 30 21:56 perl6.bat
-rw-r--r-- 1 cxw None 248 Mar 30 21:56 perl6-debug-m.bat
-rw-r--r-- 1 cxw None 242 Mar 30 21:56 perl6-m.bat

How to freeze graphs from checkpoint directory for inception-v3 model?

I am fine tuning inception-v3 model flowers using this: https://github.com/tensorflow/models/tree/master/inception
I checkpointed the result in a directory. But in the directory I see files like these:
-rw-r--r-- 1 root root 389908432 Mar 15 21:46 model.ckpt-0.data-00000-of-00001
-rw-r--r-- 1 root root 72680 Mar 15 21:46 model.ckpt-0.index
-rw-r--r-- 1 root root 15189794 Mar 15 21:47 model.ckpt-0.meta
-rw-r--r-- 1 root root 135185788 Mar 15 22:36 events.out.tfevents.1489594533.f7d5defbed64
-rw-r--r-- 1 root root 72680 Mar 15 22:37 model.ckpt-4999.index
-rw-r--r-- 1 root root 389908432 Mar 15 22:37 model.ckpt-4999.data-00000-of-00001
-rw-r--r-- 1 root root 15189794 Mar 15 22:38 model.ckpt-4999.meta
-rw-r--r-- 1 root root 130 Mar 15 22:49 checkpoint
whereas I need outputs in directory similar to this:
-rw-r----- 1 107456 5000 223 Mar 2 2016 README.txt
-rw-r----- 1 107456 5000 43 Mar 2 2016 checkpoint
-rw-r----- 1 107456 5000 434903494 Mar 15 2016 model.ckpt-157585
For that I need to do something like freezing, but freezing needs to provide output_node_names. Can anyone guide me, what will be the output_node_names for inception-v3?
Also, I need a reliable way to freeze. Is tensorflow freezer tool okay for this?
I found the answer eventually.
One-line answer should be to use freezer.py available in upstream Tensorflow codebase. See the example on how to use that program from tests.
You may check the following link for sample:
https://gist.githubusercontent.com/morgangiraud/249505f540a5e53a48b0c1a869d370bf/raw/6cb0b4d497925517316a92f935ce5dccb6aafd17/medium-tffreeze-1.py

dspace filter-media crashes after upgrading DSpace from 5.3 to 5.4

dspace filter-media was working perfectly fine on DSpace 5.3. After upgrading do 5.4 every time I run it to index a new PDF (already tested all sorts of PDFs!), it crashes with the following exception stack:
dspace#mylinux:/opt/dspace/deploy/bin> ./dspace filter-media
File: Supercalifragilisticexpialidocious.pdf.txt
Exception: org/apache/fontbox/afm/AFMParser
java.lang.NoClassDefFoundError: org/apache/fontbox/afm/AFMParser
at org.apache.pdfbox.pdmodel.font.PDFont.addAdobeFontMetric(PDFont.java:165)
at org.apache.pdfbox.pdmodel.font.PDFont.addAdobeFontMetric(PDFont.java:152)
at org.apache.pdfbox.pdmodel.font.PDFont.getAdobeFontMetrics(PDFont.java:122)
at org.apache.pdfbox.pdmodel.font.PDFont.<clinit>(PDFont.java:114)
at org.apache.pdfbox.pdmodel.font.PDFontFactory.createFont(PDFontFactory.java:100)
at org.apache.pdfbox.pdmodel.PDResources.getFonts(PDResources.java:213)
at org.apache.pdfbox.util.PDFStreamEngine.getFonts(PDFStreamEngine.java:607)
at org.apache.pdfbox.util.operator.SetTextFont.process(SetTextFont.java:59)
at org.apache.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:557)
at org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:268)
at org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:235)
at org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:215)
at org.apache.pdfbox.util.PDFTextStripper.processPage(PDFTextStripper.java:460)
at org.apache.pdfbox.util.PDFTextStripper.processPages(PDFTextStripper.java:385)
at org.apache.pdfbox.util.PDFTextStripper.writeText(PDFTextStripper.java:344)
at org.dspace.app.mediafilter.PDFFilter.getDestinationStream(PDFFilter.java:101)
at org.dspace.app.mediafilter.MediaFilterManager.processBitstream(MediaFilterManager.java:734)
at org.dspace.app.mediafilter.MediaFilterManager.filterBitstream(MediaFilterManager.java:550)
at org.dspace.app.mediafilter.MediaFilterManager.filterItem(MediaFilterManager.java:500)
at org.dspace.app.mediafilter.MediaFilterManager.applyFiltersItem(MediaFilterManager.java:468)
at org.dspace.app.mediafilter.MediaFilterManager.applyFiltersAllItems(MediaFilterManager.java:403)
at org.dspace.app.mediafilter.MediaFilterManager.main(MediaFilterManager.java:340)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.dspace.app.launcher.ScriptLauncher.runOneCommand(ScriptLauncher.java:226)
at org.dspace.app.launcher.ScriptLauncher.main(ScriptLauncher.java:78)
Caused by: java.lang.ClassNotFoundException: org.apache.fontbox.afm.AFMParser
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 28 more
Caused by: java.util.zip.ZipException: error reading zip file
at java.util.zip.ZipFile.read(Native Method)
at java.util.zip.ZipFile.access$1400(ZipFile.java:56)
at java.util.zip.ZipFile$ZipFileInputStream.read(ZipFile.java:679)
at java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(ZipFile.java:415)
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158)
at sun.misc.IOUtils.readFully(IOUtils.java:65)
at java.util.jar.JarFile.getBytes(JarFile.java:390)
at java.util.jar.JarFile.getManifestFromReference(JarFile.java:180)
at java.util.jar.JarFile.getManifest(JarFile.java:167)
at sun.misc.URLClassPath$JarLoader$2.getManifest(URLClassPath.java:779)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:416)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
... 34 more
System information:
DSpace 5.4
SUSE Linux Enterprise Server 12 (x86_64)
OpenJDK Java 1.7.0_85
Maven 3.3.3
Ant 1.9.4
Tomcat 8.0.26
Postgres 9.3.8
I got it running, but can't figure it out WHY. Any thoughts?
What I did was to copy previous DSpace's jars from [dspace]/lib.bak to [dspace]/lib. So, instead of having this set of jars, that doesn't work,
-rw-r--r-- 1 dspace users 4173 Dec 17 09:43 additions-5.4.jar
-rw-r--r-- 1 dspace users 2159510 Dec 17 09:43 dspace-api-5.4.jar
-rw-r--r-- 1 dspace users 849983 Dec 14 12:24 dspace-api-lang-5.0.6.jar
-rw-r--r-- 1 dspace users 129054 Dec 17 09:45 dspace-oai-5.4-classes.jar
-rw-r--r-- 1 dspace users 130628 Dec 17 09:43 dspace-services-5.4.jar
now I have this and it's working just fine:
-rw-r--r-- 1 dspace users 4172 Sep 1 13:40 additions-5.2.jar
-rw-r--r-- 1 dspace users 4170 Sep 2 14:04 additions-5.3.jar
-rw-r--r-- 1 dspace users 4173 Dec 17 09:43 additions-5.4.jar
-rw-r--r-- 1 dspace users 2157296 Sep 1 13:38 dspace-api-5.2.jar
-rw-r--r-- 1 dspace users 2158457 Sep 2 14:04 dspace-api-5.3.jar
-rw-r--r-- 1 dspace users 2159510 Dec 17 09:43 dspace-api-5.4.jar
-rw-r--r-- 1 dspace users 845777 Sep 1 13:39 dspace-api-lang-5.0.5.jar
-rw-r--r-- 1 dspace users 849983 Dec 14 12:24 dspace-api-lang-5.0.6.jar
-rw-r--r-- 1 dspace users 128126 Sep 1 13:51 dspace-oai-5.2-classes.jar
-rw-r--r-- 1 dspace users 128849 Sep 2 14:06 dspace-oai-5.3-classes.jar
-rw-r--r-- 1 dspace users 129054 Dec 17 09:45 dspace-oai-5.4-classes.jar
-rw-r--r-- 1 dspace users 130562 Sep 1 13:38 dspace-services-5.2.jar
-rw-r--r-- 1 dspace users 130557 Sep 2 14:04 dspace-services-5.3.jar
-rw-r--r-- 1 dspace users 130628 Dec 17 09:43 dspace-services-5.4.jar
I'm glad I've fixed the issue, of course, but I would really like to know WHY!
After upgrading from 5.3 to 5.4, by merging git tag dspace-5.4 into my local 5.3 branch, I issued a mvn -U clean package followed by a ant update.

Openshift Origin git push permission error

I've installed "openshift origin" with the oo-install script. I can login into the web console and create apps, "git clone" works but when I "git push" I get a permissions error:
remote: Permission denied - /var/lib/openshift/5373c78ae138230657000005/app-deployments/2014-05-14_19-44-15.999/dependencies/python/virtenv/include/python2.7
To ssh://5373c78ae138230657000005#insultapp-test.apps.dom1.local/~/git/insultapp.git/
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'ssh://5373c78ae138230657000005#insultapp-test.apps.dom1.local/~/git/insultapp.git/'
These are some of the folder permissions when I ssh into the gear:
drwxr-x---. 13 root 5373c78ae138230657000005 4.0K May 14 19:44 .
drwxr-xr-x. 7 root root 4.0K May 14 19:44 ..
drwxr-xr-x. 4 5373c78ae138230657000005 5373c78ae138230657000005 4.0K May 14 19:44 app-deployments
drwxr-xr-x. 4 root 5373c78ae138230657000005 4.0K May 14 19:44 app-root
drwxr-x---. 2 5373c78ae138230657000005 5373c78ae138230657000005 4.0K May 14 19:44 .auth
drwxr-x---. 3 root 5373c78ae138230657000005 4.0K May 14 19:44 .env
drwxr-x---. 2 5373c78ae138230657000005 5373c78ae138230657000005 4.0K May 14 19:44 .gem
drwxr-xr-x. 3 root root 4.0K May 14 19:44 git
-rw-r--r--. 1 root root 57 May 14 19:44 .gitconfig
drwxr-x---. 2 5373c78ae138230657000005 5373c78ae138230657000005 4.0K May 14 19:44 .openshift_ssh
drwxr-xr-x. 11 5373c78ae138230657000005 5373c78ae138230657000005 4.0K May 14 19:44 python
d---------. 3 root root 4.0K May 14 19:44 .sandbox
drwxr-x---. 2 root 5373c78ae138230657000005 4.0K May 14 19:44 .ssh
d---------. 3 root root 4.0K May 14 19:44 .tmp
lrwxrwxrwx. 1 root root 64 May 14 19:44 .vimrc -> /var/lib/openshift/5373c78ae138230657000005/app-root/data/.vimrc
Any help would be appreciated.