1

I tried to restart apache2 and it failed. I got the message below. It was working before so I don't know what went wrong and how to fix it. I'm on Ubuntu 16.04 on windows 10.

* Restarting web server apache2                                                            [fail]
* The apache2 configtest failed.
 Output of config test was:
apache2: Could not open configuration file /etc/apache2/apache2.conf: Input/output error*

 Action 'configtest' failed.
7
  • Did you attempt to edit that file form outside the Linux-on-Windows environment? That is, using a Windows editor?
    – derobert
    Commented Dec 2, 2016 at 18:31
  • Yes, I opened it with notepad++ and added phpmyadmin config.
    – Dee
    Commented Dec 2, 2016 at 18:37
  • Ah, you'll want to read this blog post: blogs.msdn.microsoft.com/commandline/2016/11/17/… .... in short, you can't do that.
    – derobert
    Commented Dec 2, 2016 at 18:39
  • (I would guess you can fix it by copying that file somewhere else using Explorer, then purge and reinstall Apache. Then using Linux tools, possibly just cp from /mnt/c/…, put your config back in place. But I'm not sure, haven't actually used Ubuntu on Windows)
    – derobert
    Commented Dec 2, 2016 at 18:45
  • Just one thing to note: Debian derivatives (including Ubuntu) have both removed and purged. Removed means you've removed the program, but left the configuration behind. If however you're adding/removing programs makes that distinction, you need to purge it (remove the config as well), as the config is what's broken.
    – derobert
    Commented Dec 2, 2016 at 18:57

2 Answers 2

3

According to Microsoft, you must not "under ANY circumstances, create and/or modify Linux files using Windows apps, tools, scripts, consoles, etc."

If you want to edit a Linux file with a Windows editor, the easiest way is probably something like this (in a bash shell):

  1. cp /path/to/file /mnt/c/whatever. Where of course whatever is some path on your system to store a temporary copy.
  2. Edit whatever using your favorite Windows editor. It'll need to support Linux line endings, of course.
  3. cp /mnt/c/whatever /path/to/file.
  4. rm /mnt/c/whatever (clean up the temporary file—you can also do this from Explorer).
1

Good day! Editor Notepad ++ only right to modify Linux files in Windows. You only need to set the necessary parameters. Critical: utf-8, the end of the Unix \ Linux line.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .