Thursday, September 30, 2021

OSCHINA 社区最新讨论话题

OSCHINA 社区最新讨论话题


请问enjoy在eclipse中报语法错误怎么回事呢

Posted: 29 Sep 2021 07:03 PM PDT

@JFinal 波波总~,最近升级项目,用enjoy替换freemarker,遇到一个问题请教下。#(task.title)这种用法,在eclipse 中#报错。如下图,能去掉错误提示吗:joy:...

vant打包

Posted: 30 Sep 2021 01:47 AM PDT

@xiahuawuyu 你好,想跟你请教个问题: 就是我从GitHub仓库中克隆vant,执行安装npm i相应的依赖之后,执行npm run dev,终端显示test文件夹下的dom.ts文件的 const fn = jest.fn();代码报错,想请教一下我该如何执行打包命令呢?谢谢。

这个需求如何用 lambda 来做呢?

Posted: 30 Sep 2021 01:34 AM PDT

姓名 班级 年龄 成绩 张三 一班 21 67 李四 二班 22 88 王五 一班 23 45 要求按照班级分组, 组合所有姓名(逗号隔开), 找到这个班级最大的年龄, 这个年级最低的分数 。 { "class": "一班", "names":"张三,王五", "maxAge" : 23, "minScore" : 45 }...

为什么运维总说docker是个黑盒?

Posted: 29 Sep 2021 10:44 PM PDT

我听过多个运维说过"docker是个黑盒,不利于运维管理,不推荐容器化"。 五年前听过,三年前听过,今年又听运维说过。我认为这是错误的。 为什么我认为这是错误的呢?因为我看到大厂在用,说明容器话的前景是对的,既然容器化的前景是对的,那么不推荐容器化就是错误的。 运维为什么要这么说呢?

从GitHub仓库中克隆vant,执行安装npm i相应的依赖之后,执行npm run dev,终端显示test下dom.ts下 const fn = jest.fn();代码报错,想请教一下我该如何执行打包命令呢?谢谢

Posted: 30 Sep 2021 12:26 AM PDT

dockerfile构建是报错

Posted: 30 Sep 2021 12:25 AM PDT

OCI runtime create failed: container_linux.go:370: starting container process caused: process_linux.go:338: getting the final child's pid from pipe caused: EOF: unknown 使用dockerfile构建docker镜像时,出现一下的报错。等待大约20分钟左右,重新使用jenkins进行打包构建则镜像打包成功。求助大佬...

话费充值API接口,三网可用API接口

Posted: 29 Sep 2021 10:42 PM PDT

话费充值接口文档 接口版本:1.0 ―、引言 文档概述 本文档提供话费充值接口规范说明,提供一整套的完整的接入示例(http 接口)供商户参 考,可以帮助商户开发人员快速完成接口开发与联调,实现与话费充值系统的交易互联。 公司官网:http://www.wikeyun.cn/ 阅读对象 本文阅读对象:开发人员与微客云系统对接支付相关的技...

怎么 ms sqlserver 执行过的sql 语句?

Posted: 29 Sep 2021 10:20 PM PDT

类似 MySQL的 show binlog events; 有方法吗?

knife4j在java11下模块化编译错误

Posted: 29 Sep 2021 08:19 PM PDT

采用java11模块化 com.github.xiaoymin knife4j-spring-boot-starter 3.0.1 module xxxx { requires springfox.core; requires springfox.spring.web; requires springfox.spi; requir...

numa是一种怎样的内存访问方式,为什么说它是为多处理器架构准备的?

Posted: 29 Sep 2021 07:58 PM PDT

numa是一种怎样的内存访问方式,为什么说它是为多处理器架构准备的?

你们见过的表里存最多多少条数据!见过的,不用现实用过的!我先来

Posted: 29 Sep 2021 06:28 AM PDT

OSCHINA 社区最新专区文章

OSCHINA 社区最新专区文章


怎么 ms sqlserver 执行过的sql 语句?

Posted: 29 Sep 2021 10:20 PM PDT

类似 MySQL的 show binlog events; 有方法吗?

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


Cannot set Wine prefix to location of steam game's prefix on Pop!_OS 20.04. Why?

Posted: 30 Sep 2021 10:47 AM PDT

So, I'm a regular player of the game Geometry Dash. Which (as some of you fellow GD players reading this know) doesn't have a Linux version, but it can be run with Proton.

Now, there's a very popular hacked client in the GD community called Mega Hack, which (yes) does have hacks for cheating like no-clip or speedhack (v6 only). But it also has some useful non-cheating hacks like Practice Music Hack (which plays the level's music in practice mode instead of OcularNebula - Stay Inside Me) and much more.

I've found a thread on the MegaHack GitHub repo saying, you can get megahack to work by changing the wine prefix but... it doesn't seem to work for me.

The command I tried is:

WINEPREFIX=/home/markix/.steam/debian-installation/steamapps/compatdata/322170/pfx wine MegaHackSetup.exe  

and the result was that it didn't work and the console spat out output way too long to put into this thread so here's a pastebin link.

How can I possibly fix this? I really want to get MegaHack running.

Why is the command called which and not where?

Posted: 30 Sep 2021 10:38 AM PDT

Logically, you would want to search for the location of the executables, hence "where" are they, but not which.

Executable doesn't run on boot-up when changed to write the logs to a file

Posted: 30 Sep 2021 10:43 AM PDT

I am running an executable on boot-up, and the executable prints logs via printf to the console and when the service runs, I see the binary running in the output of ps but no longers are printed to the console.

So to see the logs, I changed the application such that it writes to a file instead but the executable doesn't seem to run on boot-up after this change, even though the service that's supposed to run this executable is running.

Writing to a file works perfectly fine when run manually and not on boot-up.

  1. How to enable printf logs to the console for the executable running on boot-up? I am using dprintf to write a file
  2. Why would an executable that's supposed to write to a file not run on boot-up despite the service running?

Did a sample test - when there's a loop, and the executable is pushed, on boot-up it runs but as soon as the loop is commented out, the executable no longer runs.

int main(void)  {     while(1);     WriteToFile();  }    

"find" command doesn't work

Posted: 30 Sep 2021 10:40 AM PDT

I tried to use this command but it doesn't work in any way:

find . -type f -exec sed -i 's/foo/bar/g' {} +  

I found similar questions answered about 10 years ago. I don't know if syntax changed. I need help.

If I remove `ssh` from public zone and retain only rich rules in trusted one, will I be able to reach my server?

Posted: 30 Sep 2021 10:16 AM PDT

I have the following (multiple empty entries are omitted):

$ sudo firewall-cmd --list-all-zones  block    target: %%REJECT%%    icmp-block-inversion: no    masquerade: no      dmz    target: default    icmp-block-inversion: no    services: ssh    masquerade: no      drop    target: DROP    icmp-block-inversion: no    masquerade: no      external    target: default    icmp-block-inversion: no    services: ssh    masquerade: yes      home    target: default    icmp-block-inversion: no    services: ssh mdns samba-client dhcpv6-client    masquerade: no      internal    target: default    icmp-block-inversion: no    services: ssh mdns samba-client dhcpv6-client    masquerade: no      public (active)    target: default    icmp-block-inversion: no    interfaces: enp2s0    services: dhcpv6-client https ssh    ports: 50036/tcp    masquerade: no    trusted    target: ACCEPT    icmp-block-inversion: no    masquerade: no    rich rules:          rule family="ipv4" source address="myip1" service name="ssh" accept          rule family="ipv4" source address="myip2" service name="ssh" accept          rule family="ipv4" source address="myip3" service name="ssh" accept    work    target: default    icmp-block-inversion: no    services: ssh dhcpv6-client    masquerade: no  

If I do

firewall-cmd --zone=public --remove-service=ssh --permanent  

Will I be able to reach my server then? I am confused by the fact, that trusted zone has no any sources and not marked active. Why do I have only one zone active.

Also I don't see timeout option service removal command.

Windows GRUB entry keeps disappearing

Posted: 30 Sep 2021 10:06 AM PDT

I have a system with dual boot:

  1. Windows 10
  2. Ubuntu 20.04

Every now and then the Windows entry disappears. Then I run sudo os-prober && update-grub && sudo reboot and it's there after restart.

I can't understand why does it keep disappearing. I've added GRUB_DISABLE_OS_PROBER=false to /etc/default/grub but no success.

Any idea what else should I configure?

Android emulator crashing ubuntu when interacting with panel

Posted: 30 Sep 2021 10:03 AM PDT

I am using ubuntu 20.04. I recently installed android studio, and the emulator seems to be buggy at best. Specifically when I interact with the side panel of the AVD instance, it crashes. Inspecting journalctl it yields the following error

Sep 30 18:57:45 jonas-computer kernel: Code: c8 48 c1 e9 38 48 83 f9 01 77 09 4d 8d 41 ff 4d 21 d8 eb 13 4d 89 d8 4d 39 cb 72 0b 4c 89 d8 31 d2 49 f7 f1 49 89 d0 48 8b 07 <4a> 8b 04 c0 48 85 c0 0f 84 8e 00 00 00 48 8b 30 48 85 f6 0f 84 82  Sep 30 18:57:45 jonas-computer kernel: MainLoopThread[86971]: segfault at 90 ip 00007f9700a5fc84 sp 00007f9661eec428 error 4 in libOpenglRender.so[7f9700a2e000+317000]  Sep 30 18:57:45 jonas-computer kernel: Code: c8 48 c1 e9 38 48 83 f9 01 77 09 4d 8d 41 ff 4d 21 d8 eb 13 4d 89 d8 4d 39 cb 72 0b 4c 89 d8 31 d2 49 f7 f1 49 89 d0 48 8b 07 <4a> 8b 04 c0 48 85 c0 0f 84 8e 00 00 00 48 8b 30 48 85 f6 0f 84 82  

and crashes the application. Android studio yields following error:

2021-09-30 18:57:45,396 [22493427]   WARN -            #com.android.ddmlib - Failed to start monitoring emulator-5554   2021-09-30 18:57:45,432 [22493463]   WARN - manager.EmulatorProcessHandler - Emulator terminated with exit code 139  

Most suggestions with the error seems to revolve around old/updated drivers for graphics, however my machine does not have any graphics card and I have chosen to use software to emulate graphics.

I am not sure what to make of the error.

GNOME/gdm disable reveal password button

Posted: 30 Sep 2021 10:03 AM PDT

On the gdm login screen and on the GNOME lockscreen in the password entry box there is this little password reveal button at the right side.

Since this is a toggle some classmates were able to trick me into showing a good portion of my password by just pressing this button while I was away and watching me typing my password in.

Now is there any way to remove this button or show the password only while it is pressed? I've found really NOTHING on this topic on the internet except this askubuntu article asking for exactly the opposite what I want.

Can wget be configured like torrent using -c flag (Downloading parts of file from different server simulteniously)

Posted: 30 Sep 2021 09:42 AM PDT

wget has a flag -c which is continue flag. It lets continuing incomplete download using RANGE and REST HTTP request, if supported by server. Is it possible to download a content from multiple mirrors using different ranges to overcome server-side bandwidth bottleneck ? Like I want to download a 500 MiB deb/rpm/pkg.tar.gz. It has 5 mirrors. All of them has a limit of 100 KBps. I uses the above technique to get a 500 KBps speed.

Raspberry Pi OS for PC not booting up

Posted: 30 Sep 2021 09:03 AM PDT

I downloaded Raspberry Pi OS for desktop (2021-01-11-raspios-buster-i386.iso, Debian Buster with Raspberry Pi Desktop from here, Kernel version: 4.19, Release date: January 11th 2021). My computer is an HP 15-db1000AU notebook with 64 bit AMD Ryzen 3 2.6 GHz with Radeon Vega Graphics, 4GB RAM. I made a bootable USB using Rufus 3.15, using all default settings provided when the iso was loaded. I tried booting from the USB, both with persistence and without persistence. In both cases there is some text in the beginning, then the computer boots up to the raspberry pi logo, then goes into a blank screen with a blinking cursor and nothing else happens. If I forcefully turn off the laptop by pressing the power button, there is text saying something like could not mount/unmount removable media and the computer suddenly turns off.

How should I troubleshoot this? Is this a live OS? Is there any way to try out this OS without actually installing it on a hard drive?

AMD Epyc 7452 having CPU base clock as max clock speed & not boosting to boost clock?

Posted: 30 Sep 2021 09:01 AM PDT

I have an AMD Epyc 7452 CPU on an ASRock Rack ROMED6U-2L2T board running Proxmox 7 a linux system and running cpupower frequency-info reveals the following:

analyzing CPU 0:    driver: acpi-cpufreq    CPUs which run at the same hardware frequency: 0    CPUs which need to have their frequency coordinated by software: 0    maximum transition latency:  Cannot determine or is not supported.    hardware limits: 1.50 GHz - 2.35 GHz    available frequency steps:  2.35 GHz, 2.00 GHz, 1.50 GHz    available cpufreq governors: conservative ondemand userspace powersave performance schedutil    current policy: frequency should be within 1.50 GHz and 2.35 GHz.                    The governor "ondemand" may decide which speed to use                    within this range.    current CPU frequency: 1.50 GHz (asserted by call to hardware)    boost state support:      Supported: yes      Active: yes      Boost States: 0      Total States: 3      Pstate-P0:  2350MHz      Pstate-P1:  2000MHz      Pstate-P2:  1500MHz  

This CPU however is, according to its data sheet, able to boost to 3.35ghz, which I think I have never seen it do.

In the Bios I can only set the Core Performance Boost to 'Auto' or 'Disabled' (it is set to 'Auto') and looks like this:

enter image description here

Is there anything I can do to get the CPU to boost to its (advertised) max clock speed and/or where could the culprit be.. is it the bios that's causing this or is it a missing configuration somewhere in Proxmox / linux?

Is it possible to customize grub using grub-customizer in Fedora?

Posted: 30 Sep 2021 08:46 AM PDT

I recently switched from Ubuntu to Fedora, and I installed grub-customizer and the entries doesn't contain Fedora. Grub Customizer I have triple boot - Fedora,Ubuntu and W10.

os-prober give the following output:

/dev/nvme0n1p1@/EFI/Microsoft/Boot/bootmgfw.efi:Windows Boot Manager:Windows:efi  /dev/nvme0n1p7:Ubuntu 21.04 (21.04):Ubuntu:linux  

Few topics are opened on Fedora's forums but they keep circling to other topics.

Some resources I've tried looking at:

https://ask.fedoraproject.org/t/grub-customizer-fedora-entry-not-visible/12526 https://www.reddit.com/r/Fedora/comments/epqg4j/how_can_i_install_grub_customizer_on_fedora_31/ https://www.reddit.com/r/linux4noobs/comments/gvumqx/no_options_of_fedora_in_grub_customizer_help_to/ https://docs.fedoraproject.org/en-US/fedora/rawhide/system-administrators-guide/kernel-module-driver-configuration/Working_with_the_GRUB_2_Boot_Loader/

After some reading, I came to know that from Fedora 30 and above, there has been changes in BLS(no idea what that is).

So I want to know if it is possible use grub-customizer to customize grub?

nvida drivers disapeared during night (poweroff/poweron) DKMS cannot be rebuild

Posted: 30 Sep 2021 08:55 AM PDT

my setup

inxi -SMG System: Host: zaphod Kernel: 5.14.0-1-amd64 x86_64 bits: 64 Desktop: Xfce 4.16.0 Distro: Debian GNU/Linux bookworm/sid Machine: Type: Laptop System: ASUSTeK product: G750JX v: 1.0
serial: Mobo: ASUSTeK model: G750JX v: 1.0 serial: BIOS: American Megatrends v: G750JX.209 date: 11/18/2013 Graphics: Device-1: NVIDIA GK106M [GeForce GTX 770M] driver: N/A Device-2: Chicony USB2.0 HD UVC WebCam type: USB driver: uvcvideo Display: x11 server: X.Org 1.20.11 driver: loaded: nouveau,vesa unloaded: fbdev,modesetting resolution: 1024x768 OpenGL: renderer: llvmpipe (LLVM 11.0.1 256 bits) v: 4.5 Mesa 20.3.5

crash context

I use Debian testing for some really needed reasons

I need to use a High-resolution & secondary screen each day with 1920x1080.

Made an

aptitude update && aptitude safe-upgrade

all was right at that point, so I finished my work a few hours & power off the system.

here is the issue

Power on at morning & got only 1st screen working, 2cd one remains dark.

Resolutions is stuck on 1024*768

Errors seem to indicate an issue on DKMS. Then I investigated around that. But without results.

But I just cannot reboot until all procedures supposed to have been solved for anyone on many many many forums & google pages returns all without any exceptions finish by an update of the initram & kernel with deleting current ones

and then rebooting , I just cannot reboot any more as far as all procedures deletes initram & kernel & new ones cannot be build.

here we go on each try whatever I do before *(clean, purge,

install or reinstall nvidia drivers &/or legacy &/or proprietary &/or vesa/mesa)* finishes as :

Loading new nvidia-current-470.57.02 DKMS files... Building for 5.14.0-1-amd64 Building initial module for 5.14.0-1-amd64 Error! Bad return status for module build on kernel: 5.14.0-1-amd64 (x86_64) Consult /var/lib/dkms/nvidia-current/470.57.02/build/make.log for more information. dpkg: error processing package nvidia-kernel-dkms (--configure): installed nvidia-kernel-dkms package post-installation script subprocess returned error exit status 10 dpkg: dependency problems prevent configuration of nvidia-driver: nvidia-driver depends on nvidia-kernel-dkms (= 470.57.02-2) | nvidia-kernel-470.57.02; however: Package nvidia-kernel-dkms is not configured yet. Package nvidia-kernel-470.57.02 is not installed.
Package nvidia-kernel-dkms which provides nvidia-kernel-470.57.02 is not configured yet.

dpkg: error processing package nvidia-driver (--configure): dependency problems - leaving unconfigured Errors were encountered while processing: nvidia-kernel-dkms nvidia-driver needrestart is being skipped since dpkg has failed E: Sub-process /usr/bin/dpkg returned an error code (1)

I 've just worked on that since about 10AM it is about 17:30PM I just don't know how to solve that now

ho, just a thing to avoid useless answers I Cannot REINSTALL sytem

any Idea how to force build on ignore errors or anything similar or force build even on errors ?

Unable to interrupt thge installation progress/ stuck at configuring ddclient

Posted: 30 Sep 2021 08:39 AM PDT

I'm stuck in this configuring state where ctrl+c doesn't work; kill command will prohibit me from using dpkg/apt at all, and following the command to recover will lead me back to this state.

enter image description here

GNOME limited refresh rate with dual monitors

Posted: 30 Sep 2021 08:37 AM PDT

I recently installed Pop_OS! on a new disk in my computer, coming from Arch (which I can still boot to). There are a few kinks I need to work out and one in particular seems to severely limit my monitor refresh rate.

I have:

  • A 240 Hz monitor (primary) over DisplayPort
  • A 60 Hz monitor over HDMI
  • GPU: Nvidia RTX 2070
  • Disabled Sync to VBlank in Nvidia GUI

While the GNOME display settings allows me to set the refresh rate to 240 on my primary monitor, the actual DE is clearly still limited to 60, presumably due to the other monitor. If I disable the other monitor in settings, I get a smooth 240 Hz rate on my primary monitor, in regards to the DE animations and games. Otherwise, only the mouse cursor moves at a higher rate, and everything else slumps to 60. Is this fixable or is this some limitation in GNOME?

In Arch, I used Cinnamon. I was able to use 240 Hz on my primary monitor and 60 on the secondary (but only after disabling V-sync in the DE settings).

If I run glxgears, it reports that I get a whoppin 14,000 frames per second, so it feels like there's some V-sync thing forced on in GNOME. Is there a way to disable it?

Procmail: Send ticket numbers to an address named "ticket@domain"?

Posted: 30 Sep 2021 09:26 AM PDT

I am looking to do the following:

  1. User sends an email to 1234@domain
  2. Procmail recognizes 1234@domain as an email sent to ticket+1234@domain
  3. Procmail recipe handles ticket number and forwards email to the bug tracker

Where bold is my current obstacle.

Here is a proof of concept. At this point, the user still has to send the ticket to ticket+1234@domain for the email to forward correctly:

SUBJECT=`/usr/bin/formail -zx "Subject:"`  :0fhw  * To.*\/([0-9]+)@domain  * MATCH ?? ^\/[0-9]+  |/usr/bin/formail -I "Subject: $SUBJECT (Case $MATCH)"    :0  !tickets@bugtracker  

Some context:

There is one address created, ticket@domain, for ticket handling. Currently, a user sends to ticket+####@domain, and the Procmail recipe uses $MATCH to grab the ticket number that correlates to the bug tracker entry and forwards accordingly. This works.

What I want to do:

Prevent auto-completion errors (a user will enter ticket+ in the recipient field, and the wrong ticket # is auto-completed). To prevent these mistakes, a user needs to send an email to ####@domain instead of ticket+####@domain.

The Big Question:

Can I use Procmail to filter emails from ####@domain to be treated as emails from ticket+####@domain?..

Displaying icons for directories in zsh prompt

Posted: 30 Sep 2021 09:13 AM PDT

This is, roughly, my left prompt for zsh:

# Libraries  autoload -Uz colors && colors    # User color  if [ "$(whoami)" = "root" ]; then      COLOR="red"  elif [ "$(whoami)" != "root" ]; then      COLOR="magenta"  fi    # Directory icon  if [ "$()" = "Documents" ]; then      ICON=""  if [ "$()" = "Pictures" ]; then      ICON=""  if [ "$()" = "Videos" ]; then      ICON=""  else      ICON="%~"  fi    export PS1="%B%{$fg[$COLOR]%}$ICON %{$reset_color%}%b"  

Instead of displaying

~/Documents/git/project1 >>>  

I want to display

"ICON" git/project1 >>>  

where "ICON" is an appropriate (predetermined) icon for the user's current directory. If the user is not in these "chosen" directories, simply display the relative path (like in my script).

How can this script read the user's current directory and determine what icon to display (or not display) to the terminal?

Restore ipset rule on reboot

Posted: 30 Sep 2021 09:04 AM PDT

What is the easiest, most vanila way to restore a saved ipset rule in centos7, without needing to install any extra packages or plugins?

Background...

I have googled this but I seem to be going around in circles (articles telling people to google it, articles with steps which don't apply to my distro, articles with steps which simply don't work (example service ipset save gives me an error that save isn't a valid paramater) and as a linux beginner I feel like trying to muddle through the problem via the google results will just lead me further down a rabbit hole with branches off with new problems...

I have recently created a list using ipset for whitelisting a group of IPs. I added the list into my firewall rules (vi /etc/sysconfig/iptables) I restarted the firewall (systemctl restart iptables) and I tested the rules. All was fine.

Come to days after I find that the firewall is not running. On investigation it has failed to start, with the error that my rule doesn't exist.

So I now know that ipset rules aren't persistent on reboot I need to reload them. As I said I have tried to find out how to do this via google, but all of the page 1 results just don't really work for me for various reasons.

One particular guide suggests editing the ifcfg-eth0 file and adding a pre-up line which restores the ipset. I went to try this but my ifcfg-eth0 file contains a line at the top... # Automatically generated, do not edit which makes me weary of editing this file (Also it looks different than the examples on the google results. Rather than a list of commands it's just a list of key=values)

Basically is there a simple way to restore an ipset set from a file in centos7 so that it exists before the iptables service tries to use it?

Edit: I will try this tomorrow - https://www.thegeekdiary.com/centos-rhel-7-how-to-make-custom-script-to-run-automatically-during-boot/

Pip breaks when switch to Python3.7.9 using update-alternatives on Debian

Posted: 30 Sep 2021 08:39 AM PDT

I am on Debian 11 which comes with python3.9. But I don't need it, I need python3.7. So, I installed pythonn3.7.9 and updated the alternatives.

The problem is that when I switch the python version to 3.7.9, I can't install anything using pip. I get the following error in pip install command:

sudo pip3 install requests  [sudo] password for deby:   Traceback (most recent call last):    File "/usr/bin/pip3", line 10, in <module>      from importlib.metadata import distribution  ModuleNotFoundError: No module named 'importlib.metadata'    During handling of the above exception, another exception occurred:    Traceback (most recent call last):    File "/usr/bin/pip3", line 13, in <module>      from importlib_metadata import distribution  ModuleNotFoundError: No module named 'importlib_metadata'    During handling of the above exception, another exception occurred:    Traceback (most recent call last):    File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 584, in _build_master      ws.require(__requires__)    File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 901, in require      needed = self.resolve(parse_requirements(requirements))    File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 792, in resolve      raise VersionConflict(dist, req).with_context(dependent_req)  pkg_resources.VersionConflict: (pip 20.1.1 (/usr/local/lib/python3.7/site-packages), Requirement.parse('pip==20.3.4'))    During handling of the above exception, another exception occurred:    Traceback (most recent call last):    File "/usr/bin/pip3", line 15, in <module>      from pkg_resources import load_entry_point    File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3261, in <module>      @_call_aside    File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3245, in _call_aside      f(*args, **kwargs)    File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3274, in _initialize_master_working_set      working_set = WorkingSet._build_master()    File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 586, in _build_master      return cls._build_from_requirements(__requires__)    File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 599, in _build_from_requirements      dists = ws.resolve(reqs, Environment())    File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 787, in resolve      raise DistributionNotFound(req, requirers)  pkg_resources.DistributionNotFound: The 'pip==20.3.4' distribution was not found and is required by the application  

But when I switch back to Python3.9 then Pip works. I don't know how to fix this. I looked it up on Google, but couldn't find an issue where anyone faced a similar problem.

enter image description here

How to add 12spaces to the next line after the string match in shell?

Posted: 30 Sep 2021 09:25 AM PDT

I have a file called config.toml. I am doing the string match with runc.options as highlighted in the image. I need to insert a string "Systemdgroup = true" after 12 spaces. I tried the below command, which works, but used manual white 12 spaces. How it can be achieved in another way?

sed -e "/runc.options/a\            SystemdCgroup = true" /etc/containerd/config.toml  

enter image description here

Instead of typing literally 12 spaces, anything like /s+12 work?

Most Stable/efficient method for OpenStack Deployment using Debain

Posted: 30 Sep 2021 08:54 AM PDT

I was wondering witch method to use for deploy openstack

I read guides of openstack but there is no focusing on Debian.

so what it's most stable method to deploy openstack on Debian?

Thanks

Lowering/Disabling touchpad acceleration in GNOME 40 (Wayland)

Posted: 30 Sep 2021 10:53 AM PDT

I have set the touchpad speed slider to ~50% in Mouse & Touchpad Settings. I find this good enough most of the time but if I move my finger a bit too fast, the pointer flies to the edge/corner. If I set the touchpad speed too low, the small movements require multiple swipes.

I want to lower the acceleration to match it with the "precision touchpad" of Windows, which is perfect (or disable acceleration if acceleration can't be lowered).

$ cat /proc/bus/input/devices gives the following result:

I: Bus=0018 Vendor=06cb Product=cd41 Version=0100  N: Name="SYNA7DB5:01 06CB:CD41 Touchpad"  P: Phys=i2c-SYNA7DB5:01  S: Sysfs=/devices/platform/AMDI0010:01/i2c-0/i2c-SYNA7DB5:01/0018:06CB:CD41.0001/input/input10  U: Uniq=  H: Handlers=mouse1 event7   B: PROP=5  B: EV=1b  B: KEY=e520 10000 0 0 0 0  B: ABS=2e0800000000003  B: MSC=20  

From # libinput list-devices:

Device:           SYNA7DB5:01 06CB:CD41 Touchpad  Kernel:           /dev/input/event7  Group:            8  Seat:             seat0, default  Size:             103x75mm  Capabilities:     pointer gesture  Tap-to-click:     disabled  Tap-and-drag:     enabled  Tap drag lock:    disabled  Left-handed:      disabled  Nat.scrolling:    disabled  Middle emulation: disabled  Calibration:      n/a  Scroll methods:   *two-finger edge   Click methods:    *button-areas clickfinger   Disable-w-typing: enabled  Accel profiles:   flat *adaptive  Rotation:         n/a  

I tried # libinput "AccelProfile" "flat" but it tells me libinput: libinput-AccelProfile is not installed. I did # dnf search libinput and installed all the packages:

libinput.x86_64 : Input device library  libinput-devel.x86_64 : Development files for libinput  libinput-test.x86_64 : libinput integration test suite  libinput-utils.x86_64 : Utilities and tools for debugging libinput  xorg-x11-drv-libinput.x86_64 : Xorg X11 libinput input driver  xorg-x11-drv-libinput-devel.x86_64 : Xorg X11 libinput input driver development                                     : package.  

but the result stays the same.


OS Name: Fedora 34 (Workstation Edition)
OS Type: 64-bit
GNOME Version: 40.0.0
Windowing System: Wayland

jq - assert exactly 1 element reutrned

Posted: 30 Sep 2021 10:18 AM PDT

I use the following jq snippet to extract a key out of an array of values:

jq '[.[].refreshToken | select(. != null)] | unique]'  

How can I assert that only 1 element was returned? If more than 1 element found in resulting array I want a non 0 status code returned / otherwise resulting JSON array containing 1 element.

     [{        "tokenType":"Bearer",        "expiresIn":3599,        "expiresOn":"2021-09-28 17:41:15.929902",        "resource":"https://management.core.windows.net/",              "accessToken":"lkZXIuZ2mn_A",        "refreshToken":"0.AYIAGNEIQ9HtAEOq4v1k",        "oid":"0000-ea77-4abe-961b-0000",        "userId":"john.doe@yahoo.com",        "isMRRT":true,        "_clientId":"0000-0000-0000-0000",        "_authority":"https://login.microsoftonline.com/common"     }]  

How to check an encrypted (Veracrypt) external (USB) disk that has a BTRFS file system?

Posted: 30 Sep 2021 08:53 AM PDT

I want to test if physical errors of the disk, of it that is not possible, file system errors of the disk. The disk is a typical USB external drive. The disk (not by partition-level, but the whole disk itself) is encrypted using VeraCrypt. The partition I stored the files is using Btrfs. What is the way?


Here are the things I have tried on my own:

First, the web search result said badblocks but other result said that it is an obsolete tool now. And when I ran it, it asked for read-only something, and that made me think that it may destruct existing files, so I cancelled it.

Then, I tried to use the "Check filesystem" context menu on the volume of the VeraCrypt. But it showed an "fsck" window saying "If you wish to check the consistency of a BTRFS filesystem or repair a damaged filesystem, see btrfs(8) subcommand 'check'" and exited.

enter image description here

I opened a Terminal and tried to execute btrfs check but "sudo btrfs check (the device name)" failed with "no valid btrfs found on /dev/sdd" (probably because the whole disk is encrypted") and "sudo btrfs check (the decrypted directory)" failed with "not a regular file or block device".

enter image description here


PS: Thanks to the accepted answer, I got the correct device name. I am adding the following for future people who encounter the same problem. The comment I used was sudo btrfs --force --check-data-csum -p /dev/mapper/veracrypt1. I added --check-data-csum, because without it, it only checked the disk for the metadata checksum, not the actual files, so I had to run the test again (doing all the previous checks again). -p seems to be a nice option because it displays how many items have been checked so far.

Failed to set locale. Fix your system

Posted: 30 Sep 2021 09:11 AM PDT

A 32-bit server with openSUSE Tumbleweed:

While logging in, I received this warning:

/usr/bin/manpath: can't set the locale; make sure $LC_* and $LANG are correct

To fix the above error, I run these commands to modify the system language and time, but I get errors:

> sudo yast2 language  [sudo] password for root:   Failed to set locale. Fix your system.  Failed to set locale. Fix your system.  

Also:

> sudo yast2 timezone  [sudo] password for root:   Failed to set locale. Fix your system.  Failed to set locale. Fix your system.  

I couldn't figure out the cause. Does anyone have a suggestion?

Update

Locale output:

> locale   locale: Cannot set LC_CTYPE to default locale: No such file or directory  locale: Cannot set LC_ALL to default locale: No such file or directory  LANG=  LC_CTYPE=UTF-8  LC_NUMERIC="POSIX"  LC_TIME="POSIX"  LC_COLLATE="POSIX"  LC_MONETARY="POSIX"  LC_MESSAGES="POSIX"  LC_PAPER="POSIX"  LC_NAME="POSIX"  LC_ADDRESS="POSIX"  LC_TELEPHONE="POSIX"  LC_MEASUREMENT="POSIX"  LC_IDENTIFICATION="POSIX"  LC_ALL=  

Another output:

> locale -a  locale: Cannot set LC_CTYPE to default locale: No such file or directory  C  C.utf8  POSIX  aa_DJ  aa_DJ.utf8  aa_ER  aa_ER@saaho  aa_ET  af_ZA  af_ZA.utf8  agr_PE  ak_GH  am_ET  an_ES  an_ES.utf8    # ... it' a long list  

Update

Adding these lines to ~/.profile didn't fix the problem, even after logging out or even reboot:

export LANG="en_US.UTF-8"  export LC_CTYPE="en_US.UTF-8"  export LC_ALL="en_US.UTF-8"  

New observation

  1. Log in to the server directly/physically: no warning is thrown
  2. Log in to the server by SSH from a Linux laptop (openSUSE Leap 15.1): no warning is thrown
  3. Log in to the server by SSH from MacBook laptop: this warning is thrown:

/usr/bin/manpath: can't set the locale; make sure $LC_* and $LANG are correct

What are these `/tmp/_MEIxxx` directories?

Posted: 30 Sep 2021 08:41 AM PDT

I am seeing a bunch of directories with the same files in my /tmp directory. I'm wondering if what is generating those directories as there was cases when it generated to many that it filled up my disk space.

Running ls -l /tmp shows the following:

enter image description here

Then the directory contents which shows the same files being repeated:

enter image description here

gpg --passphrase-file doesn't work as root?

Posted: 30 Sep 2021 09:05 AM PDT

I'm trying to encrypt our backups using GnuPG as a pipe (reading from stdin and writing to stdout). The passphrase is read from a file. An example command:

echo "mysecret" | gpg --passphrase-file password.key --batch --symmetric --cipher-algo AES256 > test.gpg  

When I run this as a regular user, it works fine. But if I run it as root, I get:

gpg: gpg-agent is not available in this session  gpg: can't query passphrase in batch mode  gpg: error creating passphrase: invalid passphrase  gpg: symmetric encryption of `[stdin]' failed: invalid passphrase  

How can I get --passphrase-file working for root?

I cannot use --passphrase-fd 0 as suggested here because stdin is the data to be encrypted. I'm using GPG 1.4.20 (from Ubuntu 16.04.5 LTS)

Permanently disable the laptop's keyboard, keeping it disabled when turning computer on

Posted: 30 Sep 2021 10:02 AM PDT

My notebook's keyboard suddenly went all paranormal activity like weird. Two keys, minus and asterisk from the num pad were being pressed and held at random moment when typing something somewhere. I then removed the button and the small rubber that makes the contact with the board. Few days later, the return started to suffer the same thing. Everything I selected with one click was being deleted and, when in a text editor software or anything that have an input field, all being erased, just like holding the return or backspace key. I also noticed few times the dot key.

I learned about xinput to disable the keyboard and these inconvenient events, then using an external one. But it turns out that sometimes when turning the computer of, some mysterious key is also pressed, making the splash screen of my system and a screen showing what's happening behind the scenes rapidly toggle between each other. I suppose it's f2, because you can do it in Ubuntu pressing f2. Also, when turning the computer on. When this is happening during these moments, I cannot log-in nor turn the computer off simply by waiting.

I want to permanently disable the keyboard, be it when turning the computer on and off, and never use it again. I didn't find anything on BIOS or a way to do it with xinput. I'm afraid I'll have to open the computer and manually cut some wire for it to happen, but it is worthy the shot asking online, hoping for an easier solution. Much appreciated.

Easiest way to chown the contents of a directory?

Posted: 30 Sep 2021 10:39 AM PDT

I often use

ls -ld .  # remember current user and group  chown -R user.group .  chown remembered_user.remembered_group .  

Isn't there an easier way to recursively chown all files and directories in a directory but not the directory itself? It should include hidden files and work no matter how many files there are.

virt-manager copy paste functionality to the vm

Posted: 30 Sep 2021 08:27 AM PDT

Anyone know how to get Virtual Manager to install copy-paste functionality to the Virtual Machine?

Can't find anything on Google.