WSL: invoke-rc.d: could not determine current runlevel

  • A brief description apt get install/upgrade giving some errors and warning for some packages, I have been able to replicate this issue many times.

  • Expected results

Fetched 3017 kB in 31s (95.7 kB/s)
Preconfiguring packages ...
(Reading database ... 56704 files and directories currently installed.)
Preparing to unpack .../libmagickcore-6.q16-2_8%3a6.8.9.9-7ubuntu5.5_amd64.deb ...
Unpacking libmagickcore-6.q16-2:amd64 (8:6.8.9.9-7ubuntu5.5) over (8:6.8.9.9-7ubuntu5.4) ...
Preparing to unpack .../imagemagick-common_8%3a6.8.9.9-7ubuntu5.5_all.deb ...
Unpacking imagemagick-common (8:6.8.9.9-7ubuntu5.5) over (8:6.8.9.9-7ubuntu5.4) ...
Preparing to unpack .../libimage-magick-q16-perl_8%3a6.8.9.9-7ubuntu5.5_amd64.deb ...
Unpacking libimage-magick-q16-perl (8:6.8.9.9-7ubuntu5.5) over (8:6.8.9.9-7ubuntu5.4) ...
Preparing to unpack .../libimage-magick-perl_8%3a6.8.9.9-7ubuntu5.5_all.deb ...
Unpacking libimage-magick-perl (8:6.8.9.9-7ubuntu5.5) over (8:6.8.9.9-7ubuntu5.4) ...
Preparing to unpack .../linux-libc-dev_4.4.0-66.87_amd64.deb ...
Unpacking linux-libc-dev:amd64 (4.4.0-66.87) over (4.4.0-64.85) ...
Preparing to unpack .../mdadm_3.3-2ubuntu7.2_amd64.deb ...
Unpacking mdadm (3.3-2ubuntu7.2) over (3.3-2ubuntu7.1) ...
Processing triggers for libc-bin (2.23-0ubuntu5) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for systemd (229-4ubuntu16) ...
Processing triggers for ureadahead (0.100.0-19) ...
Setting up imagemagick-common (8:6.8.9.9-7ubuntu5.5) ...
Setting up libmagickcore-6.q16-2:amd64 (8:6.8.9.9-7ubuntu5.5) ...
Setting up libimage-magick-q16-perl (8:6.8.9.9-7ubuntu5.5) ...
Setting up libimage-magick-perl (8:6.8.9.9-7ubuntu5.5) ...
Setting up linux-libc-dev:amd64 (4.4.0-66.87) ...
Setting up mdadm (3.3-2ubuntu7.2) ...
Processing triggers for libc-bin (2.23-0ubuntu5) ...
Processing triggers for initramfs-tools (0.122ubuntu8.8) ...
  • Actual results (with terminal output if applicable) Removed some lines here…
Fetched 3017 kB in 31s (95.7 kB/s)
Preconfiguring packages ...
(Reading database ... 56704 files and directories currently installed.)
Preparing to unpack .../libmagickcore-6.q16-2_8%3a6.8.9.9-7ubuntu5.5_amd64.deb ...
Unpacking libmagickcore-6.q16-2:amd64 (8:6.8.9.9-7ubuntu5.5) over (8:6.8.9.9-7ubuntu5.4) ...
Preparing to unpack .../imagemagick-common_8%3a6.8.9.9-7ubuntu5.5_all.deb ...
Unpacking imagemagick-common (8:6.8.9.9-7ubuntu5.5) over (8:6.8.9.9-7ubuntu5.4) ...
Preparing to unpack .../libimage-magick-q16-perl_8%3a6.8.9.9-7ubuntu5.5_amd64.deb ...
Unpacking libimage-magick-q16-perl (8:6.8.9.9-7ubuntu5.5) over (8:6.8.9.9-7ubuntu5.4) ...
Preparing to unpack .../libimage-magick-perl_8%3a6.8.9.9-7ubuntu5.5_all.deb ...
Unpacking libimage-magick-perl (8:6.8.9.9-7ubuntu5.5) over (8:6.8.9.9-7ubuntu5.4) ...
Preparing to unpack .../linux-libc-dev_4.4.0-66.87_amd64.deb ...
Unpacking linux-libc-dev:amd64 (4.4.0-66.87) over (4.4.0-64.85) ...
Preparing to unpack .../mdadm_3.3-2ubuntu7.2_amd64.deb ...
invoke-rc.d: could not determine current runlevel
Unpacking mdadm (3.3-2ubuntu7.2) over (3.3-2ubuntu7.1) ...
Processing triggers for libc-bin (2.23-0ubuntu5) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for systemd (229-4ubuntu16) ...
Processing triggers for ureadahead (0.100.0-19) ...
Setting up imagemagick-common (8:6.8.9.9-7ubuntu5.5) ...
Setting up libmagickcore-6.q16-2:amd64 (8:6.8.9.9-7ubuntu5.5) ...
Setting up libimage-magick-q16-perl (8:6.8.9.9-7ubuntu5.5) ...
Setting up libimage-magick-perl (8:6.8.9.9-7ubuntu5.5) ...
Setting up linux-libc-dev:amd64 (4.4.0-66.87) ...
Setting up mdadm (3.3-2ubuntu7.2) ...
W: mdadm: failed to load MD subsystem.
update-initramfs: deferring update (trigger activated)
invoke-rc.d: could not determine current runlevel
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
Processing triggers for libc-bin (2.23-0ubuntu5) ...
Processing triggers for initramfs-tools (0.122ubuntu8.8) ...
  • Your Windows build number Microsoft Windows [Version 10.0.15042]

  • Steps / All commands required to reproduce the error from a brand new installation

sudo apt-get upgrade
sudo apt-get install some_packages_name
  • Required packages and commands to install Got error in upgrading these below packages: imagemagick-common libimage-magick-perl libimage-magick-q16-perl libmagickcore-6.q16-2 linux-libc-dev mdadm

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Reactions: 43
  • Comments: 62 (1 by maintainers)

Most upvoted comments

The way I fixed this:

/etc/init.d/ebtables has

case "$1" in
    start)
        [ "$EBTABLES_LOAD_ON_START" = "yes" ] && load
        ;;
    stop)
        [ "$EBTABLES_SAVE_ON_STOP" = "yes" ] && save
        clear
        ;;

Just comment out the actions taken by stop) e.g.:

stop)
    # [ "$EBTABLES_SAVE_ON_STOP" = "yes" ] && save
    # clear
    ;;

and do your

sudo apt upgrade or purge or whatever. Note that after the upgrade the init script will be redeployed so you will face the same issue down the line.

The problem comes from the install/remove scripts trying to do service ebtables stop and failing. You can see this by trying to stop ebtables manually. Or by even just trying to find out the status of the service: sudo service ebtables status

Try this:

sudo su
export RUNLEVEL=1
apt-get <whatever>

You are going to have no joy with mdadm though, for reasons that go beyond runlevels.

I had this issue when updating mysql-server. I resolved my issue like this ` sudo su apt-get remove --purge ‘mysql*’ apt-get autoremove apt-get autoclean rm -f /etc/mysql /var/lib/mysql apt-get install mysql-server

`

Still having the problem. Exporting RUNLEVEL didn’t make a difference.

I’m seeing this issue with ebtables:

$ sudo apt upgrade
Reading package lists... Done
  ebtables
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/79.4 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 77805 files and directories currently installed.)
Preparing to unpack .../ebtables_2.0.10.4-3.4ubuntu2_amd64.deb ...
invoke-rc.d: could not determine current runlevel
invoke-rc.d: could not determine current runlevel
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)
$ sudo apt remove --purge ebtables
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
  xdelta3
invoke-rc.d: could not determine current runlevel
Removing lxd dnsmasq configuration
Purging configuration files for lxd (2.21-0ubuntu3~16.04.1) ...
Removing ebtables (2.0.10.4-3.4ubuntu1) ...
invoke-rc.d: could not determine current runlevel
 * Error: insufficient privileges to access the ebtables rulesets.
invoke-rc.d: initscript ebtables, action "stop" failed.
dpkg: error processing package ebtables (--purge):
 subprocess installed pre-removal script returned error exit status 1
Processing triggers for man-db (2.7.5-1) ...
Errors were encountered while processing:
 ebtables
E: Sub-process /usr/bin/dpkg returned an error code (1)

autoremove/autoclean/install -f seems to make no difference.

I solved this issue by this:

sudo mv /var/lib/dpkg/info/{packagename}.* /tmp/
sudo dpkg --remove --force-remove-reinstreq {packagename}
sudo apt-get remove {packagename}
sudo apt-get autoremove && sudo apt-get autoclean

Maybe it’ll help somebody.

Hi I just marked ebtables as holded, so apt won’t try to update it :

$ sudo apt-mark hold ebtables ebtables set on hold.

About the same time as noelbundick and marchom found a solution, I used an alternative fix from https://github.com/Microsoft/WSL/issues/143#issuecomment-209075558 which I found linked to from a japanese bbs.

echo "Implementing udev workaround (https://github.com/Microsoft/WSL/issues/143#issuecomment-209072634)" >&2
sudo tee /usr/sbin/policy-rc.d > /dev/null <<EOF
#!/bin/sh
exit 101
EOF
sudo chmod +x /usr/sbin/policy-rc.d
sudo dpkg-divert --local --rename --add /sbin/initctl
sudo ln -fs /bin/true /sbin/initctl

There are parts of the script here and in the above linked comment from issue 143 that get around different issues related to this class of problems.

@josh-yoder-vive - It is my understanding that this isn’t causing any issues beyond a warning when running apt commands. Is that not the case?

@caseyallen386’s solution also worked for me with reinstalling docker:

sudo su
apt-get remove --purge docker-ce docker-ce-cli containerd.io
apt-get autoremove
apt-get autoclean
rm -rf /etc/docker /var/lib/docker
apt-get install docker-ce docker-ce-cli containerd.io

As of this afternoon a patch has been sponsored into Ubuntu’s devel release Cosmic and will filter down to Bionic and then get backported to Xenial.

https://bugs.launchpad.net/ubuntu/+source/ebtables/+bug/1774120/comments/8

@sirredbeard all of what you said is absolutely true. However one part is paradoxical:

WSL was intended to be used for programmers and developers to supplement their Windows workflow, so there was little need for runtime support.

I am a developer. Who in their development workflow, relies on the init system.

I am undoubtedly not the only one who does this. And many packages rely on it as well.

In this way WSL fails in its goal. It is undoubtedly a great tool, but it is also not one that I can use in its current state. It is worse than the VM I was already using. I was really hoping that WSL will be a proper replacement because that seems to be the goal that it set out to do. However it has failed me.

That said, I can not confirm the ebtables issue at this time, nor will I make a confirmation on the Ubuntu tracker. And the reason I won’t is simply this: it’s not an ebtables bug! The software is meant to run on Ubuntu and makes perfectly sane assumptions about its environment.

Trying to claim fault on them is like me making a new linux distribution that is supposed to be debian compatible yet only allow it to install RPM packages, and some RPM package fails to work on my distro because it assumes the environment is Red Hat.

If the WSL team decided (and I agree that it was a reasonable decision at the time) to not deal with a proper init system, sure, fine. But their wrong does not get transferred to the Ubuntu team nor should the Ubuntu team have to spend their time finding some strange work around because the WSL does fundamental linux concepts incorrectly. This is up to the WSL team to fix. Even if the ebtables maintainers resolve this issue this time, it is only a matter of time before it happens again.

A proper init system needs to be implemented-- period.

@sirredbeard all due respect I do not care for that issue. It’s minor and…well of no importance to me. My issue is with the fact that WSL doesn’t support something as fundamental as runlevels, which is supposedly trivial to support (again, I am unaware how trivial this is, just parroting the claim of another user). That is the underlying cause of ebtables having an issue, many packages in 16.04 having an issue, and can cause it’s own slew of problems for custom scripts that are being developed.

Same issue with me. Unable to install mysql-server or mariadb-server on wsl 2 ubuntu or debian. Have tried multiple times.

same problem happen when apt-get install or apt-get remove anything…

And the solutions above can not fix the problem…

@JulioV: for me @DzeryCZ’s solution

sudo mv /var/lib/dpkg/info/{packagename}.* /tmp/
sudo dpkg --remove --force-remove-reinstreq {packagename}
sudo apt-get remove {packagename}
sudo apt-get autoremove && sudo apt-get autoclean

didn’t work, just ran into invoke-rc.d: could not determine current runlevel when installing again, but @caseyallen386’s solution did work:

sudo su
apt-get remove --purge 'mysql*'
apt-get autoremove
apt-get autoclean
rm -f /etc/mysql /var/lib/mysql
apt-get install mysql-server

In case of mysql-server just make sure to back up (mysqldump -u root -p --all-databases > all_databases.sql) the databases and then restore them afterwards (mysql -u root -p < all_databases.sql). When mysql-server wouldn’t start up due to the runlevel error, I just rebooted the PC and then was able to start it and back up the databases.

In that sense I, personally, would probably just sudo apt purge ebtables.

If that’s a workable solution, so much the better. I am not entirely sure why/how etables is being invited to the party in 18.04. There would have been more chatter if it was a common problem previously (19 upvotes on your workaround).

Closing this issue as dupe #573 to try to get the runlevel fail (see issue title) back on track. Thank-you very much @marchom and @sirredbeard for following the etables fail and for the suggested workarounds. If the upstream package gets tweaked to be more tolerant of WSL that’s double plus good.

That workaround is narrowly limited to people’s woes with 18.04, which is now in people’s face, bumping this year old issue. The very rough guidance (if there is such a thing), based only on observation, is stuff that hangs out like this with no tag is nominally by-design or feature+backlog. I don’t work at MSFT; whether someone is looking at it or not I haven’t the slightest. But given it is now in people’s face I would bet a Internet nickle they are.

The correct work-around for this remains setting up /var/run/utmp so WSL thinks it has a runlevel.

@13steinj

If you need a full init system then WSL is probably not for you at this time. I mentioned several alternatives and the reasons to believe that there may be a solution for you in the future. There are several other key features to implement in WSL as well, Microsoft seems to be adding them fairly quickly and doing a pretty stable job overall. Let’s not forget that this is Microsoft implementing Linux on Windows. I don’t see Apple implementing native cross-platform apps. Google is just getting around to it on one device which already ran Linux, it’s not the technical accomplishment WSL is.

As for the upstream bug report, Ubuntu packages it’s distro and officially supports ~8 different containerized platforms with special customizations to run well on each, including Docker, Azure, AWS, and WSL. Microsoft cannot make this change to this package, Canonical has to. Canonical cannot fix this for the WSL image unless they know about the bug. You can be sour Microsoft hasn’t implemented an init system yet but in the mean time I am going to try to get this bug fixed by letting Canonical know. Yes, in an ideal world this wouldn’t be an issue, but this is an evolving project. If you want boring and tested, I recommend CentOS.

You complained about Ubuntu being confusingly listed Microsoft Store and I pointed out that was an existing bug, #3249. In response you stated “I do not care for that issue. It’s minor and…well of no importance to me”. Then why did you complain about it on GitHub? I then suggested you help get the bug fixed in the upstream Ubuntu container by clicking a single button, which you similarly dismissed. I have always believed if you want things to happen in open source to you have to write it yourself or be patient, file bug reports, and wait until someone else writes/fixes it. That’s the give and take of open source.

Just warnings, along the lines of this.

The RUNLEVEL environment hack (which gets picked up by /sbin/runlevel) doesn’t work because current versions of apt clobber the environment and don’t actually run as root. There’s probably some way to force the RUNLEVEL variable down apt’s throat but I didn’t take the time to look. People who feel strongly about it can do:

sudo bash -c "echo '[1] [00049] [~~  ] [runlevel] [~           ] [4.4.0-17115-Micoroso] [0.0.0.0        ] [Wed Feb 28 13:27:14 2018 STD]' | utmpdump -r > /var/run/utmp"

That will kill the runlevel warning. You’ll still get “start and stop actions are no longer supported”. Because they aren’t. Some people can’t be pleased.

This is still an issue. Can we get some sort of a resolution? This particular issue has been open for a year now.

@13steinj

Canonical supports Ubuntu on WSL similar to their support for Ubuntu on other container platforms, like Docker. Canonical partnered with Microsoft to bring Ubuntu to WSL. * Canonical are the ones who submit container images to the Microsoft Store using the reference template. It’s not like Microsoft just downloads the ISO and puts it in the store themselves. Canonical also have published documentation on their site for WSL. * * Ubuntu and Microsoft are official corporate partners, not just on WSL but on Azure as well. * If you want to learn more about how Canonical’s teams supports images of Ubuntu for several different platforms, I recommend s11e08 of the Ubuntu podcast.

By the way, from the bug report discussion it appears the actual bug is in how ebtables, called by ebtables.init, needlessly returns an error message. *. WSL fully supports EPROTONOSUPPORT socket() calls but ebtables still returns a permission error. This causes the error to be returned when the stop script is called as part of the package upgrade. *. The patch is to fix the script’s handling of the permission error. * The actual long-term solution is to patch communications.c in ebtables.

So turns out lack of a init wasn’t the issue and we could only find that out by filing a bug report and working together. Hooray open source.

@therealkenc Can you mark this bug as confirmed and that a patch is on the way? In the mean time we can point people towards @marchom’s workaround above.

@13steinj If you search for Ubuntu 18.04 in the Microsoft Store you can find it that way. There are a lot of things missing from WSL that you would find in a typical Linux distro. If you need a typical Linux distro, there are many excellent ones to chose from. There is also Docker and VirtualBox. WSL was intended to be used for programmers and developers to supplement their Windows workflow, so there was little need for runtime support. As WSL makes it way into Windows Server and SQL Server 2017 runs on Linux, it’s possible we will see further development on that. Given how an init system would slow down launching the shell, all the issues that systemd can cause, the lack of support for sysvinit outside niche distros, the abandonment of Upstart, and the relative immaturity of OpenRC, I think going without an init for now was probably a smart move, at least until Microsoft saw what the users actually did with WSL. If possible, please confirm the bug reported upstream on Ubuntu’s bug reporter so it will get fixed quicker. Thanks.

Hello everyone,

For me enabling systemd on WSL2 has resolved the issue. There is even a wrapped up version of the manipulation. Thanks to the author.

Tried everything on this thread multiple times without success:

root@PLIL19008WN:/# apt-get install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  libaio1 libcgi-fast-perl libcgi-pm-perl libencode-locale-perl libevent-core-2.1-6 libfcgi-perl libhtml-parser-perl
  libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl liblwp-mediatypes-perl
  libtimedate-perl liburi-perl mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-5.7 mysql-server-core-5.7
Suggested packages:
  libdata-dump-perl libipc-sharedcache-perl libwww-perl mailx tinyca
The following NEW packages will be installed:
  libaio1 libcgi-fast-perl libcgi-pm-perl libencode-locale-perl libevent-core-2.1-6 libfcgi-perl libhtml-parser-perl
  libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl liblwp-mediatypes-perl
  libtimedate-perl liburi-perl mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server mysql-server-5.7
  mysql-server-core-5.7
0 upgraded, 21 newly installed, 0 to remove and 172 not upgraded.
Need to get 0 B/21.0 MB of archives.
After this operation, 162 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
Selecting previously unselected package mysql-common.
(Reading database ... 29266 files and directories currently installed.)
Preparing to unpack .../0-mysql-common_5.8+1.0.4_all.deb ...
Unpacking mysql-common (5.8+1.0.4) ...
Selecting previously unselected package libaio1:amd64.
Preparing to unpack .../1-libaio1_0.3.110-5_amd64.deb ...
Unpacking libaio1:amd64 (0.3.110-5) ...
Selecting previously unselected package mysql-client-core-5.7.
Preparing to unpack .../2-mysql-client-core-5.7_5.7.25-0ubuntu0.18.04.2_amd64.deb ...
Unpacking mysql-client-core-5.7 (5.7.25-0ubuntu0.18.04.2) ...
Selecting previously unselected package mysql-client-5.7.
Preparing to unpack .../3-mysql-client-5.7_5.7.25-0ubuntu0.18.04.2_amd64.deb ...
Unpacking mysql-client-5.7 (5.7.25-0ubuntu0.18.04.2) ...
Selecting previously unselected package mysql-server-core-5.7.
Preparing to unpack .../4-mysql-server-core-5.7_5.7.25-0ubuntu0.18.04.2_amd64.deb ...
Unpacking mysql-server-core-5.7 (5.7.25-0ubuntu0.18.04.2) ...
Selecting previously unselected package libevent-core-2.1-6:amd64.
Preparing to unpack .../5-libevent-core-2.1-6_2.1.8-stable-4build1_amd64.deb ...
Unpacking libevent-core-2.1-6:amd64 (2.1.8-stable-4build1) ...
Setting up mysql-common (5.8+1.0.4) ...
update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Selecting previously unselected package mysql-server-5.7.
(Reading database ... 29434 files and directories currently installed.)
Preparing to unpack .../00-mysql-server-5.7_5.7.25-0ubuntu0.18.04.2_amd64.deb ...
Unpacking mysql-server-5.7 (5.7.25-0ubuntu0.18.04.2) ...
Selecting previously unselected package libhtml-tagset-perl.
Preparing to unpack .../01-libhtml-tagset-perl_3.20-3_all.deb ...
Unpacking libhtml-tagset-perl (3.20-3) ...
Selecting previously unselected package liburi-perl.
Preparing to unpack .../02-liburi-perl_1.73-1_all.deb ...
Unpacking liburi-perl (1.73-1) ...
Selecting previously unselected package libhtml-parser-perl.
Preparing to unpack .../03-libhtml-parser-perl_3.72-3build1_amd64.deb ...
Unpacking libhtml-parser-perl (3.72-3build1) ...
Selecting previously unselected package libcgi-pm-perl.
Preparing to unpack .../04-libcgi-pm-perl_4.38-1_all.deb ...
Unpacking libcgi-pm-perl (4.38-1) ...
Selecting previously unselected package libfcgi-perl.
Preparing to unpack .../05-libfcgi-perl_0.78-2build1_amd64.deb ...
Unpacking libfcgi-perl (0.78-2build1) ...
Selecting previously unselected package libcgi-fast-perl.
Preparing to unpack .../06-libcgi-fast-perl_1%3a2.13-1_all.deb ...
Unpacking libcgi-fast-perl (1:2.13-1) ...
Selecting previously unselected package libencode-locale-perl.
Preparing to unpack .../07-libencode-locale-perl_1.05-1_all.deb ...
Unpacking libencode-locale-perl (1.05-1) ...
Selecting previously unselected package libhtml-template-perl.
Preparing to unpack .../08-libhtml-template-perl_2.97-1_all.deb ...
Unpacking libhtml-template-perl (2.97-1) ...
Selecting previously unselected package libtimedate-perl.
Preparing to unpack .../09-libtimedate-perl_2.3000-2_all.deb ...
Unpacking libtimedate-perl (2.3000-2) ...
Selecting previously unselected package libhttp-date-perl.
Preparing to unpack .../10-libhttp-date-perl_6.02-1_all.deb ...
Unpacking libhttp-date-perl (6.02-1) ...
Selecting previously unselected package libio-html-perl.
Preparing to unpack .../11-libio-html-perl_1.001-1_all.deb ...
Unpacking libio-html-perl (1.001-1) ...
Selecting previously unselected package liblwp-mediatypes-perl.
Preparing to unpack .../12-liblwp-mediatypes-perl_6.02-1_all.deb ...
Unpacking liblwp-mediatypes-perl (6.02-1) ...
Selecting previously unselected package libhttp-message-perl.
Preparing to unpack .../13-libhttp-message-perl_6.14-1_all.deb ...
Unpacking libhttp-message-perl (6.14-1) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../14-mysql-server_5.7.25-0ubuntu0.18.04.2_all.deb ...
Unpacking mysql-server (5.7.25-0ubuntu0.18.04.2) ...
Setting up libhtml-tagset-perl (3.20-3) ...
Setting up libevent-core-2.1-6:amd64 (2.1.8-stable-4build1) ...
Processing triggers for ureadahead (0.100.0-20) ...
Setting up libencode-locale-perl (1.05-1) ...
Setting up libtimedate-perl (2.3000-2) ...
Setting up libio-html-perl (1.001-1) ...
Setting up liblwp-mediatypes-perl (6.02-1) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Setting up libaio1:amd64 (0.3.110-5) ...
Setting up liburi-perl (1.73-1) ...
Processing triggers for systemd (237-3ubuntu10.3) ...
Setting up libhtml-parser-perl (3.72-3build1) ...
Setting up libcgi-pm-perl (4.38-1) ...
Processing triggers for man-db (2.8.3-2) ...
Setting up mysql-client-core-5.7 (5.7.25-0ubuntu0.18.04.2) ...
Setting up libfcgi-perl (0.78-2build1) ...
Setting up libhttp-date-perl (6.02-1) ...
Setting up libhtml-template-perl (2.97-1) ...
Setting up mysql-server-core-5.7 (5.7.25-0ubuntu0.18.04.2) ...
Setting up libcgi-fast-perl (1:2.13-1) ...
Setting up libhttp-message-perl (6.14-1) ...
Setting up mysql-client-5.7 (5.7.25-0ubuntu0.18.04.2) ...
Setting up mysql-server-5.7 (5.7.25-0ubuntu0.18.04.2) ...
invoke-rc.d: could not determine current runlevel
 * Stopping MySQL database server mysqld                                                                                       [ OK ]
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Renaming removed key_buffer and myisam-recover options (if present)
Cannot open /proc/net/unix: No such file or directory
Cannot stat file /proc/1/fd/5: Operation not permitted
Cannot stat file /proc/3/fd/7: Operation not permitted
dpkg: error processing package mysql-server-5.7 (--configure):
 installed mysql-server-5.7 package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.7; however:
  Package mysql-server-5.7 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.27-3ubuntu1) ...
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Processing triggers for ureadahead (0.100.0-20) ...
Processing triggers for systemd (237-3ubuntu10.3) ...
Errors were encountered while processing:
 mysql-server-5.7
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

@caseyallen386 @georgique

I’m having similar problems. Casey, you basically just purged and reinstalled? Do you know why that fixed the issue but didn’t for George? I have tried uninstalling and reinstalling multiple times and mysql keeps not working, and I have several times gotten errors codes like George’s. I have just now purged everything as thoroughly as I know how, and then double checked by going through ever major folder at / and rm -r any mysql, php, or apache files I could find, and then I reinstalled, this time using sudo apt install -y lamp-server^ as per this tutorials here: https://hellojason.net/blog/how-to-setup-wordpress-locally-on-windows-subsystem-for-linux/

I’m fixing to test if everything works but while doing the LAMP install I noticed the reoccuring error code so I searched it and found this page.

If either of you know why this is happening or how it can be fixed, either the general difficulties I’m having getting MySQL to work on WSL or the specific issues brought up by this thread and related by George, I would love to know.

Yes you are right. It is not a general issue with opening sockets, as I assumed, but a specific issue that WSL does not support kernel interfaces Linux iptables. This effectively means that ebtables is currently useless because you can’t really do any filtering or bridging on the kernel level.

In that sense I, personally, would probably just sudo apt purge ebtables.

sockfd = socket(AF_INET, SOCK_RAW, PF_INET);

Yeah I should have stated that explicitly in my last message. We have two unrelated fails in Daniel’s original follow-up post and that is wreaking havoc on this issue topic. Almost to the point it may not recover.

...
invoke-rc.d: could not determine current runlevel
...
 * Error: insufficient privileges to access the ebtables rulesets.

socket(AF_INET, SOCK_RAW, ...) is [ed: better ref] #767 and friends. It has nothing to do with blog on AF_UNIX you cite. There is a UserVoice here.

EPROTONOSUPPORT has been supported in WSL since last year. * and appears to work well in other programs. So I have filed a bug report upstream with the netfilter team, who inherited ebtables, regarding the handling of EPROTONOSUPPORT errors in ebtables. Contrary to the error message, I do not believe it’s a permissions error because I can reproduce the error as root. The patches to the upgrade script (to disregard the error) by Canonical to Ubuntu Cosmic will trickle down to Bionic long before any patch by the netfilter team gets pushed to Debian then to Cosmic then Bionic, but we now have several viable short-term work arounds for WSL above, a medium-term workaround coming down from Ubuntu, and a long-term solution started.

Same problem here. Just marked this package on hold.

edit: @marchom posted a workaround as I was typing this in 😃

Hit this one just now when updating packages on Ubuntu 18.04 via Ansible

Relevant playbook task:

- name: Upgrade all packages                                                                                                                     
  apt:
    upgrade: yes
    autoclean: yes
    autoremove: yes

Which calls the following shell command:

sudo /usr/bin/apt-get upgrade --with-new-pkgs --auto-remove  

Which fails with:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  ebtables
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
5 not fully installed or removed.
Need to get 0 B/79.9 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 84358 files and directories currently installed.)
Preparing to unpack .../ebtables_2.0.10.4-3.5ubuntu2.18.04.1_amd64.deb ...
invoke-rc.d: could not determine current runlevel
 * Error: insufficient privileges to access the ebtables rulesets.
invoke-rc.d: initscript ebtables, action "stop" failed.
dpkg: warning: old ebtables package pre-removal script subprocess returned error exit status 1
dpkg: trying script from the new package instead ...
invoke-rc.d: could not determine current runlevel
 * Error: insufficient privileges to access the ebtables rulesets.
invoke-rc.d: initscript ebtables, action "stop" failed.
dpkg: error processing archive /var/cache/apt/archives/ebtables_2.0.10.4-3.5ubuntu2.18.04.1_amd64.deb (--unpack):
 new ebtables package pre-removal script subprocess returned error exit status 1
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
invoke-rc.d: could not determine current runlevel
Errors were encountered while processing:
 /var/cache/apt/archives/ebtables_2.0.10.4-3.5ubuntu2.18.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Looks like ebtables was updated 2 hours ago (https://launchpad.net/ubuntu/+source/ebtables/2.0.10.4-3.5ubuntu2.18.04.1), and this is causing failures in WSL