How to fix error: snap “telegram-desktop” has “install-snap” change in progress

I enconter this error message when installing a Snap app Telegram for Desktop from the terminal command line. I followed instructions on how to do this from the Install button of the snapcraft.io website.

First one I select is use the GUI app store. But nothing happens when click install button. Installing progress starts but go back to install. Click again and same thing is happens.

When using the command line that is I got the error of:

error: snap "telegram-desktop" has "install-snap" change in progress

How to fix?

ANSWER

The error is because you are telling Snap to install an app that has already been scheduled for installation. It’s in the queue. The GUI app store is not very informative about this scenario. Hence, it will seem like the installation process failed when in fact that is not the case.

My guess is it is put on schedule for installation because a higher priority install needs to be done first, most likely Snap core updates that have not yet been applied to the system yet.

Either wait for the core updates to finish and wait for Telegram to get installed after, or force it to update right away.

At the command line, do:

:~$ snap changes

It will show something such as:

ID Status Spawn Ready Summary
101 Done yesterday at 20:33 PST yesterday at 20:34 PST Auto-refresh snap "intellij-idea-community"
102 Doing today at 11:36 PST - Install "slack" snap

Abort the scheduled install for the app listed there, in your case “telegram-desktop” snap using the following command:

:~$ sudo snap abort 102

In the example above, I chose to abort install scheduled with ID 102. Choose the ID of the app you are trying to install that you will see on your terminal after the command above.

Then install the snap app manually:

:~$ sudo snap install telegram-desktop

This should force snap to go ahead with the install, but first it may start with its core updates, followed by the telegram-desktop snap app.

Change default app to open torrent magnet link

I installed a Popcorn-time desktop software on my Ubuntu linux to try that out. It appears to use a torrent technology to stream content as it downloads at the same time. Somehow that now gets the default to open magnet links for torrent files. Have not remembered any setting asking me to make the app open by default during installation or at download.

I don’t want this, don’t know how to change to my default torrent software – Transmission BitTorrent.

How to change back?

ANSWER

Add/edit it into the following files. Either or both is fine, but better to have it in for the system-wide list if you have multiple users.

  • System-wide: /usr/share/applications/defaults.list
  • User-specific: ~/.local/share/applications/mimeapps.list

The value of this entry – x-scheme-handler/magnet – needs to be set to the application you prefer.

For example, since you want it to be Transmission it will be similar as shown below:


x-scheme-handler/magnet=transmission-gtk.desktop

Just make sure the .desktop file for the desired application is correct. Again you can check for that file in the same directory where this list is found.

As an alternative, the following terminal commands will also help.

Find out what is the existing default app that will handle such mime-type for your existing user:

:~$ xdg-mime query default x-scheme-handler/magnet

Replace that by using the next command:

:-$ xdg-mime default transmission-gtk.desktop x-scheme-handler/magnet

Lastly, you can check again if the last command was successful by running the first one.

Support for Ubuntu Unity Desktop after 16.04 LTS

Can still use the Unity Desktop after Ubuntu 16.04 Xenial Xerus? Is it still supported?

I like the Unity desktop way of things. Been using it many years now. Read about and tried the new Ubuntu that with Gnome Shell, but I don’t like it much at all. It look clunky with many of missing things from it.

Come April 2021 Ubuntu 16.04 will EOL. Starting to find alternatives, but if Unity is still out there, I’d pick it over the others.

ANSWER

In one word, Yes.

Still can run on both LTS versions of 18.04 and 20.04. Go ahead and install it with:

sudo apt install ubuntu-unity-desktop

Choose Lightdm display manager when asked during install. Best to restart your computer afterwards. Then enjoy.

Consider that many people have said some weird looks of Unity when installed on said LTS versions appear. I forget, but I think its the window decorations and such. This is supposedly caused by the newer Gnome versions, and unpatched by Ubuntu. Unlike before.

You may also like to try out an alternative in the Ubuntu Unity Desktop spinoff. Can be found at this website – https://ubuntuunity.org/

It is not official Ubuntu flavor, but being maintained by some other 3rd party group. The experience is different from just installing 20.04 and then install Unity DE afterwards. Try it out if it suits you.

Convert a Map to POJO in Java

How do I convert a Map object to my other plain old Java object (POJO) without going into loops and having to write a class using Java reflection, or some other?

ANSWER

Well, yes, reflection is one but you didn’t want to do that yourself. For some good reason, I bet. It’s a good exercise if you have all the time in the world. But when faced with deadlines and having to write Unit tests for a whole class you wrote, there must be an easier way.

There is more than one way, but what I normally use is the Jackson ObjectMapper. Yes, the same one from the com.fasterxml.jackson library.

Anyway, with ObjectMapper it is pretty straightforward to do so. If I have a Person class like this:

    public class Person {
        private String firstName;
        private String lastName;
    }

My Map object will look like this:

        Map<String, Object> map = new HashMap<>();
        map.put("firstName", "Johnny");
        map.put("lastName", "Foo");

Then with ObjectMapper one can simply do this:

        ObjectMapper mapper = new ObjectMapper();
        Person person = mapper.convertValue(map, Person.class);

Alternatively, the keys in the Map may not align with the fields in the Person class. Well, I usually encounter this when working with JSON objects with lots of crazy looking field names. Something like this – NZT_Mor_First_Name__c – which I clearly don’t want my class field name to be like.

Well, we can use @JsonProperty annotation which is part of Jackson by the way and assign that our class field. The Person class will now look like:

    public class Person {

        @JsonProperty("NZT_Mor_First_Name__c")
        private String firstName;

        @JsonProperty("NZT_Mor_Last_Name__c")
        private String lastName;
    }

Again the Map will hold these values:

        Map<String, Object> map = new HashMap<>();
        map.put("NZT_Mor_First_Name__c", "Jose");
        map.put("NZT_Mor_Last_Name__c", "Yamut");

Now it will map out those weird looking key names to its corresponding class fields.

One thing to note is you might need to set ObjectMapper features such as ignoring unknown properties and make it case insensitive. Allow it a bit more room to wiggle, wiggle.

        ObjectMapper mapper = new ObjectMapper()
                .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
                .enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_VALUES);

Re-publish Kafka record not setting partition number?

Well, I plan to re-publish Kafka records that my app is consuming to another Kafka topic on another host (internal only). This sort of lets other groups consume data from this topic without having to create connections outside of the private network, since the original data source is a 3rd party vendor. They can then also do their own transformations or other business logic on it as if they were consuming from the original source. Delay from source to re-publish should be minimal. Will still be close to real time.

What I normally do when producing records is not to set a partition by default. Would this be okay when re-publishing records? Will there be conflict with original record partition number to the target topic partition?

ANSWER

How many partitions does your target topic have? Do you have freedom to create as many partitions as the source?

(1) If you can create 1:1 partitions then my suggestion is to retain the original partition number of that record when you publish to the destination topic.

(2) You can also assign the partition in a round-robin way when you have lesser partitions on your target topic. Save metadata info of that record in the headers, such as original partition assignment and etc. Perhaps that will be useful down the line for your consumers.

(3) Lastly, you can NOT assign a partition number. Instead, let Kafka do the magic for you. When no partitions are set, Kafka will determine the next partition in a round robin method. You can do this with a null value instead of an int for partition number.

Bottom line is that it depends on the project requirements, I suppose, or more so on the infrastructure of your destination Kafka.

Fail2ban apache-noscript jail violation rules?

Which actions specifically are considered as violating apache noscript fail2ban module? I see that it correctly banned the ip that was looking for strange urls like “/admin” “/login” etc, but also blocked my ip and I checked the log for my ip and I didn’t see any suspicious actions. So in one case it worked good in another it didn’t.

Btw one of this line was considered as apache noscript violation. Why?

myip - - [05/Sep/2020:12:55:52 +0000] "GET /css/theme/jquery-ui.custom.css HTTP/1.1" 
myip - - [05/Sep/2020:12:55:52 +0000] "GET /img/icons/manifest.json HTTP/1.1" 
myip - - [05/Sep/2020:12:55:52 +0000] "GET /css/some.css HTTP/1.1" 
myip - - [05/Sep/2020:12:55:52 +0000] "GET /css/bootstrap.min.css HTTP/1.1" 
myip - - [05/Sep/2020:12:55:52 +0000] "GET /ww.js.map HTTP/1.1" 
myip - - [05/Sep/2020:12:55:52 +0000] "GET /ww.js.map HTTP/1.1" 

Btw, why are not attached the log files in the mail report? I edited in the fail2ban configuration the log to /access.log from /*access.log so hopefully it will help with this.

Go to Source
Author: luky

Ubuntu Installation Stuck at “update-grub”

I have gone through all the similar questions asked about this problem and tried the workarounds mentioned over there but nothing works. Like the ” ps | grep ‘dmsetup create’ ” workaround simply doesn’t work, because I don’t get any output displaying any PID (so I can’t kill any process), then the one regarding deleting 30_os-prober just deletes the file but has no effect on the installation. I am trying to do a clean install on a HDD, can anyone please help me solve this problem. [I am installing Ubuntu LTS 20.04.1 from a live USB]

Go to Source
Author: Utkarsh Jha

cant restore nuget packege on ubuntu after upgrae to .net core 3.1

i am running .net core 2.1 on Ubuntu 18.04 so far so good

i upgrade my project to .net core 3.1 and installed the 3.1 SDK

since than i cant use ‘dotnet restore’

this is the full output

/usr/share/dotnet/sdk/3.1.401/NuGet.targets(128,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [/repos/myproj/portal/PortalApi/PortalApi.csproj]
/usr/share/dotnet/sdk/3.1.401/NuGet.targets(128,5): error :   The SSL connection could not be established, see inner exception. [/repos/myproj/portal/PortalApi/PortalApi.csproj]
/usr/share/dotnet/sdk/3.1.401/NuGet.targets(128,5): error :   The remote certificate is invalid according to the validation procedure. [/repos/myproj/portal/PortalApi/PortalApi.csproj]

any idea why ?

thanks

Go to Source
Author: David Munsa

Не загружается проект на Django с VPS Ubuntu, после настроек gunicorn, supervisor и nginx

Всем привет! Столкнулся с проблемой, произвел все настройки на сервере, проверил работу gunicorn, запустил проект напрямую командой gunicorn Superman.wsgi:application --bind 0.0.0.0:8001, сайт запустился, но без static файлов. Далее установил supervisor, так же произвел отдельную настройку под него и настроил nginx, при проверке supervisor sudo supervisorctl status Superman сервер ответил, что он работает, при проверке nginx sudo nginx -t сервер так же отвечает положительно successful, но когда я забиваю IP своего сайта в строку поиска браузера сайт не прогружается, ошибка – Сайт 91.228.152.32 не позволяет установить соединение, nginx пусто. В чем может быть проблема, возможно я не правильно настраиваю proxy_pass? Настройки прилагаю ниже, ПРОШУ ПОМОЧЬ В РЕШЕНИИ ПРОБЛЕМЫ, сутки ищу решение и ничего((

Настройка Gunicorn

NAME="Superman-test"                                  
DJANGODIR=/webapps/Superman-test/Superman             
SOCKFILE=/webapps/Superman-test/run/gunicorn.sock 
GROUP=www-data                                      
NUM_WORKERS=3                                     
DJANGO_SETTINGS_MODULE=Superman.settings             
DJANGO_WSGI_MODULE=Superman.wsgi                     

echo "Starting $NAME as `whoami`"

cd $DJANGODIR
source ../bin/activate
export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE
export PYTHONPATH=$DJANGODIR:$PYTHONPATH


RUNDIR=$(dirname $SOCKFILE)
test -d $RUNDIR || mkdir -p $RUNDIR

exec ../bin/gunicorn ${DJANGO_WSGI_MODULE}:application 
  --name $NAME 
  --workers $NUM_WORKERS 
  --user=$USER --group=$GROUP      
  --bind=unix:$SOCKFILE 
  --log-level=debug 
  --log-file=-

Настройка Supervisor

[program:Superman]
command = sh /webapps/Superman-test/bin/gunicorn_start 
user = root 
stdout_logfile = /webapps/Superman-test/logs/gunicorn_supervisor.log 
redirect_stderr = true 
environment=LANG=en_US.UTF-8,LC_ALL=en_US.UTF-8 

Настройка Nginx

upstream Superman-test_server {
  server unix:/webapps/Superman-test/run/gunicorn.sock fail_timeout=0;
}

server {

    listen   80;
    server_name 91.228.152.32;

    client_max_body_size 4G;

    access_log /webapps/Superman-test/logs/nginx-access.log;
    error_log /webapps/Superman-test/logs/nginx-error.log;
 
    location /static/ {
        alias /webapps/Superman-test/Superman/static/;
    }
    
    location /media/ {
        alias /webapps/Superman-test/Superman/static/app/image/;
    }

    location / {
        if(!-f $request_filename) {
            proxy_pass http://Superman-test_server;
            break;
        }
    }

    # Error pages
    error_page 500 502 503 504 /500.html;
    location = / 500.html {
        root /webapps/Superman-test/static/;
    }
}

Go to Source
Author: Jony

Combining Two Containers

I’m working on a Windows laptop and running Docker for Windows on it. I want to run an Ubuntu container with a specific version and a MySQL server on it. So the question is, do I have to download MySQL on the Ubuntu container or can I run 2 containers (Ubuntu and MySQL) and combine them? How do I combine these 2 containers?

Go to Source
Author: user19215

Blocked from using pip3

Default python is 2.7; default python3 is 3.6, which is the version I use; Ubuntu version 18.04.
I’m trying to get newly downloaded python libraries to be installed in a python 3 library.

    charles@BW2:~$ pip3 --version
    Traceback (most recent call last):
      File "/usr/bin/pip3", line 9, in <module>
      from pip import main
    ImportError: cannot import name 'main'

What to do?

Go to Source
Author: cbro630

How to show Snap app icon properly on Ubuntu Unity desktop

Had this issue where after I logged into my Ubuntu desktop all Snap apps icons do not show properly. Instead I see a plain icon in place of what the app icon should be. Have you the same experience?

This might have been fixed in later Ubuntu LTS releases, I really don’t know. But I am still on 16.04 Xenial Xerus until its EOL. Also, the reason is that I love the Unity Desktop. The Gnome Shell replacement just doesn’t cut it for me.

I have been looking for a solution on this issue for some time. The 2 main things people point out are:

– Add /snap/bin to the /etc/environment file, and;

– Something to do with the profile.

Neither of those solutions worked for me. But it did work for others according to what I have read so far.

ANSWER

To fix this icon issue, create a symlink of the Snap’s .desktop shortcut file to your user’s .local/share/applications directory.

It is as simple as that. Once done the problem will go away, and you will be left with a nice-looking icon that came with the Snap installation. This won’t go away on following restarts.

For more details on how to do this fix exactly, refer to this article – https://www.joseyamut.xyz/2020/08/13/getting-that-ubuntu-snap-icon-right-on-unity-shell/

How to stop truncate command safely

I am trying to empty my syslog.1 file which was flooded with some messages and has the size of 77 GB. I did

sudo truncate -s 0 /var/log/syslog.1

but the command is taking more than 2 hours to return. Is it safe to stop it by Ctrl-C or by the kill command? I am afraid that these methods may cause inconsistency in the file system. Is there a better way?

The system is Ubuntu 16.04. The root partition where /var/log/syslog.1 sits is almost full due to the sudden increase in size of this file as well as /var/log/syslog and /var/log/kern.log. The latter files are still continuing to grow, but the command line is still responsive.

Go to Source
Author: norio

Video4linux: /dev/video0 open failed

I am new to linux and am trying to run the ARToolKit simpleTest program. I am using Ubuntu 14.04.
I try doing ./Configure selecting the video4linux option. When I finally run the ./simpleTest command, it gives me this output:

Using supplied video config string [-dev=dev/video0 ].
video device (dev/video0) open failed

I have already modified the simpleTest.c file as such

#ifdef _WIN32
char            *vconf = "Data\WDM_camera_flipV.xml";
#else
char            *vconf = "-dev=dev/video0 ";
#endif

Please help me understand the problem! My objective is to use the inbuilt webcam of the laptop. Would appreciate any suggestions

Go to Source
Author: pranp2001