Azure/WALinuxAgent

[BUG] WALinuxAgent fails to mkfs.btrfs on the resource disk

Opened this issue · 0 comments

When configured to set up the resource disk with a BTRFS filesystem, waagent calls 'mkfs.btrfs -F' (upper-case 'F'). This is wrong: 'mkfs.btrfs' expects a lower case '-f' to force recreating a filesystem if one already exists. In fact, 'mkfs.btrfs' does not even have a '-F' option.

Note: Please add some context which would help us understand the problem better
1. Section of the log where the error occurs.

2023-06-14T19:57:09.196136+00:00 redacted kernel: [  111.070330][T12531] Btrfs loaded, crc32c=crc32c-intel, assert=on, zoned=yes
2023-06-14T19:57:09.199385+00:00 redacted python3[12387]: 2023-06-14T19:57:09.198518Z WARNING Daemon Daemon Failed to mount resource disk. Retry mounting after re-reading partition info.
2023-06-14T19:57:09.296062+00:00 redacted kernel: [  111.177410][T13161]  sdg: sdg1
2023-06-14T19:57:09.304584+00:00 redacted python3[12387]: 2023-06-14T19:57:09.304409Z WARNING Daemon Daemon Failed to mount resource disk. Attempting to format and retry mount. [mount: /mnt/resource: wrong fs type, bad option, bad superblock on /dev/sdg1, missing codepage or helper program, or other error.
2023-06-14T19:57:09.304643+00:00 redacted python3[12387]: ]
2023-06-14T19:57:09.331928+00:00 redacted python3[12387]: 2023-06-14T19:57:09.329782Z ERROR Daemon Daemon Command: [mkfs.btrfs -F /dev/sdg1], return code: [1], result: [mkfs.btrfs: invalid option -- 'F'
2023-06-14T19:57:09.332024+00:00 redacted python3[12387]: Usage: mkfs.btrfs [options] dev [ dev ... ]
2023-06-14T19:57:09.332068+00:00 redacted python3[12387]: Options:
2023-06-14T19:57:09.332092+00:00 redacted python3[12387]:   allocation profiles:
2023-06-14T19:57:09.332111+00:00 redacted python3[12387]: #011-d|--data PROFILE           data profile, raid0, raid1, raid1c3, raid1c4, raid5, raid6, raid10, dup or single
2023-06-14T19:57:09.332129+00:00 redacted python3[12387]: #011-m|--metadata PROFILE       metadata profile, values like for data profile
2023-06-14T19:57:09.332150+00:00 redacted python3[12387]: #011-M|--mixed                  mix metadata and data together
2023-06-14T19:57:09.332169+00:00 redacted python3[12387]:   features:
2023-06-14T19:57:09.332190+00:00 redacted python3[12387]: #011--csum TYPE
2023-06-14T19:57:09.332211+00:00 redacted python3[12387]: #011--checksum TYPE             checksum algorithm to use, crc32c (default), xxhash, sha256, blake2
2023-06-14T19:57:09.332236+00:00 redacted python3[12387]: #011-n|--nodesize SIZE          size of btree nodes
2023-06-14T19:57:09.332259+00:00 redacted python3[12387]: #011-s|--sectorsize SIZE        data block size (may not be mountable by current kernel)
2023-06-14T19:57:09.332283+00:00 redacted python3[12387]: #011-O|--features LIST          comma separated list of filesystem features (use '-O list-all' to list features)
2023-06-14T19:57:09.332304+00:00 redacted python3[12387]: #011-R|--runtime-features LIST  comma separated list of runtime features (use '-R list-all' to list runtime features)
2023-06-14T19:57:09.332326+00:00 redacted python3[12387]: #011-L|--label LABEL            set the filesystem label
2023-06-14T19:57:09.332345+00:00 redacted python3[12387]: #011-U|--uuid UUID              specify the filesystem UUID (must be unique)
2023-06-14T19:57:09.332366+00:00 redacted python3[12387]:   creation:
2023-06-14T19:57:09.332387+00:00 redacted python3[12387]: #011-b|--byte-count SIZE        set filesystem size to SIZE (on the first device)
2023-06-14T19:57:09.332409+00:00 redacted python3[12387]: #011-r|--rootdir DIR            copy files from DIR to the image root directory
2023-06-14T19:57:09.332432+00:00 redacted python3[12387]: #011--shrink                    (with --rootdir) shrink the filled filesystem to minimal size
2023-06-14T19:57:09.332450+00:00 redacted python3[12387]: #011-K|--nodiscard              do not perform whole device TRIM
2023-06-14T19:57:09.332472+00:00 redacted python3[12387]: #011-f|--force                  force overwrite of existing filesystem
2023-06-14T19:57:09.332491+00:00 redacted python3[12387]:   general:
2023-06-14T19:57:09.332512+00:00 redacted python3[12387]: #011-q|--quiet                  no messages except errors
2023-06-14T19:57:09.332534+00:00 redacted python3[12387]: #011-V|--version                print the mkfs.btrfs version and exit
2023-06-14T19:57:09.332553+00:00 redacted python3[12387]: #011--help                      print this help and exit
2023-06-14T19:57:09.332572+00:00 redacted python3[12387]:   deprecated:
2023-06-14T19:57:09.332592+00:00 redacted python3[12387]: #011-l|--leafsize SIZE          deprecated, alias for nodesize
2023-06-14T19:57:09.332611+00:00 redacted python3[12387]: ]
2023-06-14T19:57:09.337203+00:00 redacted python3[12387]: 2023-06-14T19:57:09.336989Z ERROR Daemon Daemon Command: [mount -t btrfs -o compress=lzo /dev/sdg1 /mnt/resource], return code: [32], result: [mount: /mnt/resource: wrong fs type, bad option, bad superblock on /dev/sdg1, missing codepage or helper program, or other error.
2023-06-14T19:57:09.337297+00:00 redacted python3[12387]: ]
2023-06-14T19:57:09.337457+00:00 redacted python3[12387]: 2023-06-14T19:57:09.337368Z ERROR Daemon Daemon Failed to mount resource disk [ResourceDiskError] Could not mount /dev/sdg1 after syncing partition table: [32] mount: /mnt/resource: wrong fs type, bad option, bad superblock on /dev/sdg1, missing codepage or helper program, or other error.
2023-06-14T19:57:09.337566+00:00 redacted python3[12387]: 2023-06-14T19:57:09.337502Z ERROR Daemon Daemon Event: name=WALinuxAgent, op=ActivateResourceDisk, message=[ResourceDiskError] Could not mount /dev/sdg1 after syncing partition table: [32] mount: /mnt/resource: wrong fs type, bad option, bad superblock on /dev/sdg1, missing codepage or helper program, or other error.
2023-06-14T19:57:09.337627+00:00 redacted python3[12387]: , duration=0

2. Serial console output: N/A
3. Steps to reproduce the behavior.
a. configure waagent to format the resource disk & create a BTRFS partition:

# Format if unformatted. If 'n', resource disk will not be mounted.
ResourceDisk.Format=y
# File system on the resource disk
# Typically ext3 or ext4. FreeBSD images should use 'ufs2' here.
ResourceDisk.Filesystem=btrfs
# Mount point for the resource disk
ResourceDisk.MountPoint=/mnt/resource

b. stop/deallocate the VM, and start it again. The 'mkfs-btrfs' failure will have been logged as above.

Distro and WALinuxAgent details:

  • Distro and Version: SLES SAP 15 SP4
  • WALinuxAgent versionWALinuxAgent-2.8.0.11 running on sles 15.4
    Python: 3.6.15
    Goal state agent: 2.8.0.11

Additional context
Issue is present on git head.