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)
The way I fixed this:
/etc/init.d/ebtableshasJust comment out the actions taken by stop) e.g.:
and do your
sudo apt upgradeorpurgeor 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 stopand 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 statusTry this:
You are going to have no joy with
mdadmthough, 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
RUNLEVELdidn’t make a difference.I’m seeing this issue with ebtables:
autoremove/autoclean/install -f seems to make no difference.
I solved this issue by this:
Maybe it’ll help somebody.
Hi I just marked ebtables as holded, so apt won’t try to update it :
$ sudo apt-mark hold ebtablesebtables 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.
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:
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:
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 installorapt-get removeanything…And the solutions above can not fix the problem…
@JulioV: for me @DzeryCZ’s solution
didn’t work, just ran into
invoke-rc.d: could not determine current runlevelwhen installing again, but @caseyallen386’s solution did work:In case of
mysql-serverjust 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.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/utmpso 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
RUNLEVELenvironment hack (which gets picked up by/sbin/runlevel) doesn’t work because current versions ofaptclobber the environment and don’t actually run as root. There’s probably some way to force theRUNLEVELvariable downapt’s throat but I didn’t take the time to look. People who feel strongly about it can do: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.
https://bugs.launchpad.net/ubuntu/+source/ebtables/+bug/1774120
@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
systemdon 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:
@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.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.
socket(AF_INET, SOCK_RAW, ...)is [ed: better ref] #767 and friends. It has nothing to do with blog onAF_UNIXyou 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:
Which calls the following shell command:
Which fails with:
Looks like
ebtableswas 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