Skyedra / UnspamifyUbuntu

Remove spam from Ubuntu
MIT License
167 stars 9 forks source link

Fails refusing to uninstall ubuntu-advantages tool #8

Open melodie11 opened 1 year ago

melodie11 commented 1 year ago

Hello, I tried your package in Ubuntu 22.04 chrooted in Cubic, meant for remixing (Bento Openbox Remix, presented at linuxvillage.org) and it failed with the following messages:

[root@cubic:~]
# ls    
fake-ubuntu-advantage-tools.deb
[root@cubic:~]
# dpkg -i fake-ubuntu-advantage-tools.deb 
Selecting previously unselected package fake-ubuntu-advantage-tools.
dpkg: regarding fake-ubuntu-advantage-tools.deb containing fake-ubuntu-advantage-tools:
 fake-ubuntu-advantage-tools conflicts with ubuntu-advantage-tools
  ubuntu-advantage-tools (version 28.1~22.04) is present and installed.

dpkg: error processing archive fake-ubuntu-advantage-tools.deb (--install):
 conflicting packages - not installing fake-ubuntu-advantage-tools
Errors were encountered while processing:
 fake-ubuntu-advantage-tools.deb
[root@cubic:~]
Skyedra commented 1 year ago

Hmmm, so I'm not familiar with cubic, but is apt available? If so, try using this method to install instead of dpkg: apt install ./fake-ubuntu-advantage-tools.deb

If I recall, apt might do some extra fancy logic for this kinda case that dpkg doesn't do (but it's been a while, so not sure on that).

melodie11 commented 1 year ago

Hi Skyedra, I tried just now and the result is not that convicing. Here is what I got:

# apt install ./fake-ubuntu-advantage-tools.deb 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'fake-ubuntu-advantage-tools' instead of './fake-ubuntu-advantage-tools.deb'
The following package was automatically installed and is no longer required:
  distro-info
Use 'apt autoremove' to remove it.
The following packages will be REMOVED:
  ubuntu-advantage-desktop-daemon ubuntu-advantage-tools
The following NEW packages will be installed:
  fake-ubuntu-advantage-tools
0 upgraded, 1 newly installed, 2 to remove and 16 not upgraded.
Need to get 0 B/658 B of archives.
After this operation, 1052 kB disk space will be freed.
Do you want to continue? [Y/n] Y
Get:1 /root/fake-ubuntu-advantage-tools.deb fake-ubuntu-advantage-tools all 0.3 [658 B]
dpkg: ubuntu-advantage-tools: dependency problems, but removing anyway as you requested:
 update-manager-core depends on ubuntu-advantage-tools.
 ubuntu-minimal depends on ubuntu-advantage-tools.
 ubuntu-advantage-pro depends on ubuntu-advantage-tools (>= 20.2).
 ubuntu-advantage-desktop-daemon depends on ubuntu-advantage-tools.
 software-properties-gtk depends on ubuntu-advantage-tools (>= 27.11~).

(Reading database ... 139699 files and directories currently installed.)
Removing ubuntu-advantage-tools (28.1~22.04) ...
dpkg: ubuntu-advantage-desktop-daemon: dependency problems, but removing anyway as you requested:
 software-properties-gtk depends on ubuntu-advantage-desktop-daemon.

Removing ubuntu-advantage-desktop-daemon (1.10~22.04.1) ...
Selecting previously unselected package fake-ubuntu-advantage-tools.
(Reading database ... 139511 files and directories currently installed.)
Preparing to unpack .../fake-ubuntu-advantage-tools.deb ...
Unpacking fake-ubuntu-advantage-tools (0.3) ...
Setting up fake-ubuntu-advantage-tools (0.3) ...
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for dbus (1.12.20-2ubuntu4.1) ...
Processing triggers for initramfs-tools (0.140ubuntu13.2) ...
(…)
N: Download is performed unsandboxed as root as file '/root/fake-ubuntu-advantage-tools.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)

I asked the system to mark the package distro-info as marked manually. I don't know what the last message triggered means. I don't know what the dependency problems issue will lead to while using. This is to be seen.

I had previously done something else to rid the system from the messages meant to invite to subscribe to Ubuntu Pro: I erased the content of the file /etc/apt/apt-conf.d/20apt-esm-hook.conf and replaced it with a commented text:

# cat /etc/apt/apt.conf.d/20apt-esm-hook.conf 
# If prompted to choose a new file when updating or upgrading 
# keep this file if you don't want systematic invitations to 
# register to Ubuntu Pro.

Strangely this file has not been removed following the suppression of the packges ubuntu-advantage-desktop-daemon and ubuntu-advantage-tools.

Certainly Ubuntu should split into two separate projects instead of annoying the users with unwanted messages (ex: Novell, Redhat before the latest split… )

Looking forward to reading your thoughts.

Skyedra commented 1 year ago

That first part might be okay actually (I think I've seen that sandbox warning before). I'd check to see if the ubuntu advantage executable is still on disk or not (I think the command is 'pro'? Been a while)

Regarding the not removing the commented file, I don't think apt removes changed files?

melodie11 commented 1 year ago

Usually when a package is updated it asks what to do with some configuration files it is supposed to replace in the system and offers a choice of several solutions. If a package is removed then it clearly removes all files belonging to the package, I don't believe it would act differently wether or not the file has been rewritten/customized.

mrbluecoat commented 3 months ago

Same on Lubuntu 24.04 LTS:

Setting up fake-ubuntu-advantage-tools (0.4) ...
Processing triggers for man-db (2.12.0-4build2) ...
N: Download is performed unsandboxed as root as file '~/Downloads/fake-ubuntu-advantage-tools.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)
floss4good commented 1 month ago

On Ubuntu 22.04.5 LTS I also got the Download is performed unsandboxed as root as file '…' couldn't be accessed by user '_apt' notice. But I got the same message for other deb file when installed with apt install while when installed with dpkg -i there was nothing wrong. Anyhow, according to Synaptic the ubuntu-advantage-tools (34~22.04) and ubuntu-advantage-desktop-daemon (1.10.ubuntu0.22.04.2) packages were removed and fake-ubuntu-advantage-tools (0.4) is installed.

However, the application Software Updater (package update-manager version 1:22.04.21) started to crash:

user@host:~$ update-manager
Traceback (most recent call last):
  File "/usr/bin/update-manager", line 40, in <module>
    from UpdateManager.UpdateManager import UpdateManager
  File "/usr/lib/python3/dist-packages/UpdateManager/UpdateManager.py", line 30, in <module>
    import uaclient.api.u.pro.packages.updates.v1 as ua
ModuleNotFoundError: No module named 'uaclient'

After checking the patch for Update Manager (for Ubuntu 23.04+ Desktop only) I've manually edited /usr/lib/python3/dist-packages/UpdateManager/UpdateManager.py and commented import uaclient.api.u.pro.packages.updates.v1 as ua from line 30 and now everything works (note that I commented just the above mentioned line, not also the ones related to _get_ua_security_status() function).

Anonymous941 commented 1 month ago

The Download is performed unsandboxed as root as file '…' couldn't be accessed by user '_apt' notice is shown when installing any .deb, so you shouldn't have to worry about that