arkane-systems / bottle-imp

A spinoff of genie to supplement WSL's new built-in systemd support.
Other
108 stars 5 forks source link

`bottle-imp` auto-generated units failed to be executed by `systemd` #38

Open mangkoran opened 1 year ago

mangkoran commented 1 year ago

I have updated to 1.0 however I still have several failed units.

❯ systemctl --failed
  UNIT                               LOAD   ACTIVE SUB    DESCRIPTION
● systemd-sysctl.service             loaded failed failed Apply Kernel Variables
● systemd-tmpfiles-clean.service     loaded failed failed Cleanup of Temporary Directories
● systemd-tmpfiles-setup-dev.service loaded failed failed Create Static Device Nodes in /dev
● systemd-tmpfiles-setup.service     loaded failed failed Create Volatile Files and Directories

❯ sudo systemctl --type=service --all | grep imp
  imp-fixshm.service                     loaded    inactive dead    bottle-imp - Fix the /dev/shm symlink to be a mount
  imp-pstorefs.service                   loaded    inactive dead    bottle-imp - Kernel Persistent Storage File System
  imp-remount-root-shared.service        loaded    inactive dead    bottle-imp - Remount Root Filesystem Shared
  imp-securityfs.service                 loaded    inactive dead    bottle-imp - Kernel Security File System
  imp-wslg-socket.service                loaded    inactive dead    bottle-imp - WSLg socket remount service

❯ systemctl status imp-fixshm
○ imp-fixshm.service - bottle-imp - Fix the /dev/shm symlink to be a mount
     Loaded: loaded (/run/systemd/generator/imp-fixshm.service; generated)
     Active: inactive (dead)

❯ sudo systemctl enable imp-fixshm
Failed to enable unit: Unit /run/systemd/generator/imp-fixshm.service is transient or generated.

Now the units will failed even after I tried to restart it. All units failed with same "protocol error".

❯ sudo systemctl restart systemd-sysctl
[sudo] password for mangkoran:
Job for systemd-sysctl.service failed because the control process exited with error code.
See "systemctl status systemd-sysctl.service" and "journalctl -xeu systemd-sysctl.service" for details.

~
❯ systemctl status systemd-sysctl.service
× systemd-sysctl.service - Apply Kernel Variables
     Loaded: loaded (/usr/lib/systemd/system/systemd-sysctl.service; static)
     Active: failed (Result: exit-code) since Mon 2022-11-28 12:31:53 +07; 15s ago
       Docs: man:systemd-sysctl.service(8)
             man:sysctl.d(5)
    Process: 1545 ExecStart=/usr/lib/systemd/systemd-sysctl (code=exited, status=243/CREDENTIALS)
   Main PID: 1545 (code=exited, status=243/CREDENTIALS)

Nov 28 12:31:53 8atagor systemd[1]: Starting Apply Kernel Variables...
Nov 28 12:31:53 8atagor systemd[1545]: systemd-sysctl.service: Failed to set up credentials: Protocol error
Nov 28 12:31:53 8atagor systemd[1545]: systemd-sysctl.service: Failed at step CREDENTIALS spawning /usr/lib/systemd/systemd-sysct>
Nov 28 12:31:53 8atagor systemd[1]: systemd-sysctl.service: Main process exited, code=exited, status=243/CREDENTIALS
Nov 28 12:31:53 8atagor systemd[1]: systemd-sysctl.service: Failed with result 'exit-code'.
Nov 28 12:31:53 8atagor systemd[1]: Failed to start Apply Kernel Variables.

~
❯ findmnt
TARGET                          SOURCE        FSTYPE      OPTIONS
/                               /dev/sdc      ext4        rw,relatime,discard,errors=remount-ro,data=ordered
├─/mnt/wsl                      none          tmpfs       rw,relatime
├─/usr/lib/wsl/drivers          drivers       9p          ro,nosuid,nodev,noatime,dirsync,aname=drivers;fmask=222;dmask=222,mmap,a
├─/usr/lib/wsl/lib              none          overlay     rw,relatime,lowerdir=/gpu_lib_packaged:/gpu_lib_inbox,upperdir=/gpu_lib/
├─/mnt/wslg                     none          tmpfs       rw,relatime
│ ├─/mnt/wslg/distro            /dev/sdc      ext4        ro,relatime,discard,errors=remount-ro,data=ordered
│ ├─/mnt/wslg/versions.txt      none[/etc/versions.txt]
│ │                                           overlay     rw,relatime,lowerdir=/systemvhd,upperdir=/system/rw/upper,workdir=/syste
│ └─/mnt/wslg/doc               none[/usr/share/doc]
│                                             overlay     rw,relatime,lowerdir=/systemvhd,upperdir=/system/rw/upper,workdir=/syste
├─/init                         rootfs[/init] rootfs      rw,size=2002932k,nr_inodes=500733
├─/dev                          none          devtmpfs    rw,nosuid,relatime,size=2002960k,nr_inodes=500740,mode=755
│ ├─/dev/pts                    devpts        devpts      rw,nosuid,noexec,noatime,gid=5,mode=620,ptmxmode=000
│ ├─/dev/hugepages              hugetlbfs     hugetlbfs   rw,relatime,pagesize=2M
│ └─/dev/mqueue                 mqueue        mqueue      rw,nosuid,nodev,noexec,relatime
├─/sys                          sysfs         sysfs       rw,nosuid,nodev,noexec,noatime
│ ├─/sys/fs/cgroup              tmpfs         tmpfs       ro,nosuid,nodev,noexec,size=4096k,nr_inodes=1024,mode=755
│ │ ├─/sys/fs/cgroup/unified    cgroup2       cgroup2     rw,nosuid,nodev,noexec,relatime,nsdelegate
│ │ ├─/sys/fs/cgroup/cpuset     cgroup        cgroup      rw,nosuid,nodev,noexec,relatime,cpuset
│ │ ├─/sys/fs/cgroup/cpu        cgroup        cgroup      rw,nosuid,nodev,noexec,relatime,cpu
│ │ ├─/sys/fs/cgroup/cpuacct    cgroup        cgroup      rw,nosuid,nodev,noexec,relatime,cpuacct
│ │ ├─/sys/fs/cgroup/blkio      cgroup        cgroup      rw,nosuid,nodev,noexec,relatime,blkio
│ │ ├─/sys/fs/cgroup/memory     cgroup        cgroup      rw,nosuid,nodev,noexec,relatime,memory
│ │ ├─/sys/fs/cgroup/devices    cgroup        cgroup      rw,nosuid,nodev,noexec,relatime,devices
│ │ ├─/sys/fs/cgroup/freezer    cgroup        cgroup      rw,nosuid,nodev,noexec,relatime,freezer
│ │ ├─/sys/fs/cgroup/net_cls    cgroup        cgroup      rw,nosuid,nodev,noexec,relatime,net_cls
│ │ ├─/sys/fs/cgroup/perf_event cgroup        cgroup      rw,nosuid,nodev,noexec,relatime,perf_event
│ │ ├─/sys/fs/cgroup/net_prio   cgroup        cgroup      rw,nosuid,nodev,noexec,relatime,net_prio
│ │ ├─/sys/fs/cgroup/hugetlb    cgroup        cgroup      rw,nosuid,nodev,noexec,relatime,hugetlb
│ │ ├─/sys/fs/cgroup/pids       cgroup        cgroup      rw,nosuid,nodev,noexec,relatime,pids
│ │ ├─/sys/fs/cgroup/rdma       cgroup        cgroup      rw,nosuid,nodev,noexec,relatime,rdma
│ │ ├─/sys/fs/cgroup/misc       cgroup        cgroup      rw,nosuid,nodev,noexec,relatime,misc
│ │ └─/sys/fs/cgroup/systemd    cgroup        cgroup      rw,nosuid,nodev,noexec,relatime,xattr,name=systemd
│ ├─/sys/kernel/debug           debugfs       debugfs     rw,nosuid,nodev,noexec,relatime
│ ├─/sys/kernel/tracing         tracefs       tracefs     rw,nosuid,nodev,noexec,relatime
│ └─/sys/fs/fuse/connections    fusectl       fusectl     rw,nosuid,nodev,noexec,relatime
├─/proc                         proc          proc        rw,nosuid,nodev,noexec,noatime
│ └─/proc/sys/fs/binfmt_misc    binfmt_misc   binfmt_misc rw,relatime
├─/run                          none          tmpfs       rw,nosuid,nodev,mode=755
│ ├─/run/lock                   none          tmpfs       rw,nosuid,nodev,noexec,noatime
│ ├─/run/shm                    none          tmpfs       rw,nosuid,nodev,noatime
│ └─/run/user                   none          tmpfs       rw,nosuid,nodev,noexec,noatime,mode=755
│   └─/run/user/1000            none[/runtime-dir]
│                                             tmpfs       rw,relatime
├─/tmp/.X11-unix                none[/.X11-unix]
│                                             tmpfs       rw,relatime
├─/mnt/c                        drvfs         9p          rw,noatime,dirsync,aname=drvfs;path=C:\;uid=1000;gid=1000;metadata;symli
├─/mnt/d                        drvfs         9p          rw,noatime,dirsync,aname=drvfs;path=D:\;uid=1000;gid=1000;metadata;symli
├─/mnt/e                        drvfs         9p          rw,noatime,dirsync,aname=drvfs;path=E:\;uid=1000;gid=1000;metadata;symli
├─/mnt/g                        drvfs         9p          rw,noatime,dirsync,aname=drvfs;path=G:\;uid=1000;gid=1000;metadata;symli
├─/mnt/h                        drvfs         9p          rw,noatime,dirsync,aname=drvfs;path=H:\;uid=1000;gid=1000;metadata;symli
├─/tmp                          tmpfs         tmpfs       rw,nosuid,nodev,nr_inodes=1048576
└─/var/lib/docker               /dev/sdc[/var/lib/docker]
                                              ext4        rw,relatime,discard,errors=remount-ro,data=ordered

~
❯ mount
none on /mnt/wsl type tmpfs (rw,relatime)
drivers on /usr/lib/wsl/drivers type 9p (ro,nosuid,nodev,noatime,dirsync,aname=drivers;fmask=222;dmask=222,mmap,access=client,msize=65536,trans=fd,rfd=7,wfd=7)
none on /usr/lib/wsl/lib type overlay (rw,relatime,lowerdir=/gpu_lib_packaged:/gpu_lib_inbox,upperdir=/gpu_lib/rw/upper,workdir=/gpu_lib/rw/work)
/dev/sdc on / type ext4 (rw,relatime,discard,errors=remount-ro,data=ordered)
none on /mnt/wslg type tmpfs (rw,relatime)
/dev/sdc on /mnt/wslg/distro type ext4 (ro,relatime,discard,errors=remount-ro,data=ordered)
rootfs on /init type rootfs (rw,size=2002932k,nr_inodes=500733)
none on /dev type devtmpfs (rw,nosuid,relatime,size=2002960k,nr_inodes=500740,mode=755)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
devpts on /dev/pts type devpts (rw,nosuid,noexec,noatime,gid=5,mode=620,ptmxmode=000)
none on /run type tmpfs (rw,nosuid,nodev,mode=755)
none on /run/lock type tmpfs (rw,nosuid,nodev,noexec,noatime)
none on /run/shm type tmpfs (rw,nosuid,nodev,noatime)
none on /run/user type tmpfs (rw,nosuid,nodev,noexec,noatime,mode=755)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,size=4096k,nr_inodes=1024,mode=755)
cgroup2 on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu type cgroup (rw,nosuid,nodev,noexec,relatime,cpu)
cgroup on /sys/fs/cgroup/cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_prio)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/rdma type cgroup (rw,nosuid,nodev,noexec,relatime,rdma)
cgroup on /sys/fs/cgroup/misc type cgroup (rw,nosuid,nodev,noexec,relatime,misc)
none on /mnt/wslg/versions.txt type overlay (rw,relatime,lowerdir=/systemvhd,upperdir=/system/rw/upper,workdir=/system/rw/work)
none on /mnt/wslg/doc type overlay (rw,relatime,lowerdir=/systemvhd,upperdir=/system/rw/upper,workdir=/system/rw/work)
none on /tmp/.X11-unix type tmpfs (rw,relatime)
drvfs on /mnt/c type 9p (rw,noatime,dirsync,aname=drvfs;path=C:\;uid=1000;gid=1000;metadata;symlinkroot=/mnt/,mmap,access=client,msize=262144,trans=virtio)
drvfs on /mnt/d type 9p (rw,noatime,dirsync,aname=drvfs;path=D:\;uid=1000;gid=1000;metadata;symlinkroot=/mnt/,mmap,access=client,msize=262144,trans=virtio)
drvfs on /mnt/e type 9p (rw,noatime,dirsync,aname=drvfs;path=E:\;uid=1000;gid=1000;metadata;symlinkroot=/mnt/,mmap,access=client,msize=262144,trans=virtio)
drvfs on /mnt/g type 9p (rw,noatime,dirsync,aname=drvfs;path=G:\;uid=1000;gid=1000;metadata;symlinkroot=/mnt/,mmap,access=client,msize=262144,trans=virtio)
drvfs on /mnt/h type 9p (rw,noatime,dirsync,aname=drvfs;path=H:\;uid=1000;gid=1000;metadata;symlinkroot=/mnt/,mmap,access=client,msize=262144,trans=virtio)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,name=systemd)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
tracefs on /sys/kernel/tracing type tracefs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,nr_inodes=1048576)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
/dev/sdc on /var/lib/docker type ext4 (rw,relatime,discard,errors=remount-ro,data=ordered)
none on /run/user/1000 type tmpfs (rw,relatime)
WSL version: 1.0.0.0
Kernel version: 5.15.74.2
WSLg version: 1.0.47
MSRDC version: 1.2.3575
Direct3D version: 1.606.4
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22621.819
---
Distro: ArchWSL
bottle-imp 1.0-1
mangkoran commented 1 year ago

After trying to reinstall it once again, it seems this issue is not appearing anymore 😅

What I did / step to reinstall:

sudo pacman -R bottle-imp

sudo rm /run/systemd/generator/imp-*

#in powershell
wsl --terminate [distro-name] #restart WSL distro

wsl -d [distro-name]

sudo pacman -U [bottle-imp-archive]

#in powershell
wsl --terminate [distro-name] #restart WSL distro once again

wsl -d [distro-name] imp -s
mangkoran commented 1 year ago

Apologize. It seems the issue is back. I think the main problem is that several imp units are not started by systemd properly.

~ took 8s
❯ exa -l /run/systemd/generator/imp-*
.rw-r--r-- 600 root 29 Nov 21:02 /run/systemd/generator/imp-fixshm.service
.rw-r--r-- 358 root 29 Nov 21:02 /run/systemd/generator/imp-pstorefs.service
.rw-r--r-- 276 root 29 Nov 21:02 /run/systemd/generator/imp-remount-root-shared.service
.rw-r--r-- 383 root 29 Nov 21:02 /run/systemd/generator/imp-securityfs.service
.rw-r--r-- 382 root 29 Nov 21:02 /run/systemd/generator/imp-wslg-socket.service

~
❯ systemctl status imp-fixshm
○ imp-fixshm.service - bottle-imp - Fix the /dev/shm symlink to be a mount
     Loaded: loaded (/run/systemd/generator/imp-fixshm.service; generated)
     Active: inactive (dead)

~
❯ systemctl status imp-pstorefs
○ imp-pstorefs.service - bottle-imp - Kernel Persistent Storage File System
     Loaded: loaded (/run/systemd/generator/imp-pstorefs.service; generated)
     Active: inactive (dead)

~
❯ systemctl status imp-remount-root-shared
○ imp-remount-root-shared.service - bottle-imp - Remount Root Filesystem Shared
     Loaded: loaded (/run/systemd/generator/imp-remount-root-shared.service; generated)
     Active: inactive (dead)

~
❯ systemctl status imp-securityfs
○ imp-securityfs.service - bottle-imp - Kernel Security File System
     Loaded: loaded (/run/systemd/generator/imp-securityfs.service; generated)
     Active: inactive (dead)

~
❯ systemctl status imp-wslg-socket
○ imp-wslg-socket.service - bottle-imp - WSLg socket remount service
     Loaded: loaded (/run/systemd/generator/imp-wslg-socket.service; generated)
     Active: inactive (dead)
  Condition: start condition failed at Tue 2022-11-29 21:02:08 +07; 10min ago
             └─ ConditionPathExists=/tmp/.X11-unix was not met

Nov 29 21:02:08 8atagor systemd[1]: bottle-imp - WSLg socket remount service was skipped because of an unmet condition check (ConditionPathExists=/tmp/.X11-unix).

Trying to restart imp-fixshm produced the following result.

❯ systemctl status imp-fixshm
○ imp-fixshm.service - bottle-imp - Fix the /dev/shm symlink to be a mount
     Loaded: loaded (/run/systemd/generator/imp-fixshm.service; generated)
     Active: inactive (dead)
  Condition: start condition failed at Tue 2022-11-29 22:40:20 +07; 7min ago
             └─ ConditionPathIsSymbolicLink=/dev/shm was not met

Nov 29 22:40:20 8atagor systemd[1]: bottle-imp - Fix the /dev/shm symlink to be a mount was skipped because of an unmet condition check (ConditionPathIsSymbolicLink=/dev/shm).

I tried to reproduce the issue by bootstrapping a new, clean ArchWSL distro and I found no issue there.

[mangkoran@8atagor ~]$ ls -la /run/systemd/generator/imp-*
-rw-r--r-- 1 root root 600 Nov 29 21:02 /run/systemd/generator/imp-fixshm.service
-rw-r--r-- 1 root root 358 Nov 29 21:02 /run/systemd/generator/imp-pstorefs.service
-rw-r--r-- 1 root root 276 Nov 29 21:02 /run/systemd/generator/imp-remount-root-shared.service
-rw-r--r-- 1 root root 383 Nov 29 21:02 /run/systemd/generator/imp-securityfs.service
-rw-r--r-- 1 root root 382 Nov 29 21:02 /run/systemd/generator/imp-wslg-socket.service
[mangkoran@8atagor ~]$ systemctl status imp-fixshm
○ imp-fixshm.service - bottle-imp - Fix the /dev/shm symlink to be a mount
     Loaded: loaded (/run/systemd/generator/imp-fixshm.service; generated)
     Active: inactive (dead) since Tue 2022-11-29 21:02:22 +07; 4min 30s ago
    Process: 31 ExecStart=/usr/lib/bottle-imp/imp-executor devshm (code=exited, status=0/SUCCESS)
   Main PID: 31 (code=exited, status=0/SUCCESS)

Nov 29 21:02:22 8atagor systemd[1]: imp-fixshm.service: Deactivated successfully.
Nov 29 21:02:22 8atagor systemd[1]: Finished bottle-imp - Fix the /dev/shm symlink to be a mount.
Notice: journal has been rotated since unit was started, output may be incomplete.
[mangkoran@8atagor ~]$ systemctl status imp-pstorefs
○ imp-pstorefs.service - bottle-imp - Kernel Persistent Storage File System
     Loaded: loaded (/run/systemd/generator/imp-pstorefs.service; generated)
     Active: inactive (dead)
  Condition: start condition failed at Tue 2022-11-29 21:02:22 +07; 4min 35s ago
             └─ ConditionPathExists=/sys/fs/pstore was not met
[mangkoran@8atagor ~]$ systemctl status imp-remount-root-shared
○ imp-remount-root-shared.service - bottle-imp - Remount Root Filesystem Shared
     Loaded: loaded (/run/systemd/generator/imp-remount-root-shared.service; generated)
     Active: inactive (dead) since Tue 2022-11-29 21:02:22 +07; 4min 39s ago
    Process: 43 ExecStart=/usr/lib/bottle-imp/imp-executor rrfs (code=exited, status=0/SUCCESS)
   Main PID: 43 (code=exited, status=0/SUCCESS)

Nov 29 21:02:22 8atagor systemd[1]: Starting bottle-imp - Remount Root Filesystem Shared...
Nov 29 21:02:22 8atagor systemd[1]: imp-remount-root-shared.service: Deactivated successfully.
Nov 29 21:02:22 8atagor systemd[1]: Finished bottle-imp - Remount Root Filesystem Shared.
[mangkoran@8atagor ~]$ systemctl status imp-securityfs
○ imp-securityfs.service - bottle-imp - Kernel Security File System
     Loaded: loaded (/run/systemd/generator/imp-securityfs.service; generated)
     Active: inactive (dead)
  Condition: start condition failed at Tue 2022-11-29 21:02:22 +07; 4min 43s ago
             └─ ConditionPathExists=/sys/kernel/security was not met
[mangkoran@8atagor ~]$ systemctl status imp-wslg-socket
○ imp-wslg-socket.service - bottle-imp - WSLg socket remount service
     Loaded: loaded (/run/systemd/generator/imp-wslg-socket.service; generated)
     Active: inactive (dead) since Tue 2022-11-29 21:02:22 +07; 4min 45s ago
    Process: 62 ExecStart=/usr/lib/bottle-imp/imp-executor wslg (code=exited, status=0/SUCCESS)
   Main PID: 62 (code=exited, status=0/SUCCESS)

Nov 29 21:02:22 8atagor systemd[1]: Starting bottle-imp - WSLg socket remount service...
Nov 29 21:02:22 8atagor systemd[1]: imp-wslg-socket.service: Deactivated successfully.
Nov 29 21:02:22 8atagor systemd[1]: Finished bottle-imp - WSLg socket remount service.