{"id":13566451,"url":"https://github.com/moonkracker/wsl2_systemd_systemctl","last_synced_at":"2026-01-22T02:39:04.238Z","repository":{"id":126107384,"uuid":"361283485","full_name":"moonkracker/wsl2_systemd_systemctl","owner":"moonkracker","description":null,"archived":false,"fork":false,"pushed_at":"2021-05-27T09:32:52.000Z","size":2,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-04T20:42:30.314Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/moonkracker.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-04-24T22:55:48.000Z","updated_at":"2021-11-13T04:02:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"8faf3092-ac61-498d-aed0-3c390dbc6a75","html_url":"https://github.com/moonkracker/wsl2_systemd_systemctl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moonkracker%2Fwsl2_systemd_systemctl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moonkracker%2Fwsl2_systemd_systemctl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moonkracker%2Fwsl2_systemd_systemctl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moonkracker%2Fwsl2_systemd_systemctl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moonkracker","download_url":"https://codeload.github.com/moonkracker/wsl2_systemd_systemctl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247103306,"owners_count":20884023,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T13:02:09.954Z","updated_at":"2026-01-22T02:39:04.205Z","avatar_url":"https://github.com/moonkracker.png","language":null,"readme":"# setting up systemd for wsl2:\n- Install packages\n```bash\nsudo apt install -y fontconfig daemonize\n```\n- Add data to /etc/profile\n```bash\nSYSTEMD_PID=$(ps -ef | grep '/lib/systemd/systemd --system-unit=basic.target$' | grep -v unshare | awk '{print $2}')\nif [ -z \"$SYSTEMD_PID\" ]; then\n   sudo /usr/bin/daemonize /usr/bin/unshare --fork --pid --mount-proc /lib/systemd/systemd --system-unit=basic.target\n   SYSTEMD_PID=$(ps -ef | grep '/lib/systemd/systemd --system-unit=basic.target$' | grep -v unshare | awk '{print $2}')\nfi\nif [ -n \"$SYSTEMD_PID\" ] \u0026\u0026 [ \"$SYSTEMD_PID\" != \"1\" ]; then\n    exec sudo /usr/bin/nsenter -t $SYSTEMD_PID -a su - $LOGNAME\nfi\n```\n- Add data to /etc/sudoers\n```bash\n\u003cuser\u003e ALL=(ALL) NOPASSWD: /usr/sbin/daemonize /usr/bin/unshare --fork --pid --mount-proc /lib/systemd/systemd --system-unit=basic.target\n\u003cuser\u003e ALL=(ALL) NOPASSWD: /usr/bin/nsenter -t [0-9]* -a su - [a-zA-Z0-9]*\n```\n- In powershell restart wsl\n```ps\nwsl --shutdown\n```\n\n","funding_links":[],"categories":["Others"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoonkracker%2Fwsl2_systemd_systemctl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoonkracker%2Fwsl2_systemd_systemctl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoonkracker%2Fwsl2_systemd_systemctl/lists"}