Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm impressed they got grub onto a hard disk image without needing root; I didn't think you could do that. I struggled with that for a while, before I found grub2-mkrescue, which I think is much easier if you're just starting out. The entire sequence to create a CD ISO is,

  # Stage the data we want in our image:
  mkdir -p isofiles/boot/grub
  cp grub.cfg isofiles/boot/grub/.
  cp kernel.bin isofiles/boot/.

  # Make the image:
  grub2-mkrescue -o os.iso isofiles

  # Clean up:
  rm -rf isofiles
Which I got from the tutorial here[1], which is also excellent.

[1]: http://os.phil-opp.com/multiboot-kernel.html



How is booting from a CD not being "root"?


Booting from a CD is outside the OS permissions system. The parent poster is talking about making the CD image.


Why should creating an ISO need root? It shouldn't be any different than creating a tarball or a zip file.


As pjc50 notes, it shouldn't; absolutely nothing about creating either ISOs or hard disk images requires root, in theory — it's just a file, after all. But in practice, tools like losetup and mount both require it. The part I found novel in the article was the mtools package, which I didn't know about.

Linux has made progress here, such as FUSE for mounting in user space. But FUSE doesn't support file systems that the OS inherently supports, for example. My understanding is that you need to write a FUSE driver for, e.g., ext2, even though Linux is perfectly capable of mounting ext2 as root.

Block devices and partition tables present another hassle.

I suspect ISOs are more easily done simply because non-root users have more need to create them: UI applications for making ISOs readily exist, but I can't think of any common applications that deal with disk images that don't already have root.


It shouldn't. However, many of the tools assume the ability to e.g. mount filesystem images as part of the process. Which does require root.


Exactly. Physical access is root access.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: