Web lists-archives.com

Re: Is it possible to install Debian in such a case.




On Fri 10 May 2019 at 16:18:51 (-0400), Felix Miata wrote:
> David Wright composed on 2019-05-10 13:32 (UTC-0500):
> > On Fri 10 May 2019 at 12:06:05 (-0400), Felix Miata wrote:
> 
> >> what I virtually always do, install from network, beginning with fetching
> >> <http://ftp.debian.org/debian/dists/stretch/main/installer-amd64/current/images/netboot/debian-installer/amd64/initrd.gz>
> >> and
> >> <http://ftp.debian.org/debian/dists/stretch/main/installer-amd64/current/images/netboot/debian-installer/amd64/linux>
> >> and placing them where Grub can find and load them.
> 
> > So I'm looking for the page that has those instructions. Do you know
> > where it is?                                                             
> 
> It's not all on https://wiki.debian.org/Grub which only has the standard Grub2
> boilerplate, to get from A to B one must first divert to C and then D. :-p There
> is a small piece of it hidden in its first FAQ (/etc/grub.d/40_custom).
> 
> > It would list the requirements, what to put where, and where in the
> > d-i process you arrive after booting.
> > (d-i ≡ debian-installer, for the OP.)                                          
> 
> Try putting this in custom.cfg in a bootable stick directory containing grub.cfg:
> 
> menuentry "Install Debian via HTTP" {
> 	search --no-floppy --label --set=root <USBSTICKLABEL>
> 	linux	/boot/linux
> 	initrd	/boot/initrd.gz
> }
> 
> Once that's done, the stick booted, and the selection made, the d-i app takes over
> by asking the exact same questions as if having booted from the NET iso.
> 
> No USB stick (or OM, or PXE) is needed for linux and initrd.gz if the target
> system already has a loadable Grub (any bootloader really, syslinux, rEFInd,
> others) installed anywhere, which is the standard installation method in my routine.

That's pretty much what I needed to get this sorted out. In my case,
using the hard disk itself, the USBSTICKLABEL is just the LABEL that's
used for the existing system itself, and I copied the files above
straight into /boot, along with all my normal kernels.

As this was new territory, I tried it out on a spare laptop. Checking
the files against the SHA256SUMS, I noticed a lot of different linux
kernels and initrd.gz files which I assume could do a similar job in
slightly different ways. I'm not sure where this is documented.

With your files, I indeed booted straight into the d-i, presumably in
the non-graphical expert version which suited me fully. One or two
wrinkles were:
. I don't know if one could get the remote install over ssh working,
. the firmware is needed on a stick, like in days of yore (or using
  "pure" Debian netinst),
. it appears important to remove the said stick at the earliest
  opportunity else the new system may be installed on the laptop's
  hard drive but with a kernel name of /dev/sdb, which is no good
  when you come to reboot into it.

I don't want to trust overwriting the MBR's boot code, so I said no
the question. I think it then asked for the device anyway, whereupon
I backed out of that screen and then selected 'Continue without
boot loader'. I think that meant that grub wasn't configured at all,
so /boot/grub/unicode.pf2 is the only file in that directory.

Before answering the clock/UTC question, I ran
/target/usr/bin/swaplabel and put back the LABEL on my swap
partition so that the original system would find it as normal.
AFAICT the new installation finds swap by its generated UUID and
my original uses LABEL, so both systems are happy.

After the installation, I used the "Classic Chroot Sequence" to test
the bootability of the new system:

# mount /dev/sda2 /mnt
# mount -o bind /proc /mnt/proc
# mount -o bind /sys /mnt/sys
# mount -o bind /dev /mnt/dev
# chroot /mnt grub-mkconfig > /boot/grub/grub.cfg
# chroot /mnt grub-install /dev/sda

before redoing the last two commands in the old system to restore
the status quo.

> Of course, this much detail shouldn't be needed by those who have more than a
> passing familiarity with using Grub.

Whether this technique is possible is something that depends on
details of booting details like how a kernel finds its root
filesystem, whether it has the wherewithal to read it, what's inside
the initrd.gz files (with their new format) etc, apart from details
of grub.

And I find recipes for grub can be very confusing, with Grub1, Grub2,
grub-pc, and those strange hybrid packages that claimed to be Grub2
but were numbered as version 1. Looking back at past postings here,
one rarely knows precisely which versions of what were being used.

> When I see "we" instead of "I" in an OP, as
> for this thread, I assume "we" means more than one person, a group, which ought to
> possess more than a passing familiarity using Grub, hence my keeping my reply short.

I think expressions like "What I have …" and "What we want …" are just
polite expressions. To me (relatively old), the latter means that the
writer is not wanting to do an unusual or idiosyncratic task (like
"nuke" resolv.conf, castrate NetworkManager!), but one that would
likely be useful for others in a similar situation. So please feel
free to be expansive.

Cheers,
David.