Monday, September 13, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


how to set xterm to have "Huge font" through .Xresources

Posted: 13 Sep 2021 10:42 AM PDT

this question is related to https://unix.stackexchange.com/questions/198010/unable-to-configure-font-in-xterm[][1], however, I have not been able to get it to work.

So, what I want is very simply to be able to have the Huge font enabled by default for me when I start xterm.

I have the following in my .Xresources:

XTerm*renderFont: true  XTerm*faceName: MiscFixed:style=Huge  XTerm*faceSize: 10  XTerm*faceLabel: Huge  

followed by xrdb -merge .Xresources but the Huge VT Option does not get invoked and I am still at the Default setting.

However, this does not do anything to get the xterm have "Huge" fonts. I also tried a bunch of things such as XTerm*VTFonts: Huge but to no avail. How do I go about doing this? Many thanks in advance!

Bash script behaving differently when executed from Crontab

Posted: 13 Sep 2021 09:29 AM PDT

I have a script that executes perfectly fine manually, though two commands in particular are completely ignored by Cron (this is just a snippet):

sinkint=$(pacmd list-sinks | sed -n '/index\W [1-9]/p' | sed 's/.*://g;s/\W//g')    pacmd set-default sink $sinkint  pacmd set-sink-volume $sinkint 20%  

Crontab

* * * * * /path/to/script arg1 >> /path/to/log  

Error messages

No PulseAudio daemon running, or not running as session daemon.  No PulseAudio daemon running, or not running as session daemon.  You have to specify a sink name/index and a volume  

These error messages don't make sense to me since the script runs fine manually.

Why Canadian Cross is used?

Posted: 13 Sep 2021 09:51 AM PDT

I'm going through the Linux From Scratch 11.0 book. On page 57 there is a bit about Canadian Cross cross-compilation. I do not understand why there need to be 3 stages and 3 machines to get to the end result. The text assumes that we start with computer A and a compiler that runs on A and produces binaries for A. So why don't we just use that compiler to build a compiler that runs on C and builds binaries for C? Why there is so much hassle instead, with building a compiler that runs on A, but builds for B, then a compiler that runs on B, but builds for C, and finally the compiler that runs on C and builds for C?

I also found an article on Wikipedia about it - https://en.wikipedia.org/wiki/Cross_compiler.

Traceroute Output to a File

Posted: 13 Sep 2021 10:32 AM PDT

I need a script that will continuously do a trace route to four addresses and output the results to a file. Can anyone help? What i have so far:

  • while true
  • do
  • traceroute google.com>/tmp/"$(date +"%Y_%m_%d_%I_%M_%p").log"
  • sleep 2
  • done

Checking date format in bash

Posted: 13 Sep 2021 09:11 AM PDT

I have the following lines in a bash script:

 while true; do      DATE=date      FORMAT="%Y%m%d"      read -p "Enter start date (YYYYMMDD)  " STARTDATE      if date=$(date -d "$STARTDATE" +'+%Y%m%d'); then         start_date=`$DATE +$FORMAT -d $STARTDATE`         echo $start_date         break      fi      echo "Please use right format (YYYYMMDD)  "   done  

This works fine as long as the input are 8 numbers (e.g. it accepts "20210901" and rejects "20213131"). However, when the input is totally off (e.g. "a" or "nonesense"), it simply takes today's date. How could the code be modified for a stricter check of the format?

How to find all possible locations for libraries and header files on any distro?

Posted: 13 Sep 2021 08:20 AM PDT

I found that the location of libraries and header files are very different on different distributions. For Example on Fedora you have /usr/lib64/libbfd.a while on Ubuntu you have /usr/lib/x86_64-linux-gnu/libbfd.a. Or on Fedora you have /usr/lib/gcc/x86_64-redhat-linux/10/include/stdatomic.h while on Ubuntu you have /usr/lib/gcc/x86_64-linux-gnu/10/include/stdatomic.h

Is there a way to know in which locations you have to look without maintaining a list of locations for every distribution?

Which $TERM renders bold text in vim as well as display status line?

Posted: 13 Sep 2021 07:46 AM PDT

I am looking for a $TERM which displays bold text in vim and display airline statusline too. To know what I mean,I have screenshot of two identical files opened by vim but using different terms by sourcing .bashrc file. XTERM VS XTERM-256 color

The left picture is using $TERM=xterm while right picture is using $TERM=xterm-256color. When using xterm, the statusline isn't visible no matter what airline theme I choose. When using xterm-256color, the statusline is visible but text isn't bold.

However, even when the terms are different, the color produced looks same. Here, the left is using xterm while right is using xterm-256color. python term

So, it seems changing term is triggering something in vim that causes unbold color when using xterm-256color and disappeared statusline when using xterm. I want to display both bold color as well as statusline. Is there a fix which would help me get both? I have mistakely asked this question in unix&linux rather than vi stackexchange so I fear my question will get closed. Also, give me names of other $TERMS so that I can try and tell if it fixed the problem.

What is the error in the service file?

Posted: 13 Sep 2021 07:43 AM PDT

I have a .NET Core application (self contained) which I've copied to the folder "/home/ubuntu/TimberApi" in an Ubuntu LightSail instance. I am trying to start it as a service. It is complaining that the unit file is invalid. Can anyone spot an error in the file?

This is the contents of the service file:

Description=Timber Store Api    [Service]  WorkingDirectory=/home/ubuntu/TimberApi  ExecStart=/home/ubuntu/TimberApi/TimberStore.Api  Restart=always  RestartSec=10  SyslogIdentifier=offershare-web-app  Environment=ASPNETCORE_ENVIRONMENT=Production    [Install]  WantedBy=multi-user.target  

Here is the error:

Failed to start TimberStoreApi.service: Unit TimberStoreApi.service has a bad unit file setting. See system logs and 'systemctl status TimberStoreApi.service' for details.

I ran "systemctl status TimberStoreApi.service" and got this:

/etc/systemd/system/TimberStoreApi.service:5: WorkingDirectory= path is not absolute: ~/TimberApi

Linux - Rename odbc.ini file in home directory

Posted: 13 Sep 2021 07:29 AM PDT

Can you please let me know how can I replace the name from odbc.ini(old name) to .odbc.ini (new name) in putty using Linux commands?

What does this error mean?

Posted: 13 Sep 2021 09:15 AM PDT

I was trying to install Arch Linux in VirtualBox, and made it through most of the setup without any issues. However, once it got past the partition setup it started spamming the console with the following message:

chroot: failed to run command 'passwd': no such file or directory.  

It does not appear to be moving past this and seems to be stuck there.

If anyone can come up with an answer for fixing this I would highly appreciate it.

Thanks in advance

Tommy.

What is the purpose of "domain name" setting in Linux?

Posted: 13 Sep 2021 07:59 AM PDT

I know that DNS treats domain names as a system of pointers, where you follow a path of domains from more general (e.g. .com.) to more specific (e.g. www.example.com.) in order to locate a host, but it is an outside means of addressing of which the host may or may not be aware.
We are also free to change the host's domain name in DNS as often as we want, or have several different names for a single host (e.g. www.example.com. and sip.example.com.) which isn't something that's local FQDN is fit for.

If you join an Active Directory domain, then it makes sense for a host to acquire the same domain name, but even non-members of IPA or AD sometimes are required to have their FQDN set by certain software packages.

So why would a Linux host need to have a notion of its own "domain name"?
At what point is it used by the OS and its network neighbors in practice?

Downloading Red hat dependencies recursively on ubuntu

Posted: 13 Sep 2021 07:45 AM PDT

I have a red hat system that's offline and an ubuntu system that's online. I want to install some software on the red hat system but the dependencies are too many. I've read answers that tell downloading recursively on red hat systems but can I do this recursive download of red hat dependencies on an ubuntu system and then install them in the former?

Modifying boot process in a Linux Live USB

Posted: 13 Sep 2021 10:30 AM PDT

I'm trying to boot a Linux Live USB for installation on my old Microsoft Surface 2, a tablet equipped with a Nvidia Tegra 4 SoC. Obviously, it needs the SoC drivers to run the GPU. I have a couple of Live USB distros I could try at booting. The first I'm attempting is the Debian 10 ARM HF. Right now, I'm concerned about the bootloader & it seems it would need the package:

https://packages.debian.org/buster/armhf/u-boot-tegra/

Of course, this is a chicken & egg problem, as I need to have the distro installed first, before it can utilize this package. So, how do I modify the Live USB's bootloader to utilize these binaries inside said package:

/usr/lib/u-boot/jetson-tk1/u-boot-tegra.bin

/usr/lib/u-boot/jetson-tk1/uboot.elf

If at all possible, by simply swapping files in the Live USB's root directory?

Come on, everybody's just itching to give me a distraction. Here's your chance.

sed : have a range finishing with the last occurrence of a pattern (greedy range)

Posted: 13 Sep 2021 09:06 AM PDT

Take the following file :

$ cat f1  stu vwx yza  uvw xyz abc  abc def ghi  def ghi jkl  ghi jkl mno  jkl mno pqr  mno pqr stu  pqr stu vwx  stu vwx yza  

To print all lines from the first one containing abc to the first one containing mno with GNU sed :

$ sed -n '/abc/,/mno/p' f1  uvw xyz abc  abc def ghi  def ghi jkl  ghi jkl mno  

How could I print all lines until the last one containing mno, e.g. how could I get the following result :

uvw xyz abc  abc def ghi  def ghi jkl  ghi jkl mno  jkl mno pqr  mno pqr stu  

In other words, is there a way to make GNU sed's range selection greedy ?

Update

  • If mno is missing, it should print out everything until the end of the file.
  • In my setting, mno cannot occur before the first abc.

EDIT I just added a dummy stu vwx yza line at the start, so that the file doesn't start with a line including abc (to avoid solutions that start from the first line - they should start from the first line having abc in it)

What is the starting address of the bootable flash partition according to the CHS address, LBA address, fdisk -l output address

Posted: 13 Sep 2021 08:10 AM PDT

I'm trying to get a deeper understanding of the linux disk layout, boot process, etc. What I'm doing is examining the layout and contents of a bootable Flash using command line tools and hexdump. The first thing was hoping to find, is the beginning of the first partition and look to see if GRUB is in the VBR, since it's bootable. My main problem now though is finding the first partition in the hexdump, because I'm not sure if I'm calculating the address correctly.

According to the partition table in the hexdump of the MBR ( See below ), the first partition starts at Head 1, Sector 3, Cylinder 1. The LBA address is 0x800 or 0d2048. Using CHS math I get that the start sector is 883, since fdisk reports that there's 40 sectors/track and 21 heads. But fdisk also reports that the the sdb1 partition starts at 3, which don't match the LBA address or the CHS address ( Or does the fdisk "Start" column not mean sectors?).

According to the output of the "file" command, which I ran on an image of the MBR, the start sector is 2048, which correlates with the LBA address, but not with the CHS address. But it also lists the GRUB stage2 address at 0x2000 and segment as 0x200. But those don't seem to correlate with where I'd expect to find the VBR, which would be at the beginning of partition 1.

So, at what address would I likely find the beginning of the boot partition/first partition in the hexdump?

Hexdumb MBR

fdisk and file output

How to mirror a screen in TigerVNC?

Posted: 13 Sep 2021 08:13 AM PDT

How to mirror a screen?

I have an answer (VNC).
A Linux VNC server - https://help.ubuntu.com/community/VNC/Servers.

Getting values of a variable which have letter, numbers and symbols in linux

Posted: 13 Sep 2021 08:19 AM PDT

How can I get all the different values of x where all the values are in this format

x=326F4333-54F1-4B2A-550C-FBFD3145C59F  

So there is no specific sequence for the numbers or the letters. But the pattern is fixed as per the following:

  • 8 letters and numbers
  • -
  • 4 letters and numbers
  • -
  • 4 letters and numbers
  • -
  • 4 letters and numbers
  • -
  • 12letters and numbers

I am using Linux.

Is there any linux utility to create plain binary dump of file and vice versa?

Posted: 13 Sep 2021 08:17 AM PDT

I want to know is there any linux utility or procedure for generating plain binary dump and reversing it back to the original file (as xxd is capable of doing it with -r argument)? I have tried xxd, it have the option to reverse to original file but it only prints plain hex dumps.

In case if above is not possible, is there any utility for conversion of plain hex strings (Example : hx829jdxkdiei) into plain binary. On windows there are some programs like 010 Editor, but I am not able to find any for Command line linux.

How to write automated tests for zsh completion?

Posted: 13 Sep 2021 07:59 AM PDT

I have a project in which I automatically generate zsh completion functions. As I work on it, I've found corner cases and bugs which I'm just writing down and making sure to re-test when I make changes. Obviously, I want to write a proper testsuite, but I can't figure out how.

For bash completions, testing is quite easy -- set COMP_* variables, run the function, and check COMP_REPLY. I'd like to do something similar for zsh.

I've read the compsys docs to the best of my ability, but I'm not seeing a solution.

I'd like to set the context by hand, run my completions, and then see an array of descriptions or something.

Has anyone found a way to test completions?

Is there a kernel option to allow a userspace app discovering custom USB devices on the host?

Posted: 13 Sep 2021 08:44 AM PDT

Consider a minimalist, buildroot-based Linux image on some 1-PCB computer with a USB host port.

Then there is another small computer: a Raspberry Pi Compute Module "CM3", the only connection between the two is USB. When the CM3 has a Linux running on it, it acts as a ethernet gadget for communication.

But when the CM3 needs to be flashed, an input pin on it, toggled by the buildroot machine, tells it "boot mode", and it will become a custom USB device "BCM2710 Boot". The Raspi folks then offer a userspace program, usbboot aka rpiboot, to find the device via VID and upload a small image turning it into a mass storage device.

When I try this, plugging the CM3 USB into a "normal" RaspberryPi's host USB port, I see this with dmesg:

[16689.527482] usb 1-1.3: new high-speed USB device number 3 using xhci_hcd  [16689.657906] usb 1-1.3: config index 0 descriptor too short (expected 55, got 32)  [16689.658302] usb 1-1.3: New USB device found, idVendor=0a5c, idProduct=2764, bcdDevice= 0.00  [16689.658319] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0  [16689.658335] usb 1-1.3: Product: BCM2710 Boot  [16689.658350] usb 1-1.3: Manufacturer: Broadcom  

Rpiboot does then find the device and sends over that spepcial image mentioned. So that works.

But when I plug it into my buildroot machine instead, I only see this:

[  597.725309] usb 3-1: new full-speed USB device number 4 using xhci-hcd  [  601.965304] usb 3-1: new high-speed USB device number 5 using xhci-hcd  

So it appears to see that there is some USB thing new, but won't go further. And rpiboot waits forever instead of finding it like on the Raspi-host. So it seems there are one or more Linux kernel config options which are not enabled in my buildroot image, which prevents this from working. I got this idea because initially, all the ethernet gadget stuff also did not work and I had to go and enable CDCETHER and some other options - but I have no idea what to look for with this non-standard device here. There are a lot of not-enabled CONFIG_USB_* options that seem to pertain to specific devices, but nothing like "custom" or such.

What is/are the corresponding option(s)?


Added: a view of sorted and line-matched (where same options) excerpts of both kernel configurations: I removed everything that's the same setting on both sides, drivers of specific devices, or nothing to do with USB, to shrink the listing by a fair amount. I went through short descriptons of these kernel options on https://cateee.net/, and so far saw nothing that seemed to fit the bill - but it's not said I didn't overlook or misinterpret something...

configRaspi4-Raspbian                           configBuildrootDevice  --------------------------------------------------------------------------------  CONFIG_HISI_HIKEY_USB is not set                  CONFIG_MEDIA_USB_SUPPORT=y                        CONFIG_NOP_USB_XCEIV=y                          CONFIG_NOP_USB_XCEIV is not set  CONFIG_USB_ACM=m                                CONFIG_USB_ACM=y  CONFIG_USB_ADUTUX=m                             CONFIG_USB_ADUTUX is not set  CONFIG_USB_AIRSPY is not set                      CONFIG_USB_AN2720=y                               CONFIG_USB_ARMLINUX=y                             CONFIG_USB_ATM=m                                  CONFIG_USB_BELKIN=y                               CONFIG_USB_CDC_COMPOSITE=m                      CONFIG_USB_CDC_COMPOSITE is not set  CONFIG_USB_CONFIGFS_ACM=y                       CONFIG_USB_CONFIGFS_ACM is not set  CONFIG_USB_CONFIGFS_ECM_SUBSET=y                  CONFIG_USB_CONFIGFS_ECM=y                       CONFIG_USB_CONFIGFS_ECM is not set                                                  CONFIG_USB_CONFIGFS_ECM_SUBSET is not set  CONFIG_USB_CONFIGFS_F_FS=y                      CONFIG_USB_CONFIGFS_F_FS is not set  CONFIG_USB_CONFIGFS_F_HID=y                     CONFIG_USB_CONFIGFS_F_HID is not set  CONFIG_USB_CONFIGFS_F_LB_SS=y                   CONFIG_USB_CONFIGFS_F_LB_SS is not set  CONFIG_USB_CONFIGFS_F_UAC2=y                      CONFIG_USB_CONFIGFS_NCM=y                       CONFIG_USB_CONFIGFS_NCM is not set  CONFIG_USB_CONFIGFS_OBEX=y                      CONFIG_USB_CONFIGFS_OBEX is not set  CONFIG_USB_CONFIGFS_RNDIS=y                     CONFIG_USB_CONFIGFS_RNDIS is not set  CONFIG_USB_CONFIGFS_SERIAL=y                    CONFIG_USB_CONFIGFS_SERIAL is not set  CONFIG_USB_CONFIGFS=m                           CONFIG_USB_CONFIGFS=y  CONFIG_USB_DEFAULT_PERSIST=y                    CONFIG_USB_DEFAULT_PERSIST is not set  CONFIG_USB_DWC2_DEBUG is not set                  CONFIG_USB_DWC2_DUAL_ROLE=y                       CONFIG_USB_DWC2_HOST is not set                   CONFIG_USB_DWC2_PCI is not set                    CONFIG_USB_DWC2_PERIPHERAL is not set             CONFIG_USB_DWC2_TRACK_MISSED_SOFS is not set      CONFIG_USB_DWC2=m                               CONFIG_USB_DWC2 is not set                                                  CONFIG_USB_DWC3_DUAL_ROLE=y                                                  CONFIG_USB_DWC3_GADGET is not set                                                  CONFIG_USB_DWC3_HAPS=y                                                  CONFIG_USB_DWC3_HOST is not set                                                  CONFIG_USB_DWC3_OF_SIMPLE=y                                                  CONFIG_USB_DWC3_OTG is not set  CONFIG_USB_DWC3 is not set                      CONFIG_USB_DWC3=y  CONFIG_USB_DWCOTG=y                               CONFIG_USB_ETH_EEM is not set                   CONFIG_USB_ETH_EEM=y  CONFIG_USB_ETH=m                                CONFIG_USB_ETH=y  CONFIG_USB_EZUSB_FX2=m                          CONFIG_USB_EZUSB_FX2 is not set  CONFIG_USB_F_ACM=m                                CONFIG_USB_F_ECM=m                              CONFIG_USB_F_ECM=y  CONFIG_USB_F_EEM=m                              CONFIG_USB_F_EEM=y  CONFIG_USB_F_FS=m                                 CONFIG_USB_F_HID=m                                CONFIG_USB_F_MASS_STORAGE=m                     CONFIG_USB_F_MASS_STORAGE=y  CONFIG_USB_F_NCM=m                                CONFIG_USB_F_OBEX=m                               CONFIG_USB_F_RNDIS=m                            CONFIG_USB_F_RNDIS=y  CONFIG_USB_F_SERIAL=m                             CONFIG_USB_F_SS_LB=m                              CONFIG_USB_F_SUBSET=m                           CONFIG_USB_F_SUBSET=y  CONFIG_USB_F_UAC2=m                               CONFIG_USB_FEW_INIT_RETRIES is not set            CONFIG_USB_G_ACM_MS=m                           CONFIG_USB_G_ACM_MS is not set  CONFIG_USB_G_HID=m                              CONFIG_USB_G_HID is not set  CONFIG_USB_G_MULTI_CDC is not set                 CONFIG_USB_G_MULTI_RNDIS=y                        CONFIG_USB_G_MULTI=m                            CONFIG_USB_G_MULTI is not set  CONFIG_USB_G_SERIAL=m                           CONFIG_USB_G_SERIAL is not set  CONFIG_USB_GADGETFS=m                           CONFIG_USB_GADGETFS is not set  CONFIG_USB_GSPCA=m                                CONFIG_USB_HIDDEV=y                             CONFIG_USB_HIDDEV is not set  CONFIG_USB_HSO=m                                  CONFIG_USB_LD=m                                 CONFIG_USB_LD is not set  CONFIG_USB_LIBCOMPOSITE=m                       CONFIG_USB_LIBCOMPOSITE=y  CONFIG_USB_MASS_STORAGE=m                       CONFIG_USB_MASS_STORAGE is not set  CONFIG_USB_MON=m                                CONFIG_USB_MON is not set  CONFIG_USB_NET_CDC_EEM=m                        CONFIG_USB_NET_CDC_EEM=y  CONFIG_USB_NET_CDC_MBIM=m                       CONFIG_USB_NET_CDC_MBIM is not set  CONFIG_USB_NET_CDC_NCM=m                        CONFIG_USB_NET_CDC_NCM is not set  CONFIG_USB_NET_CDC_SUBSET_ENABLE=m                CONFIG_USB_NET_CDC_SUBSET=m                     CONFIG_USB_NET_CDC_SUBSET is not set  CONFIG_USB_NET_CDCETHER=m                       CONFIG_USB_NET_CDCETHER=y  CONFIG_USB_NET_RNDIS_HOST=m                     CONFIG_USB_NET_RNDIS_HOST is not set  CONFIG_USB_NET_RNDIS_WLAN=m                                                                       CONFIG_USB_OTG_BLACKLIST_HUB is not set                                                  CONFIG_USB_OTG_FSM=y                                                  CONFIG_USB_OTG_WHITELIST is not set  CONFIG_USB_OTG is not set                       CONFIG_USB_OTG=y  CONFIG_USB_OTG_DISABLE_EXTERNAL_HUB is not set    CONFIG_USB_OTG_PRODUCTLIST is not set             CONFIG_USB_PWC=m                                  CONFIG_USB_RAW_GADGET is not set                  CONFIG_USB_ROLE_SWITCH=m                        CONFIG_USB_ROLE_SWITCH is not set  CONFIG_USB_SERIAL=m                             CONFIG_USB_SERIAL is not set  CONFIG_USB_SEVSEG=m                             CONFIG_USB_SEVSEG is not set  CONFIG_USB_TEST=m                               CONFIG_USB_TEST is not set  CONFIG_USB_TMC=m                                CONFIG_USB_TMC is not set  CONFIG_USB_U_ETHER=m                            CONFIG_USB_U_ETHER=y  CONFIG_USB_U_SERIAL=m                                                                             CONFIG_USB_WUSB_CBAF is not set  CONFIG_USB_ZERO=m                               CONFIG_USB_ZERO is not set  

"Data directory /var/lib/postgresql/13/main must not be owned by root"

Posted: 13 Sep 2021 09:11 AM PDT

I encounter the below problem:

└─$ sudo apt update && sudo apt full-upgrade -y     [sudo] password for kali: Hit:1 http://kali.download/kali kali-rolling InR  Reading package lists... Done  Building dependency tree... Done  Reading state information... Done   1 package can be upgraded. Run 'apt list --upgradable' to see it.   Reading package lists... Done   Building dependency tree... Done   Reading state information... Done   Calculating upgrade... Done   The following packages were automatically installed and are no longer required: exfat-fuse gstreamer1.0-pulseaudio libidn11 librest-0.7-0 libsoup-gnome2.4-1   Use 'sudo apt autoremove' to remove them.   The following packages will be upgraded: postgresql-13 1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 664 not fully installed or removed. Need to get 0 B/14.7 MB of archives. After this operation, 106 kB of additional disk space will be used.   Preconfiguring packages ... Setting up libss2:arm64 (1.46.4-1) ... (Reading database ... 255637 files and directories currently installed.)   Preparing to unpack .../postgresql-13_13.4-2_arm64.deb ... invoke-rc.d: could not determine current runlevel   Stopping PostgreSQL 13 database server: mainError: Data directory /var/lib/postgresql/13/main must not be owned by root ... failed! failed!   invoke-rc.d: initscript postgresql, action "stop" failed. dpkg: warning: old postgresql-13 package pre-removal script subprocess returned error exit status 1   dpkg: trying script from the new package instead ...   invoke-rc.d: could not determine current runlevel Stopping PostgreSQL 13 database server: main  Error: Data directory /var/lib/postgresql/13/main must not be owned by root ... failed! failed! invoke-rc.d: initscript postgresql, action "stop" failed.   dpkg: error processing archive /var/cache/apt/archives/postgresql-13_13.4-2_arm64.deb (--unpack): new postgresql-13 package pre-removal script subprocess returned error exit status 1   Errors were encountered while processing: /var/cache/apt/archives/postgresql-13_13.4-2_arm64.deb   E: Sub-process /usr/bin/dpkg returned an error code (1)  

What did I miss?

Wireguard - Clients can ping server but not each other

Posted: 13 Sep 2021 08:19 AM PDT

I have 3 nodes - 1 server, and two additional clients.

I can successfully ping the server endpoint from both clients, and I can ping the two clients from the server. However the two clients can not ping each other successfully.

I'm not too sure if I've sent the endpoint correctly - I can't find much information about what this should be set to.

On the server I see a debug error log of:

[ 2848.826167] wireguard: wg0: Invalid MAC of handshake, dropping packet from 90.218.41.186:1024  

Where might I be going wrong?


  peers = [      # For a client configuration, one peer entry for the server will suffice.        # server      {        publicKey = "***************";        allowedIPs = [ "10.100.0.1"];        endpoint = "**Server_IP_redacted**:51820";         persistentKeepalive = 25;      }        # pineapple      {        publicKey = "*************";        allowedIPs = [ "10.100.0.2" ];        endpoint = "**Server_IP_redacted**:51820";         persistentKeepalive = 25;      }    ];  

Convert multi lines to single line with spaces and quotes

Posted: 13 Sep 2021 09:12 AM PDT

How can I convert multi lines to a single line with spaces and quotes using awk or tr or any other tool which makes it simple (but not for loops)?

$ cat databases.txt  Wp_new  Frontend DB  DB_EXT  

Expected:

$ cat databases.txt  "Wp_new" "Frontend DB" "DB_EXT"    

Edit 1:

Thanks for all the useful answers. But the one I marked as correct is the one which can be typed on terminal in short time and with fewer hassles (simplicity) so that I(syadmins) can do the operations very fast without making the systems downtime more.

Docker reporting that my Linux kernel doesn't support cgroup cpu real-time period

Posted: 13 Sep 2021 08:08 AM PDT

I've configured Docker on my Ubuntu 18.04 Server to expose its API so I can create and deploy Docker containers via REST requests, which I need to add certain features to my project. This worked fine for first few endpoints I tried. However, when I attempt to create a new Docker container (the main point of the exercise), I get the message:

{"message": "Your kernel does not support cgroup cpu real-time period"}  

Is this true? Alternatively is it instead that I need to set something up to enable this functionality, or is Docker reporting incorrectly?

curl -X POST -H "Content-Type: application/json" -d "@./test-data/docker-create-api-test.json" http://localhost:1112/containers/create  {"message":"Your kernel does not support cgroup cpu real-time period"}  

Very grateful for any assistance given as this functionality is critical to my project.

How to activate a specific Terminator profile from the command-line?

Posted: 13 Sep 2021 10:07 AM PDT

I have saved a few Terminator profiles with different colors etc. How is it possible to activate a specific profile from the command line, or initially run terminator with a specific profile?

The main goal is to be able to activate profile "Prod" when we ssh to production, and "Stage" when we ssh to the staging-environment. So if there is such a terminator option then an alias can run the ssh command and then change the profile adequately.

How to install a particular version of boost with brew on MacOSX?

Posted: 13 Sep 2021 08:42 AM PDT

The command "brew install boost" works for me on my MacOSX, but it installs the latest boost 1.57. How to use brew to install the older 1.55?

Download package via apt for another architecture

Posted: 13 Sep 2021 08:23 AM PDT

I am currently in a architecture amd64, so when I try apt-get download vlc, it downloaded the appropriate architecture for my system, but how can I download the i386 version via apt?

It's for export to another system that doesn't have internet connection, also is there is any way to download any dependencies that follow?

No comments:

Post a Comment