Commit Graph

435 Commits

Author SHA1 Message Date
Richard W.M. Jones
217823da95 appliance/init: Add lsblk and blkid output to verbose log
This is useful for debugging.  The output looks like:

  + lsblk
  NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
  sda           8:0    0    1G  0 disk
  |-sda1        8:1    0  512M  0 part
  `-sda2        8:2    0  512M  0 part
    |-VG-Root 252:0    0   32M  0 lvm
    |-VG-LV1  252:1    0   32M  0 lvm
    |-VG-LV2  252:2    0   32M  0 lvm
    `-VG-LV3  252:3    0   64M  0 lvm
  sdb           8:16   0    4G  0 disk /
  + blkid
  /dev/mapper/VG-LV1: UUID="cc8a3437-4169-4b1c-b432-ee8adc563f6d" BLOCK_SIZE="4096" TYPE="ext2"
  /dev/sdb: UUID="30c70ddc-d00b-4620-a408-025890e59aa6" BLOCK_SIZE="4096" TYPE="ext2"
  /dev/mapper/VG-LV2: UUID="747009aa-e183-46ba-a034-0c437b15cebc" BLOCK_SIZE="1024" TYPE="ext2"
  /dev/mapper/VG-Root: LABEL="ROOT" UUID="01234567-0123-0123-0123-012345678902" BLOCK_SIZE="4096" TYPE="ext2"
  /dev/sda2: UUID="DfEjc1-wRU6-vh8U-we7U-ivEl-FRwo-rG0ZuL" TYPE="LVM2_member" PARTUUID="184cbb43-02"
  /dev/sda1: LABEL="BOOT" UUID="01234567-0123-0123-0123-012345678901" BLOCK_SIZE="4096" TYPE="ext2" PARTUUID="184cbb43-01"
  /dev/mapper/VG-LV3: UUID="f9e5dc21-9a2a-45a0-85b0-e2889607139a" BLOCK_SIZE="2048" TYPE="ext2"

Fixes: https://issues.redhat.com/browse/RHEL-106490
2025-07-30 11:06:37 +01:00
Richard W.M. Jones
dc218b25f0 appliance: Ignore sit0 network device in the guest
Reported-by: Srikanth Aithal <sraithal@amd.com>
Fixed-by: Stefano Brivio <sbrivio@redhat.com>
Tested-by: Srikanth Aithal <sraithal@amd.com>
See-also: https://lists.libguestfs.org/archives/list/guestfs@lists.libguestfs.org/thread/566LAY7RNM7T7EMQQQYIQA2VK5TXETK5/
2025-06-25 11:15:31 +01:00
Richard W.M. Jones
f6b1a7b57f appliance: Remove zfs-fuse
zfs-fuse has been unmaintained for a very long time.  In fact, the
website has gone.  This means that whatever we need for zfs (probably
some kind of license-compatible kernel module) is not going to be
provided by zfs-fuse.

See: https://bugzilla.redhat.com/show_bug.cgi?id=2214965
2025-05-09 15:52:30 +01:00
denisecheng
0c70675aae support TencentOS
Signed-off-by: denisecheng <denisecheng@tencent.com>
Fixes: https://github.com/libguestfs/libguestfs/pull/172
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
2025-03-03 14:22:37 +00:00
Richard W.M. Jones
72cfaff5c5 Update copyright dates for 2025
Automated using this command:

perl -pi.bak -e 's/(20[012][0-9])-20[12][01234]/$1-2025/g' `git ls-files`
2025-02-16 17:00:46 +00:00
Daniel Gomez
82e2dea96a appliance: add support for sfdisk on Debian
Fixes virt-builder error:

virt-builder: error: libguestfs error: inspect_os: execvp: sfdisk: No
such file or directory

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
2025-02-06 08:26:20 +00:00
Daniel Gomez
91fab3f498 appliance: add dhcpcd support on Debian
Debian has replaced the deprecated isc-dhcp-client (dhclient) with
dhcpcd-base (dhcpcd) as the default DHCP client [1]. This causes network
issues in virt-builder since isc-dhcp-client is no longer installed
by default.

Add support for dhcpcd (dhcpcd-base package) in Debian.

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1041066

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
2025-02-06 08:26:20 +00:00
Richard W.M. Jones
6ba8449927 appliance/init: Fix /usr/sbin symlinks in Fedora 42+
Since Fedora 42 merged /usr/sbin and /usr/bin, /usr/sbin is usually
populated with symbolic links to binaries in /usr/bin.  These are
created by a complicated script in filesystem.spec that we don't run.
Emulate sort of what that script is doing instead.

This is a hack that we can eventually remove, hopefully.

See-also: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/PCU2WWLEGLGIOY4TCCBIHLYS6ZCZ4GSS/
2025-02-05 13:09:26 +00:00
Thomas Wouters
84d1cd0707 Fix dhcpcd failing on systemd-resolved stub
dhcpcd fails to update /etc/resolv.conf if is a dangling symlink, so remove it
if it is.

This happens on Arch Linux when systemd-resolved is enabled by symlinking
/etc/resolv.conf to /run/systemd/resolve/stub-resolv.conf. The symlink is copied
into the supermin appliance, but the target file is not and this causes dhcpcd to
fail when it tries to update /etc/resolv.conf.

The handling of /etc/resolv.conf could be improved in dhcpcd but it's not their
job to decide when to remove the symlink. We do have the authority to decide
whether or not to use systemd-resolved or resolvconf in the appliance, so we can
remove it.
2024-11-13 14:09:59 +01:00
Richard W.M. Jones
798e3e59b2 appliance: Refactor the TAR_COMMAND macro
No change, just make it easier to understand.

Updates: commit 53632b4b82
2024-10-22 09:15:56 +01:00
Richard W.M. Jones
53632b4b82 appliance: Use stable owner, group and mtime in appliance tarballs
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2320025
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
2024-10-21 12:14:03 +01:00
Richard W.M. Jones
b2d682a473 appliance/init: Don't set impossible "noop" disk scheduler
Since RHEL 7.4, the noop scheduler is no longer a thing.  Trying to
set it results in the error:

  + echo noop
  /init: line 108: echo: write error: Invalid argument

The current recommendation (https://access.redhat.com/solutions/5427)
is to use mq-deadline, but that's also the default so we don't have to
do anything.

A bigger reason to remove these lines is that kernel 6.11.0 has
introduced a hang where -- rarely -- the ext4 filesystem hangs if you
try to change the scheduler while handing a page fault, even if you're
setting a scheduler that doesn't exist.  I couldn't get much detail
except for a couple of stack traces from different VMs:

  crash> set 234
      PID: 234
  COMMAND: "modprobe"
     TASK: ffff9f5ec3a22f40  [THREAD_INFO: ffff9f5ec3a22f40]
      CPU: 0
    STATE: TASK_UNINTERRUPTIBLE
  crash> bt
  PID: 234      TASK: ffff9f5ec3a22f40  CPU: 0    COMMAND: "modprobe"
   #0 [ffffb21e002e7840] __schedule at ffffffffa718f6d0
   #1 [ffffb21e002e78f8] schedule at ffffffffa7190a27
   #2 [ffffb21e002e7908] __bio_queue_enter at ffffffffa67e121c
   #3 [ffffb21e002e7968] blk_mq_submit_bio at ffffffffa67f358c
   #4 [ffffb21e002e79f0] __submit_bio at ffffffffa67e1e3c
   #5 [ffffb21e002e7a58] submit_bio_noacct_nocheck at ffffffffa67e2326
   #6 [ffffb21e002e7ac0] ext4_mpage_readpages at ffffffffa65ceafc
   #7 [ffffb21e002e7be0] read_pages at ffffffffa6381d17
   #8 [ffffb21e002e7c40] page_cache_ra_unbounded at ffffffffa6381ff5
   #9 [ffffb21e002e7ca8] filemap_fault at ffffffffa63761b5
  #10 [ffffb21e002e7d48] __do_fault at ffffffffa63d1892
  #11 [ffffb21e002e7d70] do_fault at ffffffffa63d2425
  #12 [ffffb21e002e7da0] __handle_mm_fault at ffffffffa63d8c6b
  #13 [ffffb21e002e7e88] handle_mm_fault at ffffffffa63d95c2
  #14 [ffffb21e002e7ec8] do_user_addr_fault at ffffffffa60b34ea
  #15 [ffffb21e002e7f28] exc_page_fault at ffffffffa7186e4e
  #16 [ffffb21e002e7f50] asm_exc_page_fault at ffffffffa72012a6
      RIP: 000055d16159f8d8  RSP: 00007ffdd4c1f340  RFLAGS: 00010206
      RAX: 00000000000bec82  RBX: 00007ff2fd00dc82  RCX: 000055d1615b492a
      RDX: 00007ffdd4c216b0  RSI: 00000000200bec82  RDI: 000055d185725960
      RBP: 00007ffdd4c1f5a0   R8: 0000000000000000   R9: 0000000000000000
      R10: 0000000000000000  R11: 0000000000000202  R12: 00000000200bec82
      R13: 000055d185725960  R14: 00007ffdd4c216b0  R15: 000055d1615b9708
      ORIG_RAX: ffffffffffffffff  CS: 0033  SS: 002b

  crash> set 230
      PID: 230
  COMMAND: "modprobe"
     TASK: ffff98ce03ca3040  [THREAD_INFO: ffff98ce03ca3040]
      CPU: 0
    STATE: TASK_UNINTERRUPTIBLE
  crash> bt
  PID: 230      TASK: ffff98ce03ca3040  CPU: 0    COMMAND: "modprobe"
   #0 [ffffaf9940307840] __schedule at ffffffff9618f6d0
   #1 [ffffaf99403078f8] schedule at ffffffff96190a27
   #2 [ffffaf9940307908] __bio_queue_enter at ffffffff957e121c
   #3 [ffffaf9940307968] blk_mq_submit_bio at ffffffff957f358c
   #4 [ffffaf99403079f0] __submit_bio at ffffffff957e1e3c
   #5 [ffffaf9940307a58] submit_bio_noacct_nocheck at ffffffff957e2326
   #6 [ffffaf9940307ac0] ext4_mpage_readpages at ffffffff955ceafc
   #7 [ffffaf9940307be0] read_pages at ffffffff95381d1a
   #8 [ffffaf9940307c40] page_cache_ra_unbounded at ffffffff95381ff5
   #9 [ffffaf9940307ca8] filemap_fault at ffffffff953761b5
  #10 [ffffaf9940307d48] __do_fault at ffffffff953d1895
  #11 [ffffaf9940307d70] do_fault at ffffffff953d2425
  #12 [ffffaf9940307da0] __handle_mm_fault at ffffffff953d8c6b
  #13 [ffffaf9940307e88] handle_mm_fault at ffffffff953d95c2
  #14 [ffffaf9940307ec8] do_user_addr_fault at ffffffff950b34ea
  #15 [ffffaf9940307f28] exc_page_fault at ffffffff96186e4e
  #16 [ffffaf9940307f50] asm_exc_page_fault at ffffffff962012a6
      RIP: 0000556b7a7468d8  RSP: 00007ffde2ffb560  RFLAGS: 00000206
      RAX: 00000000000bec82  RBX: 00007f5331a0dc82  RCX: 0000556b7a75b92a
      RDX: 00007ffde2ffd8d0  RSI: 00000000200bec82  RDI: 0000556ba8edf960
      RBP: 00007ffde2ffb7c0   R8: 0000000000000000   R9: 0000000000000000
      R10: 0000000000000000  R11: 0000000000000202  R12: 00000000200bec82
      R13: 0000556ba8edf960  R14: 00007ffde2ffd8d0  R15: 0000556b7a760708
      ORIG_RAX: ffffffffffffffff  CS: 0033  SS: 002b

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2303267
2024-08-16 08:32:40 +01:00
Olaf Hering
4ef645778a appliance: only wait for resolv.conf update if dhcpcd succeeded
In case network was requested, but the host lacks both dhclient and
dhcpcd, skip the loop which waits for a resolv.conf update.

This reduces boot time by 10 seconds.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2024-05-15 17:11:02 +01:00
Alexey Shabalin
f878f72430 daemon: Add gost checksum command support
gostsum - generates or checks GOST R34.11-94 message digests
gost12sum - generates or checks GOST R34.11-2012 message digests

A reference implementation https://github.com/gost-engine/engine

Fixes: https://github.com/libguestfs/libguestfs/pull/132
Signed-off-by: Alexey Shabalin <shaba@altlinux.org>

[RWMJ: Added documentation, and added gostsum package to
the appliance]
2024-01-25 13:28:22 +00:00
Richard W.M. Jones
0b8b1e4b2d New mailing list email address 2023-11-16 10:38:59 +00:00
Richard W.M. Jones
f53859723e appliance: Wait for /etc/resolv.conf to be populated
Work around this issue with dhcpcd:
https://github.com/NetworkConfiguration/dhcpcd/issues/258

Fixes: commit 0e37e5feea
2023-11-16 10:17:35 +00:00
Richard W.M. Jones
0e37e5feea appliance: Allow dhcpcd to be used on Red Hat platforms
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2247057
Fixes: https://github.com/libguestfs/libguestfs/issues/121
2023-10-30 14:31:26 +00:00
cunshunxia
188c5f7d93 support OpencloudOS
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Fixes: https://github.com/libguestfs/libguestfs/pull/125
2023-09-19 11:02:23 +01:00
Richard W.M. Jones
7503eeebed Remove virt-dib
The tool only supports an older version of the diskimage-builder
metadata, and we do not have the time or inclination to update it to a
newer version.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1910039
2023-02-07 13:30:35 +00:00
Richard W.M. Jones
e2c7bddf10 Update copyright dates for 2023
Run this command across the source:

  perl -pi.bak -e 's/(20[012][0-9])-20[12][012]/$1-2023/g' `git ls-files`

and remove changes to po{,-docs}/*.po{,t} (these will be regenerated
later when we run 'make dist').
2023-02-07 10:50:48 +00:00
Richard W.M. Jones
d5472a2219 appliance: Add back libldm (ldmtool) and libxml2 to package list
Commit 133a491677 ("Use guestfsd binary to auto-generate library
dependencies for appliance", October 2020) removed explicit
dependencies for various system packages that the daemon links
directly to, ie. all of these libraries:

$ objdump -p daemon/guestfsd | grep NEEDED | sort
  NEEDED               libacl.so.1
  NEEDED               libaugeas.so.0
  NEEDED               libcap.so.2
  NEEDED               libc.so.6
  NEEDED               libgcc_s.so.1
  NEEDED               libhivex.so.0
  NEEDED               libjansson.so.4
  NEEDED               libm.so.6
  NEEDED               libpcre2-8.so.0
  NEEDED               librpm.so.9
  NEEDED               libselinux.so.1
  NEEDED               libsystemd.so.0
  NEEDED               libtirpc.so.3
(plus libyara which I don't have installed.)

This avoids having to update these dependencies if they change, eg.
when we switched from PCRE to PCRE2 we did not need to update this
file.

However the same commit also incorrectly removed two apparent library
packages (libldm, libxml2) which the daemon does not link to, but
which we'd like to pull in because of tools they provide, in
particular ldmtool.

Re-add those two explicit dependencies.

Fixes: commit 133a491677
2022-11-07 12:44:07 +00:00
Richard W.M. Jones
001683e885 appliance: Remove LD_PRELOAD=libSegFault.so
This feature was removed in glibc 2.35:
https://savannah.gnu.org/forum/forum.php?forum_id=10111
2022-10-24 10:41:09 +01:00
Richard W.M. Jones
4004e8eb36 appliance: Create symlink /etc/crypto-policies/back-ends/opensslcnf.config
Downstream patched openssl in Fedora 37+ broke unless
/etc/crypto-policies/back-ends/opensslcnf.conf is present.  Files in
this directory are generated by %post rules that use scripting
languages so cannot easily be created by supermin.

Add a symlink to the DEFAULT policy file if the configuration file
doesn't exist.

A symptom of this problem is the error:

  Requested hash sha256 is not supported.
  Failed to set pbkdf parameters.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2133884
Updates: commit d6ba398825
2022-10-12 12:42:15 +01:00
Richard W.M. Jones
f73c653cc0 Revert "appliance: Copy in /etc/crypto-policies/back-ends/ files"
This reverts commit d6ba398825.
2022-10-12 10:08:14 +01:00
Richard W.M. Jones
d6ba398825 appliance: Copy in /etc/crypto-policies/back-ends/ files
Downstream patched openssl in Fedora 37+ broke unless
/etc/crypto-policies/back-ends/opensslcnf.conf is present.  Files in
this directory are generated by %post rules that use scripting
languages so cannot easily be created by supermin.

Force a copy of the host files into the appliance.  This is not ideal
and is hopefully a temporary fix until Fedora's openssl is fixed.

A symptom of this problem is the error:

  Requested hash sha256 is not supported.
  Failed to set pbkdf parameters.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2133884
2022-10-11 21:59:49 +01:00
Richard W.M. Jones
0e784824e8 daemon: Add zstd support to guestfs_file_architecture
This is required so we can determine the file architecture of
zstd-compressed Linux kernel modules as used by OpenSUSE and maybe
other distros in future.

Note that zstd becomes a required package, but it is widely available
in current Linux distros.

The package names come from https://pkgs.org/download/zstd and my own
research.
2022-08-09 19:04:41 +01:00
Laszlo Ersek
9a3e9a6c03 introduce the "clevis_luks_unlock" API
Introduce a new guestfs API called "clevis_luks_unlock". At the libguestfs
level, it is quite simple; it wraps the "clevis luks unlock" guest command
(implemented by the "clevis-luks-unlock" executable, which is in fact a
shell script).

The complexity is instead in the network-based disk encryption
(Clevis/Tang) scheme. Useful documentation:

- https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html-single/security_hardening/index#configuring-automated-unlocking-of-encrypted-volumes-using-policy-based-decryption_security-hardening
- https://github.com/latchset/clevis#clevis
- https://github.com/latchset/tang#tang

The package providing "clevis-luks-unlock" is usually called
"clevis-luks", occasionally "clevis". Some distros don't package clevis at
all. Add the new API under a new option group (which may not be available)
called "clevisluks".

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1809453
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220630122048.19335-3-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
2022-07-01 15:07:26 +02:00
Laszlo Ersek
8fc4d16715 appliance, daemon: disable lvm2 devicesfile
In guestfs-tools commit 4fe8a03cd2d3 ('sysprep: remove lvm2's default
"system.devices" file', 2022-04-11), we disabled the use of LVM2's new
"devicesfile" feature, which could interfere with the cloning of virtual
machines.

We suspected in

  https://bugzilla.redhat.com/show_bug.cgi?id=2072493#c6

that the same lvm2 feature could affect the libguestfs appliance itself,
but decided in

  https://bugzilla.redhat.com/show_bug.cgi?id=2072493#c8
  https://bugzilla.redhat.com/show_bug.cgi?id=2072493#c10

that this would not be the case, because "appliance/init" already
constructed a pristine LVM_SYSTEM_DIR.

Unfortunately, that's not enough: due to the "use_devicesfile=1" default
(on RHEL9 anyway), some "lvm" invocation, possibly inside the
lvm-set-filter API, *creates* "$LVM_SYSTEM_DIR/devices/system.devices".
And then we get (minimally) warnings such as

> Please remove the lvm.conf global_filter, it is ignored with the devices
> file.
> Please remove the lvm.conf filter, it is ignored with the devices file.

when using the lvm-set-filter API.

Explicitly disable the "devices file" in "appliance/init", and also
whenever we rewrite "lvm.conf" -- that is, in set_filter()
[daemon/lvm-filter.c]. In the former, check for the feature by locating
the devicesfile-related utilities "lvmdevices" and "vgimportdevices". In
the C code, invoke the utilities with the "--help" option instead. (In
"appliance/init",  I thought it was best not to call any lvm2 utilities
even with "--help", with our lvm2.conf still under construction there.) If
either utility is available, set "use_devicesfile = 0".

Cc: David Teigland <teigland@redhat.com>
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1965941
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220530141027.16167-1-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
[lersek@redhat.com: style fix: break "devicesfile_feature" in the function
 definition to a new line]
2022-05-31 08:47:58 +02:00
Richard W.M. Jones
4418e6345a appliance: Error out if QUERY_FILES_CMD cannot be set
Instead of continuing on regardless and failing with a weird error
later, error out early if we don't know about the distro and so cannot
set QUERY_FILES_CMD.  This avoids situations like
https://github.com/libguestfs/libguestfs/issues/81
2022-05-21 17:19:54 +01:00
Richard W.M. Jones
bf5fcdbc9b appliance: Print guestfsd.deps after generation
Sometimes generating this file fails.  To help with debugging these
situatons, print the guestfsd.deps file after it has been generated.
2022-05-21 11:11:59 +01:00
Olaf Hering
f47e0bb672 appliance: reorder mounting of special filesystems in init
Make sure proc and dev are available early.
No change in behavior intended.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2021-09-15 12:37:08 +01:00
Olaf Hering
9db0c98c99 appliance: enable bash's Process Substitution feature
bash can read input from a spawned process, and even provide input to
such process. This feature relies on /dev/fd/ being present. In the
past udev silently created this symlink, so this bash feature worked
more or less by accident. With recent systemd versions, such as 246
which is included in Leap 15.3, the symlink is not created anymore. As
a result scripts, such as /sbin/dhclient-script, fail to work
properly.

This symlink should have been created in version 1 of this variant of /init.

https://bugzilla.opensuse.org/show_bug.cgi?id=1190501

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2021-09-15 12:37:08 +01:00
Olaf Hering
c0de4de902 appliance: add reboot and netconfig for SUSE
systemd-sysvinit contains the reboot command, which is used to
properly stop the VM. This was required by other packages, and as a
result always available. Since Leap 15.3 it will not be installed, and
as a result the VM will just panic because /init died.

If the appliance is started with --network, dhclient will run
/usr/sbin/dhclient-script, which in turn may call /sbin/netconfig to
update /etc/resolv.conf. Install sysconfig-netconfig to make sure DNS
resolving actually works.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2021-09-14 20:49:02 +01:00
Richard W.M. Jones
ae7187af94 appliance: Add mount package for Debian
https://listman.redhat.com/archives/libguestfs/2021-September/msg00013.html

Reported-by: Joerg Schiermeier
2021-09-06 15:23:03 +01:00
Hilko Bengen
39f514b28d appliance: Fix searching for shared libraries on usr-merged Debian systems
If /lib is a symlink to usr/lib, paths to shared libraries as
determined by ld.so may differ from dpkg's file lists.

We turn the filename search pattern into a glob expression by
prefixing it with a '*', so the required packages are found again:

$ dpkg -S /lib/x86_64-linux-gnu/libpcre2-8.so.0
dpkg-query: no path found matching pattern /lib/x86_64-linux-gnu/libpcre2-8.so.0
$ dpkg -S */lib/x86_64-linux-gnu/libpcre2-8.so.0
libpcre2-8-0:amd64: /usr/lib/x86_64-linux-gnu/libpcre2-8.so.0
2021-08-31 15:49:55 +01:00
Richard W.M. Jones
90a076fe19 appliance: Add IBM850 iconv converter for syslinux
$ guestfish -N fs:vfat:2G syslinux /dev/sda1
libguestfs: error: syslinux: Error converting to codepage 850 Invalid argument
...

This happens because of the default codepage requested by syslinux
(code page 850) combined with the appliance missing the iconv
converter for this codepage.

Reported-by: Yongkui Guo
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1990720
2021-08-06 08:26:51 +01:00
Richard W.M. Jones
2f587bbaec daemon: Read ISO9660 Primary Volume Descriptor directly.
It turns out we can read the information we need for the isoinfo API
directly from the ISO9660 PVD.  We don't need to use either isoinfo or
xorriso.  This also has the advantages of reducing by 1 the number of
dependencies in the appliance, and reducing potential vulnerability to
a crafted ISO file.

This also fixes timezone calculation for the datetime fields.

Thanks: Thomas Schmitt
Updates: commit efb8a766ca
2021-03-31 11:35:32 +01:00
Richard W.M. Jones
efb8a766ca daemon: Allow xorriso as an alternative to isoinfo.
Currently the guestfs_isoinfo and guestfs_isoinfo_device APIs run
isoinfo inside the appliance to extract the information.

isoinfo is part of genisoimage which is somewhat dead upstream.
xorriso is supposedly the new thing.  (For a summary of the situation
see: https://wiki.debian.org/genisoimage).

This commit rewrites the parsing from C to OCaml to make it easier to
deal with, and allows you to use either isoinfo or xorriso.

Mostly the same fields are available from either tool, but xorriso is
a bit more awkward to parse.
2021-03-30 15:21:54 +01:00
Richard W.M. Jones
c9ee831aff inspection: Fix inspection of recent RPM guests using non-BDB.
Recent RPM-based guests have switched from using Berkeley DB (BDB) to
sqlite.  In order to inspect these guests (and earlier ones) we need
to stop using the hokey parsing of the BDB and use librpm APIs
instead.

This commit adds a new internal API so we can call librpm from the
daemon, and changes the library part to use the new API for RPM-based
guests.

This change removes the requirement for BDB tools like db_dump.

See also:
http://lists.rpm.org/pipermail/rpm-ecosystem/2021-March/000751.html
http://lists.rpm.org/pipermail/rpm-ecosystem/2021-March/000754.html
https://blog.fpmurphy.com/2011/08/programmatically-retrieve-rpm-package-details.html

This breaks the virt-inspector test (now in the separate guestfs-tools
repository).  However this is not a bug in libguestfs, but a bug in
the phoney Fedora guest that we use for testing - we created a
BDB-style RPM database which was supposed to be just enough to make
the old code work.  The new code using real librpm needs
/usr/lib/rpm/rpmrc (not present in the phoney image) and also cannot
parse the phoney database, so we will need to separately rework that
test.

Thanks: Panu Matilainen
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1766487
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1409024
2021-03-26 16:26:00 +00:00
Richard W.M. Jones
f19fd566f6 appliance: Add dhclient for Arch-like Manjaro distro.
Thanks: hatifnatt on IRC
2021-02-17 09:44:19 +00:00
Thierry Vignaud
d2611b62e9 include rpm for Mageia
This fixes:
"-supermin: ext2fs_namei: parent directory not found:
/var/lib/rpm: File not found by ext2_lookup"

This because chkconfig contains /var/lib/rpm/alternatives on Mageia
2020-11-24 09:30:06 +00:00
Thierry Vignaud
32021c72fe Include exfatprogs
It's the new upstream name of exfat-utils.
As eg found on Mageia.
2020-11-24 09:28:05 +00:00
Thierry Vignaud
999fca8731 appliance: Add ntfs-3g-system-compression for Mageia
This package in Mageia enables optional support for Windows 10
"CompactOS" (file-level compression), read-only, which is sufficient
for inspecting Windows guests and doing certain types of modifications
to them.  Virt-v2v appears to work, but it may be that anything that
involves modifying a compressed file might not work.

See commit e6764a5415
2020-11-12 10:36:03 +00:00
Hilko Bengen
133a491677 Use guestfsd binary to auto-generate library dependencies for appliance
The ELF NEEDED are used to determine guestfsd's library dependencies
with help from the dynamic linker and the package manager.

This was prompted by Debian bug #972241 which was caused by a
libtirpc package renaming in Debian/unstable because the SONAME had
been changed.
2020-10-19 12:14:34 +01:00
Richard W.M. Jones
0e17236d7d Update copyright dates to 2020. 2020-03-06 19:32:32 +00:00
Richard W.M. Jones
e6764a5415 appliance: Add ntfs-3g-system-compression (RHBZ#1703463).
This package in Fedora enables optional support for Windows 10
"CompactOS" (file-level compression), read-only, which is sufficient
for inspecting Windows guests and doing certain types of modifications
to them.  Virt-v2v appears to work, but it may be that anything that
involves modifying a compressed file might not work.

I couldn't find the equivalent package in Debian or SUSE.  It's
available in Arch AUR although I didn't verify that part of the change
actually works there (but should be safe because supermin ignores
packages that are not known about on the target system).
2020-02-17 12:38:27 +00:00
Pino Toscano
8eb696f827 appliance: remove custom Shadow augeas lens
Now that augeas 1.2.0 is required, assume the Shadow lens is available
there, and thus drop the local copy.
2019-05-30 09:12:32 +02:00
Richard W.M. Jones
2bb6be333e appliance: Remove /etc/dhcp/dhclient-enter-hooks.d/resolved.
Workaround for Ubuntu which uses this script to try to start a systemd
service.  That won't work because systemd is not used inside the
appliance.  See:

https://bugs.launchpad.net/ubuntu/+source/supermin/+bug/1824236

Thanks: Ioanna Alifieraki
2019-05-29 17:54:52 +01:00
Bernhard Rosenkränzer
a4ef6716b4 Add OpenMandriva support as guest and host (RHBZ#1694268). 2019-04-03 13:08:08 +01:00
Richard W.M. Jones
05d4fcb64d Update copyright dates for 2019.
This command run over the source:

perl -pi.bak -e 's/(20[01][0-9])-2018/$1-2019/g' `git ls-files`
2019-01-08 11:58:30 +00:00