LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 06-11-2020, 02:42 AM   #31
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,129

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121

Well I tried. My point was it's better to have a restore set as a starting point, no matter how old, rather than solely rely on forensic scraping.
 
Old 06-11-2020, 11:19 AM   #32
qelpp
Member
 
Registered: Jun 2020
Posts: 35

Original Poster
Rep: Reputation: Disabled
Code:
root@neon:~# cryptsetup open /dev/sda3 sda3_crypt -- luks
Enter passphrase for /dev/sda3: 
root@neon:~#
FIRSTLY I have to note that in the past I was quickly following your suggested commands and had forgotten that at the above step the passphrase was the one I had chosen for the install thumbdrive which I created that was the start of this issue. i had just tried the original passphrase, it failed, I automatically tried the thumbdrive passphrase, it worked, I moved on to your other suggestions... I apologize for not noting that significant difference.

So now I do blkid and again get:
Code:
/dev/mapper/sda3_crypt: UUID="grQVpf-NLQp-yubt-FKw6-0Mmc-PT1q-KSBbLD" TYPE="LVM2_member"

--------

Code:
root@neon:~# mkdir /sda3_crypt
root@neon:~# mount /dev/sda3_crypt/root /sda3_crypt
mount: /sda3_crypt: special device /dev/sda3_crypt/root does not exist.
root@neon:~# mount /dev/Live-OS-vg/root /sda3_crypt
mount: /sda3_crypt: wrong fs type, bad option, bad superblock on /dev/mapper/Live--OS--vg-root, missing codepage or helper program, or other error.
root@neon:~# mount /dev/mapper/Live--OS--vg-root /sda3_crypt
mount: /sda3_crypt: wrong fs type, bad option, bad superblock on /dev/mapper/Live--OS--vg-root, missing codepage or helper program, or other error.
root@neon:~# mkdir /Live-OS
root@neon:~# 
root@neon:~# mount /dev/mapper/Live--OS--vg-root /Live-OS
mount: /Live-OS: wrong fs type, bad option, bad superblock on /dev/mapper/Live--OS--vg-root, missing codepage or helper program, or other error.
I will wait for a suggestion before using the terminal again.

Last edited by qelpp; 06-11-2020 at 11:21 AM.
 
Old 06-11-2020, 11:53 AM   #33
qelpp
Member
 
Registered: Jun 2020
Posts: 35

Original Poster
Rep: Reputation: Disabled
Since the blkid lists it as "/dev/mapper/sda3_crypt" and i did not use "mapper/sda3_crypt" in the previous posting, only "mapper/Live-OS-vg".

Should I try this:
Code:
mount /dev/mapper/sda3_crypt/root /sda3_crypt
 
Old 06-11-2020, 05:15 PM   #34
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by qelpp View Post
Code:
root@neon:~# mount /dev/mapper/Live--OS--vg-root /Live-OS
mount: /Live-OS: wrong fs type, bad option, bad superblock on /dev/mapper/Live--OS--vg-root, missing codepage or helper program, or other error.
Thats's what I feared. /dev/mapper/Live--OS--vg-root contains no filesystem. I am afraid the data on this disk is lost.
 
Old 06-11-2020, 05:39 PM   #35
qelpp
Member
 
Registered: Jun 2020
Posts: 35

Original Poster
Rep: Reputation: Disabled
It could wipe out all the files in a 230MB disk in a few seconds? I use dd urandom, which I know takes a long time, but a few seconds to wipe all the files off? Not just some header or indices or whatever, everything?


Code:
neon@neon:~$ sudo mount /dev/mapper/sda3_crypt/root /sda3_crypt
mount: /sda3_crypt: special device /dev/mapper/sda3_crypt/root does not exist (a path prefix is not a directory).
Specifically what is the difference? Why exactly does "(a path prefix is not a directory)" mean the files were deleted?
Code:
neon@neon:~$ sudo mount /dev/mapper/Live-OS-vg/root /sda3_crypt
mount: /sda3_crypt: special device /dev/mapper/Live-OS-vg/root does not exist.
 
Old 06-11-2020, 06:48 PM   #36
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by qelpp View Post
It could wipe out all the files in a 230MB disk in a few seconds? I use dd urandom, which I know takes a long time, but a few seconds to wipe all the files off? Not just some header or indices or whatever, everything?
It wipes out the LUKS header in a few microseconds. Without the LUKS header, the bits that used to be your files may still be there, but nobody and nothing can decrypt them. It's like having to read an Egyptian text after losing the stone of Rosetta.
Quote:
Code:
neon@neon:~$ sudo mount /dev/mapper/sda3_crypt/root /sda3_crypt
mount: /sda3_crypt: special device /dev/mapper/sda3_crypt/root does not exist (a path prefix is not a directory).
Specifically what is the difference? Why exactly does "(a path prefix is not a directory)" mean the files were deleted?
Code:
neon@neon:~$ sudo mount /dev/mapper/Live-OS-vg/root /sda3_crypt
mount: /sda3_crypt: special device /dev/mapper/Live-OS-vg/root does not exist.
Neither /dev/mapper/Live-OS-vg/root nor /dev/mapper/sda3_crypt/root exist, therefore they can't be mounted. I suppose that the absence of /dev/mapper/sda3_crypt is processd by one branch of the code, and the fact that /dev/mapper/Live-OS-vg exists but is not a directory (or the other way around) is processed by another, thus leading to different error messages.

In any case, "a path prefix is not a directory" doesn't mean that files were deleted. It's not an example for a particularly well-written error message, but you often get error messages that are somewhat hard to understand.
 
Old 06-11-2020, 08:08 PM   #37
qelpp
Member
 
Registered: Jun 2020
Posts: 35

Original Poster
Rep: Reputation: Disabled
Quote:
Neither /dev/mapper/Live-OS-vg/root nor /dev/mapper/sda3_crypt/root exist, therefore they can't be mounted.
If they don't exist, why does "/dev/mapper/sda3_crypt" exist?
Code:
/dev/mapper/sda3_crypt: UUID="grQVpf-NLQp-yubt-FKw6-0Mmc-PT1q-KSBbLD" TYPE="LVM2_member"
 
Old 06-11-2020, 10:39 PM   #38
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,780

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by qelpp View Post
If they don't exist, why does "/dev/mapper/sda3_crypt" exist?
Code:
/dev/mapper/sda3_crypt: UUID="grQVpf-NLQp-yubt-FKw6-0Mmc-PT1q-KSBbLD" TYPE="LVM2_member"
It's not directly a filesystem, but an LVM Physical Volume (PV) which can contain Logical Volumes (LVs) where filesystems reside. Now that you have the LUKS volume unlocked, you can run "lvs" to see what LVs exist, and the "lsblk -f" command should dig down into those LVs and report what filesystems it finds. You should be able to mount those filesystems and see what they contain.

I've avoided getting involved here until now because you were already getting good advice and I hate joining situations that have little chance of success. I fear you will find that the LUKS volume and LVM structure within it were created by your accidental installation run. Your only hope of recovering your data would be if that LUKS volume were not at the same physical disk location as was your old one. You can scan the disk for additional LUKS headers by running a binary editor like hexedit on the whole disk (i.e., /dev/sda, not /dev/sda3) and searching for the hexadecimal sequence
4C 55 4B 53 BA BE
That's the ASCII characters "LUKS" followed by the hex bytes 0xBA and 0xBE. If you should find that at some location other than the start of the current partition 3, it might be your old LUKS header. It's still a long shot that the LUKS header and its key material are uncorrupted, but at least there would be something more to look at.
 
Old 06-11-2020, 10:55 PM   #39
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by qelpp View Post
If they don't exist, why does "/dev/mapper/sda3_crypt" exist?
Code:
/dev/mapper/sda3_crypt: UUID="grQVpf-NLQp-yubt-FKw6-0Mmc-PT1q-KSBbLD" TYPE="LVM2_member"
It was created by cryptsetup, or as a consequence of cryptsetup opening the encrypted device.
 
Old 06-12-2020, 12:36 AM   #40
qelpp
Member
 
Registered: Jun 2020
Posts: 35

Original Poster
Rep: Reputation: Disabled
Hexedit

I installed hexedit and then used the command "hexedit /dev/sda" and it appeared to complete extremely quickly, is that really normal going through a 230GB drive? Or are you saying that it isn't going through 230GBs, just some header or something with no multi-gigabyte contents.

Using "Find" it did not find the sequence 4C 55 4B 53 BA BE, in fact it only found two occurrences of 4C, and that's it fifth down on the left column and at the bottom.

Here are the last lines after rows of zeros, with the total at the bottom.

Code:
E4895DFC   00 00 00 00  45 46 49 20  50 41 52 54  00 00 01 00  5C 00 00 00  ....EFI PART....\...
E4895E10   C3 04 9F 43  00 00 00 00  AF 44 F2 1B  00 00 00 00  01 00 00 00  ...C.....D..........
E4895E24   00 00 00 00  22 00 00 00  00 00 00 00  8E 44 F2 1B  00 00 00 00  ...."........D......
E4895E38   6B 0A A8 74  12 13 11 48  B0 2E 67 ED  3A E4 6E 7E  8F 44 F2 1B  k..t...H..g.:.n~.D..
E4895E4C   00 00 00 00  80 00 00 00  80 00 00 00  7C 49 5B 9B  00 00 00 00  ............|I[.....
E4895E60   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ....................
E4895E74   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ....................
E4895E88   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ....................
E4895E9C   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ....................
E4895EB0   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ....................
E4895EC4   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ....................
E4895ED8   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ....................
E4895EEC   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ....................
E4895F00   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ....................
E4895F14   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ....................
E4895F28   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ....................
E4895F3C   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ....................
E4895F50   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ....................
E4895F64   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ....................
E4895F78   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ....................
E4895F8C   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ....................
E4895FA0   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ....................
E4895FB4   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ....................
E4895FC8   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ....................
E4895FDC   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ....................
E4895FF0   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00               ................
---  sda       --0x37E4896000/0x37E4896000------------------------------------------------------
 
Old 06-12-2020, 12:48 AM   #41
qelpp
Member
 
Registered: Jun 2020
Posts: 35

Original Poster
Rep: Reputation: Disabled
Code:
root@neon:~# lvs
  LV     VG         Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root   Live-OS-vg -wi-a----- 221.35g                                                    
  swap_1 Live-OS-vg -wi-a----- 976.00m                                                    
root@neon:~# lsblk -f
NAME           FSTYPE LABEL                    UUID                                   MOUNTPOINT
loop0          squash                                                                 /rofs
sda                                                                                   
├─sda1         vfat                            FDD5-2728                              
├─sda2         ext4                            25bc771f-565d-4ca9-b96c-a2bf6b8e514f   /media/neo
└─sda3         crypto                          df736320-c6fa-49c8-af42-7b3658b73a73   
  └─sda3_crypt LVM2_m                          grQVpf-NLQp-yubt-FKw6-0Mmc-PT1q-KSBbLD 
    ├─Live--OS--vg-root
    │                                                                                 
    └─Live--OS--vg-swap_1
Code:
root@neon:~# mount /dev/sda3/Live--OS--vg-root /sda3_crypt
mount: /sda3_crypt: special device /dev/sda3/Live--OS--vg-root does not exist (a path prefix is not a directory).
root@neon:~# mount /dev/mapper/Live--OS--vg-root /Live-OS
mount: /Live-OS: wrong fs type, bad option, bad superblock on /dev/mapper/Live--OS--vg-root, missing codepage or helper program, or other error.
root@neon:~# mount /dev/mapper/Live--OS--vg-root /sda3_crypt
mount: /sda3_crypt: wrong fs type, bad option, bad superblock on /dev/mapper/Live--OS--vg-root, missing codepage or helper program, or other error.
root@neon:~# mount /dev/mapper/sda3_crypt /sda3_crypt
mount: /sda3_crypt: unknown filesystem type 'LVM2_member'.
 
Old 06-12-2020, 02:12 AM   #42
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by qelpp View Post
Hexedit

I installed hexedit and then used the command "hexedit /dev/sda" and it appeared to complete extremely quickly, is that really normal going through a 230GB drive? Or are you saying that it isn't going through 230GBs, just some header or something with no multi-gigabyte contents.
It doesn't read the whole disk, just a few disk blocks. You don't have that much RAM anyway.

It might be an interesting exercise to analyze the data structures on the disk, but you won't be able to decrypt your data with hexedit.
 
Old 06-12-2020, 02:15 AM   #43
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by qelpp View Post
Code:
root@neon:~# mount /dev/sda3/Live--OS--vg-root /sda3_crypt
mount: /sda3_crypt: special device /dev/sda3/Live--OS--vg-root does not exist (a path prefix is not a directory).
You can't mount /dev/sda3/Live--OS--vg-root because there is no file with that name.
Quote:
Code:
root@neon:~# mount /dev/mapper/Live--OS--vg-root /Live-OS
mount: /Live-OS: wrong fs type, bad option, bad superblock on /dev/mapper/Live--OS--vg-root, missing codepage or helper program, or other error.
/dev/mapper/Live--OS--vg-root exists, but it can't be mounted because it contains no filesystem.
Quote:
Code:
root@neon:~# mount /dev/mapper/Live--OS--vg-root /sda3_crypt
mount: /sda3_crypt: wrong fs type, bad option, bad superblock on /dev/mapper/Live--OS--vg-root, missing codepage or helper program, or other error.
It still contains no filesystem.
Quote:
Code:
root@neon:~# mount /dev/mapper/sda3_crypt /sda3_crypt
mount: /sda3_crypt: unknown filesystem type 'LVM2_member'.
/dev/mapper/sda3_crypt also contains no filesystem. It does contain LVM data structures.
 
Old 06-12-2020, 09:16 AM   #44
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,780

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by qelpp View Post
Hexedit

I installed hexedit and then used the command "hexedit /dev/sda" and it appeared to complete extremely quickly, is that really normal going through a 230GB drive? Or are you saying that it isn't going through 230GBs, just some header or something with no multi-gigabyte contents.

Using "Find" it did not find the sequence 4C 55 4B 53 BA BE, in fact it only found two occurrences of 4C, and that's it fifth down on the left column and at the bottom.
You must not have done the search properly, since that sequence is absolutely known to exist at least once on the disk.

To search in hexedit:
  1. Run "hexedit -s /dev/sda". The "-s" option formats the display on 512-byte sector boundaries.
  2. In hexedit, type the "/" character (or Ctrl-s). The text "Hexa string to search:" will appear in the middle of the window.
  3. Type the characters "4c554b53babe" (without the quotes, case does not matter) and press <Enter>.
    hexedit will begin searching through the disk and stop at the first occurrence of that sequence. If it's not at the start of a sector (hex address is a multiple of 0x200), ignore it. That sequence appears inside the cryptsetup executable, among other places.
  4. If the location is at the start of a sector, make note of the address.
  5. Press "/" and <Enter> to continue the search with the same sequence. Repeat steps 4 and 5 until no more occurrences are found.

In addition, you can see if anything recognizable exists on those Logical Volumes by running "file -sL /dev/mapper/Live--OS--vg-root /dev/mapper/Live--OS--vg-swap_1" I suspect that the file command will just report "data" for both, because those volumes were almost certainly created by the installer and probably not yet formatted.
 
Old 06-12-2020, 01:22 PM   #45
qelpp
Member
 
Registered: Jun 2020
Posts: 35

Original Poster
Rep: Reputation: Disabled
hexedit -s /dev/sda

Found only one:

Code:
4DCFFFF0   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ................
4DD00000   4C 55 4B 53 BA BE 00 01  61 65 73 00 00 00 00 00  LUKS....aes.....



---  sda       --0x4DCFFFE0/0x37E4896000--sector 2549759---------------------
^^^^with this as the bottom line^^^^
Last night on the hexedit manpage I just noticed the very limited Synopsis, of which --help was no help. I did use > to go to the end of the file, but didn't notice the Ctrl-S & Ctrl-R (and would never have known to enter "/") because the items above those didn't seem like anything I wanted to do, I did try Home & End which were disappointing. Thank you. I had used the Find selection of the terminal to look for the string.

Last edited by qelpp; 06-12-2020 at 01:47 PM. Reason: clarification
 
  


Reply



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
[SOLVED] Cannot Update KDE Neon or Reinstall KDE Neon or Linux Mint goatchaser Linux - Newbie 3 12-29-2017 01:04 PM
LXer: KDE Neon Linux Developer Edition to Use Wayland by Default for KDE Plasma 5.8 LXer Syndicated Linux News 0 09-07-2016 05:03 AM
LXer: KDE Plasma Wayland Image Now Built on KDE Neon Infrastructure, Qt 5.7 Is Coming LXer Syndicated Linux News 0 07-05-2016 12:36 AM
LXer: conf.kde.in: Project Neon Returns With Bleeding Edge KDE Software LXer Syndicated Linux News 0 03-11-2011 05:41 PM
neon-0.26.4 vs neon-0.27.3 rob.til Slackware 0 08-30-2008 07:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 01:21 PM.

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