Tuesday, February 1, 2022

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


How to make my Program Display Always on top

Posted: 01 Feb 2022 01:03 AM PST

Program Info & Problem

I have created a Python Program Using Pygame Module which displays the Ads on the monitor. It shows The Ad on screen But as soon as I launch different applications like kodi or vlc or chrome, etc. It goes behind those applications.

The Problem is: The program runs but behind those applications if these applications are launched after my Ad Program.

Ideal Working

  1. Program Laucnhed
  2. Ad Displayed on screen
  3. Launched Other Application
  4. The Program still displayes the ad on top of screen.

System Info

OS: Linux - Ubuntu 20

Language: Python

Module: Pygame, Pymovie, GTK3+

Architecture: amd64

Desktop Environment: OpenBOX

Code Launch: CLI using a bash script which launches the python program of advertisement.

Sample Screenshot of Advertisement

Advertisement Sample

Please Help! Thank you.

I want to replace \ with \\\\ using sed

Posted: 01 Feb 2022 12:46 AM PST

**Hi, I have tried using sed to read . Unable to read \ and replace it with \\ I want to replace single \ with 4 \\


Which parameters does configuration.nix take?

Posted: 01 Feb 2022 12:23 AM PST

My /etc/nixos/configuration.nix starts with { config, lib, modulesPath, pkgs, ... }:, because that's what was in whichever example I copied. A quick search through the NixOS manual, man nixos-generate-config, and man configuration.nix shows only examples with an even simpler { config, pkgs, ... }:.

Removing the , ... and running nixos-rebuild switch doesn't help; it prints the following three times:

error: anonymous function at /etc/nixos/configuration.nix:1:1 called with unexpected argument 'specialArgs', at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:372:8

How do I figure out its arguments?

can /etc/skel directory's files and directories automatically copied over to a existing user’s like with the newly created ones?

Posted: 01 Feb 2022 12:20 AM PST

The /etc/skel directory contains files and directories that are automatically copied over to a new user's when it is created from useradd command. But , when checked with the old existing users , it do not contains all the files and directories (.ssh directory in my case) as it should have inside /etc/skel.

  1. I have uncommented SKEL=/etc/skel in /etc/default/useradd.
  2. placed .ssh directory inside /etc/skel But the .ssh directory is not showing when logged in from existing users , where it works fine with the newly created users.

I have to print the consolidated value of p1,p2,p6,p8 , can someone help

Posted: 31 Jan 2022 11:33 PM PST

            <r p="1">0.0</r>              <r p="2">0.0</r>              <r p="3">0.0</r>              <r p="4">1.06</r>              <r p="5">0.0</r>              <r p="6">0.0</r>              <r p="7">3.0</r>              <r p="8">0.0</r>              <r p="9">0.0</r>              <r p="10">0.0</r>              <r p="11">0.0</r>              <r p="12">0.0</r>              <r p="13">38810.3359375</r>              <r p="14">0.0</r>              <r p="15">0.0</r>              <r p="16">294.0</r>              <r p="17">0.0</r>              <r p="18">86.24</r>              <r p="19">0.0</r>              <r p="20">4.43</r>              <r p="21">0.0</r>              <r p="22">5091.99609375</r>              <r p="23">0.0</r>              <r p="24">0.0</r>              <r p="25">0.0</r>              <r p="26">0.0</r>              <r p="27">0.0</r>              <r p="28">0.0</r>              <r p="29">9.23</r>              <r p="30">24.9609375</r>              <r p="31">0.0</r>              <r p="32">0.0</r>              <r p="33">38712.0</r>              <r p="34">0.0</r>  

lvremove is not removing previous LV'S filesystem signature. Is it safe to remove it while using lvcreate?

Posted: 31 Jan 2022 11:41 PM PST

I removed a logical volume that was formatted with ext4 with no data in it. I then proceeded to create a swap LVM but it's giving me a warning that there is an ext4 signature present. I am assuming that lvremove command doesn't remove the fs signature. Is it safe to remove the signature when prompted using lvcreate?

[root@workstation ~]# lvs    LV   VG   Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert    home cl   -wi-ao----  <6.52g                                                        root cl   -wi-ao----  19.00g                                                        swap cl   -wi-ao----   2.00g                                                        lv01 vg01 -wi-a----- 404.00m                                                        lv02 vg01 -wi-a----- 100.00m                                                      [root@workstation ~]# lvremove /dev/vg01/lv02  Do you really want to remove active logical volume vg01/lv02? [y/n]: y    Logical volume "lv02" successfully removed.  [root@workstation ~]#   [root@workstation ~]#   [root@workstation ~]# lvcreate -n swap1 -L 100M vg01  WARNING: ext4 signature detected on /dev/vg01/swap1 at offset 1080. Wipe it? [y/n]:     

Question marks showing in ls of directory even with root

Posted: 01 Feb 2022 12:57 AM PST

If I do ls -alt in any folder i get the following. Even with the files or folders i create with root. Commands such as stat filename returns Operation not permitted. Any idea what causes this?

[root@011319292d9c ~]# pwd  /root  [root@011319292d9c ~]# ls -alt  ls: cannot access '.': Operation not permitted  ls: cannot access '..': Operation not permitted  ls: cannot access '.bash_profile': Operation not permitted  ls: cannot access '.tcshrc': Operation not permitted  ls: cannot access '.bashrc': Operation not permitted  ls: cannot access '.bash_logout': Operation not permitted  ls: cannot access 'test-file-i-created-as-root': Operation not permitted  total 0  d????????? ? ? ? ?            ? .  d????????? ? ? ? ?            ? ..  -????????? ? ? ? ?            ? .bash_logout  -????????? ? ? ? ?            ? .bash_profile  -????????? ? ? ? ?            ? .bashrc  -????????? ? ? ? ?            ? .cshrc  -????????? ? ? ? ?            ? .tcshrc  -????????? ? ? ? ?            ? test-file-i-created-as-root  

P.S. This happened inside a docker container which I started it with bash from docker image with redhat 8.5 as follows for debugging purposes:

docker run --rm -ti --entrypoint /bin/bash <Image-ID>   

Prevent LibreOffice from using system theme

Posted: 31 Jan 2022 10:23 PM PST

I recently started using Linux Mint 19.3 Cinnamon. I understand that LibreOffice automatically uses the system colour theme---my preferred system theme is dark so LibreOffice uses it as well. However, I want LibreOffice to use the light theme while keeping my system dark. I have tried searching online extensively, and attempted several of the suggested solutions, such as editing the .desktop file to include env GTK_THEME (such as this post), but none of them have worked for me. Linux being so customisable, surely this shouldn't be so hard? None of the similar questions asked ever really reached a definitive solution, so is this not even possible?

Expectation (light Libre + dark system):

Light LibreOffice

enter image description here

flatpak

Some also suggest using the flatpak variant of LibreOffice, as it does not use the system GTK and instead comes with Adwaita-light by default, but I tried this and it didn't work either. It automatically changes with the system theme.

Moreover, although the flatpak version allows me to use a "preinstalled theme" (it comes with six), this is not quite the same as when Libre runs with the light system theme. Some bars remain dark, while the region that gets changed loses some refinement. Overall, it just looks bad (I have used grey in the example below, just because white is even worse and so is not what I want).

enter image description here

I would think lots of people face this issue, but can't find an easy solution!

During any upgrade, and even upgrading my Linux major version, should I reply: "replace configuration files" or "keep them" when I'm asked for?

Posted: 31 Jan 2022 10:19 PM PST

I'm about to upgrade from Debian 10 to 11.
During this step, and like when I do common apt-get upgrade or dist-upgrade, I'm expecting to receive a lot of questions: "Do you want to replace or to keep your configurations files?"

And having little knowledge (or absolutely no, sometimes) about the goals and the effects of most packages that are asking for this, a diff won't help me. What is the default response you recommend to answer, when you "know nothing"?

Y : replace configurations file
or
N : keep them
or
press Enter key, to use the default answer suggested?

Unable to install anything on kali Linux 2019.1

Posted: 31 Jan 2022 08:59 PM PST

This is my /etc/apt/sources.list contain

deb http://http.kali.org/kali kali-rolling main contrib non-free   deb-src http://http.kali.org/kali kali-rolling main contrib non-free  

yet I am unable to update it or download anything. I have Linux 2019.1. As it is old version but I need it for my work. How to fix this issue?

Is there a cleaner way to get active vim+tmux window renaming?

Posted: 31 Jan 2022 08:22 PM PST

I have finally achieved what I wanted with my vim+tmux setup, but I'm curious if there is a better way to do this. I also hope that this helps out anyone looking for this sort of functionality.

In short, the window tab titles now actively rename themselves to " file_name " and " basepath/ ", i.e. on opening panes and windows, opening files in vim, changing directories, and changing pane focus.

I took care of renaming inside vim with:

.vimrc

if exists('$TMUX')      autocmd BufEnter,FocusGained,BufWrite * call system("tmux rename-window ' " . expand("%:t") . " '")  endif  

According to :help filename-modifiers I should have been able to add:

"autocmd VimLeave * call system("tmux rename-window ' " . expand("%:h") . "/ '")  

But it just returned a period followed by my slash.

Here's where I had to get scrappy. I took care of exiting vim and directory changes in my:

.bash_aliases

tmux ls > /dev/null 2>&1  TMUX_STATUS=$?  if [ $TMUX_STATUS -eq 0 ]; then        # Get pwd, trim to "basepath/" and rename window      basepathTitle () {          getval=$(pwd)          BASEPATH_TITLE="${getval##*/}"          tmux rename-window " ${BASEPATH_TITLE:0:12}/ "      }        # Change cd functionality to rename window title to pwd after every directory change      cd () {          builtin cd "$@"          CD_STATUS=$?          basepathTitle          return "$CD_STATUS"      }        # Change vim functionality to change title back to basepath on close      vim () {                    FILE_NAME=$@          #tmux rename-window " ${FILE_NAME:0:12} "          /usr/bin/vim.gtk3 "$FILE_NAME"          VIM_STATUS=$?          basepathTitle          return "$VIM_STATUS"      }        # Set window title when tmux starts      basepathTitle  fi  

That just left the issue of renaming the window every time I switched pane focus, including from vim to shell. I finally found this option in the tmux man pages:

.tmux.conf

set -g focus-events on  set-hook -g pane-focus-in 'rename-window " #{b:pane_current_path}/ "'  

The b reduces the current path to the head directory or basepath. I hope this helps someone, and again I'd love to know if there is a cleaner way to do this. Comments about using automatic-rename with status-interval are unwelcome ;)

Set firefox developer edition as the default browser in VS Code on Linux

Posted: 31 Jan 2022 08:04 PM PST

I have installed firefox developer edition on my MX-Linux. When I tried to configure the live server of VS Code to run it as default, I failed. I followed this link to set up, but ultimately it is not working for me.

What I did after following the above mentioned link is to include this piece of line in the settings.json file after I entered config live server in the search bar "liveServer.settings.AdvanceCustomBrowserCmdLine": "/usr/share/applications/firefox-developer.desktop". However, it is not working out for me.

Did I miss anything out here? I know I could add a comment on that thread, but I don't have enough reputations on stackoverflow to comment anything. So I had to post here.

I hope anyone can help me with this. Thanks in advance.

Should I worry if 'pkexec' is in a cPanel user's /home/virtfs (CVE-2021-4034)?

Posted: 01 Feb 2022 12:02 AM PST

The recent security bug CVE-2021-4034 in Linux involves /usr/bin/pkexec. Following media reports (zdnet, etc.) I changed its permission, but also found this file: /home/virtfs/foo/usr/bin/pkexec for cPanel user foo.

I don't know why a user would have pkexec shadowed.

Unfortunately we are running an outdated WHM/cPanel (with root) on outdated CentOS 6, until we can migrate the last sites off it.

How to get the email of the logged in user when login occurs through SSH keys?

Posted: 01 Feb 2022 12:17 AM PST

I'm using bash shell and Ubuntu 18.04. I SSH into the server using a fairly standard RSA public-private key set up, where I put my public key in the .ssh/authorized_keys file of the server, entry looking like this

ssh-rsa AAAAB…KKRaniLSv8mHQ== first.last@example.com  

Is it possible, after login, to write a script or command that would tell me the email of my logged in account? In the above case, I would want the script to output first.last@example.com.

Edit: I don't have sudo privileges for the logged in user in question.

Docker 20.10.x keeps system waiting for several minutes before shutdown or reboot

Posted: 31 Jan 2022 10:03 PM PST

I have successfully upgraded my Debian buster to latest version (Bullseye) and after that, whenever I want to reboot or shut it down, it takes several minutes to complete while waiting for some process to finish with these messages:

watchdog: watchdog0: watchdog did not stop!  systemd-shutdown[1]: Syncing filesystem and block devices.  systemd-shutdown[1]: Sending SIGTERM to remaining process...  systemd-journald[372]: Received SIGTERM from PID 1 (systemd-shutdown).  systemd-shutdown[1]: waiting for process: containerd-shim.  

I've got docker installed on my system which seems to be the cause of problem.

$ ps aux | grep containerd-shim  root        3420  0.0  0.1 1451744 21876 ?       Sl   11:07   0:00 /usr/bin/containerd-shim-runc-v2 -namespace moby -id 0dd6b89a62d...66cc5c0a44b6f01d77c -address /run/containerd/containerd.sock    $ dpkg -S /usr/bin/containerd-shim-runc-v2   containerd: /usr/bin/containerd-shim-runc-v2    $ aptitude why containerd  i   docker.io Depends containerd  

I've tried stopping dockers' service/socket before rebooting the system. Nothing changed.

Any idea how to resolve this?


$ docker version  Client:   Version:           20.10.5+dfsg1   API version:       1.41   Go version:        go1.15.9   Git commit:        55c4c88   Built:             Wed Aug  4 19:55:57 2021   OS/Arch:           linux/amd64   Context:           default   Experimental:      true    Server:   Engine:    Version:          20.10.5+dfsg1    API version:      1.41 (minimum version 1.12)    Go version:       go1.15.9    Git commit:       363e9a8    Built:            Wed Aug  4 19:55:57 2021    OS/Arch:          linux/amd64    Experimental:     false   containerd:    Version:          1.4.5~ds1    GitCommit:        1.4.5~ds1-2   runc:    Version:          1.0.0~rc93+ds1    GitCommit:        1.0.0~rc93+ds1-5+b2   docker-init:    Version:          0.19.0    GitCommit:          

Dual Boot Windows 10 / Linux Mint 19.3 on Dell XPS 13 (7390)

Posted: 31 Jan 2022 09:30 PM PST

As I'm new to dual boot Linux with Windows I'm probably missing a lot during this process and I'll be glad if someone can help me sort things out.

I got a new Dell XPS 13 (7390). It came with Windows 10 Home installed, which I need to maintain for work reasons, but I'd like to have Linux Mint as my primary OS.

I followed Dell's instructions to install Linux by shrinking the Windows' partition and then using that creating 4 new partitions in it: /boot; /root; /home; /swap.

Please do tell me if you need to know more about my machine to understand what's happening.

At first I had problems in make my USB flash drive recognize the unallocated space, which I finally solved as explained here (but without setting boot mode to legacy (as it is no longer possible).

Now I have the two systems installed. The only problem is that I can boot Windows only selecting "Raid On" on BIOS settings, while Mint works only switching it back to AHCI mode.

Is there a way to solve this and not touch the BIOS every time?

Alpine 3.9.4 update busybox 1.30.0

Posted: 01 Feb 2022 01:14 AM PST

I am using latest stable version of alpine 3.9.4 image. this image comes with busybox -1.29.3-r10. I need to upgrade to busybox 1.30.0.

apk upgrade busybox command not upgrading the package. What is the right steps to upgrade busybox package in Alpine Linux?

Problem due to incorrect libstdc++6

Posted: 31 Jan 2022 09:02 PM PST

When I do sudo apt-get -f install I am getting

Preparing to unpack .../libstdc++6_8.1.0-5ubuntu1~14.04_amd64.deb ...  Unpacking libstdc++6:amd64 (8.1.0-5ubuntu1~14.04) over (5.4.0-6ubuntu1~16.04.10) ...  dpkg: error processing archive /var/cache/apt/archives/libstdc++6_8.1.0-5ubuntu1~14.04_amd64.deb (--unpack):   trying to overwrite shared '/usr/share/doc/libstdc++6', which is different from other instances of package libstdc++6:amd64  Processing triggers for libc-bin (2.23-0ubuntu11) ...  Errors were encountered while processing:   /var/cache/apt/archives/libstdc++6_8.1.0-5ubuntu1~14.04_amd64.deb  E: Sub-process /usr/bin/dpkg returned an error code (1)}  

I'm using Ubuntu 14.04.5

This is probably because of a conflict with libstdc++. (it happened when I was trying to install adobe acrobat) How/where do I find the right version of libstdc++6 and how to uninstall the broken version?

The output of apt-cache policy libstdc++6:i386 is

libstdc++6:i386:    Installed: 8.1.0-5ubuntu1~14.04    Candidate: 8.1.0-5ubuntu1~14.04    Version table:   *** 8.1.0-5ubuntu1~14.04 500          500 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu trusty/main i386 Packages          100 /var/lib/dpkg/status       5.4.0-6ubuntu1~16.04.11 8500          500 http://mirror.****/ubuntu xenial-updates/main i386 Packages       5.4.0-6ubuntu1~16.04.10 500          500 http://mirror.****/ubuntu xenial-security/main i386 Packages       5.3.1-14ubuntu2 500          500 http://mirror.****/ubuntu xenial/main i386 Packages  

(I have snipped the full IP address when I wrote **** above)

$ dpkg --print-foreign-architectures is  i386  

Output of dpkg -l libstdc++6 is

| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend  |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)  ||/ Name                 Version         Architecture    Description  +++-====================-===============-===============-==============================================  iU  libstdc++6:amd64     5.4.0-6ubuntu1~ amd64           GNU Standard C++ Library v3  iF  libstdc++6:i386      8.1.0-5ubuntu1~ i386            GNU Standard C++ Library v3  

Output of grep -v "#" /etc/apt/sources.list:

deb http://mirror**/ubuntu/ xenial main restricted  deb-src http://mirror**/ubuntu/ xenial main restricted  

and so on so forth.
Will the problem get solved if I manually edit this file and change xenial to trusty (running apt-get-clean did not help fix this)

When I run sudo apt-get install --reinstall libstdc++6:i386, I get:

Reading package lists... Done  Building dependency tree         Reading state information... Done  You might want to run 'apt-get -f install' to correct these:  The following packages have unmet dependencies:   libstdc++-5-dev : Depends: libstdc++6 (>= 5.5.0-12ubuntu1~14.04) but 5.4.0-6ubuntu1~16.04.10 is to be installed   libstdc++6 : Depends: gcc-5-base (= 5.4.0-6ubuntu1~16.04.10) but 5.5.0-12ubuntu1~14.04 is to be installed                Breaks: libreoffice-core (<= 1:4.4.4~rc3-0ubuntu1) but 1:4.2.8-0ubuntu5.1 is to be installed                Breaks: libstdc++6:i386 (!= 5.4.0-6ubuntu1~16.04.10) but 8.1.0-5ubuntu1~14.04 is to be installed   libstdc++6:i386 : Breaks: libstdc++6 (!= 8.1.0-5ubuntu1~14.04) but 5.4.0-6ubuntu1~16.04.10 is to be installed  E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).  

and I cannot run apt-get -f install for the same reason as mentioned at the beginning of the thread. Let me know what can be done.

fix debian libc-bin

Posted: 31 Jan 2022 10:07 PM PST

Apparently I broke my Debian system again.

If I want to install anything using apt I get the following warning:

Reading state information... Done  You might want to run 'apt --fix-broken install' to correct these.  The following packages have unmet dependencies:   libc-bin : Depends: libc6 (< 2.25) but 2.27-3 is to be installed   locales : Depends: libc-bin (> 2.27) but 2.24-11+deb9u3 is to be installed  E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).  

Following this hint is no use, as it only results in

The following packages were automatically installed and are no longer required:    bc cups-browsed cups-core-drivers cups-daemon cups-filters cups-filters-core-drivers    cups-ppdc cups-server-common dc foomatic-db-compressed-ppds foomatic-db-engine hp-ppd    hplip-data libart-2.0-2 libavahi-glib1 libcupscgi1 libcupsmime1 libcupsppdc1    libfontembed1 libgutenprint2 libhpmud0 liblouisutdml-bin liblouisutdml-data    liblouisutdml7 libqpdf17 libsane-hpaio libsnmp-base libsnmp30 mscompress    openprinting-ppds printer-driver-all printer-driver-brlaser printer-driver-c2050    printer-driver-c2esp printer-driver-cjet printer-driver-dymo printer-driver-escpr    printer-driver-foo2zjs printer-driver-foo2zjs-common printer-driver-fujixerox    printer-driver-hpijs printer-driver-m2300w printer-driver-min12xxw    printer-driver-pnm2ppa printer-driver-ptouch printer-driver-pxljr    printer-driver-sag-gdi python3-pexpect python3-pil python3-ptyprocess    python3-renderpm python3-reportlab python3-reportlab-accel qpdf ssl-cert  Use 'sudo apt autoremove' to remove them.  The following packages will be REMOVED:    cups hplip libc-bin locales printer-driver-gutenprint printer-driver-hpcups    printer-driver-postscript-hp printer-driver-splix task-english task-print-server  WARNING: The following essential packages will be removed.  This should NOT be done unless you know exactly what you are doing!    libc-bin  0 upgraded, 0 newly installed, 10 to remove and 7 not upgraded.  1 not fully installed or removed.  After this operation, 22.0 MB disk space will be freed.  You are about to do something potentially harmful.  To continue type in the phrase 'Yes, do as I say!'   ?]   

A quick Google search informed me that removing libc-bin is a terrible idea, which and idiot like me should never do. The question is now, how can I fix my problem?


Further info:

$ cat /etc/apt/sources.list  # deb cdrom:[Debian GNU/Linux 9.4.0 _Stretch_ - Official amd64 NETINST 20180310-11:21]/ stretch main  # deb cdrom:[Debian GNU/Linux 9.4.0 _Stretch_ - Official amd64 NETINST 20180310-11:21]/ stretch main  deb http://ftp.de.debian.org/debian/ stretch main non-free contrib  deb-src http://ftp.de.debian.org/debian/ stretch main non-free contrib    deb http://security.debian.org/debian-security stretch/updates main contrib non-free  deb-src http://security.debian.org/debian-security stretch/updates main contrib non-free    # stretch-updates, previously known as 'volatile'  deb http://ftp.de.debian.org/debian/ stretch-updates main contrib non-free  deb-src http://ftp.de.debian.org/debian/ stretch-updates main contrib non-free  

Requested by comments:

$ sudo apt install libc-bin/stable

Reading package lists... Done  Building dependency tree         Reading state information... Done  libc-bin is already the newest version (2.24-11+deb9u3).  Selected version '2.24-11+deb9u3' (Debian:9.4/stable [amd64]) for 'libc-bin'  Selected version '2.24-11+deb9u3' (Debian:9.4/stable [amd64]) for 'libc6' because of 'libc-bin'  You might want to run 'apt --fix-broken install' to correct these.  The following packages have unmet dependencies:   libc-bin : Depends: libc6 (< 2.25) but 2.27-3 is to be installed   locales : Depends: libc-bin (> 2.27) but 2.24-11+deb9u3 is to be installed  E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).  

$ cat /etc/apt/sources.list.d/*

# deb-src http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu cosmic main  # deb-src http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu cosmic main  

$ apt-cache policy

Package files:   100 /var/lib/dpkg/status       release a=now   500 http://ftp.de.debian.org/debian stretch-updates/main amd64 Packages       release o=Debian,a=stable-updates,n=stretch-updates,l=Debian,c=main,b=amd64       origin ftp.de.debian.org   500 http://security.debian.org/debian-security stretch/updates/non-free amd64 Packages       release v=9,o=Debian,a=stable,n=stretch,l=Debian-Security,c=non-free,b=amd64       origin security.debian.org   500 http://security.debian.org/debian-security stretch/updates/contrib amd64 Packages       release v=9,o=Debian,a=stable,n=stretch,l=Debian-Security,c=contrib,b=amd64       origin security.debian.org   500 http://security.debian.org/debian-security stretch/updates/main amd64 Packages       release v=9,o=Debian,a=stable,n=stretch,l=Debian-Security,c=main,b=amd64       origin security.debian.org   500 http://ftp.de.debian.org/debian stretch/contrib amd64 Packages       release v=9.4,o=Debian,a=stable,n=stretch,l=Debian,c=contrib,b=amd64       origin ftp.de.debian.org   500 http://ftp.de.debian.org/debian stretch/non-free amd64 Packages       release v=9.4,o=Debian,a=stable,n=stretch,l=Debian,c=non-free,b=amd64       origin ftp.de.debian.org   500 http://ftp.de.debian.org/debian stretch/main amd64 Packages       release v=9.4,o=Debian,a=stable,n=stretch,l=Debian,c=main,b=amd64       origin ftp.de.debian.org  Pinned packages:  

$dpkg --list libc6

 Desired=Unknown/Install/Remove/Purge/Hold  | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend  |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)  ||/ Name             Version       Architecture  Description  +++-================-=============-=============-=====================================  ii  libc6:amd64      2.27-3        amd64         GNU C Library: Shared libraries  

find /lib -name libc-\*

/lib/x86_64-linux-gnu/libc-2.27.so  

Combining rsync and find

Posted: 01 Feb 2022 01:01 AM PST

I'm trying to use find & rsync to back up specific files from a remote machine, and getting nowhere.

Here's the setup: I want to use rsync to back up all files containing *state* or *srm on the remote machine into a local directory. I specifically want to run this from my local machine, rather than running it with find on the remote machine (a RetroPie, if you're curious), because I don't want to set up login credentials from the remote machine. I already have ssh keys set up properly. I'm aiming to backup into ~/retropie-backup locally.

The find command that I'm using works properly on the remote machine (truncated to one result for clarity):

$ find  -iname "*state*" -o -iname "*srm"  ./RetroPie/roms/snes/EarthBound (USA).srm  

So far so good. I also know that I need to add -s to rsync so it doesn't panic over spaces in the file names. My attempt at combining the two, however, doesn't work:

$ rsync -v -s pi@retropie:'`find  -iname "*state*" -o -iname "*srm"`' retropie-backup/  rsync: link_stat "/home/pi/`find  -iname "*state*" -o -iname "*srm"`" failed: No such file or directory (2)  

I can tell that I'm missing something basic, but I'm just not seeing it. Any suggestions?

How to start a script after login using gdm?

Posted: 31 Jan 2022 08:06 PM PST

I am using arch linux with xmonad, and I login using gdm, but to make xmonad work properly I have to run a script directly after login (actually I want to run .xinitrc after login using gdm to set some configuration).so, How it is possible ro run a bash script immediatly after login.

I tried several ways such as editing

/etc/gdm/PostLogin/Default  

thank you,

How to renice all threads (and children) of one process on Linux?

Posted: 01 Feb 2022 01:14 AM PST

Linux does not (yet) follow the POSIX.1 standard which says that a renice on a process affects "all system scope threads in the process", because according to the pthreads(7) doc "threads do not share a common nice value".

However, sometimes, it can be convenient to renice "everything" related to a given process (one example would be Apache child processes and all their threads). So,

  • how can I renice all threads belonging to a given process ?
  • how can I renice all child processes belonging to a given process ?

I am looking for a fairly easy solution.

I know that process groups can sometimes be helpful, however, they do not always match what I want to do: they can include a broader or different set of processes.

Using a cgroup managed by systemd might also be helpful, but even if I am interested to hear about it, I mostly looking for a "standard" solution.

EDIT: also, man (7) pthreads says "all of the threads in a process are placed in the same thread group; all members of a thread group share the same PID". So, is it even possible to renice something which doesn't have it's own PID?

Building python with openssl support

Posted: 01 Feb 2022 12:01 AM PST

I have the following directory structure:

nchambers@nchambers-305E4A-305E5A-305E7A:~/mini-bin$ la  2to3               cpp-5.3.0            gcov-5.3.0           grmid-5.3.0         objcopy-2.25.1    python3.5-config      .sources  2to3-3.5           elfedit-2.25.1       gcov-tool-5.3.0      grmiregistry-5.3.0  objdump-2.25.1    python3.5m            strings-2.25.1  addr2line-2.25.1   g++-5.3.0            gfortran-5.3.0       gserialver-5.3.0    pydoc             python3.5m-config     strip-2.25.1  aot-compile-5.3.0  gappletviewer-5.3.0  gij-5.3.0            gtnameserv-5.3.0    pydoc3            python3-config        x86_64-unknown-linux-gnu-c++-5.3.0  ar-2.25.1          gc-analyze-5.3.0     gjar-5.3.0           idle                pydoc3.5          python-config         x86_64-unknown-linux-gnu-g++-5.3.0  .archives          gcc-5.3.0            gjarsigner-5.3.0     idle3               python            pyvenv                x86_64-unknown-linux-gnu-gcc-5.3.0  as-2.25.1          gcc-ar-5.3.0         gjavah-5.3.0         idle3.5             python2           pyvenv-3.5            x86_64-unknown-linux-gnu-gcc-ar-5.3.0  bash               gcc-nm-5.3.0         gkeytool-5.3.0       jcf-dump-5.3.0      python2.7         ranlib-2.25.1         x86_64-unknown-linux-gnu-gcc-nm-5.3.0  .binaries          gcc-ranlib-5.3.0     gnative2ascii-5.3.0  jv-convert-5.3.0    python2.7-config  readelf-2.25.1        x86_64-unknown-linux-gnu-gcc-ranlib-5.3.0  .build             gcj-5.3.0            gorbd-5.3.0          ld-2.25.1           python2-config    rebuild-gcj-db-5.3.0  x86_64-unknown-linux-gnu-gcj-5.3.0  c++-5.3.0          gcj-dbtool-5.3.0     gprof-2.25.1         ld.bfd-2.25.1       python3           size-2.25.1           x86_64-unknown-linux-gnu-gfortran-5.3.0  c++filt-2.25.1     gcjh-5.3.0           grmic-5.3.0          nm-2.25.1           python3.5         smtpd.py  nchambers@nchambers-305E4A-305E5A-305E7A:~/mini-bin$ la .sources/  bash-4.4-beta  binutils-2.25.1  boost_1_60_0  gcc-5.3.0  Python-2.7.11  Python-3.5.1  nchambers@nchambers-305E4A-305E5A-305E7A:~/mini-bin$ la .build/  bash-4.4-beta  binutils-2.25.1  boost_1_60_0  gcc-5.3.0  Python-2.7.11  Python-3.5.1  nchambers@nchambers-305E4A-305E5A-305E7A:~/mini-bin$ la .binaries/  bash-4.4-beta  binutils-2.25.1  boost_1_60_0  gcc-5.3.0  Python-2.7.11  Python-3.5.1  nchambers@nchambers-305E4A-305E5A-305E7A:~/mini-bin$   

Generally, tar balls go in .archives, unpacked sources go in .sources, building happens in .build, and the final binaries are store in .binaries. I then symlink the binaries from .binaries to ~/mini-binwhich is on my $PATH.I know its a weird workflow, but it works for me. Anyways, I am looking to rebuild python-2.7.11 (and 3.4.0, but am starting with 2.7.11) from source. It builds fine on my system, but I need it to build with ncurses, readline, ssl, etc support. Do I have to compile these libraries from source? If so, where would I put the libraries? How do I tell python to build with them. Thank you and have a good day!

rsync with different user

Posted: 01 Feb 2022 01:15 AM PST

I'm working with two ubuntu instances on AWS (which I use a pem key to access them).

I set up rsync for both instances, and it works if I use the default user which is ubuntu@ipaddress. However if I try to use rsync with another user (I'm typing sudo su - jenkins for example or even typing sudo before the rsync command), then I get the following error.

Permission denied (publickey).  rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]  rsync error: unexplained error (code 255) at io.c(226) [Receiver=3.1.0]  

Steps that I've taken:

I've tried creating an ssh key (using ssh-keygen) while logged in as jenkins and added that to the authorized_keys file in both /home/ubuntu/.ssh/authorized_keys (where i'm running the rsync from) and even $JENKINS_HOME/.ssh/authorized_keys (where I tried running rsync from there too).

I even tried using the pem key to do the same thing and that didn't work either.

Here's what I'm trying to run

rsync -avuh --delete -e ssh jenkins@ipaddress:/var/lib/jenkins/* /var/lib/jenkins

And here's with the key file

rsync -avuh --delete -e 'ssh -i path/to/key.pem' jenkins@10.96.2.210:/var/lib/jenkins/* /var/lib/jenkins

P.S.: The only reason why I don't want to run it with the ubuntu user is because I get failed: Permission denied (13) on a lot of things (since the files are owned by jenkins).

End goal:

I'm trying to keep the backup jenkins instance backed up constantly with the primary instance by doing a cronjob:

*/30 * * * * /usr/bin/rsync -avuh --delete -e ssh root@jenkinsprimary:/var/lib/jenkins/* /var/lib/jenkins

Combined `mkdir` and `cd`? [duplicate]

Posted: 31 Jan 2022 08:59 PM PST

is there any way (what is the easiest way in bash) to combine the following:

mkdir foo  cd foo  

The manpage for mkdir does not describe anything like that, maybe there is a fancy version of mkdir? I know that cd has to be shell builtin, so the same would be true for the fancy mkdir...

Aliasing?

How to properly and easily configure `xdg-open` without any environment?

Posted: 31 Jan 2022 11:14 PM PST

I'm using OpenBox window manager without any desktop environment.

xdg-open behaves strangely. It opens everything with firefox.

$ xdg-settings --list  Known properties:    default-web-browser           Default web browser  

I'm looking for a simple program; something like reading every *.desktop file in /usr/share/applications/ folder and automatically setting xdg settings.

No comments:

Post a Comment