Comments (2)
Looks like this was solved in another project by disabling some systemd services and explictly mounting binfmt_misc:
DamionGans/ubuntu-wsl2-systemd-script#15
https://github.com/DamionGans/ubuntu-wsl2-systemd-script/pull/17/files
It'd be great to have these changes ported here, as disabling the service alone doesn't fix the issue.
from subsystemctl.
I resolved the issue locally by mounting binfmt:
diff --git a/src/bottle.rs b/src/bottle.rs
index f04804a..cbb4768 100644
--- a/src/bottle.rs
+++ b/src/bottle.rs
@@ -243,6 +243,14 @@ fn exec_systemd2_child(systemd_bin: CString) -> Result<(), error::Error> {
)
.expect("proc mount failure");
+ nix::mount::mount(
+ Some(OsStr::new("binfmt_misc")),
+ OsStr::new("/proc/sys/fs/binfmt_misc"),
+ Some(OsStr::new("binfmt_misc")),
+ MsFlags::MS_NOSUID | MsFlags::MS_NODEV | MsFlags::MS_NOEXEC,
+ OS_NONE,
+ )
+ .expect("binfmt mount failure");
nix::unistd::chdir("/").unwrap();
nix::unistd::setgid(nix::unistd::Gid::from_raw(0)).unwrap();
nix::unistd::setuid(nix::unistd::Uid::from_raw(0)).unwrap();
and disabling binfmt mount related services
sudo mkdir -p /etc/systemd/wsl2-incompatible/user/sockets.target.wants/ /lib/systemd/wsl2-incompatible/system/sysinit.target.wants/ /usr/lib/systemd/wsl2-incompatible/system/
# remove binfmt mounting done by systemd because it doesn't work and triggers 'too many simlinks error
sudo mv /lib/systemd/system/sysinit.target.wants/proc-sys-fs-binfmt_misc.automount /lib/systemd/wsl2-incompatible/system/sysinit.target.wants/
sudo mv /lib/systemd/system/sysinit.target.wants/systemd-binfmt.service /lib/systemd/wsl2-incompatible/system/sysinit.target.wants/
sudo mv /usr/lib/systemd/system/proc-sys-fs-binfmt_misc.automount /usr/lib/systemd/wsl2-incompatible/system/
sudo mv /usr/lib/systemd/system/proc-sys-fs-binfmt_misc.mount /usr/lib/systemd/wsl2-incompatible/system/
from subsystemctl.
Related Issues (16)
- Not working in ssh
- Supports cloning environment variables such as WSL_DISTRO_NAME HOT 2
- Cannot access DISPLAY :0 HOT 1
- error in command using subsystemctl exec bash HOT 3
- Shell falls back to sh on subsystemctl shell
- pkg subsystemctl is removed from aur? HOT 3
- Some thoughts about setuid
- A note on AppArmor and WSL
- errors
- 404 PAGE HOT 1
- Missing Windows Path HOT 1
- is this available for CentOS/RHEL? HOT 9
- WORKING GOOD in CENTOS7/RHEL7 / Oracle Linux 7 HOT 1
- Cockpit + KVM HOT 1
- I was able to run the subsystemctl in Centos 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from subsystemctl.