Rich Mingin (PLUG) via plug on 4 Jul 2023 09:34:37 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Reinstall of Linux didn't work


I will jump in here because I've spent a ton of time dual booting.
It's more general advice, not all specific to your current
predicament, but hopefully it'll be useful down the road as well.

1. Windows breaks all bootloaders except its own, on a long enough
timeline. This has *always* been true. Maybe your setup is good, you
maintain it well, you are fully prepared, but some Patch Tuesday, you
will see your PC just bypass all ideas of a "boot loader" and go
straight into Windows. This is "when", not "if". Be prepared for it,
get used to re-registering your preferred bootloader, and you will
save pain and headaches in the long run.

1a. Windows breaks bootloaders, so having one that is as independent
as possible of *both* "payloads" is valuable to me. I like a
bootloader that I can wipe the Windows partitions, the linux ones, and
as long as the ESP is still there, it just dutifully pops up and tells
me about all the big nothing I can boot. It helps with point 1. I've
been using rEFInd for years, but am getting away from it as my number
of dual-booting machines plummets.

1b. If you are not dual booting, the advice given previously holds. On
my mono-booting Linux machines, I've started preferring systemd-boot
(previously Gummiboot) or GRUB, since they're the best-supported and
best-understood options, they tend to need the least hand-holding.
They are also unsuitable for dual boot due to point 1a, though, as
they tend to break badly if the hosting Linux install goes "poof" for
any reason.

2. Because of point 1, you really want a boot loader that you can
easily repair/reinstall without booting a particular "payload" OS.
This is why I stuck with rEFInd for so long, you can reinstall it
directly from Windows (after it hijacks boot) and quickly get back to
good.

3. DO NOT (EVER) WIPE YOUR ESP. This is the little ~512MB-1GB FAT32
sucker that Windows and most Linuxes make on first install. If you
blow that away, *all* boot options that used it will break, and in the
case of Windows, sometimes irreparably. It used to be verboten by the
UEFI spec, but these days I make one ESP per OS, one made by Windows
on the Windows disk, and one made by Linux or by hand on the Linux
disk. This gives me maximum survivability when MS updates do something
untoward.

4. After long experience, the most "survivable" disk/partition layout
for dual boot is to install Windows first, to the "first" disk as
Windows sees it, and *not* format any disks that will not be Windows
"owned". Linux reads NTFS fine, but having Windows 'think' that your
Linux partitions should have "drive letters" has caused pain more
often than you'd imagine.

So in summary, my personal recipe for longer term dual boot survival
goes like this:

1. Install Windows in the usual ways. See point 4 above.
2. Do all updates/driver installs/USMT migrations, etc, to get Windows
"all set" and least likely to blow away boot order while you are still
setting it up.
3. Install Linux, and have Linux partition/format any disks that
belong only to Windows. I do *not* use any Windows-reads-ext4 type
stuff, because you are just handing Windows loaded guns and then
asking later where all these holes in your chest came from. Limit the
access the xenophobic OS gets to shoot you in the foot.
4. Install a boot loader that ideally lives on the ESP (did you make a
second ESP for Linux? That's the ideal place for a boot loader you
like, as "limit Windows access to things it does not understand"
applies). If your boot loader keeps booting and doing things with the
host OS gone, that's even more better. Most distros I know have access
to rEFInd and other options and will keep them updated for you, which
while not essential, is nice.
5. Make some alternate boot media. I have a large USB with Ventoy
https://www.ventoy.net/ that carries around a bunch of utility and
distro ISOs for me, as well as my personalized Windows media, and I
was able to just toss a rEFInd ISO on there and it works like magic. I
can use that to directly rescue boot my Linux and Windows installs,
assuming I haven't done something unpleasant to the partitions/file
systems, and it has saved me on many Patch Tuesdays.
6. Be ready to rescue boot and reinstall/reregister your chosen boot
loader. It *will* get broken eventually. The official MS Windows
worldview is that Windows is the *only* OS, and anything on the disks
that isn't Windows, boots Windows, or can be read/written by Windows
is probably bad data or disk cruft, and can be ignored/overwritten. Be
prepared.

On Tue, Jul 4, 2023 at 3:14 AM Will via plug <plug@lists.phillylinux.org> wrote:
>
> I could fix these issues if it were Arch or other equivalent simple distro.
>
> My 2 cents from my vantage point to fix it on my own system is first, get a chroot going. I would be using the Arch USB but that's because pacman and pacstrap are on there (match your live distro with your installed distro).  I would then wipe the boot distro and rebuild. Do not use grub, it will self destruct because it is an active project doing a lot of good work that will break configurations (since many do not want to spend time learning how to maintain grub).
>
> I would use systemd boot personally. Do not get fancy with your boot loader. Ext or even fat32 will best for formatting the partition as long as you set the boot partition flags. The rest of your partitions should remain untouched. Please note any UEFI assignments are weird to get started at first but not impossible. Assuming your kernel, boot loader, and UEFI assignments are set correctly you will be fine.
>
> I do not have the slightest idea how to accomplish these tasks with an installer to aide you, but while in a chroot the Arch wiki should have a lot of guidance on how one may proceed regardless of whatever distro they are using. Just remember you may have to update your fstab which shouldn't be too difficult with the directions on the Arch wiki. Alternatively you could experiment with genfstab after you have backed up the fstab. Just remember genfstab requires all mounts be set before using chroot from the live distro -> original install.
>
> -Will C
>
>
> On Tue, Jul 4, 2023, 00:09 Keith C. Perry via plug <plug@lists.phillylinux.org> wrote:
>>
>> While I'm sure there are grub ninjas that are good at working from the grub rescue prompt, for me, I boot from a USB live cd and then fix these issues by mounting the Linux partition, then bind mounting (mount --bind) /proc /sys and /dev to those same paths on the mounted linux partition.  I chroot to that partition and then reinstall grub.  For Ubuntu that would "update grub" (if something has changed- usually doesn't hurt to run anyway) and then grub-install /dev/<whatever the disk is for the mount partition you are in>  so if you had mounted /dev/sda1 then you would do grub-install /dev/sda.
>>
>> I hope that makes some sense.
>>
>>
>> ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
>> Keith C. Perry, MS E.E.
>> Managing Member, DAO Technologies LLC
>> (O) +1.215.525.4165 x2033
>> (M) +1.215.432.5167
>> www.daotechnologies.com
>>
>> ________________________________
>> From: "Philadelphia Linux User's Group Discussion List" <plug@lists.phillylinux.org>
>> To: "Philadelphia Linux User's Group Discussion List" <plug@lists.phillylinux.org>
>> Sent: Monday, July 3, 2023 3:40:24 PM
>> Subject: [PLUG] Reinstall of Linux didn't work
>>
>> I'll do my best to keep this succinct.
>>
>> First, some background. This computer was running Windows and Linux alongside each other, using grub to allow me to boot into the Ubuntu installation on sda, and the Windows 10 insulation on sdb. All work relatively well until recently.
>>
>> Rather than continue wrestling with my installation of Linux refusing to update anything (no reason to get into that now), I figured a fresh installation over it was probably a good idea. Since the computer was running Ubuntu, I installed in Ubuntu based distribution over it.
>>
>> First time, I used the custom installation option, selecting what I thought were the correct partitions for booth, swap, etc. No luck. I got an error saying no such device, unknown file system, entering rescue mode. I figured I had done something wrong, so I allowed the installer to wipe sda completely. No luck here, either - it  looks like I got the same exact error. At least, it's the same no such device along with an error prompt.
>>
>> I'm at a grub rescue prompt. Hopefully, I can work from here to edit the grub configuration, and get into the operating system.
>>
>> Thoughts?
>>
>> ___________________________________________________________________________
>> Philadelphia Linux Users Group         --        http://www.phillylinux.org
>> Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
>> General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug
>> ___________________________________________________________________________
>> Philadelphia Linux Users Group         --        http://www.phillylinux.org
>> Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
>> General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug
>
> ___________________________________________________________________________
> Philadelphia Linux Users Group         --        http://www.phillylinux.org
> Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
> General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug