Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 776790 - app-emulation/libguestfs-appliance should warn about sourcing /etc/profile on first installs
Summary: app-emulation/libguestfs-appliance should warn about sourcing /etc/profile on...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: No maintainer - Look at if you want to take care of it
Depends on:
Blocks: EAPI5Removal
  Show dependency tree
Reported: 2021-03-17 02:28 UTC by fabrice nicol
Modified: 2021-04-11 11:02 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---

list of installed packages (qlist) (qlist,40.09 KB, text/plain)
2021-03-17 02:28 UTC, fabrice nicol
strace log of virt-copy-out example (strace_virt-copy-out.log,57.18 KB, text/x-log)
2021-03-17 02:39 UTC, fabrice nicol

Note You need to log in before you can comment on or make changes to this bug.
Description fabrice nicol 2021-03-17 02:28:43 UTC
Created attachment 691923 [details]
list of installed packages (qlist)

Calls to `guestfish' or `virt-copy-ou' request access to `supermin', and issue an error message about LIBGUESTFS_PATH.
Normally supermin is a part of app-emulation/libguestfs-appliance.
Installed versions of libguestfs and libguestfs-appliance are current.
No output except for error messages.

Calls examples:

# virt-copy-out -a Gentoo.2021-03-16-04-55-38.vdi /sbin fslibguestfs: error: cannot find any suitable libguestfs supermin, fixed or old-style appliance on LIBGUESTFS_PATH (search path: /usr/lib64/guestfs)

# guestfish --ro -a Gentoo.2021-03-16-04-55-38.vdi run : download /dev/sda /dev/sdd
libguestfs: error: cannot find any suitable libguestfs supermin, fixed or old-style appliance on LIBGUESTFS_PATH (search path: /usr/lib64/guestfs)

Exit code was 1 in either case.

-------------------  Attachements --------------------------

$ emerge --info

Portage 3.0.13 (python 3.8.8-final-0, default/linux/amd64/17.1/desktop/plasma, gcc-10.2.0, glibc-2.32-r7, 5.11.6-gentoo x86_64)
System uname: Linux-5.11.6-gentoo-x86_64-Intel-R-_Core-TM-_i7-5820K_CPU_@_3.30GHz-with-glibc2.2.5
KiB Mem:    82201896 total,   3741500 free
KiB Swap:   10780252 total,  10650972 free
Timestamp of repository gentoo: Sun, 14 Mar 2021 16:00:01 +0000
Head commit of repository gentoo: ebc65b360483b27111d2f727bb4aea66aa778eba
sh bash 5.0_p18
ld GNU ld (Gentoo 2.35.1 p2) 2.35.1
app-shells/bash:          5.0_p18::gentoo
dev-java/java-config:     2.3.1::gentoo
dev-lang/perl:            5.30.3::gentoo
dev-lang/python:          2.7.18_p7::gentoo, 3.8.8::gentoo, 3.9.2::gentoo
dev-util/cmake:           3.18.5::gentoo
sys-apps/baselayout:      2.7::gentoo
sys-apps/openrc:          0.42.1-r1::gentoo
sys-apps/sandbox:         2.20::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r5::gentoo
sys-devel/automake:       1.16.2-r1::gentoo
sys-devel/binutils:       2.35.1-r1::gentoo
sys-devel/gcc:            10.2.0-r5::gentoo
sys-devel/gcc-config:     2.3.3::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.3::gentoo
sys-kernel/linux-headers: 5.4-r1::gentoo (virtual/os-headers)
sys-libs/glibc:           2.32-r7::gentoo

    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://
    priority: -1000
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-jobs: 1

    location: /var/lib/layman/haskell
    masters: gentoo
    priority: 50

ACCEPT_LICENSE="@FREE linux-fw-redistributable no-source-code bh-luxi"
CFLAGS="-O2 -march=haswell -pipe"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -march=haswell -pipe"
FCFLAGS="-O2 -march=haswell -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -march=haswell -pipe"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="fr en"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
USE="X a52 aac acl acpi activities alsa amd64 audio base berkdb bindist bluetooth branding bzip2 cairo cdda cdr cli crypt cups dbus declarative dri dts dvd dvdr elogind emboss encode exif flac fortran gdbm gif gpm gtk gtk3 gui iconv icu ipv6 java jpeg kde kipi kwallet lcms libglvnd libnotify libtirpc mad mng mp3 mp4 mpeg mpi multilib ncurses networkmanager nls nptl ocaml ogg opengl openmp pam pango pcre pdf phonon plasma png policykit ppds qml qt4 qt5 readline sdl seccomp semantic-desktop spell split-usr ssl startup-notification static static-libs svg tcpd threads tiff truetype udev udisks unicode upower usb video virtualbox vorbis widgets wxwidgets x264 xattr xcb xml xv xvid zlib" ABI_X86="64" ADA_TARGET="gnat_2018" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="evdev synaptics" KERNEL="linux" L10N="fr en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-3 php7-4" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_8" PYTHON_TARGETS="python3_8" RUBY_TARGETS="ruby26" USERLAND="GNU" VIDEO_CARDS="nouveau intel vmware" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"


$ eix libguestfs-appliance
[I] app-emulation/libguestfs-appliance
     Available versions:  (~)1.38.0
     Installed versions:  1.38.0(00:58:15 03/17/21)

fab@fabpc ~/mkg $ eix libguestfs
[I] app-emulation/libguestfs
     Available versions:  (~)1.38.6-r103(0/1.38)^t {doc erlang +fuse gtk inspect-icons introspection libvirt lua ocaml +perl python ruby selinux static-libs systemtap test KERNEL="linux" LUA_SINGLE_TARGET="+lua5-1" PYTHON_SINGLE_TARGET="python3_7 python3_8"}
     Installed versions:  1.38.6-r103(0/1.38)^t(01:38:05 03/17/21)(fuse gtk inspect-icons introspection libvirt lua ocaml perl ruby static-libs systemtap -doc -erlang -python -selinux -test KERNEL="linux" LUA_SINGLE_TARGET="lua5-1" PYTHON_SINGLE_TARGET="python3_8 -python3_7")
Comment 1 fabrice nicol 2021-03-17 02:39:47 UTC
Created attachment 691926 [details]
strace log of virt-copy-out example
Comment 2 Ionen Wolkens gentoo-dev 2021-03-17 04:21:21 UTC
I haven't tried but this sound suspicious:
LIBGUESTFS_PATH (search path: /usr/lib64/guestfs)

Considering /etc/env.d/99libguestfs-appliance should set:

If you've just installed it, maybe you need to source /etc/profile?
Comment 3 fabrice nicol 2021-03-17 05:37:00 UTC
(In reply to Ionen Wolkens from comment #2)
> I haven't tried but this sound suspicious:
> LIBGUESTFS_PATH (search path: /usr/lib64/guestfs)
> Considering /etc/env.d/99libguestfs-appliance should set:
> LIBGUESTFS_PATH=/usr/share/guestfs/appliance/
> If you've just installed it, maybe you need to source /etc/profile?

Well, normally emerge should work without sourcing /etc/profile.
This said, you are right, it is part of the issue.
A second sub-issue is that after sourcing /etc/profile, virt-copy
requested me to add myself to the kvm group. This should be automated
by portage somehow (as is done for the virtualbox packages). 
Yet once all of this was settled, it was not the whole story.
Actually it so turns out that libguestfs has a covert dependency 
to (media-sound/pulseaudio), and that the ebuild has omitted it in its dependency graph.
I would advise a fix to this effect.
See below:

" cannot open shared object file: No such file or directory" 

$ groups fab
wheel audio video users plugdev kvm

$ . /etc/profile

$ virt-copy-out -a Gentoo.2021-03-16-04-55-38.vdi /sbin fs
libguestfs: error: /usr/local/bin/qemu-system-x86_64 exited with error status 127.
To see full error messages you may need to enable debugging.
and run the command again.  For further information, read:
You can also run 'libguestfs-test-tool' and post the *complete* output
into a bug report or message to the libguestfs mailing list.

>>> after exporting the above env. vars:

ibguestfs: trace: set_verbose true
libguestfs: trace: set_verbose = 0
libguestfs: trace: set_path "/usr/share/guestfs/appliance/"
libguestfs: trace: set_path = 0
libguestfs: create: flags = 0, handle = 0x55fe86ee9190, program = virt-copy-out
libguestfs: trace: set_pgroup true
libguestfs: trace: set_pgroup = 0
libguestfs: trace: add_drive "Gentoo.2021-03-16-04-55-38.vdi" "readonly:true"
libguestfs: creating COW overlay to protect original drive content
libguestfs: trace: get_tmpdir
libguestfs: trace: get_tmpdir = "/tmp"
libguestfs: trace: disk_create "/tmp/libguestfsX9reBQ/overlay1.qcow2" "qcow2" -1 "backingfile:/home/fab/mkg/Gentoo.2021-03-16-04-55-38.vdi"
libguestfs: command: run: qemu-img
libguestfs: command: run: \ create
libguestfs: command: run: \ -f qcow2
libguestfs: command: run: \ -o backing_file=/home/fab/mkg/Gentoo.2021-03-16-04-55-38.vdi
libguestfs: command: run: \ /tmp/libguestfsX9reBQ/overlay1.qcow2
qemu-img: warning: Deprecated use of backing file without explicit backing format (detected format of vdi)
Formatting '/tmp/libguestfsX9reBQ/overlay1.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=57671680000 backing_file=/home/fab/mkg/Gentoo.2021-03-16-04-55-38.vdi backing_fmt=vdi lazy_refcounts=off refcount_bits=16
libguestfs: trace: disk_create = 0
libguestfs: trace: add_drive = 0
libguestfs: trace: is_config
libguestfs: trace: is_config = 1
libguestfs: trace: launch
libguestfs: trace: max_disks
libguestfs: trace: max_disks = 255
libguestfs: trace: version
libguestfs: trace: version = <struct guestfs_version = major: 1, minor: 38, release: 6, extra: -gentoo, >
libguestfs: trace: get_backend
libguestfs: trace: get_backend = "direct"
libguestfs: launch: program=virt-copy-out
libguestfs: launch: version=1.38.6-gentoo
libguestfs: launch: backend registered: unix
libguestfs: launch: backend registered: uml
libguestfs: launch: backend registered: libvirt
libguestfs: launch: backend registered: direct
libguestfs: launch: backend=direct
libguestfs: launch: tmpdir=/tmp/libguestfsX9reBQ
libguestfs: launch: umask=0022
libguestfs: launch: euid=1000
libguestfs: trace: get_backend_setting "force_tcg"
libguestfs: trace: get_backend_setting = NULL (error)
libguestfs: begin testing qemu features
libguestfs: trace: get_cachedir
libguestfs: trace: get_cachedir = "/var/tmp"
libguestfs: checking for previously cached test results of /usr/local/bin/qemu-system-x86_64, in /var/tmp/.guestfs-1000
libguestfs: command: run: /usr/local/bin/qemu-system-x86_64
libguestfs: command: run: \ -display none
libguestfs: command: run: \ -help
/usr/local/bin/qemu-system-x86_64: error while loading shared libraries: cannot open shared object file: No such file or directory
libguestfs: error: /usr/local/bin/qemu-system-x86_64 exited with error status 127, see debug messages above
libguestfs: trace: launch = -1 (error)
libguestfs: trace: close
libguestfs: closing guestfs handle 0x55fe86ee9190 (state 0)
libguestfs: command: run: rm
libguestfs: command: run: \ -rf /tmp/libguestfsX9reBQ
Comment 4 fabrice nicol 2021-03-17 05:45:53 UTC
After installing media-sound/pulseaudio, the issue was solved.
So it all boils down to:

+ adding a media-sound/pulseaudio to the COMMON_DEPEND variable of the ebuild (I checked that it is not there)  
+ adding user to the kvm group
+ hopefully avoid sourcing /etc/profile manually.
Comment 5 Ionen Wolkens gentoo-dev 2021-03-17 05:50:26 UTC
(In reply to fabrice nicol from comment #4)
> + adding a media-sound/pulseaudio to the COMMON_DEPEND variable of the
> ebuild (I checked that it is not there)  
Look at the trace again, it used /usr/local/bin/qemu-system-x86_64.

portage didn't install this, if you emerged qemu with USE=-pulseaudio it'd be in /usr/bin (not /usr/local) and not need pulseaudio

Please clean old files from /usr/local

> + adding user to the kvm group
portage can't add "your" user to groups, it doesn't know what user you use.

> + hopefully avoid sourcing /etc/profile manually.
portage can't control the shells you have currently open, they need to be either restarted to update automatically, or have you source manually.
Comment 6 fabrice nicol 2021-03-17 06:12:13 UTC
Issue solved after cleaning up /usr/local/ and rebuilding libguestfs.
One note however: the "add user to kvm group" issue should be somehow documented on a Gentoo page (as for Virtualbox) or any other means. Running into crashes before realizing this, upon reading relatively cryptic error messages is not ideaL  
Many thanks.
Comment 7 Ionen Wolkens gentoo-dev 2021-03-17 06:19:08 UTC
(In reply to fabrice nicol from comment #6)
> One note however: the "add user to kvm group" issue should be somehow
> documented on a Gentoo page (as for Virtualbox) or any other means. Running
> into crashes before realizing this, upon reading relatively cryptic error
> messages is not ideaL  
Was the error cryptic? When you said "requested me to add myself to the kvm group" I thought it was straight forward.

For the record, I don't use this, so I haven't seen the messages.

Generally I do feel packages should warn when they modify /etc/env.d in a way that requires shells to load it immediately to function though, so it's one thing I think should be changed.
Comment 8 fabrice nicol 2021-03-17 06:53:55 UTC
+ The kvm group error message was not about an obligation for the **user** to be added to the kvm group but mentioned that "libguestfs may be very slow" if user is not in kvm. I had crashes whilst I did not add myself (as a user) to group kvm. But this may be an indirect problem caused by my local qemu build. 

+ The portage qemu install adds qemu to group kvm automatically. So this may suffice to satisfy libguestfs. Now that I have removed myself (as a user) from group kvm, and rebuilt libguestfs, all is fine and I have no kvm warnings.

+ However considering the error message about slowness and the fact that you will add a warning about /etc/profile sourcing, it might be a good idea to warn about group kvm too.
Comment 9 Andreas Sturmlechner gentoo-dev 2021-04-11 11:02:49 UTC
This package seems stuck at 1.40.1 while libguestfs enjoys regular releases (1.44.1 currently). Barely any packaging other than us?