Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression found with the newly added FAT{12|16|32} support #500

Closed
azayet01 opened this issue May 19, 2024 · 0 comments · Fixed by #499
Closed

Regression found with the newly added FAT{12|16|32} support #500

azayet01 opened this issue May 19, 2024 · 0 comments · Fixed by #499

Comments

@azayet01
Copy link
Contributor

azayet01 commented May 19, 2024

Assuming the following YAML section to generate the image :

actions:                                                                                                 
  - action: image-partition
    imagename: {{ $target }}-{{ $variant }}.img
    imagesize: 4G
    partitiontype: gpt
    partitions:
      - name: bios
        fs: fat32
        start: 0%
        end: 2MB
        flags: [ bios_grub ]
      - name: efi
        fs: fat32
        start: 2MB
        end: 200MB
        flags: [ boot, esp ]
      - name: boot
        fs: ext4
        start: 200MB
        end: 400MB
      - name: root
        fs: ext4
        start: 400MB
        end: 100%
    mountpoints:
      - mountpoint: /boot/efi
        partition: efi
      - mountpoint: /boot
        partition: boot
        options: [ x-systemd.automount ]
      - mountpoint: /
        partition: root

With fs set to fat32, the partitions are not mounted after creating and formatting the partitions.
It use to work but then after a rebase, some few changes introduced the regression.

After investigation, I found the culprit commit :
commit 94fedb2
Date: Tue Mar 19 17:43:42 2024 +0000
actions: image-partition: enable creation of FAT{12|16|32} partitions

This one added more options when it comes to creating FAT partitions. So when partition fs is defined as "fat", "fat12", "fat16", "fat32", "msdos" or "vfat", then mkfs.vfat is used to create the partition, and different options were used depending on the FAT type.

The main issue is that mounting a FAT partition should use "vfat"
as fs type when using syscall.Mount().

So, in order to fix this issue, "vfat" is simply used to mount "fat", "fat12", "fat16", "fat32" or "msdos" partitions.
I created a pull request with a proposed fix here.

tgspot pushed a commit to tgspot/kali that referenced this issue Oct 21, 2024
The keywords 'fat32' or 'vfat' are equivalent, but due to a regression
in debos 1.1.4, using 'fat32' now leads to a build failure:

```
2024/05/27 07:44:27 ==== Setup the disk image ====
2024/05/27 07:44:27 Formatting partition 1 | mkfs.fat: Warning: lowercase labels might not work properly on some systems
2024/05/27 07:44:27 Formatting partition 1 | mkfs.fat 4.2 (2021-01-31)
[...]
2024/05/27 07:44:28 Action `recipe` failed at stage Run, error: esp mount failed: no such device
```

Upstream issues:
- go-debos/debos#500
- go-debos/debos#502
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant