If I burn the Debian 11 downloadable ISO to an M2 drive, just like with a USB stick, I’m sure it would work. But what I want to do is place the installer on a single partition of the M2 drive, rather than overwriting all partitions on the entire disk.
I manually partitioned the drive as:
P1 2G EFI
P2 5G Debian 11 Installer
P3 100G Debian 11 (will be installed here from installer on P2)
P4 100G Home
With the goal of booting pure UEFI from P1, where at first it loads the installer, but once installed, I get a choice (in GRUB) of booting the installed OS on P3 or the installer environment again on P2 for recovery purposes.
P1 is EFI type, the others are Linux Filesystem type. The partition table is GPT.
I tried dding the Debian 11 installer iso onto P2, but of course, it does not boot, because I need to install a bootloader/EFI record onto P1 so the motherboard sees it as bootable.
But I need to do it without messing up the system I’m using to setup the drive.
When you use the graphical disk writer tool to write an iso to a thumb drive, I think it actually creates two partitions on the USB drive. So I think I need to figure out how to dd the two partitions (install and EFI) separately onto the prepared M2 drive partitions, but from a single iso file. How can that be done?
Debian installation media is usually more than one partition. The issue is that you’re trying to dd multiple partitions into a single one.
The most painless option would be to back up your home folder, dd the installation media onto the drive, then do the rest of the partitioning through the Debian installation media itself.
You can also dd individual partitions (looking at debian-10.7.0-amd64-netinst.iso it has two). Mount the image and dd individual partitions. It will take a bit of repartitioning but shouldn’t be too painful as long as you’re vaguely familiar with dd and parted (or gparted).
-P tells losetup to scan for partitions, -f finds the first unused loop device.
This will put the drive cause the device and it’s partitions to show up at /dev/mapper/loop[y]p[x]. [y] is the loop device number (usually 0) and [x] is the partition number.
From there, mount the desired partitions with mount as you normally would.
Sorry the response took a bit. It had been a hot minute since I used losetup so I had to double check the manual. If you have any other issues let me know.
When I ran sudo losetup -P -f ~/bootable.iso, one partition auto-mounted. They were both in /dev/loop0p1.
So I dded them onto the hard drive and it does boot and run the installer, but unfortunately the installer is not happy and says something is wrong with the installation media.
I think it is unable to auto-mount the installation media into the ramdisk environment because the partition layout is different.
So two possibilities. One, the order of the partitions matters and I need to put the EFI partition after the main installer partition like on the official media.
Alternatively, I may be able to mount the installation media manually and skip the auto-mounting step, but I don’t know where to mount it to that the installer looks for it? Do you know the path that the install disk should mount to in the installation environment?
So it turns out the order of partitions makes no difference. So I need to figure out how to mount the installation media manually after the ramdisk loads, or give up on the idea.
Do you not have any other media to burn or dd this to?
Otherwise you would need to find out bow many MB the partitions are and then tell DD to only write that information to each required partition.
My recommended way of install Debian is to always use the net install method. It is a minimal boot iso and will download fresh packages from Debian. can fit on the smallest cd, sdcard, usb stick, etc.
Since new computers often don’t have optical drives since OSes are installed from flash, and since flash dries, unlike CD’s are re-writable, get lost, aren’t labeled, etc.
It is very easy to end up in a situation where I need a live/install “CD” that I don’t have because a CD wasn’t used, and the thumb drive used may have been reused and/or is nowhere to be found.
Thinking it would be easy to do so, I thought it would be a good idea to put the installer in a bootable partition on the same drive the OS installs on. Need to fix something? Just choose “Boot Installer” from GRUB.
So it’s likely that the partition size is causing the problem? Or is dd corrupting the partition by short-writing? Can fsck after dd fix it?
That is actually a good idea and useful. I thought that you were trying to get Debian installed. It seemed convoluted just to get it installed, but this makes more sense.
Probably partition sizing is the issue. You can short write with DD and it should not cause an issue. I don’t think fsck can fix Juliet ISO partitions. So What I would recommend is using the minimal install iso because it is small and you can fit both partitions in the 5GiB that you alloted. Also it would give you the ability to pull hot files from the internet versus working with dead files that you have more than likely upgraded from since last install, unless you are looking for a completely offline fix.
So for clarification, Has Debian already been installed?