Lost password - Restore encrypted home

22 risposte [Ultimo contenuto]
amuza
Offline
Iscritto: 02/12/2018

Hi,

I decided to change my user's password, I did it, and now I cannot remember it. Home directory is encrypted, but I keep the passphrase.

I am searching for a solution in the Ubuntu universe but I just find cumbersome workarounds. I find ways to recover files, but not a way to let everything as it was (names, permissions, location, etc.).

I would like to know every step to restore my encrypted home so that everything ends up as it is now.

Any help or guide suggestion is very welcome!

PD. Please let me know if Trisquel has any difference from Ubuntu I should take into account.

akito
Offline
Iscritto: 05/10/2017

You lost your user password but not the encryption passphrase? Can you decrypt the encrypted home with your old password?

If you can mount the encrypted home then you can copy the files by using live cd image of trisquel or any other gnu/linux distro.

Magic Banana

I am a member!

I am a translator!

Offline
Iscritto: 07/24/2010

I do not understand whether you forgot the passphrase that was used to encrypt your home folder (if so, that is over: you need the password to decrypt the data!) or the new passphrase. Could you clarify?

To everybody with using Trisquel 7 with an encrypted home folder on a separate partition and who want to do a fresh install of Trisquel 8: there is nothing to fear (but backup your data anyway)! From the live system:

  1. select 'Something else" (or whatever it is called nowadays) as an "Installation type" (or whatever it is called nowadays);
  2. choose your the root partition (probably that of Trisquel 7), i.e., the partition with the filesystem that will be mounted on /: it will be formatted and you can change the type of filesystem, if you wish;
  3. choose the partition with Trisquel 7's /home as the analog partition for Trisquel 8 but do *not* click the box that asks it to be formated;
  4. double-check that the partition with Trisquel 7's /home will *not* be formatted!
  5. proceed with the installation;
  6. specify the *same* login and the *same* password;
  7. once you reboot in the installed system, your home folder, still encrypted, has your data.
amuza
Offline
Iscritto: 02/12/2018

Thanks for your messages.

Hey, that's a good idea! Maybe this is the time to go to Trisquel 8 and contribute to testing.

Sorry, I meant I have simply forgotten the new password I set to my user, so I'm locked out, but fortunately I still keep with me the passphrase I used to encrypt the home folder when I installed Trisquel long ago.

Magic Banana: I like the idea of moving to Trisquel 8, but your 7-step guide does not include a solution to my problem, does it?

I guess the step 0 should be to decrypt the home directory somehow. I guess with ecryptfs-recover-private. But, will that leave permissions as they were so that later everything works ok?

Magic Banana

I am a member!

I am a translator!

Offline
Iscritto: 07/24/2010

It is actually a solution (but specify the password used to decrypt your home folder). Now if you prefer to stick to Trisquel 7, you can reset your password too. That involves booting a live system (e.g., the Trisquel 8 live system), a 'sudo chroot' in the installed root partition and 'passwd LOGIN', where LOGIN must be replaced by your login. I can detail if necessary.

amuza
Offline
Iscritto: 02/12/2018

Not needed, thanks. It's been a long process, but finally I managed to restore everything as it was. Thank you!

amuza
Offline
Iscritto: 02/12/2018

And another question, where should I download Trisquel 8?

Trying at https://trisquel.info/en/download but 64bit Trisquel 8 is not found in any server I try.

amuza
Offline
Iscritto: 02/12/2018

Forget this question. Maybe I could not download it because at that moment there were some changes in the servers, as I see the official Trisquel 8 is now out : )

\o/

amuza
Offline
Iscritto: 02/12/2018

Need help again, now to upgrade to Trisquel 8. I'm not opening a new thread just in case it is related to this one. Anyway I did open an issue at
https://trisquel.info/en/issues/24146

Home was encrypted. I lost my user's password, but had with me the mount passphrase to decrypt it. So I did:

- Boot with a Live Trisquel USB
- Run
ecryptfs-recover-private --rw
- Copy decrypted contents to an external drive preserving their permissions
- Set a new password for my user
- Delete the original encrypted home directory
- Create /home/myusername where myusername is the same as it was
- Copy dectrypted contents from the external drive to /home/myusername preserving permissions

Everything seemed to be good, I can login with myusername and access my home directory.

Then I tried to upgrade to Trisquel 8, but I got the following:

myusername@mycomputername:~$
myusername@mycomputername:~$
myusername@mycomputername:~$ sudo update-manager
[sudo] password for myusername:

** (update-manager:3875): WARNING **: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-5e8wQfhIBZ: Connection refused
Traceback (most recent call last):
File "/usr/bin/update-manager", line 115, in
app = UpdateManager(data_dir, options)
File "/usr/lib/python3/dist-packages/UpdateManager/UpdateManager.py", line 115, in __init__
self.options and self.options.use_proposed)
File "/usr/lib/python3/dist-packages/UpdateManager/MetaReleaseGObject.py", line 44, in __init__
MetaReleaseCore.__init__(self, useDevelopmentRelease, useProposed)
File "/usr/lib/python3/dist-packages/UpdateManager/Core/MetaRelease.py", line 94, in __init__
cache = apt.Cache()
File "/usr/lib/python3/dist-packages/apt/cache.py", line 107, in __init__
self.open(progress)
File "/usr/lib/python3/dist-packages/apt/cache.py", line 151, in open
self._cache = apt_pkg.Cache(progress)
SystemError: E:Encountered a section with no Package: header, E:Problem with MergeList /var/lib/apt/lists/deb.torproject.org_torproject.org_dists_trusty_main_i18n_Translation-en, E:The package lists or status file could not be parsed or opened.

(update-manager:3875): GLib-CRITICAL **: g_hash_table_destroy: assertion 'hash_table != NULL' failed

(update-manager:3875): GLib-CRITICAL **: g_hash_table_destroy: assertion 'hash_table != NULL' failed
Exception ignored in: myusername@mycomputername:~$
myusername@mycomputername:~$
myusername@mycomputername:~$
myusername@mycomputername:~$
myusername@mycomputername:~$
myusername@mycomputername:~$
myusername@mycomputername:~$
myusername@mycomputername:~$ do-release-upgrade
Checking for a new Trisquel release
Traceback (most recent call last):
File "/usr/bin/do-release-upgrade", line 116, in
useProposed=options.proposed_release)
File "/usr/lib/python3/dist-packages/UpdateManager/Core/MetaRelease.py", line 94, in __init__
cache = apt.Cache()
File "/usr/lib/python3/dist-packages/apt/cache.py", line 107, in __init__
self.open(progress)
File "/usr/lib/python3/dist-packages/apt/cache.py", line 151, in open
self._cache = apt_pkg.Cache(progress)
SystemError: E:Encountered a section with no Package: header, E:Problem with MergeList /var/lib/apt/lists/deb.torproject.org_torproject.org_dists_trusty_main_i18n_Translation-en, E:The package lists or status file could not be parsed or opened.
myusername@mycomputername:~$

So I went to
Software & Udates > Other Software
and uncheck boxes for Tor sources.

Then I could run the update manager


myusername@mycomputername:~$ sudo update-manager
[sudo] password for myusername:

** (update-manager:15434): WARNING **: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-5e8wQfhIBZ: Connection refused
Checking for a new Trisquel release

** (do-release-upgrade:15498): WARNING **: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-5e8wQfhIBZ: Connection refused
authenticate 'flidas.tar.gz' against 'flidas.tar.gz.gpg'
extracting 'flidas.tar.gz'

** (flidas:15498): WARNING **: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-5e8wQfhIBZ: Connection refused

Besides the messages above, the upgrade stopped with a window saying:

"Could not calculate the upgrade

An unresolvable problem occurred while calculating the upgrade.

This can be caused by:
* Upgrading to a pre-release version of Trisquel
* Running the current pre-release version of Trisquel
* Unofficial software packages not provided by Trisquel

If none of this applies, then please report this bug using the command https://trisquel.info/en/project/issues in a browser.."

As I am running Trisquel 7, I thought the cause could only be the third one, so I went again to
Software & Udates > Other Software
and unchecked every box.

Then I run update manager again but got the same error window saying it could not calculate the upgrade : (

Please find here some logs:
https://privatebin.net/?201152c12c5eb511#0ptAzd4wz27HqNPBf+CnKbFuBesGc6srYnLJsWxxxSs=

Another thing I noticed is my swap partition was not working. So far I have just managed to delete the swap partition, and now I am fighting to create a swap and encrypt it, but when using
ecryptfs-setup-swap
it freezes with the message 'cryptdisks stop/waiting'. I read somewhere it might be a bug of Ubuntu 14.04. So I guess I can forgat about this now, and focus on the upgrade to Trisquel 8.

Magic Banana

I am a member!

I am a translator!

Offline
Iscritto: 07/24/2010

About the encrypted swap (since david and you solved the upgrade problem): I had that same issue when creating it on Trisquel. I have found a solution based on that sole line in /etc/crypttab (where /dev/sda1 is my swap partition, yours may be different!):
cryptswap1 /dev/sda1 /dev/urandom swap,cipher=aes-cbc-essiv:sha256,offset=16,noearly
and that one in /etc/fstab:
/dev/mapper/cryptswap1 none swap sw 0 0

Those same lines work in Trisquel 8: there is no need to re-encrypt the swap.

amuza
Offline
Iscritto: 02/12/2018

Forget everything! At least for now...

I did what david suggested (sudo apt-get remove trisquel-desktop-common-recommended) and it is upgrading now.

Thanks!

amuza
Offline
Iscritto: 02/12/2018

Thank you very much!

I will try that solution for the swap once I can, unfortunately now I am stuck in the middle of an unsuccessful upgrade :/

https://trisquel.info/en/issues/24146

amuza
Offline
Iscritto: 02/12/2018

I already have my open issue #24146, so I do not know if it is alright to ask for help here too. Please let me know.

The thing is, once the upgrade process finished, I restarted my computer, saw this new Trisquel 8 water drops image, but then the screen turned dark and I don't manage to get out of it. If I restart again I get the same dark screen.

Fortunately tty is accessible. I can login through tty. But Ctrl+Alt+F7 keeps showing a dark screen.

Any suggestion?

Magic Banana

I am a member!

I am a translator!

Offline
Iscritto: 07/24/2010

What happens if you try to start the display manager?
$ sudo systemctl start lightdm.service

Take a look at the journal:
$ journalctl

amuza
Offline
Iscritto: 02/12/2018

Oh, I get the dark screen when running that command!

On the journal thing, don't have time now but I will find a way to copy it and paste it here. I am the kind of basic user who uses GUI for almost everything...

Thanks for following up!

Magic Banana

I am a member!

I am a translator!

Offline
Iscritto: 07/24/2010

Amuza sent me, by email, the logs of LightDM on his (her?) system. They include that line:
pam_ck_connector(lightdm-greeter:session): nox11 mode, ignoring PAM_TTY :0

A search on the Web suggests that only one user cannot login because, for some reason, ~/.Xauthority is unreadable. A solution would therefore be to log into a text session (Ctrl+Alt+F1 gives one) and remove ~/.Xauthority:
$ sudo rm ~/.Xauthority

@amuza: tell us if that solves your problem.

amuza
Offline
Iscritto: 02/12/2018

Thank you Banana!

I run that command but everything stays as it was = (

And the journal logs keep saying the same things.

By the way, I thought this ~./Authority file would recreate after a reboot, but I did reboot the computer and cannot find it.

Please let me know if there is anything else I could try.

Otherwise I guess I'll have go for a fresh install.

Magic Banana

I am a member!

I am a translator!

Offline
Iscritto: 07/24/2010

The file I proposed to remove is .Xauthority and not .Authority but I believe you removed the correct file (otherwise you would have got an error message like "rm: cannot remove '.Authority': No such file or directory"). Other users on the Web suggest to remove ~/.Xresources.

If that does not work, you could try to create a new user and see if this user can get a graphical session (as you know, Alt+F7 gets you back to the graphical session):
$ sudo adduser login
You can substitute "login" by any login string.

amuza
Offline
Iscritto: 02/12/2018

Yes, you are right, I tried with .Xauthority, sorry.
I cannot try with ~/.Xresources because I don't seem to have that file.

I tried this good idea of creating a new user. I added it to the sudo group, logged in with it through vty, run $ sudo systemctl start lightdm.service but got the dark screen too.

I am realizing now it cannot be related to users as the dark screen arrives at startup before any login.

Thank you for keeping suggesting!

I am also receiving support in the issue I opened.

Magic Banana

I am a member!

I am a translator!

Offline
Iscritto: 07/24/2010

It looks like the problem may have nothing to do with the display manager (LightDM) and everything to do with the X server (Xorg). Try to simply launch, from a text session, a graphical session without a display manager:
$ startx
Any error message?

amuza
Offline
Iscritto: 02/12/2018

Please have a look.

tmp_7325-IMG_20180426_154239-362482846.jpg
Magic Banana

I am a member!

I am a translator!

Offline
Iscritto: 07/24/2010

The problem looks much worse than only not being able to get a graphical session. You cannot even use 'apt-get'. It looks like the problem I faced when upgrading Trisquel 7 with this PPA: https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test

I ended up doing a fresh install. See for my advice ("a fresh install after a backup of what matters") when the package manage is not functional: https://trisquel.info/forum/trisquel-8-codename-flidas-release-candidate-ready-testing#comment-130966

Right below that post, you can read how davidpgil did not follow that advice but fixed his system using the 'dpkg' low-level interface to the package manager. You can give it a try.

amuza
Offline
Iscritto: 02/12/2018

I started to try davidpgil's solution, but my case was not exactly the same and it did not work.

So I ended up going for the 7-step guide Magic Banana wrote above. That was quick and clean. I have my Trisquel 8 up and running and so far every important thing seems to work smoothly.

Thank you very much for the great support and explanations!