Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1067804

Summary: Container which only have a / filesystem fail to start
Product: Red Hat Enterprise Linux 7 Reporter: Luwen Su <lsu>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.0CC: acathrow, ajia, berrange, dyuan, mzhan
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-02-24 08:12:44 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 Luwen Su 2014-02-21 05:56:01 UTC
Description of problem:
If the container only have one / filesystem , it will fail to start.

: systemd-machined: Machine lxc-sandbox terminated.


Version-Release number of selected component (if applicable):
libvirt-1.1.1-23.el7.x86_64
kernel-3.10.0-89.el7.x86_64


How reproducible:
100%

Steps to Reproduce:
1.#cat test.xml
<domain type='lxc'>
  <name>sandbox</name>
  <uuid>fdc5d804-7a9b-51b0-1d0f-1313f1d4c1df</uuid>
  <memory unit='KiB'>524288</memory>
  <currentMemory unit='KiB'>524288</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <os>
    <type arch='x86_64'>exe</type>
    <init>/usr/libexec/libvirt-sandbox-init-lxc</init>
  </os>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/libexec/libvirt_lxc</emulator>
    <filesystem type='mount' accessmode='passthrough'>
      <source dir='/'/>
      <target dir='/'/>
      <readonly/>
    </filesystem>
    <console type='pty'>
      <target type='lxc' port='0'/>
    </console>
    <console type='pty'>
      <target type='lxc' port='1'/>
    </console>
  </devices>
  <seclabel type='static' model='selinux' relabel='no'>
    <label>system_u:system_r:virtd_lxc_t:s0:c0.c1023</label>
  </seclabel>
</domain>

2.
#virsh -c lxc:/// define test.xml
#virsh -c lxc:/// start sandbox
Domain sandbox started

#echo $?
0

# virsh -c lxc:/// list --all
 Id    Name                           State
----------------------------------------------------
 -     sandbox                        shut off

3.
# cat /var/log/messages 
Feb 21 13:51:47 localhost systemd: Starting Container lxc-sandbox.
Feb 21 13:51:47 localhost systemd-machined: New machine lxc-sandbox.
Feb 21 13:51:47 localhost systemd: Started Container lxc-sandbox.
Feb 21 13:51:47 localhost journal: End of file while reading data: Input/output error
Feb 21 13:51:47 localhost systemd-machined: Machine lxc-sandbox terminated.
Feb 21 13:51:47 localhost journal: No such file or directory


Actual results:
Fail to start , and return value is 0

Expected results:
Give the right error 

Additional info:

Comment 2 Daniel Berrangé 2014-02-21 09:30:29 UTC
(In reply to time.su from comment #0)
> Description of problem:
> If the container only have one / filesystem , it will fail to start.
> 
> : systemd-machined: Machine lxc-sandbox terminated.
> 
> 
> Version-Release number of selected component (if applicable):
> libvirt-1.1.1-23.el7.x86_64
> kernel-3.10.0-89.el7.x86_64
> 
> 
> How reproducible:
> 100%
> 
> Steps to Reproduce:
> 1.#cat test.xml
> <domain type='lxc'>
>   <name>sandbox</name>
>   <uuid>fdc5d804-7a9b-51b0-1d0f-1313f1d4c1df</uuid>
>   <memory unit='KiB'>524288</memory>
>   <currentMemory unit='KiB'>524288</currentMemory>
>   <vcpu placement='static'>1</vcpu>
>   <os>
>     <type arch='x86_64'>exe</type>
>     <init>/usr/libexec/libvirt-sandbox-init-lxc</init>

This binary is only intended for usage by the 'virt-sandbox' command line tool or library, which knows how to setup a guest in the right way for it to work. Your XML here is missing many things that libvirt-sandbox-init-lxc requires in order to work. Hence the guest immediately shuts down as your test demonstrates.

Here you are testing plain libvirt LXC so you should a different binary, eg /bin/sh.

>   </os>
>   <clock offset='utc'/>
>   <on_poweroff>destroy</on_poweroff>
>   <on_reboot>restart</on_reboot>
>   <on_crash>destroy</on_crash>
>   <devices>
>     <emulator>/usr/libexec/libvirt_lxc</emulator>
>     <filesystem type='mount' accessmode='passthrough'>
>       <source dir='/'/>
>       <target dir='/'/>
>       <readonly/>
>     </filesystem>
>     <console type='pty'>
>       <target type='lxc' port='0'/>
>     </console>
>     <console type='pty'>
>       <target type='lxc' port='1'/>
>     </console>
>   </devices>
>   <seclabel type='static' model='selinux' relabel='no'>
>     <label>system_u:system_r:virtd_lxc_t:s0:c0.c1023</label>
>   </seclabel>
> </domain>
> 
> 2.
> #virsh -c lxc:/// define test.xml
> #virsh -c lxc:/// start sandbox
> Domain sandbox started
> 
> #echo $?
> 0
> 
> # virsh -c lxc:/// list --all
>  Id    Name                           State
> ----------------------------------------------------
>  -     sandbox                        shut off