Bug 1190754 - supermin fails to create appliance if TMPDIR is a relative path
Summary: supermin fails to create appliance if TMPDIR is a relative path
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: supermin
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Richard W.M. Jones
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-02-09 15:20 UTC by James (purpleidea)
Modified: 2015-02-10 10:06 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-02-10 09:47:21 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
supermin command output (2.44 MB, text/plain)
2015-02-09 15:20 UTC, James (purpleidea)
no flags Details
Version with TMPDIR set (1.02 MB, text/plain)
2015-02-09 16:02 UTC, James (purpleidea)
no flags Details

Description James (purpleidea) 2015-02-09 15:20:39 UTC
Created attachment 989736 [details]
supermin command output

Description of problem:

Supermin bug

Version-Release number of selected component (if applicable):
$ supermin --version
supermin 5.1.10


How reproducible:
100%

Steps to Reproduce:
Ran a script which failed. R
Actual results:


Expected results:


Additional info:

Was asked to provide the following:

$ supermin -v -v -v --build --if-newer --copy-kernel -f ext2 --host-cpu x86_64 /usr/lib64/guestfs/supermin.d -o /tmp/appliance.d

[attached]

Comment 1 James (purpleidea) 2015-02-09 16:02:23 UTC
Created attachment 989765 [details]
Version with TMPDIR set

Comment 2 James (purpleidea) 2015-02-09 16:04:36 UTC
(In reply to James (purpleidea) from comment #1)
> Created attachment 989765 [details]
> Version with TMPDIR set

Turns out this bug seems to get triggered when TMPDIR is set...

Comment 3 Richard W.M. Jones 2015-02-09 16:14:51 UTC
Is it running out of space on $TMPDIR?

What actually happens is that the base image
(/usr/lib64/guestfs/supermin.d/base.tar.gz) is untarred into a
temporary directory under $TMPDIR or /tmp.  In the failing case
that's into `tmpdir/superminXXXXXX.tmpdir/base.d/'.  Then that
directory is iterated over and the files/directories are created
in the target filesystem (/tmp/appliance.d/root, probably).

supermin: ext2: populating from base image
supermin: ext2: copy_file tmpdir/supermine17934.tmpdir/base.d -> /
supermin: ext2: copy_file tmpdir/supermine17934.tmpdir/base.d/etc -> /etc
supermin: error: lstat: No such file or directory: tmpdir/supermine17934.tmpdir/base.d/etc

As you can see after expanding the filesystem, iterating over the
first directory in the tarball (etc/) it fails.

Can you also do:

tar ztvvvf /usr/lib64/guestfs/supermin.d/base.tar.gz

Comment 4 James (purpleidea) 2015-02-09 21:06:37 UTC
(In reply to Richard W.M. Jones from comment #3)
> Is it running out of space on $TMPDIR?

It's in a subdirectory of my home, so no.
$ df -h | grep home
/dev/dm-0       946G  478G  467G  51% /home

It is btrfs, in case there would be some reason that this is triggering something.

> 
> What actually happens is that the base image
> (/usr/lib64/guestfs/supermin.d/base.tar.gz) is untarred into a
> temporary directory under $TMPDIR or /tmp.  In the failing case
> that's into `tmpdir/superminXXXXXX.tmpdir/base.d/'.  Then that
> directory is iterated over and the files/directories are created
> in the target filesystem (/tmp/appliance.d/root, probably).
> 
> supermin: ext2: populating from base image
> supermin: ext2: copy_file tmpdir/supermine17934.tmpdir/base.d -> /
> supermin: ext2: copy_file tmpdir/supermine17934.tmpdir/base.d/etc -> /etc
> supermin: error: lstat: No such file or directory:
> tmpdir/supermine17934.tmpdir/base.d/etc
> 
> As you can see after expanding the filesystem, iterating over the
> first directory in the tarball (etc/) it fails.
> 
> Can you also do:
> 
> tar ztvvvf /usr/lib64/guestfs/supermin.d/base.tar.gz


$ tar ztvvvf /usr/lib64/guestfs/supermin.d/base.tar.gz
-rw-r--r-- 0/0            1328 2014-12-18 15:58 ./etc/yum.repos.d/fedora-updates-testing.repo
-rw-r--r-- 0/0            1270 2014-12-18 15:58 ./etc/yum.repos.d/fedora-updates.repo
-rw-r--r-- 0/0            1252 2014-12-18 15:58 ./etc/yum.repos.d/fedora.repo
-rw------- 0/0            7046 2014-12-18 15:57 ./etc/tcsd.conf
-rw-r--r-- 0/0            1518 2014-12-18 15:57 ./etc/aliases
-rw-r--r-- 0/0            2835 2014-12-18 15:57 ./etc/bashrc
-rw-r--r-- 0/0            1602 2014-12-18 15:57 ./etc/csh.cshrc
-rw-r--r-- 0/0             841 2014-12-18 15:57 ./etc/csh.login
-rw-r--r-- 0/0               0 2014-12-18 15:57 ./etc/environment
-rw-r--r-- 0/0               0 2014-12-18 15:57 ./etc/exports
-rw-r--r-- 0/0              64 2014-12-18 15:57 ./etc/filesystems
-rw-r--r-- 0/0             261 2014-12-18 15:57 ./etc/group
-rw-r--r-- 0/0               9 2014-12-18 15:57 ./etc/host.conf
-rw-r--r-- 0/0             158 2014-12-18 15:57 ./etc/hosts
-rw-r--r-- 0/0             370 2014-12-18 15:57 ./etc/hosts.allow
-rw-r--r-- 0/0             460 2014-12-18 15:57 ./etc/hosts.deny
-rw-r--r-- 0/0             942 2014-12-18 15:57 ./etc/inputrc
-rw-r--r-- 0/0               0 2014-12-18 15:57 ./etc/motd
-rw-r--r-- 0/0             513 2014-12-18 15:57 ./etc/passwd
-rw-r--r-- 0/0             233 2014-12-18 15:57 ./etc/printcap
-rw-r--r-- 0/0            1750 2014-12-18 15:57 ./etc/profile
-rw-r--r-- 0/0            6545 2014-12-18 15:57 ./etc/protocols
-rw-r--r-- 0/0          673046 2014-12-18 15:57 ./etc/services
-rw-r--r-- 0/0              76 2014-12-18 15:57 ./etc/shells
-rw-r--r-- 0/0           65536 2014-12-18 15:58 ./etc/pki/nssdb/cert8.db
-rw-r--r-- 0/0            9216 2014-12-18 15:58 ./etc/pki/nssdb/cert9.db
-rw-r--r-- 0/0           16384 2014-12-18 15:58 ./etc/pki/nssdb/key3.db
-rw-r--r-- 0/0           11264 2014-12-18 15:58 ./etc/pki/nssdb/key4.db
-rw-r--r-- 0/0             451 2014-12-18 15:58 ./etc/pki/nssdb/pkcs11.txt
-rw-r--r-- 0/0           16384 2014-12-18 15:58 ./etc/pki/nssdb/secmod.db
-rw-r--r-- 0/0            2321 2014-12-18 15:57 ./etc/selinux/semanage.conf
-rw-r--r-- 0/0              31 2014-12-18 15:58 ./etc/fedora-release
-rw-r--r-- 0/0              56 2014-12-18 15:58 ./etc/issue
-rw-r--r-- 0/0              55 2014-12-18 15:58 ./etc/issue.net
-rw-r--r-- 0/0             377 2014-12-18 15:58 ./etc/os-release
-rw-r--r-- 0/0              31 2014-12-18 15:58 ./etc/system-release-cpe
-rw-r--r-- 0/0            1285 2014-12-18 15:57 ./etc/dracut.conf
-rw-r--r-- 0/0             504 2014-12-18 15:58 ./etc/crypto-policies/config
-rw-r--r-- 0/0             323 2014-12-18 15:57 ./etc/pki/ca-trust/ca-legacy.conf
-rw-r--r-- 0/0             119 2014-12-18 15:57 ./etc/default/useradd
-rw-r--r-- 0/0            2028 2014-12-18 15:57 ./etc/login.defs
-rw-r--r-- 0/0             232 2014-12-18 15:57 ./etc/pam.d/config-util
-rw-r--r-- 0/0             701 2014-12-18 15:57 ./etc/pam.d/fingerprint-auth
-rw-r--r-- 0/0             154 2014-12-18 15:57 ./etc/pam.d/other
-rw-r--r-- 0/0             760 2014-12-18 15:57 ./etc/pam.d/password-auth
-rw-r--r-- 0/0             329 2014-12-18 15:57 ./etc/pam.d/postlogin
-rw-r--r-- 0/0             743 2014-12-18 15:57 ./etc/pam.d/smartcard-auth
-rw-r--r-- 0/0             760 2014-12-18 15:57 ./etc/pam.d/system-auth
-rw-r--r-- 0/0            4620 2014-12-18 15:57 ./etc/security/access.conf
-rw-r--r-- 0/0              82 2014-12-18 15:57 ./etc/security/chroot.conf
-rw-r--r-- 0/0             604 2014-12-18 15:57 ./etc/security/console.handlers
-rw-r--r-- 0/0             939 2014-12-18 15:57 ./etc/security/console.perms
-rw-r--r-- 0/0            3635 2014-12-18 15:57 ./etc/security/group.conf
-rw-r--r-- 0/0            2411 2014-12-18 15:57 ./etc/security/limits.conf
-rw-r--r-- 0/0             191 2014-12-18 15:57 ./etc/security/limits.d/20-nproc.conf
-rw-r--r-- 0/0            1440 2014-12-18 15:57 ./etc/security/namespace.conf
-rwxr-xr-x 0/0            1019 2014-12-18 15:57 ./etc/security/namespace.init
-rw------- 0/0               0 2014-12-18 15:57 ./etc/security/opasswd
-rw-r--r-- 0/0            2972 2014-12-18 15:57 ./etc/security/pam_env.conf
-rw-r--r-- 0/0             419 2014-12-18 15:57 ./etc/security/sepermit.conf
-rw-r--r-- 0/0            2179 2014-12-18 15:57 ./etc/security/time.conf
-rw-r--r-- 0/0           10923 2014-12-18 15:58 ./etc/pki/tls/openssl.cnf
-rw-r--r-- 0/0          242153 2014-12-18 15:57 ./etc/ssh/moduli
-rw-r--r-- 0/0             364 2014-12-18 15:58 ./etc/openldap/ldap.conf
-rw-r--r-- 0/0            2620 2014-12-18 15:57 ./etc/mtools.conf
-rw-r--r-- 0/0            2391 2014-12-18 15:58 ./etc/libuser.conf
-rw-r--r-- 0/0            1718 2014-12-18 15:57 ./etc/security/pwquality.conf
-rw-r--r-- 0/0             589 2014-12-18 15:58 ./etc/xattr.conf
-rw-r--r-- 0/0             495 2014-12-18 15:57 ./etc/krb5.conf
-rw------- 0/0            1753 2014-12-18 15:58 ./etc/sysconfig/ip6tables-config
-rw------- 0/0            1740 2014-12-18 15:58 ./etc/sysconfig/iptables-config
-rw-r--r-- 0/0              12 2014-12-18 15:57 ./etc/adjtime
-rw-r--r-- 0/0              58 2014-12-18 15:57 ./etc/networks
-rw-r--r-- 0/0             798 2014-12-18 15:57 ./etc/sysconfig/init
-rw-r--r-- 0/0             634 2014-12-18 15:57 ./etc/sysconfig/netconsole
-rw-r--r-- 0/0             254 2014-12-18 15:57 ./etc/sysconfig/network-scripts/ifcfg-lo
-rw-r--r-- 0/0             714 2014-12-18 15:57 ./etc/sysconfig/readonly-root
-rw-r--r-- 0/0             754 2014-12-18 15:58 ./usr/share/info/dir
-rw-r--r-- 0/0              96 2014-12-18 15:58 ./etc/groff/site-tmac/man.local
-rw-r--r-- 0/0              90 2014-12-18 15:58 ./etc/groff/site-tmac/mdoc.local
-rw-r--r-- 0/0            1756 2014-12-18 15:58 ./etc/default/nss
-rw-r--r-- 0/0              28 2014-12-18 15:58 ./etc/ld.so.conf
-rw-r--r-- 0/0            1720 2014-12-18 15:58 ./etc/nsswitch.conf
-rw-r--r-- 0/0            1634 2014-12-18 15:58 ./etc/rpc
-rw-r--r-- 0/0           56359 2014-12-18 15:58 ./usr/lib64/gconv/gconv-modules
-rw-r--r-- 0/0              38 2014-12-18 15:58 ./etc/fuse.conf
-rw-r--r-- 0/0            2883 2014-12-18 15:57 ./etc/dbus-1/session.conf
-rw-r--r-- 0/0            2991 2014-12-18 15:57 ./etc/dbus-1/system.conf
-rw-r----- 0/0             191 2014-12-18 15:57 ./etc/libaudit.conf
-rw-r--r-- 0/0             192 2014-12-18 15:58 ./etc/pam.d/chfn
-rw-r--r-- 0/0             192 2014-12-18 15:58 ./etc/pam.d/chsh
-rw-r--r-- 0/0             715 2014-12-18 15:58 ./etc/pam.d/login
-rw-r--r-- 0/0             640 2014-12-18 15:58 ./etc/pam.d/remote
-rw-r--r-- 0/0             143 2014-12-18 15:58 ./etc/pam.d/runuser
-rw-r--r-- 0/0             138 2014-12-18 15:58 ./etc/pam.d/runuser-l
-rw-r--r-- 0/0             540 2014-12-18 15:58 ./etc/pam.d/su
-rw-r--r-- 0/0             137 2014-12-18 15:58 ./etc/pam.d/su-l
-rw-r--r-- 0/0             326 2014-12-18 15:58 ./usr/lib/udev/rules.d/60-raw.rules
-rw-r--r-- 0/0             458 2014-12-18 15:58 ./etc/rsyncd.conf
-rw-r--r-- 0/0              12 2014-12-18 15:58 ./etc/sysconfig/rsyncd
-rw-r--r-- 0/0             108 2014-12-18 15:58 ./etc/cron.d/raid-check
-rw-r--r-- 0/0            2915 2014-12-18 15:58 ./etc/sysconfig/raid-check
-rw-r--r-- 0/0              34 2014-12-18 15:58 ./usr/lib/tmpfiles.d/mdadm.conf
-rw-r--r-- 0/0           58447 2014-12-18 15:58 ./etc/lvm/lvm.conf
-rw-r--r-- 0/0              94 2014-12-18 15:57 ./etc/GREP_COLORS
-rw-r--r-- 0/0             337 2014-12-18 15:57 ./etc/profile.d/colorgrep.csh
-rw-r--r-- 0/0             277 2014-12-18 15:57 ./etc/profile.d/colorgrep.sh
-rw-r--r-- 0/0             111 2014-12-18 15:58 ./etc/magic
-rw-r--r-- 0/0             112 2014-12-18 15:57 ./etc/e2fsck.conf
-rw-r--r-- 0/0             956 2014-12-18 15:57 ./etc/mke2fs.conf
-rw-r--r-- 0/0            5090 2014-12-18 15:58 ./etc/DIR_COLORS
-rw-r--r-- 0/0            5725 2014-12-18 15:58 ./etc/DIR_COLORS.256color
-rw-r--r-- 0/0            4669 2014-12-18 15:58 ./etc/DIR_COLORS.lightbgcolor
-rw-r--r-- 0/0            1642 2014-12-18 15:58 ./etc/profile.d/colorls.csh
-rw-r--r-- 0/0            1501 2014-12-18 15:58 ./etc/profile.d/colorls.sh
-rw-r--r-- 0/0              18 2014-12-18 15:58 ./etc/skel/.bash_logout
-rw-r--r-- 0/0             193 2014-12-18 15:58 ./etc/skel/.bash_profile
-rw-r--r-- 0/0             231 2014-12-18 15:58 ./etc/skel/.bashrc
-rw-r--r-- 0/0             416 2014-12-18 15:57 ./etc/sysconfig/zfs-fuse
-rw-r--r-- 0/0            1982 2014-12-18 15:58 ./etc/virc
-rw-r--r-- 0/0             947 2014-12-18 15:57 ./etc/dbus-1/system.d/org.freedesktop.hostname1.conf
-rw-r--r-- 0/0             937 2014-12-18 15:57 ./etc/dbus-1/system.d/org.freedesktop.locale1.conf
-rw-r--r-- 0/0            8344 2014-12-18 15:57 ./etc/dbus-1/system.d/org.freedesktop.login1.conf
-rw-r--r-- 0/0            2959 2014-12-18 15:57 ./etc/dbus-1/system.d/org.freedesktop.machine1.conf
-rw-r--r-- 0/0             953 2014-12-18 15:57 ./etc/dbus-1/system.d/org.freedesktop.resolve1.conf
-rw-r--r-- 0/0            9720 2014-12-18 15:57 ./etc/dbus-1/system.d/org.freedesktop.systemd1.conf
-rw-r--r-- 0/0             947 2014-12-18 15:57 ./etc/dbus-1/system.d/org.freedesktop.timedate1.conf
-rw-r--r-- 0/0             129 2014-12-18 15:57 ./etc/pam.d/systemd-user
-rw-r--r-- 0/0             449 2014-12-18 15:57 ./etc/sysctl.conf
-rw-r--r-- 0/0             546 2014-12-18 15:57 ./etc/systemd/bootchart.conf
-rw-r--r-- 0/0             452 2014-12-18 15:57 ./etc/systemd/coredump.conf
-rw-r--r-- 0/0             806 2014-12-18 15:57 ./etc/systemd/journald.conf
-rw-r--r-- 0/0             780 2014-12-18 15:57 ./etc/systemd/logind.conf
-rw-r--r-- 0/0             427 2014-12-18 15:57 ./etc/systemd/resolved.conf
-rw-r--r-- 0/0            1308 2014-12-18 15:57 ./etc/systemd/system.conf
-rw-r--r-- 0/0             444 2014-12-18 15:57 ./etc/systemd/timesyncd.conf
-rw-r--r-- 0/0            1022 2014-12-18 15:57 ./etc/systemd/user.conf
-rw-r--r-- 0/0              49 2014-12-18 15:57 ./etc/udev/udev.conf
-rw-r--r-- 0/0               8 2014-12-18 15:57 ./etc/yum/protected.d/systemd.conf
-rw-r--r-- 0/0            2121 2014-12-18 15:58 ./etc/ssh/ssh_config
-rw-r--r-- 0/0            2484 2014-12-18 15:58 ./etc/nilfs_cleanerd.conf
-rw-r--r-- 0/0              75 2014-12-18 15:58 ./etc/iproute2/ematch_map
-rw-r--r-- 0/0              31 2014-12-18 15:58 ./etc/iproute2/group
-rw-r--r-- 0/0             442 2014-12-18 15:58 ./etc/iproute2/rt_dsfield
-rw-r--r-- 0/0             317 2014-12-18 15:58 ./etc/iproute2/rt_protos
-rw-r--r-- 0/0             112 2014-12-18 15:58 ./etc/iproute2/rt_realms
-rw-r--r-- 0/0              92 2014-12-18 15:58 ./etc/iproute2/rt_scopes
-rw-r--r-- 0/0              87 2014-12-18 15:58 ./etc/iproute2/rt_tables
-rw-r--r-- 0/0              11 2014-12-18 15:58 ./etc/sysconfig/cbq/avpkt
-rw-r--r-- 0/0              79 2014-12-18 15:58 ./etc/sysconfig/cbq/cbq-0000.example

Comment 5 Richard W.M. Jones 2015-02-10 09:32:29 UTC
It doesn't seem to be a btrfs problem.  I created a temporary
btrfs device, mounted it, and used it as a TMPDIR but it did
not appear to affect supermin appliance creation.

Comment 6 Richard W.M. Jones 2015-02-10 09:35:03 UTC
OK I see what it is.  It's because you've use a relative path for TMPDIR.
You should use an absolute path instead (eg. TMPDIR=~/tmpdir)

Comment 7 Richard W.M. Jones 2015-02-10 09:47:21 UTC
I've added this error message if TMPDIR is not set correctly, so
at least it won't fail randomly:

https://github.com/libguestfs/supermin/commit/5096f0f02a87b864cc07e7ea6d7b0e406fdffd5c

Comment 8 James (purpleidea) 2015-02-10 10:06:09 UTC
Aha. Beautiful, thanks for being so responsive.

Cheers!


Note You need to log in before you can comment on or make changes to this bug.