Mount CD ISO File

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
 
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.
 
Last edited:
Back
Top