Score:1

Stuck at login screen tty1 (Ubuntu 20.04.2)

in flag

I am using Ubuntu via a virtual machine and every time I either exit saving the current estate or power it off, it always work when running the virtual machine again. After trying to install python3 via the terminal, I noticed the background of my desktop (in the VM) changed to black, most of my apps were gone, and I couldn't open anything.

Closed the VM, re-opened it and encounter this that has never been shown to me before. I type my username and password but then what? I am very inexperienced with any of this so I am unsure as to what is expected. Is there a way to move on from this screen? Did I lose all the stuff in the VM? Is there a way to recover what I had saved and installed in this machine and moved it to a new one? SCREENSHOT

@mchid This is the output: SCREENSHOT 2 I am afraid I have toasted that VM, I'll look into how to delete this one as to not lose space. Lesson learned the hard way.

mchid avatar
bo flag
How did you install python3? Python3 should be installed by default.
mateolanda1 avatar
in flag
@mchid I uninstalled it and reinstalled it with the terminal.(sudo apt install python3 python3-pip) I really don't know if that has anything to do with moving on from the tty login screen but is the last thing I did.
mchid avatar
bo flag
Oof. It is possible to recover but it might be easier to reinstall. Lots of packages depend on Python so all of those packages were most likely removed when you uninstalled python. What does the following command return (please edit your question and post the output there): `cat /var/log/apt/history.log | grep Remove | grep -Po "(?<=, )[[:alnum:]-:.]+(?= \()"`
mchid avatar
bo flag
Just copy and paste the command, it's one single line.
mateolanda1 avatar
in flag
@mchid it is telling me "grep: missing )"
mchid avatar
bo flag
I went ahead and provided an answer.
mchid avatar
bo flag
It looks like you just need an internet connection. `sudo service network-manager start` and then try again.
mateolanda1 avatar
in flag
@mchid same output. Is not that bad, luckily I had everything backed in my host machine. How can I thank you? I appreciate the time and the explanation of the commands.
Score:1
bo flag

You can try to reinstall the packages that were uninstalled. First run the following command:

sed -n '/^Remove/ s/([^ ]*//g;s/Remove: //p' < /var/log/apt/history.log | tee uninstalled

This command lists uninstalled packages and prints this output to a file named uninstalled.

If the list is clean and only contains package names, run the following commands to reinstall those packages:

sudo apt update
sudo apt install $(cat uninstalled)

After installation, reboot to apply the changes.

If that doesn't work, I would recommend to reinstall Ubuntu. In the future, you should always review the list of packages to uninstall before you press y to accept the changes.


To explain further, the file /var/log/apt/history.log contains your apt history. Uninstalled packages will be listed after "Removed:" on the same line. The sed command finds this line and cleans up the list to only list package names.

The -n option suppresses output.

/^Remove/ says to look for lines that begin with "Remove".

s/([^ ]*//g removes the version number contained within parenthesis after each package name (substitute /this/ with nothing and g is for all instances).

s/Remove: //p substitutes "Remove:" with nothing and prints the result.

Finally, tee uninstalled writes the output to a file named "uninstalled".

mateolanda1 avatar
in flag
@mchip just did it. I edited my question with the outcome. I don't know how to thank you for the time. I can't vote.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.