kdomanski / iso9660

A go library for reading and creating ISO9660 images

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

invalid argument error when trying to extract ISO to directory

smahm006 opened this issue · comments

I am trying to extract a ubuntu iso image (from https://releases.ubuntu.com/22.04/) to a temporary folder. Below is the code I am using

func ExtractISO() error {
	temp, err := os.MkdirTemp("temp", "ubuntu-")
	if err != nil {
		return fmt.Errorf("creating temp dir: %s", err)
	}
	iso_file, err := os.Open("ubuntu-22.04.3-live-server-amd64.iso")
	if err != nil {
		return fmt.Errorf("opening iso file: %s", err)
	}
	defer iso_file.Close()
	if err = util.ExtractImageToDirectory(iso_file, temp); err != nil {
		return fmt.Errorf("extracting image: %s", err)
	}
	return nil
}

I am getting hit with an error extracting image: open temp/ubuntu-4020240902/boot/grub/i386-pc/zstd.mod: invalid argument

I am not sure what the reason is, maybe the - in i386-pc?

EDIT: I just realized this might also be a permissions issue