docker

[Docker]System has not been booted with systemd as init system (PID 1). Can't operate.Failed to connect to bus: Host is down 에러 해결방

joje* 2024. 9. 18. 18:52

- wsl2를 이용해 Docker 이용환경을 구축하다 보면 아래와 같은 에러를 마주칠 수 있다.

System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

 

에러의 원인은 리눅스 환경구축 시 서비스 관리자가 init으로 설정되어 그렇다. Docker를 이용하기 위해서는 서비스 관리자를 systemd로 변경해주어야 한다.

 

해결방법: 

1. wsl2 최신버전으로 업데이트(최소한 wsl 0.67.6 이상 버전) 및 Ubuntu 접속

powerShell에서 아래 명령어 입력

wsl --update
wsl -d ubuntu

** wsl version 확인 명령어 : wsl --version

 

2. Ubuntu에서 vim을 이용해 wsl.conf 파일 열기 

cd /etc
sudo vim wsl.conf

 

3. wsl.conf 파일에 아래내용을 입력 후 저장

[boot]
systemd=true

 

4. Ubuntu 종료 후 재실행

powerShell에서 아래 명령어를 이용해 배포판 목록과 상태를 확인

wsl -l-v

 

Ubuntu가 정상적으로 종료되었음을 확인

 

powerShell에서 Ubuntu 재기동

wsl -d ubuntu

 

5. 시스템 관리자 변경확인

Ubuntu에 접속해 아래 명령어를 통해 시스템관리자가 systemd로 변경되었음을 확인

pstree

 

 

6. Docker 재설치

 

-참고한 사이트

https://m.blog.naver.com/xell00/223158675748

 

wsl2 ubuntu에서 systemd 사용

wsl2 ubuntu에서 systemd 사용해 보겠습니다. 먼저, systemd를 사용하려면 WSL 버전 0.67.6 이상 이어야...

blog.naver.com

https://www.hakawati.co.kr/entry/WSL2-%EC%97%90%EC%84%9C-Systemd-%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0

 

WSL2 에서 Systemd 사용하기

Overview WSL을 기본적으로 설치하면 sysvinit, 줄여서 init을 사용한다. 이는 오래된 시스템으로 centos 기준 6버전 이하, ubuntu 기준 12.04 이하 버전에서 사용해 왔다. 최신 리눅스 시스템은 init 대신 system

www.hakawati.co.kr

 

**설치한 Ubuntu 삭제방법

https://webnautes.tistory.com/2013

 

Windows에 설치한 WSL2 및 Ubuntu 삭제하는 방법

Windows에 설치한 WSL 및 Ubuntu를 삭제하는 방법을 다룹니다.2023.8.7 최초작성2024. 1. 72024. 3. 112024. 6. 231.윈도우키 + R을 누른 후, cmd를 입력하고 엔터키를 눌러 명령 프롬프트를 실행합니다2.등록되어

webnautes.tistory.com