• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
UBports Robot Logo UBports Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

Is it possible to block ads via hosts file on UT?

Scheduled Pinned Locked Moved Solved Support
hostsadsblock
32 Posts 8 Posters 4.9k Views 3 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • O Offline
      Opolork
      last edited by Opolork 20 Dec 2021, 08:10

      Hi.

      I notice a lot of ads showing in my UT web browser.

      In Debian, I've a long list of entries in the /etc/hosts (ref: https://vitux.com/linux-hosts-file).

      Would doing the same in UT be ok? Or is there a better way?

      Thanks.

      How can you trust that an app really won't send some company your location data, when you tell it not to? The only way you can trust a program not to do something it isn't supposed to do is if it is free software. ~ RMS

      A N 2 Replies Last reply 20 Dec 2021, 08:42 Reply Quote 1
      • P Offline
        Pulsar33
        last edited by Pulsar33 20 Dec 2021, 08:29

        Yes, you can. You need to remount / as RW so be careful

        sudo mount -o remount,rw /
        cd /etc
        sudo mv hosts hosts_org
        sudo cp your_hosts_file .
        

        Then reboot

        As you surely know, your new hosts file must begin with the content of the original one

        BR
        Pulsar33

        Aquaris BQ E5 HD UBports OTA-25 (currently testing features)
        Aquaris BQ E5 HD Ubuntu Edition Canonical OTA-15 (last Canonical version, daily use)
        Raspberry Pi 4 B - 4 GB & 8 GB with various OS and Desktops (UBports not OK)

        K 1 Reply Last reply 20 Dec 2021, 10:06 Reply Quote 1
        • A Offline
          AppLee @Opolork
          last edited by 20 Dec 2021, 08:42

          @opolork
          In addition the Pulsar33's answer you can use uAdBlock (from the Open Store) it does the same IIRC.
          Also when you'll update the OS you might lose your hosts file and have to redo the procedure.

          The easy way if good enough for you is tu use uAdBlock.

          1 Reply Last reply Reply Quote 3
          • K Offline
            Keneda @Pulsar33
            last edited by 20 Dec 2021, 10:06

            @pulsar33 said in Is it possible to block ads via hosts file on UT?:

            sudo mount -o remount,rw /

            sudo mount -o remount,ro / in the end also

            2015-2023 : Meizu MX4 ☠️⚰️✝️
            2023-2024 : Nexus 5 ☠️⚰️✝️
            2024-***** : FPOS Fairphone 5 waiting UT for freedom 😉
            🇲🇫🇬🇧

            P 1 Reply Last reply 20 Dec 2021, 10:32 Reply Quote 2
            • P Offline
              Pulsar33 @Keneda
              last edited by Pulsar33 20 Dec 2021, 10:32

              @keneda I prefer rebooting (as said) which remounts ro and starts properly
              BR
              Pulsar33

              Aquaris BQ E5 HD UBports OTA-25 (currently testing features)
              Aquaris BQ E5 HD Ubuntu Edition Canonical OTA-15 (last Canonical version, daily use)
              Raspberry Pi 4 B - 4 GB & 8 GB with various OS and Desktops (UBports not OK)

              1 Reply Last reply Reply Quote 1
              • N Offline
                nero355 @Opolork
                last edited by 20 Dec 2021, 13:35

                @opolork

                • Run Pi-Hole on your home network.
                • When not at home connect via PiVPN (which supports both OpenVPN and WireGuard and is Pi-Hole aware during the installation!) to your home network in order to have adblocking on your phone 🙂

                My phones :

                • BQ Aquaris E5 HD Ubuntu Phone Edition - Ubuntu Touch 16.04 LTS
                • ZUK Z2 Pro - ZUI Android 8.x
                • Xiaomi Mi 9T - Jolla SailFish 3.4.x Community Build

                P.S. : I am NOT a developer! ;)

                O 1 Reply Last reply 20 Dec 2021, 14:30 Reply Quote 1
                • O Offline
                  Opolork @nero355
                  last edited by 20 Dec 2021, 14:30

                  @nero355 said in Is it possible to block ads via hosts file on UT?:

                  Pi-Hole

                  Hi. That seems a bit too complex and involved for my liking.

                  How can you trust that an app really won't send some company your location data, when you tell it not to? The only way you can trust a program not to do something it isn't supposed to do is if it is free software. ~ RMS

                  N 1 Reply Last reply 21 Dec 2021, 18:37 Reply Quote 0
                  • O Offline
                    Opolork
                    last edited by Opolork 20 Dec 2021, 14:49

                    @applee said in Is it possible to block ads via hosts file on UT?:

                    uAdBlock

                    Hi AL.

                    I just check and uAdBlock was already installed. I opened it and a popup window said no update available. I went past than and say "Last updated: 7 Apr 2020".

                    I'm on v2.6.2 and the settings have 'Check for updates on app start' enabled.

                    Does the settings 'remain in r/w status' need to be on?

                    Thanks.

                    How can you trust that an app really won't send some company your location data, when you tell it not to? The only way you can trust a program not to do something it isn't supposed to do is if it is free software. ~ RMS

                    A 1 Reply Last reply 20 Dec 2021, 15:01 Reply Quote 0
                    • A Offline
                      AppLee @Opolork
                      last edited by 20 Dec 2021, 15:01

                      @opolork I don't remember,
                      But I think it can be turned off.
                      What is important is to select the proper blacklist(s) and to update them once in a while.
                      Also I noticed a couple of time the app crashed silently, but a reboot fixed it for months.

                      O 1 Reply Last reply 20 Dec 2021, 15:15 Reply Quote 0
                      • O Offline
                        Opolork @AppLee
                        last edited by 20 Dec 2021, 15:15

                        @applee said in Is it possible to block ads via hosts file on UT?:

                        @opolork I don't remember,
                        But I think it can be turned off.
                        What is important is to select the proper blacklist(s) and to update them once in a while.
                        Also I noticed a couple of time the app crashed silently, but a reboot fixed it for months.

                        I checked all the blocked lists, it's now updated to today. 🙂

                        How can you trust that an app really won't send some company your location data, when you tell it not to? The only way you can trust a program not to do something it isn't supposed to do is if it is free software. ~ RMS

                        1 Reply Last reply Reply Quote 1
                        • O Offline
                          Opolork
                          last edited by 20 Dec 2021, 15:47

                          Does uAdBlock rewrite the whole /etc/hosts file everytime it updates it or does it only change it's own entries? In other words - do custom entries someone would make in /etc/hosts be overwritten every time uAdBlock does its stuff?

                          How can you trust that an app really won't send some company your location data, when you tell it not to? The only way you can trust a program not to do something it isn't supposed to do is if it is free software. ~ RMS

                          A 1 Reply Last reply 20 Dec 2021, 15:49 Reply Quote 0
                          • A Offline
                            AppLee @Opolork
                            last edited by 20 Dec 2021, 15:49

                            @opolork
                            I don't know about that.
                            Maybe you can make some tests if nobody knows...

                            Good question though

                            1 Reply Last reply Reply Quote 1
                            • O Offline
                              Opolork
                              last edited by 20 Dec 2021, 16:12

                              Is it possible to access the /etc/hosts from my PC? I find editing on a smartphone to be too cumbersome. I'd like to open them the hosts file on a text editor on my PC (Debian 11) and do a few edits.

                              How can you trust that an app really won't send some company your location data, when you tell it not to? The only way you can trust a program not to do something it isn't supposed to do is if it is free software. ~ RMS

                              A 1 Reply Last reply 20 Dec 2021, 16:21 Reply Quote 0
                              • A Offline
                                AppLee @Opolork
                                last edited by 20 Dec 2021, 16:21

                                @opolork
                                You can do it using ADB or SSH...

                                O 1 Reply Last reply 20 Dec 2021, 17:58 Reply Quote 0
                                • O Offline
                                  Opolork @AppLee
                                  last edited by 20 Dec 2021, 17:58

                                  @applee Which is easier? Do you know a basic/quick method?

                                  How can you trust that an app really won't send some company your location data, when you tell it not to? The only way you can trust a program not to do something it isn't supposed to do is if it is free software. ~ RMS

                                  F A 2 Replies Last reply 20 Dec 2021, 18:49 Reply Quote 0
                                  • F Offline
                                    Fuseteam @Opolork
                                    last edited by 20 Dec 2021, 18:49

                                    @opolork do keep in mind that the hosts file is readonly for a reason. any changes will be lost after an ota update, uAdBlock know how to restore it changes, but it might become tedious for you to restore your changes

                                    O 1 Reply Last reply 20 Dec 2021, 19:16 Reply Quote 1
                                    • O Offline
                                      Opolork @Fuseteam
                                      last edited by 20 Dec 2021, 19:16

                                      @fuseteam Ok, it'd be best to let uAdBlock maange it so. Thank you. 🙂

                                      How can you trust that an app really won't send some company your location data, when you tell it not to? The only way you can trust a program not to do something it isn't supposed to do is if it is free software. ~ RMS

                                      1 Reply Last reply Reply Quote 1
                                      • A Offline
                                        AppLee @Opolork
                                        last edited by 21 Dec 2021, 08:17

                                        @opolork

                                        Both are really simple.
                                        For ADB (which I do not use) you can type a single command like this adb shell sh after connecting your device with USB cable.

                                        SSH allows you to avoid the cable and use the wifi instead.
                                        But you need to configure it first using UT Tweak Tool.
                                        I don't remember if it's required, but I will advise to push a public key to your device so you won't have to enter a passphrase.
                                        To connect with SSH you just type ssh phablet@<ip_address>...

                                        O 2 Replies Last reply 24 Dec 2021, 10:48 Reply Quote 3
                                        • D Offline
                                          domubpkm
                                          last edited by 21 Dec 2021, 14:49

                                          uAdBlock blocks at the DNS level and unfortunately some lists cannot act and be installed at this level. This means that uAdBlock, although useful, is becoming less and less effective as time goes by, unfortunately, given the evolution of technologies for installing crap on computers...

                                          1 Reply Last reply Reply Quote 1
                                          • N Offline
                                            nero355 @Opolork
                                            last edited by nero355 21 Dec 2021, 18:37

                                            @opolork said in Is it possible to block ads via hosts file on UT? [Resolved]:

                                            That seems a bit too complex and involved for my liking.

                                            I am using it now for about 5 years or so and it's AWESOME!!! 😄

                                            I can recommend running Pi-Hole + Unbound to pretty much EVERYONE who has a spare Raspberry Pi laying around!

                                            @domubpkm said in Is it possible to block ads via hosts file on UT? [Resolved]:

                                            uAdBlock blocks at the DNS level and unfortunately some lists cannot act and be installed at this level. This means that uAdBlock, although useful, is becoming less and less effective as time goes by, unfortunately, given the evolution of technologies for installing crap on computers...

                                            Things like DNS over HTTPS and ads beeing hosted on the same server as the content (YouTube for example!) are becoming a much bigger issue IMHO :pouting_face:

                                            But fortunately you can still block a lot of stuff via DNS so I am very happy with that method on my home network! 🙂

                                            My phones :

                                            • BQ Aquaris E5 HD Ubuntu Phone Edition - Ubuntu Touch 16.04 LTS
                                            • ZUK Z2 Pro - ZUI Android 8.x
                                            • Xiaomi Mi 9T - Jolla SailFish 3.4.x Community Build

                                            P.S. : I am NOT a developer! ;)

                                            O 1 Reply Last reply 24 Dec 2021, 15:36 Reply Quote 1
                                            5 out of 32
                                            • First post
                                              5/32
                                              Last post