1

I saw an answer to a similar question, https://askubuntu.com/a/280843/808169, only there is a gap. The answer was almost spot-on for my case, but didn't answer the question of how I could un-instal newly installed packages along with installing removed ones.

To reproduce what happened to my system, all you need to do is run this one-liner (DO NOT RUN IT, unless you do so on a VM if you have ample time and a lot of kindness):

bash <(wget -q -O - https://bitbucket.org/DataspeedInc/dbw_mkz_ros/raw/default/dbw_mkz/scripts/ros_install.bash)

This one-liner is explained here: https://bitbucket.org/DataspeedInc/dbw_mkz_ros/src/81e63fcc335d7b64139d7482017d6a97b405e250/ROS_SETUP.md?fileviewer=file-view-default

Despite warnings, and because I stayed up all night, I accidentally ran it, and I didn't have any backup up to this point. I also don't want to clean install Ubuntu as I have a lot of libraries install in the /usr/... file subtree.

The answer that I linked to indicates that Ubuntu keeps log files, which can be used to back-trace commands if you know enough bash scripting. Can someone kindly help me formulate such script? I would tremendously appreciate this.

By the way, my system still works, but it just doesn't feel right, as if something at the core is not right and I don't feel safe in terms of privacy.

Thank you in advance.

Nanis
  • 11
  • 1
  • Read the script and undo all that - https://bitbucket.org/DataspeedInc/dbw_mkz_ros/raw/default/dbw_mkz/scripts/ros_install.bash . – Panther Mar 17 '18 at 19:36
  • You're right! But I am a bit reluctant because it's new grounds for me. Good call however. – Nanis Mar 17 '18 at 19:44
  • 1
    @Panther That's not a comment. Tha's an answer... :-) Ping me an I'll come back and upvote... – Fabby Mar 17 '18 at 20:34
  • @Fabby I do not think it is an answer as I did not outline the command to reverse the changes, just gave the suggestion. – Panther Mar 17 '18 at 20:53

1 Answers1

2

It's not actually possible to reverse the script.

We have the currently served file for us - but we can't verify that was served to you. Basically you could have been sent anything - rootkits, bitlocker, keylogger, worm, whatever.

That said, assuming the script at https://bitbucket.org/DataspeedInc/dbw_mkz_ros/raw/default/dbw_mkz/scripts/ros_install.bash is what was run, it doesn't do that much:

sudo apt-get remove -y thunderbird transmission-gtk transmission-common unity-webapps-common brasero-common
sudo apt-get purge unity-webapps-common apport

can be reversed by

sudo apt install thunderbird unity-webapps-common

or whichever of the removed programs you want installed. You can check /var/log/apt/history.log to find what was removed and installed. None of them is essential AFAIAA.

Run these lines one at a time.

sudo apt purge ros-*-desktop ros-*-dbw-mkz
sudo rm -i /etc/apt/sources.list.d/ros-*
sudo apt-key del 421C365BD9FF1F717815A3895523BAEEB01FA116 # not required but cleans up your keys
sudo apt-key del 66F84AE1EB71A8AC108087DCAF677210FF6D3CDA # not required but cleans up your keys
#sudo rm -rf /etc/ros
#sudo rm -rf /opt/ros
rm ~/.config/autostart/joystick_demo.desktop

and check for errors. Note in two lines you'll have to remove the # from the start, they're very powerful deletions and will ruin your system if they're wrong. They remove everything in the two ros directories.

There are lines in ros_install.bash like:

gsettings set org.gnome.desktop.screensaver lock-enabled false

AFAIK there is no way to tell for sure what your prior setting was. None of the settings seems bad, but you might want to check them (they're readable and obvious).

You'll want to check the end of ~/.bashrc for lines added; remove them with an editor like gedit.

That would appear to reverse the main changes made by the ros_install.bash script.

There are several places where unknown stuff is done that needs deeper diving, the ros-$VAR-desktop package could depend on all sorts of things, and mess up your system. The rosdep init and rosdep update are unexplored above, and again could have made arbitrary changes. The yaml file in the sdk_install.bash could be doing anything, I didn't check.

To round things off you'll want to

sudo apt update && sudo apt dist-upgrade

Then reboot.

pbhj
  • 3,231