Skip to content

crun detach mode process do not exit when using systemd #1827

@yiwa273679

Description

@yiwa273679

my app cont-ctrl will call “crun run --detach helloworld” command

Image

everything is OK when I exec “cont-ctrl start helloworld -d”.

root@c1rdb02:~# cont-ctrl start helloworld -d
[123.516616200][EB-KPI][CONT] STARTING helloworld
[123.516870400][EB-KPI][CONT] VERIFYSIG helloworld
[123.518854600][EB-KPI][CONT] VERITYSETUP helloworld
[123.537028400][EB-KPI][CONT] MOUNT_START helloworld
[123.545635600][EB-KPI][CONT] MOUNTED_CONTENT helloworld
[123.546654600][EB-KPI][CONT] STARTRUNC helloworld
root@c1rdb02:~# Yep! I am helloworld_startup.sh!
!!!Hello World!!!
root@c1rdb02:~# ps auxf |grep helloworld
root         465  0.0  0.0   2828   740 ttyLF0   S+   17:27   0:00      \_ grep helloworld
root         455  0.7  0.0   2084  1352 ?        Ss   17:27   0:00 /bin/sh /usr/bin/helloworld_startup.sh
root         456  1.5  0.0   5204  1736 ?        S    17:27   0:00  \_ helloworld

But two processess named 'crun run --detach helloworld' will exist when using systemd:

c1rdb02 login: root
root@c1rdb02:~# ps auxf |grep helloworld
root         226  0.0  0.0   4200  1148 ?        Ss   17:25   0:00 crun run --detach helloworld
root         236  0.0  0.0   4300  2220 ?        S    17:25   0:00 crun run --detach helloworld
root         237  0.0  0.0   2084  1356 ?        Ss   17:25   0:00  \_ /bin/sh /usr/bin/helloworld_startup.sh
root         241  0.1  0.0   5204  1736 ?        S    17:25   0:00      \_ helloworld
root         354  0.0  0.0   2828   684 ttyLF0   S+   17:26   0:00      \_ grep helloworld
root@c1rdb02:~# cat /lib/systemd/system/helloworld.service
[Unit]
Description=Hello World Container Service

[Service]
Type=simple
Environment="XDG_RUNTIME_DIR=/run/user/0"
ExecStartPre=/bin/mkdir -p /run/user/0
ExecStart=/sbin/cont-ctrl start %p -d
ExecStopPost=/sbin/cont-ctrl stop %p -d
NotifyAccess=all
TimeoutStopSec=30

[Install]
WantedBy=multi-user.target

I don't know why exec the same command 'cont-ctrl start helloworld -d' will show two deferephenomenons

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions