Bug 987867
Summary: | Running command is hang in generic container | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Alex Jia <ajia> |
Component: | libvirt-sandbox | Assignee: | Daniel Berrangé <berrange> |
Status: | CLOSED NOTABUG | QA Contact: | Virtualization Bugs <virt-bugs> |
Severity: | high | Docs Contact: | |
Priority: | high | ||
Version: | 7.0 | CC: | dyuan, gsun, weizhan, zpeng |
Target Milestone: | rc | ||
Target Release: | --- | ||
Hardware: | x86_64 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2013-07-24 10:50:14 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Alex Jia
2013-07-24 10:42:16 UTC
The virt-sandbox-service tool is not intended for running interactive commands like /bin/sh. It is for system services, where stdin will be wired up to /dev/null by systemd or an equivalent init system. If you want to run /bin/sh, then virt-sandbox is the command to use (In reply to Daniel Berrange from comment #2) > The virt-sandbox-service tool is not intended for running interactive > commands like /bin/sh. It is for system services, where stdin will be wired > up to /dev/null by systemd or an equivalent init system. If you want to run > /bin/sh, then virt-sandbox is the command to use Got it, in addition, if I run the following steps then connect container to check whether current user is my specified user, however, the user is root, is it expected result? with steps on Description then current user is 'bob'. # virt-sandbox-service create --username bob -C -u httpd.service -N dhcp foobar Created sandbox container dir /var/lib/libvirt/filesystems/foobar Created unit file /etc/systemd/system/foobar_sandbox.service Created sandbox config /etc/libvirt-sandbox/services/foobar.sandbox # virt-sandbox-service start foobar XXX [ OK ] Reached target Timers. [ OK ] Reached target Basic System. Starting The Apache HTTP Server... Starting Cleanup of Temporary Directories... [ OK ] Started Cleanup of Temporary Directories. [ OK ] Started The Apache HTTP Server. [ OK ] Reached target Sandbox multi-user target. XXX # virt-sandbox-service connect foobar sh-4.2# id uid=0(root) gid=0(root) groups=0(root) sh-4.2# ps -ef UID PID PPID C STIME TTY TIME CMD root 1 0 0 19:04 pts/0 00:00:00 /bin/systemd --unit multi-user.target --log-target console --system root 14 1 0 19:04 ? 00:00:00 /usr/lib/systemd/systemd-journald root 22 1 0 19:04 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND apache 39 22 0 19:04 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND apache 41 22 0 19:04 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND apache 42 22 0 19:04 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND apache 43 22 0 19:04 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND apache 44 22 0 19:04 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND root 88 1 0 19:05 ? 00:00:00 /sbin/dhclient --no-pid eth0 root 89 0 0 19:05 ? 00:00:00 /bin/sh root 91 89 0 19:05 ? 00:00:00 ps -ef sh-4.2# grep bob /etc/passwd bob:x:1000:1000::/home/bob:/bin/bash sh-4.2# su bob bash-4.2$ id uid=1000(bob) gid=1000(bob) groups=1000(bob) I think I'd say that it is intentional that you become 'root' when connecting to the container. If you were only 'bob', then you may not have sufficient privileges to fix any problem in the container. (In reply to Daniel Berrange from comment #2) > The virt-sandbox-service tool is not intended for running interactive > commands like /bin/sh. It is for system services, where stdin will be wired > up to /dev/null by systemd or an equivalent init system. If you want to run > /bin/sh, then virt-sandbox is the command to use Need to fix man page about EXAMPLE section? and also need to document this on guide or test plan as not to be test? thanks. # man virt-sandbox-service-create Create foobar1 Generic container # virt-sandbox-service create -U 1234 foobar1 -- /usr/bin/foobar -a -b Created container dir /var/lib/libvirt/filesystems/foobar1 Created sandbox config /etc/libvirt-sandbox/foobar1.sandbox |