Wednesday, April 28, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


Generating PPS (pulse-per-second) on Linux

Posted: 28 Apr 2021 10:06 AM PDT

Has anybody successfully used the pps_gen_parport kernel module to generate PPS on a PC's printer output port?

The module has been marked as broken almost since it appeared in the kernel at 2.6.38, on account of a potential lockup problem. However there are a couple of unapplied patches which (a) allow the polarity of the signal to be specified and (b) in principle fix the lockup problem.

https://lore.kernel.org/patchwork/patch/760701/

https://lkml.org/lkml/2011/2/18/310

https://lore.kernel.org/patchwork/patch/760699/

With the patches applied, I am able to build the module on x86_64 4.19.0 (Debian) using DKMS, and am able to run it without- in the short term at least- lockups.

With debugging messages, I can see that the code is running over the system call that should be writing to the parallel port (specifically, pulsing the strobe signal) but an attached logic analyzer shows nothing happening. I've tried running a slightly older version of the code on an old laptop with limited success.

This from https://github.com/torvalds/linux/blob/master/drivers/pps/generators/pps_gen_parport.c

    /* busy loop until the time is right for an assert edge */      do {          ktime_get_real_ts64(&ts2);      } while (expire_time.tv_sec == ts2.tv_sec && ts2.tv_nsec < lim);    // Debugging output here is successful        /* set the signal */      port = dev->pardev->port;      port->ops->write_control(port, SIGNAL); // Appears to have no effect    // Debugging output here is successful        /* busy loop until the time is right for a clear edge */      lim = NSEC_PER_SEC - dev->port_write_time;      do {          ktime_get_real_ts64(&ts2);      } while (expire_time.tv_sec == ts2.tv_sec && ts2.tv_nsec < lim);  

I've blacklisted the lp module so that pps_gen_parport can have exclusive access to the device, hence

# modprobe pps_gen_parport  # lsmod | grep par  pps_gen_parport        16384  0  parport_pc             32768  1  parport                57344  3 parport_pc,ppdev,pps_gen_parport    # dmesg -e  [ +11.585790] pps_gen_parport: parallel port PPS signal generator  [  +0.000133] pps_gen_parport: attached to parport0  [  +0.000049] pps_gen_parport: port write takes 1429ns  [Apr28 17:58] pps_gen_parport: we are late this time 1619629128.999968656  [Apr28 17:59] pps_gen_parport: we are late this time 1619629141.999983670  

The object of the exercise is to compare PPS output from the computer with PPS signals from other equipment, so that I can see what latency to assume when the computer is reporting timed input events.

It might just be that I've made some silly mistake with what modules should be in memory etc.

Is anybody sufficiently familiar with this area that they can make any suggestions?

How to specify multiple .pws and .prepl files in ASPELL_CONF?

Posted: 28 Apr 2021 09:40 AM PDT

I'm trying to configure aspell version 3.1.20 to use the $XDG_CONFIG_HOME/aspell/ directory instead of ~/.aspell. According the the Arch Wiki, one can do so by setting the ASPELL_CONF environment variable to something like

"per-conf $XDG_CONFIG_HOME/aspell/aspell.conf; personal $XDG_CONFIG_HOME/aspell/en.pws; repl $XDG_CONFIG_HOME/aspell/en.prepl"  

However, I'm Brazilian and I regurlarly use aspell to check spelling in both English and Portuguese. In other words, I need to specify multiple .pws and .prepl files (one for each language). I tried doing something along the lines of

export ASPELL_CONF="per-conf $XDG_CONFIG_HOME/aspell/aspell.conf; personal $XDG_CONFIG_HOME/aspell/en.pws; repl $XDG_CONFIG_HOME/aspell/en.prepl $XDG_CONFIG_HOME/aspell/pt_BR.pws; repl $XDG_CONFIG_HOME/aspell/pt_BR.prepl"  

but I'm getting the following error messages:

$ aspell -l pt_BR check doc.txt  Error: Expected language "pt_BR" but got "en".    $ aspell -l en check doc.txt  Error: Expected language "pt_BR" but got "en".  

How do I specify .pws and .prepl files for multiple languages?

Linux Mint 18.3 KDE black screen after booting when install Nvidia drivers

Posted: 28 Apr 2021 09:40 AM PDT

When I install nvidia drivers after second reboot my screen is black on SDDM (login manager).

Tried to add:

xrandr --setprovideroutputsource modesetting NVIDIA-0  xrandr --auto  

to file: /usr/share/sddm/scripts/Xsetup from here

  • Nvidia v384
  • GeForce GT 525M

How to fix Liquorix problems

Posted: 28 Apr 2021 09:32 AM PDT

I installed liquorix as a lubuntu kernel to improve the performance of the computer in tasks that require graphics processing, such as simulators or games, the problem is that you see lines like glitches when a graphic object is behind another, how can I solve this problem ?

Equipment details:

enter image description here

Error example:

enter image description here

Using user certificate to authenticate a mounted file system

Posted: 28 Apr 2021 09:07 AM PDT

I'm trying to figure out a way to mount a Windows shared drive to my CentOS machine using my user certificate to authenticate. Using Samba, I've succesfully set up the mount (fstab) using my username and password against the windows network, but would like to change it to use a X509 certificate instead.

I can't get ssh-server to start without prompting for my password [WSL2]

Posted: 28 Apr 2021 09:00 AM PDT

sorry if this question is stupid or something, I'm not very proficient in the Linux world. In fact, I've only come this long way because I want to use Valgrind in CLion on my Windows machine.

While trying to figure out how I can accomplish, I had to go over multiple steps, also involving setting up the ssh server in my WSL instance (Ubuntu 20.04.2 LTS). For that I found this very helpful walkthrough. However, I got stuck at

run the command sudo visudo

add the following line %sudo ALL=NOPASSWD: /usr/sbin/sshd after %sudo ALL=(ALL:ALL) ALL

You can test that you don't need a sudo password when you start ssh by running sudo service ssh --full-restart (if ssh is already running) or sudo service ssh start (if ssh is not running)

Problem is that whatever I do, I cannot get sudo service ssh --full-restart to work without prompting me for a password. I did try quite a lot of other things by now but nothing changes anything. This is what I've tried so far:

  • checking that the sudoers file actually contains that extra line after editing (it does)
  • go through this GitHub Gist
  • I found out that the gist is outdated for Ubuntu versions 18.04 and higher. So I looked at the updated gist and replaced /usr/sbin/sshd with /etc/init.d/ssh
  • I used wsl -t Ubuntu to stop the WSL instance and restarted it after editing to make sure it's not some kind of restart issue
  • Following this comment on the original gist, I checked the whitespace characters in my sudoers file and found out that everything used tabs, but my line had spaces. I replaced the spaces with a tab
  • I saw two posts on this StackExchange and browsed the answers, found barely anything new/helpful. I tried two things: Putting the new line at the bottom of the file and checking that sudo is not aliased

After all this research / troubleshooting, I just don't know what else I could be missing here. If anyone has an idea how I could get this to work, I'd be very thankful.

System:

  • Windows 10 Pro
  • WSL 2
  • Ubuntu 20.04.2 LTS

Calculating MAX nofiles and MAX nproc on Linux Servers

Posted: 28 Apr 2021 08:13 AM PDT

Is there any formula or basis that we can consider to calculate hard and soft limits for NPROC and NOFILE? My system is currently using 4096 for NOFILE which is the default value, and we recently had an issue with rsyslog because there were too many open files.

rsyslogd: imjournal: fopen() failed for path: '/var/lib/rsyslog/imjournal.state.tmp': Too many open files  

There is a way to increase the NOFILE in rsyslog to prevent this issue. However, regardless of this issue, is there a way we can use, like the amount of physical memory installed or total disk space or CPU counts, to calculate MAX NOFILE and NPROC for a system?

How to determine the cipher used from a binary blob

Posted: 28 Apr 2021 07:57 AM PDT

A client of mine uses a ReSI to manage remote control. I have never heard of ReSI and apperently it runs only with a windows client.

The configuration file (that we've got form the client) has an entry sshkey and I would like to extract that and convert it to OpenSSH format so that I can use the openSSH client.

I can see that the key is encoded in base64 and I extracted it into a file. file tells me this:

$ file enc_key  enc_key: openssl enc'd data with salted password, base64 encoded  

I decoded the base64 file and got a binary blob that starts with Salted__. I also used openssl enc with

$ openssl enc -in enc_key -d  -a -out enc_key.bin  Salted__....  

and I got the same binary blob and when I run file on it I get:

$ file enc_key.bin  enc_key.bin: openssl enc'd data with salted password  

I have the passphrase (our client sent me the passphrase in a separate email) but I'm still unable to decrypt the file even with the passphrase. I tried all supported ciphers:

for cipher in $(openssl enc -list | tail -n +2) ; do openssl enc ${cipher} -d -in enc_key.bin -pass "pass:<THE PASSPHASE>" ; done  

yields either an error messages or a binary blobs.

Is it possible to determine how this the data was encrypted in the first place, which cipher was used?

copy files from multiple remote machines to local and create directories for remote machines

Posted: 28 Apr 2021 08:16 AM PDT

Have multiple vm machines that am using for studying, and have come up with this script for copying some files from vm's to my local machine:

SG=rohos; date; for i in `cat /etc/hosts | grep "$SG-" | awk '{print $2}'` ;do echo "Logging into ${i}";ssh -i /root/.ssh/vm_private_key keyless-user@${i} "sudo mkdir -p /tmp/${SG}/${i}; sudo cp /var/some.log /tmp/${SG}/${i}/ ";done  

What could be changed in this script so that multiple typing of destination directories for mkdir and cp could be avoided? Or if you have a better tool like rsync or something else please enlighten me.


SG=rohos  date   for i in `cat /etc/hosts | grep "$SG-" | awk '{print $2}'`   do     echo "Logging into ${i}"    ssh -i /root/.ssh/vm_private_key keyless-user@${i} "sudo mkdir -p /tmp/${SG}/${i}; sudo cp /var/some.log /tmp/${SG}/${i}/ "  done  

Google Meet’s screen sharing don’t work for Firefox

Posted: 28 Apr 2021 07:18 AM PDT

Audio and video works fine, but when I try to share my screen people don't see it, it only happens for google meet. I tested zoom, and talky.io and they work fine.

I'm up to date with my system updates (yay -Syyu) I have an old laptop and tested the same thing and it works fine, I tried to go back to an older kernel but is the same issue.

inxi

System:    Kernel: 5.11.14-1-MANJARO x86_64 bits: 64 compiler: gcc v: 10.2.0     parameters: BOOT_IMAGE=/boot/vmlinuz-5.11-x86_64     root=UUID=27906bb8-3958-4a94-a688-4d11820a51e8 rw quiet apparmor=1     security=apparmor udev.log_priority=3     resume=UUID=27906bb8-3958-4a94-a688-4d11820a51e8 resume_offset=1949696     Desktop: KDE Plasma 5.21.4 tk: Qt 5.15.2 wm: kwin_x11 vt: 1 dm: SDDM     Distro: Manjaro Linux base: Arch Linux   Machine:    Type: Laptop System: LENOVO product: 82B1 v: Lenovo Legion 5 15ARH05H     serial: <filter> Chassis: type: 10 v: Lenovo Legion 5 15ARH05H     serial: <filter>     Mobo: LENOVO model: LNVNB161216 v: SDK0J40709 WIN serial: <filter>     UEFI: LENOVO v: FSCN14WW date: 08/26/2020   Battery:    ID-1: BAT0 charge: 61.2 Wh (100.0%) condition: 61.2/60.0 Wh (102.0%)     volts: 17.4 min: 15.4 model: Celxpert L19C4PC0 type: Li-poly     serial: <filter> status: Full cycles: 3   Memory:    RAM: total: 15.57 GiB used: 4.21 GiB (27.0%)     RAM Report: permissions: Unable to run dmidecode. Root privileges required.   CPU:    Info: 8-Core model: AMD Ryzen 7 4800H with Radeon Graphics bits: 64     type: MT MCP arch: Zen 2 family: 17 (23) model-id: 60 (96) stepping: 1     microcode: 8600104 cache: L2: 4 MiB bogomips: 92669     Speed: 1905 MHz min/max: 1400/2900 MHz boost: enabled Core speeds (MHz):     1: 1905 2: 3833 3: 1816 4: 1603 5: 3461 6: 1685 7: 2345 8: 2275 9: 2186     10: 1805 11: 2141 12: 3106 13: 1676 14: 1689 15: 1900 16: 1397     Flags: 3dnowprefetch abm adx aes aperfmperf apic arat avic avx avx2 bmi1     bmi2 bpext cat_l3 cdp_l3 clflush clflushopt clwb clzero cmov cmp_legacy     constant_tsc cpb cpuid cqm cqm_llc cqm_mbm_local cqm_mbm_total cqm_occup_llc     cr8_legacy cx16 cx8 de decodeassists extapic extd_apicid f16c flushbyasid     fma fpu fsgsbase fxsr fxsr_opt ht hw_pstate ibpb ibrs ibs irperf lahf_lm     lbrv lm mba mca mce misalignsse mmx mmxext monitor movbe msr mtrr mwaitx     nonstop_tsc nopl npt nrip_save nx osvw overflow_recov pae pat pausefilter     pclmulqdq pdpe1gb perfctr_core perfctr_llc perfctr_nb pfthreshold pge pni     popcnt pse pse36 rdpid rdpru rdrand rdseed rdt_a rdtscp rep_good sep sha_ni     skinit smap smca smep ssbd sse sse2 sse4_1 sse4_2 sse4a ssse3 stibp succor     svm svm_lock syscall tce topoext tsc tsc_scale umip v_vmsave_vmload vgif     vmcb_clean vme vmmcall wbnoinvd wdt xgetbv1 xsave xsavec xsaveerptr xsaveopt     xsaves     Vulnerabilities: Type: itlb_multihit status: Not affected     Type: l1tf status: Not affected     Type: mds status: Not affected     Type: meltdown status: Not affected     Type: spec_store_bypass     mitigation: Speculative Store Bypass disabled via prctl and seccomp     Type: spectre_v1     mitigation: usercopy/swapgs barriers and __user pointer sanitization     Type: spectre_v2 mitigation: Full AMD retpoline, IBPB: conditional, IBRS_FW,     STIBP: conditional, RSB filling     Type: srbds status: Not affected     Type: tsx_async_abort status: Not affected   Graphics:    Device-1: NVIDIA TU106M [GeForce RTX 2060 Mobile] vendor: Lenovo     driver: nvidia v: 460.67 alternate: nouveau,nvidia_drm bus-ID: 01:00.0     chip-ID: 10de:1f15 class-ID: 0300     Device-2: IMC Networks Integrated Camera type: USB driver: uvcvideo     bus-ID: 3-3:2 chip-ID: 13d3:56ff class-ID: 0e02     Display: x11 server: X.Org 1.20.11 compositor: kwin_x11 driver:     loaded: nvidia display-ID: :0 screens: 1     Screen-1: 0 s-res: 1920x1080 s-dpi: 143 s-size: 341x191mm (13.4x7.5")     s-diag: 391mm (15.4")     Monitor-1: DP-2 res: 1920x1080 hz: 144 dpi: 142 size: 344x193mm (13.5x7.6")     diag: 394mm (15.5")     OpenGL: renderer: GeForce RTX 2060/PCIe/SSE2 v: 4.6.0 NVIDIA 460.67     direct render: Yes   Audio:    Device-1: NVIDIA TU106 High Definition Audio driver: snd_hda_intel v: kernel     bus-ID: 01:00.1 chip-ID: 10de:10f9 class-ID: 0403     Device-2: AMD Raven/Raven2/FireFlight/Renoir Audio Processor vendor: Lenovo     driver: N/A alternate: snd_pci_acp3x, snd_rn_pci_acp3x bus-ID: 05:00.5     chip-ID: 1022:15e2 class-ID: 0480     Device-3: AMD Family 17h HD Audio vendor: Lenovo driver: snd_hda_intel     v: kernel bus-ID: 05:00.6 chip-ID: 1022:15e3 class-ID: 0403     Sound Server-1: ALSA v: k5.11.14-1-MANJARO running: yes     Sound Server-2: JACK v: 0.125.0 running: no     Sound Server-3: PulseAudio v: 14.2 running: yes     Sound Server-4: PipeWire v: 0.3.25 running: no   Network:    Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet     vendor: Lenovo driver: r8169 v: kernel port: 1000 bus-ID: 03:00.0     chip-ID: 10ec:8168 class-ID: 0200     IF: eno1 state: up speed: 100 Mbps duplex: full mac: <filter>     IP v4: <filter> type: dynamic noprefixroute scope: global     broadcast: <filter>     Device-2: Intel Wi-Fi 6 AX200 driver: iwlwifi v: kernel port: 1000     bus-ID: 04:00.0 chip-ID: 8086:2723 class-ID: 0280     IF: wlp4s0 state: down mac: <filter>     IF-ID-1: br-5326cefa0dd9 state: down mac: <filter>     IP v4: <filter> scope: global broadcast: <filter>     IF-ID-2: docker0 state: down mac: <filter>     IP v4: <filter> scope: global broadcast: <filter>     WAN IP: <filter>   Bluetooth:    Device-1: Intel AX200 Bluetooth type: USB driver: btusb v: 0.8 bus-ID: 5-3:3     chip-ID: 8087:0029 class-ID: e001     Report: rfkill ID: hci0 rfk-id: 3 state: down bt-service: enabled,running     rfk-block: hardware: no software: yes address: see --recommends   Logical:    Message: No logical block device data found.   RAID:    Message: No RAID data found.   Drives:    Local Storage: total: 1.38 TiB used: 39.02 GiB (2.8%)     SMART Message: Unable to run smartctl. Root privileges required.     ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: SK Hynix model: HFS512GD9TNI-L2A0B     size: 476.94 GiB block-size: physical: 512 B logical: 512 B speed: 31.6 Gb/s     lanes: 4 rotation: SSD serial: <filter> rev: 11010C10 temp: 32.9 C     scheme: GPT     ID-2: /dev/sda maj-min: 8:0 vendor: PNY model: CS900 1TB SSD     size: 931.51 GiB block-size: physical: 512 B logical: 512 B speed: 6.0 Gb/s     rotation: SSD serial: <filter> rev: 0613 scheme: GPT     Message: No optical or floppy data found.   Partition:    ID-1: / raw-size: 131.44 GiB size: 128.31 GiB (97.62%)     used: 38.99 GiB (30.4%) fs: ext4 dev: /dev/sda2 maj-min: 8:2 label: N/A     uuid: 27906bb8-3958-4a94-a688-4d11820a51e8     ID-2: /boot/efi raw-size: 260 MiB size: 256 MiB (98.46%)     used: 28.6 MiB (11.2%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1     label: SYSTEM_DRV uuid: 14DE-10F9   Swap:    Kernel: swappiness: 60 (default) cache-pressure: 100 (default)     ID-1: swap-1 type: file size: 16 GiB used: 0 KiB (0.0%) priority: -2     file: /swapfile   Unmounted:    ID-1: /dev/nvme0n1p2 maj-min: 259:2 size: 16 MiB fs: <superuser required>     label: N/A uuid: N/A     ID-2: /dev/nvme0n1p3 maj-min: 259:3 size: 475.69 GiB fs: ntfs     label: Windows-SSD uuid: A652DE9752DE6B95     ID-3: /dev/nvme0n1p4 maj-min: 259:4 size: 1000 MiB fs: ntfs label: WINRE_DRV     uuid: F440DF6D40DF34D8     ID-4: /dev/sda1 maj-min: 8:1 size: 16 MiB fs: <superuser required>     label: N/A uuid: N/A     ID-5: /dev/sda3 maj-min: 8:3 size: 800.06 GiB fs: ntfs label: Data     uuid: 42F2D6CAF2D6C179   USB:    Hub-1: 1-0:1 info: Full speed (or root) Hub ports: 2 rev: 2.0     speed: 480 Mb/s chip-ID: 1d6b:0002 class-ID: 0900     Hub-2: 2-0:1 info: Full speed (or root) Hub ports: 4 rev: 3.1 speed: 10 Gb/s     chip-ID: 1d6b:0003 class-ID: 0900     Hub-3: 3-0:1 info: Full speed (or root) Hub ports: 4 rev: 2.0     speed: 480 Mb/s chip-ID: 1d6b:0002 class-ID: 0900     Device-1: 3-3:2 info: IMC Networks Integrated Camera type: Video     driver: uvcvideo interfaces: 2 rev: 2.0 speed: 480 Mb/s power: 500mA     chip-ID: 13d3:56ff class-ID: 0e02     Hub-4: 4-0:1 info: Full speed (or root) Hub ports: 2 rev: 3.1 speed: 10 Gb/s     chip-ID: 1d6b:0003 class-ID: 0900     Hub-5: 5-0:1 info: Full speed (or root) Hub ports: 4 rev: 2.0     speed: 480 Mb/s chip-ID: 1d6b:0002 class-ID: 0900     Hub-6: 5-1:2 info: Genesys Logic Hub ports: 2 rev: 2.1 speed: 480 Mb/s     chip-ID: 05e3:0610 class-ID: 0900     Device-1: 5-1.1:4 info: Logitech G203 Gaming Mouse type: Mouse,HID     driver: hid-generic,usbhid interfaces: 2 rev: 2.0 speed: 12 Mb/s     power: 300mA chip-ID: 046d:c084 class-ID: 0300 serial: <filter>     Device-2: 5-3:3 info: Intel AX200 Bluetooth type: Bluetooth driver: btusb     interfaces: 2 rev: 2.0 speed: 12 Mb/s power: 100mA chip-ID: 8087:0029     class-ID: e001     Device-3: 5-4:5 info: Integrated Express ITE Device(8910) type: Keyboard     driver: hid-generic,usbhid interfaces: 1 rev: 2.0 speed: 12 Mb/s     power: 100mA chip-ID: 048d:c100 class-ID: 0301     Hub-7: 6-0:1 info: Full speed (or root) Hub ports: 2 rev: 3.1 speed: 10 Gb/s     chip-ID: 1d6b:0003 class-ID: 0900     Hub-8: 6-1:2 info: Genesys Logic USB3.2 Hub ports: 2 rev: 3.2 speed: 5 Gb/s     chip-ID: 05e3:0620 class-ID: 0900   Sensors:    System Temperatures: cpu: 50.5 C mobo: 0 C gpu: nvidia temp: 42 C     Fan Speeds (RPM): N/A   Info:    Processes: 343 Uptime: 26m wakeups: 1 Init: systemd v: 247 tool: systemctl     Compilers: gcc: 10.2.0 Packages: pacman: 1260 lib: 322 flatpak: 0     Shell: Bash v: 5.1.0 running-in: yakuake inxi: 3.3.04```  

Unshrink text permanently in Libreoffice

Posted: 28 Apr 2021 09:28 AM PDT

When I use LibreOffice Calc in Ubuntu 20.04, I am not able to expand a paragraph so that it looks always like this :

enter image description here

Instead, it always looks like this with the little arrow on the right :

enter image description here

How can I fix that?

How to recollect network information from Ubunto to use it on Freebsd?

Posted: 28 Apr 2021 07:32 AM PDT

FreeBSD and other BSD systems, required certain network information at installation time, like if I will use a DHCP server, or the IP address, subnet mask, IP address of default gateway, domain name of the network, IP addresses of the network's DNS servers, etc.

When I install Ubuntu, I do not need to provide this information: in some way, Ubuntu recollect that data and use it, given the impression that the system "just works". I understand that under the hood Ubuntu just automatize something that the BSD developers thought it will be enough to just ask the user. But because I do not know this information beforehand, I will like to know where Ubuntu store this information, so I can use it to install FreeBSD on the same machine that now I have Ubuntu.

What I want to do is to move to FreeBSD (currently, I'm using it inside a VirtualBox inside Ubuntu), but I hit that wall.

I hope someone can point me in the right direction

Rename multiple files in multiple subdirectories using for loop

Posted: 28 Apr 2021 06:23 AM PDT

I am trying to rename files with the same names in different subdirectories using for loop.They should be renamed according to the name of subdirectory.

Subdirectory1/File.txt  Subdirectory2/File.txt  

should look like

Subdirectory1/Subdirectory1.txt  Subdirectory2/Subdirectory2.txt  

I tried many commands and I am getting different errors. The last command, which I found on forum also doesn't work. Can somebody help me?

dir="Subdirectory1, Subdirectory2"  declare -i count=1 for file in "$dir"/*.txt; do  mv "$file" "${dir}/${dir} ${count}.txt"  count+=1  done  

After running this, I get:

mv: cannot stat '/*/*.txt': No such file or directory  

How can I group by the country in column two and then sort by the resulting sum?

Posted: 28 Apr 2021 09:24 AM PDT

I have the file like:

1   UA  2   GB  3   UA  3   UA  2   US  1   UA  4   US   

How can I group by the second column and sum by the first one? So the output should be like:

8 UA    6 US  2 GB  

Cannot umount USB drive because it's "not mounted" despite being able to list its content

Posted: 28 Apr 2021 06:19 AM PDT

I've connected external USB drive to my raspberry pi.

sudo lsblk -o UUID,NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL,MODEL    UUID                                 NAME        FSTYPE   SIZE MOUNTPOINT LABEL  MODEL                                       sda                931.5G                   SAMSUNG_HD103SJ  2d895223-03fe-422c-8266-2542b8f19787 └─sda1      ext4   931.5G                                       mmcblk0             14.4G  9F2D-0578                            ├─mmcblk0p1 vfat     256M /boot      boot  efc2ea8b-042f-47f5-953e-577d8860de55 └─mmcblk0p2 ext4    14.2G /          rootfs  

Than I've mounted it as follow:

sudo mount /dev/sda1 /mnt/samsung  

The ls /mnt/samsung gives me the sample.jpg file inside listed.

Right after I've tried to do sudo umount /mnt/samsung but I got error:

umount: /mnt/samsung: not mounted.  

How is that possible?

I've also changed ownership of mnt/samsung with chown www-data:www-data because I need access to this disk from my PHP script.

I can see files there, but they appear to be... local? When I remove the disk, content of mnt/samsung is still there... all the files.

I tried to reboot after adding this line to /etc/fstab with no result:

UUID=2d895223-03fe-422c-8266-2542b8f19787 /mnt/samsung ext4 defaults,auto,nofail,umask=000,allow_$  

the mount command returns:

/dev/mmcblk0p2 on / type ext4 (rw,noatime)  devtmpfs on /dev type devtmpfs (rw,relatime,size=1873872k,nr_inodes=117736,mode=755)  sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)  proc on /proc type proc (rw,relatime)  securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)  tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)  devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)  tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)  tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)  tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)  cgroup2 on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)  cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,name=systemd)  bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)  cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)  cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)  cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)  cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls)  cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)  cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)  cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)  cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)  systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=27,pgrp=1,timeout=0,minproto=5,maxproto=5,direct)  mqueue on /dev/mqueue type mqueue (rw,relatime)  sunrpc on /run/rpc_pipefs type rpc_pipefs (rw,relatime)  debugfs on /sys/kernel/debug type debugfs (rw,relatime)  configfs on /sys/kernel/config type configfs (rw,relatime)  /dev/mmcblk0p1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)  tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=401192k,mode=700,uid=1000,gid=1000)  

rm: cannot remove 'x' : Directory not empty [closed]

Posted: 28 Apr 2021 09:14 AM PDT

As on "cannot remove 'some_directory': Directory not empty", I had issues when deleting files. This happened on an external NTFS-partition, but could have happened on any other partition.

A process that very likely triggers problems when creating or deleting directories from scripts, is an active onedrive client. You can verify this with the 'lsof' command. The onedrive client is busy suncing changes at the moment you want to delete something.

Solution: wait or turn-off onedrive sync.

Apache logs: how many different IPs per day with sed or awk?

Posted: 28 Apr 2021 07:11 AM PDT

Given a file /var/log/apache2/other_vhosts_access.log like this:

example.com:443 1.1.1.1 - - [25/Jan/2021:12:00:00 +0000] "GET /abc/def/ghi?token=jklm12 HTTP/1.1" 200 1000 "-" "Mozilla/5.0 (Macintosh; Intel...  example.com:443 1.1.1.1 - - [25/Jan/2021:12:10:00 +0000] "GET /abc/def/ghi?token=jklm12 HTTP/1.1" 200 1000 "-" "Mozilla/5.0 (Macintosh; Intel...  example.com:443 2.2.2.2 - - [25/Jan/2021:12:20:00 +0000] "GET /abc/def/ghi?token=jklm13 HTTP/1.1" 200 1000 "-" "Mozilla/5.0 (Macintosh; Intel...  ...  example.com:443 33.33.33.33 - - [12/Apr/2021:12:00:00 +0000] "GET /abc/def/ghi?token=jklm14 HTTP/1.1" 200 1000 "-" "Mozilla/5.0 (Macintosh; Intel...  example.com:443 4.4.4.4 - - [13/Apr/2021:12:00:00 +0000] "GET /abc/def/ghi?token=jklm12 HTTP/1.1" 200 1000 "-" "Mozilla/5.0 (Macintosh; Intel...  

how to get (or count the number of) the distinct IPs per day?

Example:

 25/Jan/2021       1.1.1.1       2.2.2.2   12/Apr/2021       33.33.33.33   13/Apr/2021       4.4.4.4  

or

 25/Jan/2021  2   12/Apr/2021  1   13/Apr/2021  1  

How to do the "group by day"?

How to debug a .desktop file?

Posted: 28 Apr 2021 07:36 AM PDT

I've installed Gnome Boxes, Gnome Builder and Peek through flatpak, and when I click the app in the aplication menu, they don't start.
And I don't know why, so I just looked at the .desktop in /var/lib/flatpak/exports/share/applications file and change Terminal=true but it does not show any terminal.
Then I tried to run the Exec parameter in terminal, and it works fine, no errors.
And finally I remove all flags in Exec but still does nothing
Anyone that has this same issue? Any solution?
Or at least someone knows how to debug a .desktop file?

Gnome Boxes

[Desktop Entry]  Name=Boxes  GenericName=Virtual machine viewer/manager  Comment=View and use virtual machines  Keywords=virtual machine;vm;  Exec=/usr/bin/flatpak run org.gnome.Boxes @@u %U @@  Icon=org.gnome.Boxes  Terminal=true  Type=Application  StartupNotify=true  Categories=GNOME;GTK;System;Development;Emulator;  MimeType=application/x-cd-image;  DBusActivatable=true  X-Flatpak=org.gnome.Boxes  

Gnome Builder

[Desktop Entry]  Name=Builder  Comment=Build software for GNOME  Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=gnome-builder --file-forwarding org.gnome.Builder @@u %U @@  Icon=org.gnome.Builder  DBusActivatable=true  StartupNotify=true  Terminal=false  Type=Application  Categories=GNOME;GTK;Development;IDE;  Keywords=Build;Develop;  MimeType=text/x-c;text/x-csrc;text/x-changelog;text/x-chdr;text/x-c++hdr;text/x-python;application/x-python;application/javascript;application/x-javascript;text/x-javascript;text/javascript;text/x-js;text/x-shellscript;application/x-shellscript;text/x-sh;text/x-vala;text/x-makefile;text/x-c++;text/x-cpp;text/x-c++src;text/css;application/x-gnome-app-info;application/x-desktop;text/x-go;text/html;text/x-markdown;application/json;application/x-m4;application/xml;text/xml;application/x-yaml;text/x-sql;application/x-ruby;text/x-ruby;text/x-pkg-config;text/x-lua;text/x-php;application/x-php;text/x-php-source;application/x-php-source;text/x-perl;application/x-perl;  X-Flatpak-RenamedFrom=gnome-builder;  Actions=new-window;create-project;clone-repo;new-editor;dspy;  X-Flatpak=org.gnome.Builder    [Desktop Action new-window]  Name=Open a Project  Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=gnome-builder org.gnome.Builder --greeter    [Desktop Action create-project]  Name=Start New Project  Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=gnome-builder org.gnome.Builder --create-project    [Desktop Action clone-repo]  Name=Clone Repository  Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=gnome-builder org.gnome.Builder --clone    [Desktop Action new-editor]  Name=New Editor Workspace  Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=gnome-builder org.gnome.Builder --editor    [Desktop Action dspy]  Name=D-Bus Inspector  Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=gnome-builder org.gnome.Builder --dspy  

Peek

[Desktop Entry]  Name=Peek  Exec=/usr/bin/flatpak run com.uploadedlobster.peek @@u %U @@  GenericName=Animated GIF recorder  Comment=Record short animated GIF images from your screen  Keywords=screencast;screen recorder;screen capture;GIF;WebM;APNG;  Icon=com.uploadedlobster.peek  Type=Application  Categories=GTK;GNOME;Graphics;2DGraphics;AudioVideo;Video;Recorder;  StartupNotify=true  Terminal=true  DBusActivatable=true  X-Flatpak=com.uploadedlobster.peek  

Basic OS info

Distro: Void Linux (musl)  Architecture: x64  DE: Gnome 40 (with Wayland)  

agnoster theme: time in color

Posted: 28 Apr 2021 06:44 AM PDT

I'm using agnoster theme: [![enter image description here][1]][1]

and I was wondering how to color time in a different color of username.

At the moment, my prompt_context() function from agnoster.theme.sh file is like that:

prompt_context() {  local user=`whoami`    if [[ $user == $DEFAULT_USER || $user != $DEFAULT_USER || -n $SSH_CLIENT ]]; then          # green is the color of background          # white is the color of foreground                prompt_segment green white "[\A] $user@\h "       fi  

}

The problem is the colors are the same for my username and for time.

I've already tried things like that:

prompt_segment green white " ${red green [\A]}$user@\h "  

But it doesn't work. I've had a look at this too: https://github.com/ohmybash/oh-my-bash/blob/master/themes/agnoster/agnoster.theme.sh#L156-L178 but I'm a bit lost.

Does anyone have an idea?

Process states in OS theory vs in Linux

Posted: 28 Apr 2021 06:42 AM PDT

I'm trying to map Linux process state codes (as in ps) to states in the OS state diagram but I can't seem to map them. Is it because Linux process states don't necessarily match the theoretical OS state diagram? Specifically, I am unsure where D/S/T/I fit in the diagram.

  • ps process state codes from the man page:

    PROCESS STATE CODES         Here are the different values that the s, stat and state output         specifiers (header "STAT" or "S") will display to describe the         state of a process:                   D    uninterruptible sleep (usually IO)                 I    Idle kernel thread                 R    running or runnable (on run queue)                 S    interruptible sleep (waiting for an event to                      complete)                 T    stopped by job control signal                 t    stopped by debugger during the tracing                 W    paging (not valid since the 2.6.xx kernel)                 X    dead (should never be seen)                 Z    defunct ("zombie") process, terminated but not                      reaped by its parent  
  • OS process state diagram from Wikipedia: enter image description here

Similar to Does "stopped" belong to "blocked" state? but the answer is pretty incomplete.

How to configure nullmailer on a home computer to use yahoo as relay host?

Posted: 28 Apr 2021 06:50 AM PDT

I would like to start using nullmailer (version 1:2.2-3, according to dpkg-query) to forward to my personal Yahoo address any emails generated by programs (notably cron) running on my home desktop computer (Debian buster).

My home desktop computer connects to the internet through an ISP (Xfinity), and does not have a FQDN. In other words, when I run hostname --fqdn on it, the output is a string containing no periods. (For the purposes of this question, let's say that this output is simply, XXMYBOXXX1.)

Therefore, I would like to configure nullmailer to send all outgoing mail through an external relay host, namely smtp.mail.yahoo.com.

Here's what I've tried so far (without success).

I left the /etc/nullmailer/adminaddr and /etc/nullmailer/defaultdomain files empty, and put the following in the /etc/remotes file (modulo some redactions in all-caps, and leading and trailing XX)2:

smtp.mail.yahoo.com smtp --auth-login --port=465 --ssl --user=XXXMEXXX@yahoo.com --pass=XXXPASSWDXXX --insecure  

...although I have tried many variations. In particular, I have changed --ssl to --tls, and I have tried both of these settings with and without the --insecure flag.

The next listing shows the ownerships and permissions for all the configuration files I have for nullmailer:

drwxr-xr-x 2 root root 4096 Apr 26 07:39 /etc/nullmailer/  -rw-r--r-- 1 root root    0 Apr 26 07:48 /etc/nullmailer/adminaddr  -rw-r--r-- 1 root root    0 Apr 26 07:46 /etc/nullmailer/defaultdomain  -rw------- 1 mail mail  115 Apr 26 08:11 /etc/nullmailer/remotes  

As I said earlier, all the various nullmailer configurations I have attempted have failed. Here is a typical example of what this failure looks like. If I attempt to send a message to a test address using the following command

echo 'some text' | /usr/bin/mail -s 'some subject' XXTESTXX@XXMAILSVCXX.com  

...I get nothing at XXTESTXX@XXMAILSVCXX.com (nor at XXXMEXXX@yahoo.com, for that matter), and the following lines get added to XXMYBOXXX's /var/log/mail.log:

Apr 26 09:01:33 XXMYBOXXX nullmailer: Trigger pulled.  Apr 26 09:01:33 XXMYBOXXX nullmailer: Rescanning queue.  Apr 26 09:01:33 XXMYBOXXX nullmailer: Starting delivery, 1 message(s) in queue.  Apr 26 09:01:33 XXMYBOXXX nullmailer: Starting delivery: host: smtp.mail.yahoo.com protocol: smtp file: 1619438493.9195  Apr 26 09:01:33 XXMYBOXXX nullmailer: From: <root@XXMYBOXXX> to: <XXTESTXX@XXMAILSVCXX.com>  Apr 26 09:01:33 XXMYBOXXX nullmailer: Message-Id: <1619438493.951858.9194.nullmailer@XXMYBOXXX>  Apr 26 09:01:35 XXMYBOXXX nullmailer: smtp: Failed: 550 Request failed; Mailbox unavailable  Apr 26 09:01:35 XXMYBOXXX nullmailer: Sending failed: Permanent error in sending the message  Apr 26 09:01:35 XXMYBOXXX nullmailer: Moving message 1619438493.9195 into failed  Apr 26 09:01:35 XXMYBOXXX nullmailer: Generating bounce for 1619438493.9195  Apr 26 09:01:36 XXMYBOXXX nullmailer: Delivery complete, 0 message(s) remain.  Apr 26 09:01:36 XXMYBOXXX nullmailer: Trigger pulled.  Apr 26 09:01:36 XXMYBOXXX nullmailer: Rescanning queue.  Apr 26 09:01:36 XXMYBOXXX nullmailer: Starting delivery, 1 message(s) in queue.  Apr 26 09:01:36 XXMYBOXXX nullmailer: Starting delivery: host: smtp.mail.yahoo.com protocol: smtp file: 1619438495.9198  Apr 26 09:01:36 XXMYBOXXX nullmailer: From: <> to: <root@XXMYBOXXX>  Apr 26 09:01:36 XXMYBOXXX nullmailer: Message-Id: <1619438496.000360.9199.nullmailer@XXMYBOXXX>  Apr 26 09:01:37 XXMYBOXXX nullmailer: smtp: Failed: 550 Request failed; Mailbox unavailable  Apr 26 09:01:37 XXMYBOXXX nullmailer: Sending failed: Permanent error in sending the message  Apr 26 09:01:37 XXMYBOXXX nullmailer: Moving message 1619438495.9198 into failed  Apr 26 09:01:37 XXMYBOXXX nullmailer: Not generating double bounce for 1619438495.9198  Apr 26 09:01:37 XXMYBOXXX nullmailer: Delivery complete, 0 message(s) remain.  

How must I change my nullmailer configuration so that the mail command above will work?


Distro info:

% uname -ar  Linux debug-3 4.19.0-16-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64 GNU/Linux  

1 Apologies for this obnoxious pseudonym. It was largely dictated by the pattern I used to indicate redactions throughtout this post.

2 The value I actually use for the --pass flag is an "app password" generated by https://login.yahoo.com/myaccount/security for an "app" called "nullmailer".

Can't install apt-transport-https on Debian 9 stretch due to unmet dependencies: apt (>= 1.5~alpha4)

Posted: 28 Apr 2021 10:02 AM PDT

I have a Dockerfile which is built in a CI/CD pipeline. It starts with a Drupal image based on Debian 9 stretch and installs Node 10. Building the image has worked for the past three years but it just stopped working yesterday.

To reproduce the issue I can run the container without any of the instructions from the Dockerfile:

docker run -it drupal:8.6.1-apache bash  

Then in the container I run this script which should install Node 10:

curl -fsSL https://deb.nodesource.com/setup_10.x | bash -  

The script fails when trying to install apt-transport-https. If I try to install it directly so I can see the error I get:

apt-get update && apt-get install -y apt-transport-https  ...  Some packages could not be installed. This may mean that you have  requested an impossible situation or if you are using the unstable  distribution that some required packages have not yet been created  or been moved out of Incoming.  The following information may help to resolve the situation:    The following packages have unmet dependencies:   apt-transport-https : Depends: apt (>= 1.5~alpha4) but 1.4.8 is to be installed  E: Unable to correct problems, you have held broken packages.  

If I try to run this to install that specific version:

apt-get install -y apt=1.5~alpha4  ...  E: Version '1.5~alpha4' for 'apt' was not found  

If I run this to see the list of available versions of apt:

apt list -a apt  ...  apt/stable-updates 1.8.2.3 amd64 [upgradable from: 1.4.8]  apt/stable,stable 1.8.2.2 amd64  apt/oldstable 1.4.11 amd64  apt/oldstable 1.4.10 amd64  apt/now 1.4.8 amd64 [installed,upgradable to: 1.8.2.3]  

Then if I:

apt-get install -y apt=1.8.2.3  ...  The following packages have unmet dependencies:   apt : Depends: libapt-pkg5.0 (>= 1.7.0~alpha3~) but 1.4.8 is to be installed         Depends: libgnutls30 (>= 3.6.6) but 3.5.8-5+deb9u5 is to be installed  E: Unable to correct problems, you have held broken packages.  

Then if I try to install the required version of libapt-pkg5.0:

The following packages have unmet dependencies:   libapt-pkg5.0 : Depends: libc6 (>= 2.27) but 2.24-11+deb9u4 is to be installed                   Depends: libzstd1 (>= 1.3.2) but 1.1.2-1+deb9u1 is to be installed                   Breaks: apt (< 1.6~) but 1.4.8 is to be installed                   Recommends: apt (>= 1.8.2.3) but 1.4.8 is to be installed  

Then if I run:

apt-get install -y libzstd1=1.3.8+dfsg-3+deb10u2 # this seems to install fine  apt-get install -y libc6=2.28-10  

The libc6 installation fails with:

Reading package lists... 0%  Reading package lists... Done  Building dependency tree  Reading state information... Done  The following package was automatically installed and is no longer required:    linux-libc-dev  Use 'apt autoremove' to remove it.  Suggested packages:    glibc-doc libc-l10n locales  Recommended packages:    libidn2-0  The following packages will be upgraded:    libc6  1 upgraded, 0 newly installed, 0 to remove and 57 not upgraded.  Need to get 2867 kB of archives.  After this operation, 1693 kB of additional disk space will be used.  Get:1 http://deb.debian.org/debian buster/main amd64 libc6 amd64 2.28-10 [2867 kB]  Fetched 2867 kB in 1s (1858 kB/s)  debconf: delaying package configuration, since apt-utils is not installed  dpkg: warning: 'ldconfig' not found in PATH or not executable  dpkg: error: 1 expected program not found in PATH or not executable  Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin  E: Sub-process /usr/bin/dpkg returned an error code (2)  

At this point I've spent hours troubleshooting this issue and I'm wondering if it's worth it to keep going in this direction or if there is another way to resolve this.

I was able to satisfy all the dependencies using aptitude in a fresh container like this:

apt-get update  apt-get install -y aptitude  aptitude install apt-transport-https    

It asks me:

The following NEW packages will be installed:    apt-transport-https libseccomp2{a}  The following packages will be upgraded:    apt{b} libapt-pkg5.0{b}  2 packages upgraded, 2 newly installed, 0 to remove and 59 not upgraded.  Need to get 2575 kB of archives. After unpacking 1189 kB will be used.  The following packages have unmet dependencies:   apt : Depends: libgnutls30 (>= 3.6.6) but 3.5.8-5+deb9u3 is installed and it is kept back         Breaks: aptitude (< 0.8.10) but 0.8.7-1 is installed   libapt-pkg5.0 : Depends: libc6 (>= 2.27) but 2.24-11+deb9u3 is installed and it is kept back                   Depends: libzstd1 (>= 1.3.2) but it is not going to be installed                   Breaks: aptitude (< 0.8.9) but 0.8.7-1 is installed  The following actions will resolve these dependencies:         Keep the following packages at their current version:  1)     apt [1.4.8 (now)]  2)     apt-transport-https [Not Installed]  3)     libapt-pkg5.0 [1.4.8 (now)]        Accept this solution? [Y/n/q/?]  

This solution does nothing but if I enter n it then asks me:

The following actions will resolve these dependencies:          Install the following packages:  1)      libboost-iostreams1.67.0 [1.67.0-13+deb10u1 (stable)]  2)      libboost-system1.67.0 [1.67.0-13+deb10u1 (stable)]  3)      libgpm2 [1.20.4-6.2+b1 (oldstable)]  4)      libncursesw6 [6.1+20181013-2+deb10u2 (stable)]  5)      libtinfo6 [6.1+20181013-2+deb10u2 (stable)]  6)      libunistring2 [0.9.10-1 (stable)]  7)      libzstd1 [1.3.8+dfsg-3+deb10u2 (stable)]          Upgrade the following packages:  8)      aptitude [0.8.7-1 (now, oldstable) -> 0.8.11-7 (stable)]  9)      aptitude-common [0.8.7-1 (now, oldstable) -> 0.8.11-7 (stable)]  10)     libc-bin [2.24-11+deb9u3 (now) -> 2.28-10 (stable)]  11)     libc-dev-bin [2.24-11+deb9u3 (now) -> 2.28-10 (stable)]  12)     libc6 [2.24-11+deb9u3 (now) -> 2.28-10 (stable)]  13)     libc6-dev [2.24-11+deb9u3 (now) -> 2.28-10 (stable)]  14)     libcwidget3v5 [0.5.17-4+b1 (now, oldstable) -> 0.5.17-11 (stable)]  15)     libgnutls30 [3.5.8-5+deb9u3 (now) -> 3.6.7-4+deb10u4 (stable)]  16)     libhogweed4 [3.3-1+b2 (now, oldstable) -> 3.4.1-1 (stable)]  17)     libidn2-0 [0.16-1+deb9u1 (now, oldstable) -> 2.0.5-1+deb10u1 (stable)]  18)     libnettle6 [3.3-1+b2 (now, oldstable) -> 3.4.1-1 (stable)]  19)     libp11-kit0 [0.23.3-2 (now, oldstable) -> 0.23.15-2+deb10u1 (stable)]  20)     libtasn1-6 [4.10-1.1+deb9u1 (now, oldstable) -> 4.13-3 (stable)]  21)     libxapian30 [1.4.3-2+deb9u3 (now, oldstable) -> 1.4.11-1 (stable)]    Accept this solution? [Y/n/q/?]  

Accepting this solution works - apt-transport-https is successfully installed and then I am able to run the curl -fsSL https://deb.nodesource.com/setup_10.x | bash - script to install Node. However, this is an interactive solution which requires me to enter n once, then y twice, and I couldn't figure out a way to have that happen automatically during a Docker build.

Error no matching VNC server running for this user

Posted: 28 Apr 2021 09:34 AM PDT

guys, I'm running Kali Nethunter but when I try to run it in graphical mode by running the command kex & I have this error:

vncserver: No matching VNC server running for this user!  

Does anyone know how I can solve this?

What are the correct permissions for a systemd .service?

Posted: 28 Apr 2021 07:01 AM PDT

I need to create a service for a web server called daphne I would like to know what are the correct linux permissions for this. or if exists a general rule for whatever systemd service?

airmon-ng start wlan0 problems

Posted: 28 Apr 2021 08:03 AM PDT

I was trying to aircrack-ng, but the problem everytime I

airmon-ng start wlan0  

prism0 shows up not mon0. What to do?

root@kali:~# airmon-ng start wlan0  PHY Interface Driver Chipset  phy0 wlan0 wl Broadcom Corporation BCM43142 802.11b/g/n (rev 01)      (experimental wl monitor mode vif enabled for [phy0]wlan0 on [phy0]prism0)  

Unable to perform file operations on a MTP device mounted via GVFS: "Operation not supported"

Posted: 28 Apr 2021 08:05 AM PDT

I am running Linux Mint 17.1 64-bit (based on Ubuntu 14.04). Ever since upgrading from Linux Mint 14/Ubuntu 12.10, the Python script I use to sync music to my Walkman has stopped working.

Previously, when I mounted my Walkman, it would automatically show up as the path /run/user/1000/gvfs/WALKMAN/Storage Media and would work like any other file system: I could copy tracks to it, delete tracks from it, etc, all through Python. However, I can't remember if I had to make any changes to get this to happen.

Since upgrading to Linux Mint 17 (and now 17.1), when I mount the Walkman, it shows up as the path /run/user/1000/gvfs/mtp:host=%5Busb%3A002%2C007%5D/Storage Media. Furthermore, when I try to run the same file operations, they now fail. I have discovered that this happens not just through Python, but on the command line as well. For example:

david@MILTON:~$ cp '/data/Music/10SecsWhiteNoise.mp3' '/run/user/1000/gvfs/mtp:host=%5Busb%3A002%2C006%5D/Storage Media/MUSIC'  cp: cannot create regular file '/run/user/1000/gvfs/mtp:host=%5Busb%3A002%2C006%5D/Storage Media/MUSIC/10SecsWhiteNoise.mp3': Operation not supported  

I have done some research on this problem, but the most common explanation seems to be that it was formerly solved by this PPA: https://launchpad.net/~langdalepl/+archive/ubuntu/gvfs-mtp

But now, Ubuntu versions since 13.10 contain all these changes so it should no longer be necessary. So why am I still having these errors? I am still able to do file operations on my Walkman through a graphical file manager (Caja, on Linux Mint), just not via the command line.

Thruk installation "failed to open socket"

Posted: 28 Apr 2021 09:22 AM PDT

I am extremely confused, and Google isn't really helping. Also, I'm kind of a Linux novice. I've taken a couple of classes, but that was all about how to configure things in a basic Linux setup. I'm now trying to learn how to set things up to actually use. At work we use Nagios/Thruk so I'm trying to set it up on my home network so I can learn it better.

I set up a CentOS 6.6 machine. I've installed Nagios on it, and that's working fine. Now I'm trying to set up Thruk. I've managed to get livestatus and Thruk installed, but I'm stuck at getting it to actually work. In the documentation it shows that I'm supposed to add these two lines to the /usr/local/nagios/etc/nagios.cfg file:

broker_module=/usr/local/lib/mk-livestatus/livestatus.o /var/lib/nagios/rw/live  event_broker_options=-1  

the event_broker_options=-1 line already existed, so I added the other line above it. In some examples, it is shown as this instead:

broker_module=/usr/local/lib/mk-livestatus/livestatus.o /tmp/live.sock  event_broker_options=-1  

I've tried both, and I cannot seem to get this to work. I've done all the basics I can think of. I've reinstalled and updated all of the components (nagios, livestatus, thruk), I've reloaded and restarted all service associated a billion times. When the line I added is in there, Nagios starts when I tell it to start, but it then stops immediately. When I go into the /usr/local/nagios/var/nagios.log file, I see the following lines whenever I try to start Nagios and it fails:

Error: Could not load module '/usr/local/lib/mk-livestatus/livestatus.o' -> /usr/local/lib/mk-livestatus/livestatus.o: undefined symbol: last_command_check  Error: Failde to load module '/usr/local/lib/mk-livestatus/livestatus.o' .  Error: Module loading failed. Aborting.  

If I comment out the line I added to the nagios.cfg file, Nagios will load and work properly, but Thruk still isn't working properly. If I load the Thruk page, I get this:

No Backend available  None of the configured Backends could be reached, please have a look at the logfile for detailed information and make sure the core is up and running.  Details:  home-net: ERROR: failed to open socket /tmp/live.sock: No such file or directory (/tmp/live.sock)  

It appears to me to be something wrong with livestatus, but I don't understand it well enough to fix it on my own and I'm having a lot of difficulty finding (or maybe understanding) the answer anywhere. From what I understood, I thought the nagios.cfg file was supposed to configure the live.sock file. Is that not correct? I'm doing my best, but I need some help.

Use here-document in a one-liner?

Posted: 28 Apr 2021 08:58 AM PDT

I have a simple script that executes commands on remote host using ssh and a here-document.

I was trying to do it with a one-liner at command line but I couldn't figure out how to do the here-document outside of a script. Is it possible? I spent some time googling and reading documentation about here-documents, but it wasn't coming to me.

This script works fine - I needed the here-document section in order to run awk remotely via ssh but I usually like to do one-liners for simple stuff:

#!/bin/bash  # it looks up all my hosts with 'db' in the name  # then gets the PID of any rsyncs running as user 'research'  # and pumps them into xargs    getHosts=(`curl --silent "http://assetts.lab/all_hosts" | grep -v ^# | awk -F" " '{print$1}'|grep db`)  for BOX in ${getHosts[@]};do      echo "$BOX: "      ssh -T sshUser@$BOX <<"EOF"  ps -ef | egrep "rsync|iasync" | awk -F" " '{if ($1 ~ "research") print $2}'|sudo xargs -i ps -fp '{}'  #ps -ef | egrep "rsync|iasync" | awk -F" " '{if ($1 ~ "research") print $2}'|sudo xargs -i kill '{}'  EOF      echo  done  

I'm probably missing something simple... Anyway thanks for any suggestions :)

Scheduling command/script by specifying the exact second

Posted: 28 Apr 2021 07:46 AM PDT

I'm using bash and wondering how I can execute a command/script at a later specified time, with the accuracy of a second?

I read the man page for the at-command, but as far as I could understand it's only possible specify minutes (and not seconds). Right now I first use at and then sleep to get it to execute the right second. To demonstrate, if I would like to run my_script.sh at 22.21.05 I would do:

echo "sleep 5; my_script.sh" | at 22.21  

But it would be much nicer to have a command with it built in. Something like at 22.21.05.

No comments:

Post a Comment