Eu quebrei o subsistema Windows Linux (Bash no Ubuntu no Windows 10). Ajuda do Linux?

22

Eu tenho jogado com o novo subsistema linux no Windows e de alguma forma eu o quebrei e agora a maioria dos componentes internos do Ubuntu (apt-get, dpkg, etc) não funcionam. Tudo que eu tento alguma coisa eu recebo a mesma mensagem ...

    Setting up udev (204-5ubuntu20.19) ...
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: No such file or directory
runlevel:/var/run/utmp: No such file or directory
 * udev requires devtmpfs support, not started
   ...fail!
invoke-rc.d: initscript udev, action "restart" failed.
dpkg: error processing package udev (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of systemd-services:
 systemd-services depends on udev (>= 175-0ubuntu23); however:
  Package udev is not configured yet.

dpkg: error processing package systemd-services (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libpam-systemd:amd64:
No apport report written because the error message indicates its a followup error from a previous failure. libpam-systemd:amd64 depends on systemd-services (= 204-5ubuntu20.19); however:
  Package systemd-services is not configured yet.


dpkg: error processing package libpam-systemd:amd64 (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
 udev
 systemd-services
 libpam-systemd:amd64
E: Sub-process /usr/bin/dpkg returned an error code (1)

Alguma idéia de como corrigir isso?

    
por Mike Pengelly 13.04.2016 / 04:24

4 respostas

18

Corrigido.

Ran:

apt-get remove upstart

então

apt-get remove udev

então

apt-get autoremove

e tudo parece estar funcionando agora.

    
por 13.04.2016 / 06:48
34

Atenção, este processo irá restaurar o Lxss na configuração inicial

Para reinstalar o Lxss, abra o Windows cmd como administrador e execute:

C:\WINDOWS\system32>LxRun.exe /uninstall

Então:

C:\WINDOWS\system32>LxRun.exe /install
    
por 15.04.2016 / 01:56
9

A resposta oficial da microsoft

github: Microsoft / BashOnWindows

This is an issue that everyone will start seeing. We need to add something on this in our official docs.

As @nuclearmistake points out, udev is something that breaks in apt-get but the errors should not cause any issues in WSL. We have reached out to Canonical on this one asking for the best solution and they recommend the following changes:

Write the following to /usr/sbin/policy-rc.d

#!/bin/sh exit 101

chmod +x /usr/sbin/policy-rc.d

dpkg-divert --local --rename --add /sbin/initctl

ln -s /bin/true /sbin/initctl

I have tried this one myself and it looks to work quite well.

    
por 20.04.2016 / 07:44
6

Aqui está uma solução mais segmentada. Crie um script chamado /usr/sbin/policy-rc.d ( nano /usr/sbin/policy-rc.d ) com o seguinte conteúdo:

#!/bin/sh
case "$1" in
    udev|systemd-logind) exit 101;;
esac

Salve e saia ( Ctrl + O Ctrl + X ). Marque o script como executável ( chmod +x /usr/sbin/policy-rc.d ). Este script informa a dpkg para não tentar iniciar udev ou systemd-logind .

Você poderá concluir a etapa de configuração dpkg com falha anterior ( dpkg --configure -a ).

    
por 17.04.2016 / 10:06