guestfs-tools for *BSD images
Hi! I'm curious about general support for BSD flavors with the guestfs-tools and any history behind this. I've read through small bits of the code, and from what I can tell certain commands aren't going to be supported (install[0], update, uninstall) but maybe some will "just work" such as inject-ssh[1] or password? I've been attempting to set a user password for an OpenBSD 6.9 image[2], but I'm met with an error related to mounting (ufs). Embarrassingly, and while the error is very clear, I don't understand how to resolve this or if I'm trying to achieve something that doesn't work. I've tried adding `--mount-options` but I can't tell if these are getting propagated down. ``` $ virt-sysprep -v --add openbsd-6.9.qcow2 --password openbsd:password:openbsd ... command: mount '/dev/sda4' '/sysroot//' [ 1.997492] ufs: ufs was compiled with read-only support, can't be mounted as read-write [ 1.998352] ufs: You didn't specify the type of your ufs filesystem [ 1.998352] [ 1.998352] mount -t ufs -o ufstype=sun|sunx86|44bsd|ufs2|5xbsd|old|hp|nextstep|nextstep-cd|openstep ... [ 1.998352] [ 1.998352] >>>WARNING<<< Wrong ufstype may corrupt your filesystem, default is ufstype=old [ 2.001713] ufs: ufs_fill_super(): bad magic number command: mount returned 32 command: mount: stderr: mount: /sysroot: wrong fs type, bad option, bad superblock on /dev/sda4, missing codepage or helper program, or other error. ocaml_exn: 'mount_options' raised 'Failure' exception guestfsd: error: mount exited with status 32: mount: /sysroot: wrong fs type, bad option, bad superblock on /dev/sda4, missing codepage or helper program, or other error. guestfsd: => mount_options (0x4a) took 0.02 secs virt-sysprep: warning: mount_options: mount exited with status 32: mount: /sysroot: wrong fs type, bad option, bad superblock on /dev/sda4, missing codepage or helper program, or other error. (ignored) [ 2.3] Performing "abrt-data" ... guestfsd: <= inspect_get_type (0x1e3) request length 56 bytes commandrvf: stdout=n stderr=y flags=0x0 commandrvf: udevadm --debug settle -E /dev/sda4 SELinux enabled state cached to: disabled No filesystem is currently mounted on /sys/fs/cgroup. Failed to determine unit we run in, ignoring: No data available guestfsd: => inspect_get_type (0x1e3) took 0.01 secs guestfsd: <= glob_expand (0x71) request length 68 bytes guestfsd: error: glob_expand_stub: you must call 'mount' first to mount the root filesystem guestfsd: => glob_expand (0x71) took 0.00 secs virt-sysprep: error: libguestfs error: glob_expand: glob_expand_stub: you must call 'mount' first to mount the root filesystem If reporting bugs, run virt-sysprep with debugging enabled and include the complete output: virt-sysprep -v -x [...] libguestfs: closing guestfs handle 0x555ea1442800 (state 2) ... ``` This brings me to asking if there is any desire to support BSD flavors, has it been done in the past and removed, or is it even feasible? I would imagine this has already been explored and I'm just failing to find the mail thread explaining things. If anyone has any experience doing this or advice, I would really appreciate it. I'm incredibly new to all of this, my apologies if this seems dumb or a waste of time. Thank you kindly for any assistance on the matter, Brady Pratt [0]: https://github.com/rwmjones/guestfs-tools/blob/master/customize/customize_ru... [1]: https://github.com/rwmjones/guestfs-tools/blob/3a498512f58bc431db490e96cdb71... [2]: https://bsd-cloud-image.org/
On Tue, Dec 07, 2021 at 12:18:30PM -0600, Brady Pratt wrote:
[ 1.998352] >>>WARNING<<< Wrong ufstype may corrupt your filesystem, default is ufstype=old
The problem is this one and it's not easily resolvable. UFS isn't a single filesystem type, it's a clade of filesystems which all evolved from a common ancestor through the various BSDs, but crucially have the same magic number (so no way to differentiate them). For *BSD itself this isn't a problem since the same OS creates and consumes the filesystem. But it's a problem for Linux which must be told which filesystem type to mount - and get it wrong, as you can see above, Bad Things happen. So it's not really possible to resolve this in libguestfs as we don't know the filesystem type until after we have mounted and inspected it. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html
Thank you for the explanation! On Wed, Dec 8, 2021 at 4:52 AM Richard W.M. Jones <rjones@redhat.com> wrote:
On Tue, Dec 07, 2021 at 12:18:30PM -0600, Brady Pratt wrote:
[ 1.998352] >>>WARNING<<< Wrong ufstype may corrupt your filesystem, default is ufstype=old
The problem is this one and it's not easily resolvable. UFS isn't a single filesystem type, it's a clade of filesystems which all evolved from a common ancestor through the various BSDs, but crucially have the same magic number (so no way to differentiate them). For *BSD itself this isn't a problem since the same OS creates and consumes the filesystem. But it's a problem for Linux which must be told which filesystem type to mount - and get it wrong, as you can see above, Bad Things happen.
So it's not really possible to resolve this in libguestfs as we don't know the filesystem type until after we have mounted and inspected it.
Rich.
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html
So I should add that one-off changes are still possible, albeit they have to be done manually. You could try: $ virt-rescue -a openbsd.img Inside the rescue shell you can mount the disk using the correct ufstype= mount option, eg:
<rescue> mount -o ufstype=WHATEVER /dev/sda1 /sysroot/
You can also automate this to some extent using guestfish (the "mount-options" command). Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/
On 12/08/21 11:52, Richard W.M. Jones wrote:
On Tue, Dec 07, 2021 at 12:18:30PM -0600, Brady Pratt wrote:
[ 1.998352] >>>WARNING<<< Wrong ufstype may corrupt your filesystem, default is ufstype=old
The problem is this one and it's not easily resolvable. UFS isn't a single filesystem type, it's a clade of filesystems which all evolved from a common ancestor through the various BSDs, but crucially have the same magic number (so no way to differentiate them). For *BSD itself this isn't a problem since the same OS creates and consumes the filesystem.
(I think it *should* be considered a problem even for the *BSDs; what about moving disks between different BSD versions or flavors?)
But it's a problem for Linux which must be told which filesystem type to mount - and get it wrong, as you can see above, Bad Things happen.
So it's not really possible to resolve this in libguestfs as we don't know the filesystem type until after we have mounted and inspected it.
Rich.
Hi Brady, There is a related bug before: Bug 541618 <https://bugzilla.redhat.com/show_bug.cgi?id=541618> - guestfish not able to mount freebsd ufs2 partitions automatically On Wed, Dec 8, 2021 at 10:26 PM Laszlo Ersek <lersek@redhat.com> wrote:
On 12/08/21 11:52, Richard W.M. Jones wrote:
On Tue, Dec 07, 2021 at 12:18:30PM -0600, Brady Pratt wrote:
[ 1.998352] >>>WARNING<<< Wrong ufstype may corrupt your filesystem, default is ufstype=old
The problem is this one and it's not easily resolvable. UFS isn't a single filesystem type, it's a clade of filesystems which all evolved from a common ancestor through the various BSDs, but crucially have the same magic number (so no way to differentiate them). For *BSD itself this isn't a problem since the same OS creates and consumes the filesystem.
(I think it *should* be considered a problem even for the *BSDs; what about moving disks between different BSD versions or flavors?)
But it's a problem for Linux which must be told which filesystem type to mount - and get it wrong, as you can see above, Bad Things happen.
So it's not really possible to resolve this in libguestfs as we don't know the filesystem type until after we have mounted and inspected it.
Rich.
_______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://listman.redhat.com/mailman/listinfo/libguestfs
On 12/09/21 03:28, Yongkui Guo wrote:
Hi Brady, There is a related bug before: Bug 541618 <https://bugzilla.redhat.com/show_bug.cgi?id=541618> - guestfish not able to mount freebsd ufs2 partitions automatically
The last comment on that bug is dated 2013-11-22 at present. With the justification given by Rich in this very thread (= impossible to tell apart different things that all claim to be UFS), is it even possible to fix that bug? Should we close it as CANTFIX? Thanks Laszlo
On Wed, Dec 8, 2021 at 10:26 PM Laszlo Ersek <lersek@redhat.com> wrote:
On 12/08/21 11:52, Richard W.M. Jones wrote:
On Tue, Dec 07, 2021 at 12:18:30PM -0600, Brady Pratt wrote:
[ 1.998352] >>>WARNING<<< Wrong ufstype may corrupt your filesystem, default is ufstype=old
The problem is this one and it's not easily resolvable. UFS isn't a single filesystem type, it's a clade of filesystems which all evolved from a common ancestor through the various BSDs, but crucially have the same magic number (so no way to differentiate them). For *BSD itself this isn't a problem since the same OS creates and consumes the filesystem.
(I think it *should* be considered a problem even for the *BSDs; what about moving disks between different BSD versions or flavors?)
But it's a problem for Linux which must be told which filesystem type to mount - and get it wrong, as you can see above, Bad Things happen.
So it's not really possible to resolve this in libguestfs as we don't know the filesystem type until after we have mounted and inspected it.
Rich.
_______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://listman.redhat.com/mailman/listinfo/libguestfs
On Thu, Dec 09, 2021 at 12:06:33PM +0100, Laszlo Ersek wrote:
On 12/09/21 03:28, Yongkui Guo wrote:
Hi Brady, There is a related bug before: Bug 541618 <https://bugzilla.redhat.com/show_bug.cgi?id=541618> - guestfish not able to mount freebsd ufs2 partitions automatically
The last comment on that bug is dated 2013-11-22 at present. With the justification given by Rich in this very thread (= impossible to tell apart different things that all claim to be UFS), is it even possible to fix that bug? Should we close it as CANTFIX?
Yes - I've closed it now with a reference to this thread. Rich.
Thanks Laszlo
On Wed, Dec 8, 2021 at 10:26 PM Laszlo Ersek <lersek@redhat.com> wrote:
On 12/08/21 11:52, Richard W.M. Jones wrote:
On Tue, Dec 07, 2021 at 12:18:30PM -0600, Brady Pratt wrote:
[ 1.998352] >>>WARNING<<< Wrong ufstype may corrupt your filesystem, default is ufstype=old
The problem is this one and it's not easily resolvable. UFS isn't a single filesystem type, it's a clade of filesystems which all evolved from a common ancestor through the various BSDs, but crucially have the same magic number (so no way to differentiate them). For *BSD itself this isn't a problem since the same OS creates and consumes the filesystem.
(I think it *should* be considered a problem even for the *BSDs; what about moving disks between different BSD versions or flavors?)
But it's a problem for Linux which must be told which filesystem type to mount - and get it wrong, as you can see above, Bad Things happen.
So it's not really possible to resolve this in libguestfs as we don't know the filesystem type until after we have mounted and inspected it.
Rich.
_______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://listman.redhat.com/mailman/listinfo/libguestfs
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/
participants (4)
-
Brady Pratt -
Laszlo Ersek -
Richard W.M. Jones -
Yongkui Guo