LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 05-02-2017, 09:14 PM   #1
Suker Punch
LQ Newbie
 
Registered: Oct 2014
Posts: 8

Rep: Reputation: Disabled
A corrupted GRUB


OK here is the problem, mostly of my own creation.
There was a problem with the “/boot” folder being full doing an update. So I ended up doing what I have done in the past which was to delete the 3 parts of the Grub file variants (tripple sets) of the old grubs – that made room.
(as a side point why are the “/boot” folders always filling up, instead of autodeleting to the 2nd or 3rd install back?)
What happened is that I have created a very interesting situation.
a) The original grub, was a 3.1.5 (I think) and that had been deleted, and the OLD 3.5.5 grub, was running on the 3.1.5 (lines of code in the boot loader?).
b) Anyway, I found that there were problems in getting the latest version installed – 4.7.1 (?) as there was no room in the /boot folder, so I moved the triplicated sets of grub files, in the 3.X.X file series into the bin, and only kept the 4.X.X series in the “/boot” folder.
c) The trash bin is inside the encrypted home folder.
(awesome)
d) And when I went to reboot – failure.
I am now in this position.
I can’t boot up, and the encrypted home folder as yet has not been accessed, and I think it's due to the pathway via grub, being corrupted.
The recovery pass phrase that I do have, is either filed away in plain sight, or the one I have, doesn’t work, neither do either of the log in passwords.
This is the message I get.
Error unlocking /dev/sda3: Command-line `cryptsetup luksOpen "/dev/sda3" "luks-0c5f4912-c00f-4aac-904e-f8035db5d6d3" ' exited with non-zero exit status 2: No key available with this passphrase.
The system being corrupted and in need of a full update is not bad, as I need to do a full reinstall anyway – as per the reasons outlined above, but getting locked out of my home folder is not so goo.
But I would like to retrieve the much needed files from the home folder.
So I want some help to figure this out.
I figure I have a range of options.
The drive is partitioned so:
/dev/sda1 is the EFI System 512M (Installed in UEFI mode)
/dev/sda2 is the Ext2 Linux File System 512M
/dev/sda3 is the LUKS Encryption (version 1) — Locked 120G
The object. Access /dev/sda3 and retrieve the data from it.
Then install the latest version of Xubuntu.
I have tried to access the encrypted drive using a live USB, and the apparent passphrase, isn’t working. And I cannot manifest a log in screen – to use my decryption password and then the user password. This is what I really want to be able to do.
I figure that I can:
Reinstall a 3.1.5 Xubuntu OS (?) and into either or one of the /dev/sda drives….
And maybe it might fix the engagement of the GUI “LOG IN” password interface, to then be able to access the home drive, with it’s pass word.
Or install an operating system (later version) ONLY into the sda2 folder, and trying to boot up from that – not sure how to do it.
Install the OS onto a spare drive AND then try to access the home folder like that.
Or
Create a rescue CD / USB and have a crack at repairing the /sda1 and or /sda2 drive.
https://stephentanner.com/restoring-...ypted-lvm.html
http://www.system-rescue-cd.org/disk...-damaged-Grub/

But there is the issue of the Key in the Grub, and the encrypted home directory.

It's how to load that up,

And a ubuntu forums thread 940904......

The data I have on the drive is important, it contains a flood mitigation project and this is to stop towns being washed away….

I have been able to back it all up in the form of image files... But I have one possible easy option to possibly dig out the pass phrase where ever I may have stashed that, or somehow repair the grub and boot from a 3.2 ubuntu / xubuntu persistent USB drive, OR enable some kind of booting to display the enter the "mount the encrypted file system" pass word....

I don’t have months to redo all the work.

I am floundering a little bit here can anyone help me with this.
 
Old 05-03-2017, 04:12 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
This has nothing to do with grub.
The triplets you are deleting are kernels - which is not always safe; better to use your package manager.

Opening the luks container for sda3 (say from a liveCD) is trivial, you even show the required command above. But if you don't have the pass-phrase, impossible.

Simplest to restore from a recent backup.
 
Old 05-03-2017, 07:30 AM   #3
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,504

Rep: Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490
Quote:
(as a side point why are the “/boot” folders always filling up, instead of autodeleting to the 2nd or 3rd install back?)
Because you're using one of the Ubuntu's. Many Linux distributions doing a kernel update will automatically remove older kernels so that you never have more than 2-3 kernels. I think the most recent version of Ubuntu now does this but previously did not and I have seen posts on the Ubuntu forums with users having 30+ kernels!! Simply deleting the kernels is not the proper procedure. I'm not an Ubuntu user but you should have no problem finding the proper method with a simple online search.

Quote:
The original grub, was a 3.1.5 (I think) and that had been deleted, and the OLD 3.5.5 grub, was running on the 3.1.5 (lines of code in the boot loader?).
Grub is still on version 2 so I think you are confusing Grub version with the kernel version. The numbers above would be appropriate for a kernel. I'm not sure what you are referring to when you say you removed triplicated grub files??
 
Old 05-03-2017, 03:26 PM   #4
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: Slackware®
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Moderator response

Moved: This thread is more suitable in <Ubuntu> and has been moved accordingly to help your thread/question get the exposure it deserves.
 
Old 05-03-2017, 10:20 PM   #5
Suker Punch
LQ Newbie
 
Registered: Oct 2014
Posts: 8

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by yancek View Post
Because you're using one of the Ubuntu's. Many Linux distributions doing a kernel update will automatically remove older kernels so that you never have more than 2-3 kernels. I think the most recent version of Ubuntu now does this but previously did not and I have seen posts on the Ubuntu forums with users having 30+ kernels!! Simply deleting the kernels is not the proper procedure. I'm not an Ubuntu user but you should have no problem finding the proper method with a simple online search.



Grub is still on version 2 so I think you are confusing Grub version with the kernel version. The numbers above would be appropriate for a kernel. I'm not sure what you are referring to when you say you removed triplicated grub files??


Yeah what I meant was that the GRUB boot loader, has the lines of code in it that referenced the different kernels.

And the GRUB tripplets I was referring too, were like this:


In the /boot/grub/Grub.cfg file are these entries:

menuentry 'Ubuntu, with Linux 3.2.0-68-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.2.0-68-generic-advanced-f74c948f-bb45-4c82-8d43-7fe0b28a28bc' {
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_msdos
insmod ext2
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 f74c948f-bb45-4c82-8d43-7fe0b28a28bc
else
search --no-floppy --fs-uuid --set=root f74c948f-bb45-4c82-8d43-7fe0b28a28bc
fi
echo 'Loading Linux 3.2.0-68-generic ...'
linux /boot/vmlinuz-3.2.0-68-generic root=UUID=f74c948f-bb45-4c82-8d43-7fe0b28a28bc ro quiet splash $vt_handoff
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-3.2.0-68-generic
}
menuentry 'Ubuntu, with Linux 3.2.0-68-generic (upstart)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.2.0-68-generic-init-upstart-f74c948f-bb45-4c82-8d43-7fe0b28a28bc' {
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_msdos
insmod ext2
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 f74c948f-bb45-4c82-8d43-7fe0b28a28bc
else
search --no-floppy --fs-uuid --set=root f74c948f-bb45-4c82-8d43-7fe0b28a28bc
fi
echo 'Loading Linux 3.2.0-68-generic ...'
linux /boot/vmlinuz-3.2.0-68-generic root=UUID=f74c948f-bb45-4c82-8d43-7fe0b28a28bc ro quiet splash $vt_handoff init=/sbin/upstart
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-3.2.0-68-generic
}
menuentry 'Ubuntu, with Linux 3.2.0-68-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.2.0-68-generic-recovery-f74c948f-bb45-4c82-8d43-7fe0b28a28bc' {
recordfail
load_video
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_msdos
insmod ext2
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 f74c948f-bb45-4c82-8d43-7fe0b28a28bc
else
search --no-floppy --fs-uuid --set=root f74c948f-bb45-4c82-8d43-7fe0b28a28bc
fi
echo 'Loading Linux 3.2.0-68-generic ...'
linux /boot/vmlinuz-3.2.0-68-generic root=UUID=f74c948f-bb45-4c82-8d43-7fe0b28a28bc ro recovery nomodeset
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-3.2.0-68-generic
}



And in the BOOT folder, are these files:

abi-3.2.0-68-generic
config-3.2.0-68-generic
initrd.img-3.2.0-68-generic
System.map-3.2.0-68-generic
vmlinuz-3.2.0-68-generic



During an earlier /boot space making exercise, I had deleted the earliest 3.XXX series, and left in the later 3.XXX series kernels.

However, during the last bout of /boot space making, I deleted the latter 3.XXX series of kernels and just left the 4.XXX series kernels in the /boot folder.

But it was the 3.1 / 3.2 kernel set, that was referenced in GRUB, that was the boot up sequence.

And this is the exact nature of the problem.

I could use a 3.1 or 3.2 USB boot stick (with persistence) to boot up from - SO OK I can do that and then see what happens.

So rather than speculate, I ought to do it.

but to speculate, there is the issue of essentially getting the enter the code to boot into the encrypted file system with (not recovery passphrase), and the matching key in the LUKS encryption system.

I don't know about this. Maybe I should just go and find out.

If it works, then come back and report the success, if not, then come back and research the LUKS issue further.

I do believe I have the passphrase written down somewhere, and it's safely stashed away ??????

Maybe I should get off my arse and go look for that as well.

Will be back within 12 hours.
 
Old 05-04-2017, 06:29 AM   #6
TxLonghorn
Member
 
Registered: Feb 2004
Location: Austin Texas
Distribution: Mandrake 9.2
Posts: 702

Rep: Reputation: 231Reputation: 231Reputation: 231
It appears that you are saying you deleted that text from the grub.cfg file. If that is all you did, you did not accomplish anything. Deleting that text simply removed those menuentries from the Grub menu.
 
Old 05-04-2017, 06:20 PM   #7
Suker Punch
LQ Newbie
 
Registered: Oct 2014
Posts: 8

Original Poster
Rep: Reputation: Disabled
The text from the Grub.cfg file, was a citation of the "triplicate sets" referred too in an earlier posting.

Meaning that on with the /boot folder only occupying a very small percentage of a 500 Meg partition, and being told that I cannot install the update because the /boot folder has no more space, I had pointed out that by deleting the "sets" of 3.1 XXX, 3.2 XXX etc., kernels I was able to make a lot of space in the /boot folder to install the updates.

Yah - confusing I know.
 
Old 05-04-2017, 06:43 PM   #8
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
Have you considered booting up with Boot Repair Disk (https://sourceforge.net/projects/boot-repair-cd/) and seeing if it will rebuild grub for you?
 
  


Reply

Tags
encrypted, grub 2



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to repair corrupted grub srinivas reddy ramana Linux - Newbie 6 03-13-2016 10:09 AM
grub.conf got corrupted SkM007 Linux - Newbie 2 10-30-2011 08:22 PM
grub corrupted......help ashwinidubey Linux - Newbie 3 06-23-2008 01:46 AM
corrupted grub loader ti479 Linux - Software 2 11-28-2006 05:52 PM
Grub loader corrupted reply2vinay Linux - Software 3 09-20-2005 05:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 06:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration