[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Query about GRUB comand line functionality
Re: Query about GRUB comand line functionality
Mon, 9 Mar 2015 15:11:22 +0800
On 26/02/2015, Bret Busby <address@hidden> wrote:
> On 25/02/2015, Simon Hobson <address@hidden> wrote:
>> Bret Busby <address@hidden> wrote:
>>> The system is completely broken, due to attempting to install an extra
>>> operating system, which now appears to me, to be a trojan horse.
>>> The system previously had installed, MS Windows 8 (which got lost,
>>> when Debian Linux was installed, but, the loss of MS Windows 8, on
>>> that computer, has not been a problem, for me), Debian Linux 7.x and
>>> Ubuntu Linux 14.04 LTS.
>>> That is the order in which the operating systems were installed,
>>> before the additional one broke the system.
>>> When Debian Linux was added, GRUB showed only the Debian Linux OS.
>>> When Ubuntu Linux was added, the Ubuntu GRUB showed the boot options
>>> of Ubuntu and Debian.
>>> When the trojan horse operating system was added, the bootloader shows
>>> only the trojan horse operating system, which does not boot.
>>> In trying to restore the system to the state before the trojan horse
>>> operating system, I have found how to get to a GRUB command line
>>> prompt, which shows above specified version of GRUB as being present.
>> Often the easiest way to fix things is to boot a live CD/USB drive close
>> one of the installed OSs and work from there. I know some of the Debian
>> installers (everything but the "Net install ?) have an option for rescue
>> live modes. In Rescue mode, you can specify a partition to mount as your
>> root volume, and from there you have a working system that you can use to
>> repair the rest.
>> What I'd do is :
>> Boot from a Live CD/USB drive.
>> Mount each partition one at a time and have a look at what it contains -
>> listing of the partitions will also tell you what type it is, if Win8 is
>> still there then that should show as NTFS. If there's a /etc/fstab then
>> that's a Linux/Unix root filesystem and you can see from the contents of
>> file what other partitions it uses. You can also look for files like
>> /etc/debian_version which will give you a bit more clue as to which is
>> Once you have identified a suitable root partition, use rescue mode to
>> the system and mount that as the root filesystem - actually I think it
>> a chroot. You can mount it's other filesystems (mount -a) and then have a
>> booted system. From there, you can use update-grub and grub-install to put
>> working bootloader back in place.
>> Whether grub shows all the other systems depends on the settings you give
>> it, and/or what the distro configures it to do. From memory, I think
>> defaults to looking for others.
>> The tricky thing with multiple OSs is managing the bootloader. By
>> each one will want to install it's own. So whenever you do anything in
>> Ubuntu that needs an update to the boot config, it'll do it's own thing
>> install the grub that's installed in Ubuntu. Similarly for Debian. And of
>> course, Windows will just blow away anything it feels like !
>> So it may be best to remove (uninstall & purge) the grub package(s) from
>> but one OS. You then have to reboot into that one OS whenever your need
>> update grub - but you'll have a more consistent experience.
>> The tricky one is that many installers will want to install their own by
>> default - and it may or may not be difficult to persuade them not to
>> up your current install. From memory, Debian does ask before installing
>> grub, and it asks if you want to scan for other OSs. I have a feeling
>> some others, especially in "easy install" mode, may just go ahead and do
>> what they like.
>> PS - what was the last OS you installed that broke it ?
> Answer to the "PS" - PC-BSD 10.1.1 - it was supposed to be able to
> allow PC-BSD to be installed into a selectable OS booting UEFI/GPT
> computer system, using the GRUB bootloader, as the selectable OS
> bootloader (I use the term "selectable OS booting", rather than
> "multi-booting", as, to me, multi-booting means being able to boot
> multiple operating systems, concurrently, which, I believe, instead,
> requires virtual machines, like VMWare), and, allowing the person
> performing the installation, to select into which GPT partition,
> PC-BSD would be installed, but, instead, it has wrecked the computer
> system, rendering the system unusable without either restoring GRUB,
> if that can successfully be done (which appears increasingly
> doubtful), or, a complete system rebuild, involving re-installing each
> of the operating systems that was previously installed (which excludes
> MSWin8, as no installation media, were provided with the computer).
> PC-BSD 10.1.1 is dangerous, and, to me, a trojan horse thing.
> I had gone into the rescue mode, using a Debian 7.8 install iso image,
> and got to a screen that said something like "Into which of the
> following partitions do you want to install the root partition?", and
> it listed the 13 GPT partitions, in the format of something like
> /dev/sda<x> .
> But, it did not show which were the OS partitions (one for each of
> MSWin8, Debian 7, and Ubuntu 14.04 LTS).
> In trying to use the GRUb command line to which I had referred, I
> hoped to try to find which of the partitions were the OS partitions,
> so as to hopefully be able to restore the GRUB bootlaoder, and be able
> to boot one of the bootable operating systems.
> In trying to find whether I could save the sequence of command line
> commands and the respective response outputs, I had hoped to be able
> to, using a USB thumbdrive, examine the information on a usable
> computer, and figure out what to do next.
> At present, I do not know which partitions are the appropriate
> partitions into which to install root systems, so I am unable to use
> the rescue mode -> restore grub process.
> It took me about an hour, to get the system to provide me with the
> information for me to (and, including my doing it, to) write down the
> information that I believe to be the relevant information from the
>> ls (hd0, gpt<x>)
> commands for each of the partitions.
> Then, the next day that I have the time to do it, I expect that it
> will take me another hour or two, to obtain and write down the
> information from the GRUB
>> ls (hd0, gpt<x>)/
> commands for each of the partitions, to try to establish what is each
> It may be another week, before I can allocate that time
> The GRUB ls commands appear to not show partition labels for the non
> PC-BSD OS partitions, even though they should have labels (unless the
> OS partition labels have been stripped by the PC-BSD installation
> procedure, in addition to the other damage that it has done to the
> From a response that I have seen on another mailing list, to my query,
> the GRUB command line does not provide for mounting a USB thumb drive,
> then writing all commands and responses, from a start point to an end
> point, to a file to be saved on the USB thumb drive, then to unmount
> the USB thumbdrive, which would otherwise allow the commands and
> responses, to be examined as wanted, on an operable system, without
> having to boot the now inoperable system, into the GRUB command line
> mode (which appears to be all that works, now, on that computer), to
> rerun the commands, each time that I want to re-examine the commands
> and the responses.
> That is unfortunate, as the functionality that I want, would be quite
> helpful, if it would be available.
I have attached a copy of what I believe to be the last usable version
of the grub.cfg file, which I hope will be successfully transmitted as
If not, I will try to send it inline, within a further message.
I have found that file, using the file manager in a Debian 7.60 LXDE
amd64 LiveCD. That does not tell me (that I can interpret), in which
partition, the file sits, due to the use of the meaningless and
obscurantist UUID system of partition descriptors, rather than the
meaningful partition number system ( (hd<x>, gpt<y>) in the PC-BSD
UEFI/GPT system, or /dev/sda<y> in the more meaningful (than UUID)
Debian v <n<=6> systems) but, I assume, by context, the following.
The grub.cfg file and the Ubuntu installation, are in partition 12.
The Debian installation is/was in partition 6 (it appears to be not
visible to the Debian 7.6 LiveCD).
Now, the question becomes, given that the now disabled/overridden GRUB
bootloader has apparently been located in the Ubuntu installation in
(apparently) partition 12 of the HDD, how do I disable the BSD
bootloader and re-enable the GRUB bootloader that is apparently in
partition 12 on the HDD?
I understand that a Debian 7.8 installation CD, in the rescue mode,
has the option "Device to use as root file system", which, I assume
would restore the functionality of the GRUB bootloader, if it was in
the Debian installation, but, the last properly functioning GRUB
bootloader is in the Ubuntu installation, and I am not confident that
the Debian software, if used to operate on the Ubuntu system, would
not interfere with the (previous to the sabotage by PC-BSD)
functionality of the Ubuntu installation, and the Ubuntu 14.04 LTS dik
that I have, appears to not have an equivalent of the rescue mode of
the Debian installation CD.
Thank you in anticipation, for any constructive and helpful advice
that solves the problem.
"So once you do know what the question actually is,
you'll know what the answer means."
- Deep Thought,
Chapter 28 of Book 1 of
"The Hitchhiker's Guide to the Galaxy:
A Trilogy In Four Parts",
written by Douglas Adams,
published by Pan Books, 1992
Description: Binary data
- Re: Query about GRUB comand line functionality,
Bret Busby <=