# Mount CD ISO File



## N74JRW (Nov 9, 2019)

Hi,

I'm trying to make an unattended install file for FreeBSD per this tutorial. 

https://www.sysadminnotes.ca/worknotes/automated-freebsd-installations.html

One step has the user mount the FreeBSD install ISO with the following command: 
_sudo mount -t cd9660 /dev/`mdconfig -f FreeBSD-12.1-RELEASE-amd64-disc1.iso` /mnt/iso_

I do and receive the following output:
_mdconfig: open(/dev/mdctl): Permission denied  _<-- Note the sudo in the command I executed.
_mount_cd9660: /dev: Block device required_

I also tried with no luck: 
_sudo mount_cd9660 /dev/`mdconfig -a -t vnode -o readonly -f FreeBSD-12.1-RELEASE-amd64-disc1.iso` /mnt/iso_

What could I be doing wrong? I'm running FreeBSD 12.1 amd64 on a very old PC. 

Thanks


----------



## Zhsk (Nov 9, 2019)

I Use  #bsdconfig .


----------



## T-Daemon (Nov 10, 2019)

The problem here is the order the shell executes  commands and how sudo(8) interprets the command.  The command between backticks ( ``mdconf -f FreeBSD-12.1-RELEASE-amd64-disc1.iso``) is executed by the shell first (you can see this at the "Permission denied" message, it is printed before the "Password:" prompt), but as normal user, after that `sudo mount -t  cd9660 ....`

I'm not sure if it's possible to instruct sudo(8) to execute the command between the backticks as root as well in the form the command is given here.

To mount the iso image as a memory disk run su(1) before, or if you insist on sudo(8) split the command in `sudo mdconfig FreeBSD-12.1-RELEASE-amd64-disc1.iso` ( you can omit the -f option) and `sudo mount_cd9660 /dev/mdX /mnt/iso` , where mdX is the printed out device name from the previous command.


----------



## N74JRW (Nov 10, 2019)

Great! Thanks. Much obliged


----------

