Laptop dilemma - trying to switch to Linux unsuccessfully

Hi, I have an older HP laptop that is stuck in repair mode. Windows does not boot and so I wanted to switch to Linux. I’ve tried resetting the boot order so that it will boot from USB and used MultibootUSB to add two Linux distro ISOs to a USB to trial them first. Unfortunately this is not working. The laptop uses UEFI so I’m not sure if that is part of the problem. I’m considering wiping the hard drive entirely to start from scratch, but is there something I could do first - maybe try a different Multiboot tool for my USB? The USB is formatted ex-FAT - is that a problem? Could the Windows boot loader be causing a problem?

Hi dr-rockit
Welcome to the forum, When you say “Unfortunately this is not working” can you be a little more specific and explain exactly whats happening when you try to boot to USB also I’m not sure what you mean by ‘repair mode’ but if it’s UEFI it might a good idea to enter the BIOS and and change it to Legacy Boot, also I don’t think ex-FAT is a good choice I would use fat32 or ext4, completely wiping the hard drive seems a bit drastic at this point and I don’t see how it would help

Graeme

Hi, for what it’s worth my Universal Bootloader does work with UEFI, and this is the script I use to initially format a key;

#!/usr/bin/env bash
parted -s /dev/${1} mklabel msdos
parted -s /dev/${1} mkpart primary 1MiB 551MiB
parted -s /dev/${1} mkpart primary 552MiB 100%
parted -s /dev/${1} set 1 esp on
parted -s /dev/${1} set 1 boot on
mkfs.fat -F32 /dev/${1}1
mkfs.ext4 -C 65535 -O bigalloc -O ^has_journal /dev/${1}2
dosfslabel /dev/${1}1 MP-BOOT
e2label /dev/${1}2 MP-DATA

Source for the application application is here;

MP,
In the lines like
parted -s /dev/${1} mklabel msdos
does one replace the “${1}” with the /media/… path of the USB stick?
Excuse my ignorance.

Ok, so to use this script you would first ensure that no pre-existing filesystems were mounted on the device, i.e. unmount anything mounted on /media.

Then do “lsusb” to identify the device name for your USB key, typically something like /dev/sdb.

In this instance you would run the script with “sdb” as the first and only parameter.

Note; I wasn’t expecting anyone to try running this, I was just demonstrating the partition types and layout that works. So …

WARNING: running this script and supplying the wrong device name, for example the device name of your hard drive, will render your installation irrecoverably broken. Make SURE you know the device name for your USB key and only supply this device name.

So, this script is relatively harmless on a broken laptop, but be a little more careful when running on your main machine :wink:

Note: Linux device naming schemes;

  • sd(x) typically SCSI, SATA or USB disk devices, starting as “sda”
  • hd(x) typically older IDE disk devices, starting as “hda”
  • vd(x) typically used by some virtualisation systems, started by “vda”

On modern systems, expect your main hard drive to be “/dev/sda”, if you think “/dev/sda” is your USB drive, think and check three times before you act on that thought :slight_smile:

I find it a little ironic that IDE was a parallel interface swapping many bits simultaneously, however newsr SATA/USB devices are serial bit at a time interfaces and are typically many times quicker … maybe I’m missing something, it just feels counter-intuitive.

Thanks for that.
When plugging in a random (old) USB stick I get this:
keith@E5570:~$ lsusb

Bus 002 Device 004: ID 413c:81b6 Dell Computer Corp. DW5811e Snapdragon™ X7 LTE
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 007: ID 8087:0a2b Intel Corp. Bluetooth wireless interface
Bus 001 Device 003: ID 0a5c:5832 Broadcom Corp. 5880
Bus 001 Device 002: ID 1bcf:28b8 Sunplus Innovation Technology Inc. Integrated_Webcam_HD
Bus 001 Device 008: ID 1307:0163 Transcend Information, Inc. 256MB/512MB/1GB Flash Drive
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

keith@E5570:~$ df -h
Filesystem Size Used Avail Use% Mounted on
tmpfs 775M 2.4M 773M 1% /run
/dev/nvme0n1p3 117G 49G 63G 44% /
tmpfs 3.8G 344K 3.8G 1% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
/dev/nvme0n1p2 512M 6.1M 506M 2% /boot/efi
tmpfs 775M 196K 775M 1% /run/user/1000
/dev/sda1 481M 15M 466M 4% /media/keith/5913-2DE4
keith@E5570:~$

So the df command is the most useful for me.
It always did confuse me that my m.2(?) “hard drive” is /dev/nvme0n1p3 whereas my media are /dev/sda1 and you are right: I have to be very careful!

One more question: do I replace the “1” in ${1} with /dev/sda1?

Sure “df” is good too :slight_smile:

I think I probably meant “lsblk” rather than “lsusb”, the latter is great but doesn’t show device names :slight_smile:

So “/dev/sda” refers to the device, “/dev/sda1” refers to the first partition on the device, “/dev/sda2” refers to the second partition on the device (etc).

As “parted” is partitioning the device (rather than the partition) the script needs a device reference … from there it can get to a partition reference just by adding a digit - it/when it needs to.

If you take a look at the last four lines, these commands reference partitions and you’ll notice it adds a “1” or “2” on the end :slight_smile:

But do I put ${sda}1 in the command? It’s the format I’m after.

Ok, so if you do;

# save the script as "format.sh"
chmod +x format.sh
./format.sh sda

This should partition device /dev/sda, which in your case seems to be a USB key. When it’s complete, you should have two partitions, /dev/sda1 and /dev/sda2, the latter is the one you would put a linux install onto.

In bash script, ${n} where (n >= 0) represents the “nth” parameter supplied. Where parameter 0 is the name of the command or script. So;

./format.sh sda

Inside the script, ${0} == “format.sh” and ${1} == “sda”

So;

parted -s /dev/${1} mklabel msdos
# actually does
parted -s /dev/sda mklabel msdos

I think I’ve understood that, but may have to come back to you. Sorry to be dim!

Repair mode is HP laptop software that attempts to fix problems that might stop Windows from booting properly. I’m not sure exactly what is going wrong, but Windows no longer boots. Neither does a Linux ISO from the USB stick. The BIOS hard drive diagnostic and memory diagnostic tell me that there is nothing abnormal, but nothing boots from the USB. It goes back into repair mode and eventually crashes without restarting.

I’ll try changing the BIOS to Legacy Boot and re-formatting the USB to FAT32 and tell you how that changes things.

I had a similiar problem with a friends PC and it turned out to be a HDD issue and the answer was to replace the drive and install Linux but there are other possibilities, just out of curiosity are you able to access the Boot Menu during start up and if so is it listing the USB stick ?

Another option I’ve spotted recently, if your machine has USB 3.1 or better (maybe not if it’s an older machine) an external USB based SSD can also give good results at maybe 5x the throughput of a traditional hard drive, not to mention the near zero seek time.

You can get a “Sabrent” (or similar) external SSD enclosure for under a tenner, then just stick a random 2.5" SSD into it and plug it into an external USB port. The WD Blue 256 drives seem pretty good for about 30 quid.

I’ve been using this as a storage mechanism for the last six months or so, not really noticed any real difference coming down from an M.2.

MultibootUSB allows you to boot into a terminal window to test whether your ISO is working or not. When I tried it with a live boot ISO of Zorin it came up with the following error messages:
Failed to load libcom32.c32
Failed to load COM32 vesamenu.c32

It may well be that the hard drive is faulty despite it testing okay on the BIOS diagnostic. But would that affect the ability to boot from a USB?

Got an update on booting Zorin from live USB. Went through to boot screen and selected ‘Try or install Zorin’

After several minutes of trying to boot, got the following error message:

‘The disk contains an unclean file system (0, 0)
Metadata kept in Windows cache refused to mount
Falling back to read-only mount because the NTFS partition is in an unsafe state. Please resume and shutdown Windows fully (no hibernation or fast restarting)
Could not mount read-write, trying read-only
Unable to find a medium containing a live file system
Attempt interactive reboot from a URL?
yes no (default yes)’

Unsuccessful at booting from URL, but not sure whether I selected the right option(s)

Mmm, sounds like your Windows partition is stuffed, which may or may not be down to the disk itself being stuffed. When you boot a “live ISO”, it tends to try to mount any other pre-existing filesystems it can see … which would include your stuffed Windows filesystem … and it looks like that is causing problems. If you want to boot the USB properly, try going into the BIOS and disabling the hard drive support. (i.e. turn off IDE and/or SATA support).
Failing that, if you take a look at the docs, most distro’s have some way to boot the ISO with the “mount other filesystems” option disabled.

Okay, thanks a lot will have a look at that