Monday, August 30, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


How to use curl to access a webpage behind a login form?

Posted: 30 Aug 2021 10:19 AM PDT

There is this webpage I'm trying to scrape but it is behind a login form that needs user/password.
I used Firefox debug mode to find HTTP requests. Upon entering the credentials, there is a POST request which return a set-cookie in Response Headers. There is subsequent GET that uses this cookie (instead of user/pass) to finally access the actual page.

I want to fetch that cookie via curl in command line.
I tried to replicate what Firefox did with Copy as cURL command on POST. It forms the curl request (with user/pass inside a --data-raw switch and a short ASP.NET_SessionId inside a -H 'Cookie: ....
Problem is, it does not return any headers. The returned HTTP website indicated something went wrong.
Now, in forming up the --data-raw, there are fields like __VIEWSTATE, __VIEWSTATEGENERATOR and __EVENTVALIDATION which seem to change on each GET of the login page. I filled them up via a little scrpting. It didn't fix the issue.

I'm using the copied curl command from firefox alongside -c cookie.txt -D - -v ...It does not print the cookie in headers or dump the cookie in the file.

is there a way to download all of the DNS records from PowerDNS?

Posted: 30 Aug 2021 10:15 AM PDT

Is there a way to download all of the DNS records from PowerDNS? I don't even know how the records are stored.

How to remove lines from the files based on key values in a different file

Posted: 30 Aug 2021 10:20 AM PDT

I have a file1:

1   a   aa  2   b   bb  3   a   aa  4   b   bb  5   a   aa  6   b   bb  7   a   aa  8   b   bb  

and file2:

1  2  5  

I need to delete all lines in from file1 where values in column1 are found in file2

start rabbitmq-server ERROR

Posted: 30 Aug 2021 09:48 AM PDT

I tried starting rabbitmq-server when installing rabbitmq on Ubuntu and i get the following Error: Job for rabbitmq-server.service failed because the control process exited with error code. See "systemctl status rabbitmq-server.service" and "journalctl -xe" for details.

rabbitmq-server.service - RabbitMQ Messaging Server Loaded: loaded (/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: enabled) Active: activating (auto-restart) (Result: exit-code) since Mon 2021-08-30 18:31:15 CEST; 5s ago Process: 89134 ExecStart=/usr/sbin/rabbitmq-server (code=exited, status=1/FAILURE) Main PID: 89134 (code=exited, status=1/FAILURE)

I already tried rm /var/lib/rabbitmq/.erlang.cookie, but permission was denied. Restaring doesn't work too. I would really appreciate it, if you could help me solve this problem :)

Why the value of PRI is different in ps and top?

Posted: 30 Aug 2021 10:04 AM PDT

nginx PID is 19910

  1. The value is 19 in ps -eo pri

     ps -eo pid,ppid,ni,pri,psr,pcpu,stat,cmd |head -n1;ps -eo pid,ppid,ni,pri,psr,pcpu,stat,cmd |grep nginx     PID  PPID  NI PRI PSR %CPU STAT CMD   19910     1   0  19   0  0.0 Ss   nginx: master process /usr/sbin/nginx   19911 19910   0  19   2  0.0 S    nginx: worker process   19912 19910   0  19   1  0.0 S    nginx: worker process   19914 19910   0  19   1  0.0 S    nginx: worker process   19915 19910   0  19   0  0.0 S    nginx: worker process  
  2. The value is 80 in ps -elf

     ps -elf |head -n1;ps -elf |grep nginx   F S UID        PID  PPID  C PRI  NI ADDR SZ WCHAN  STIME TTY          TIME CMD   5 S root     19910     1  0  80   0 - 21487 sigsus Jul29 ?        00:00:00 nginx: master process /usr/sbin/nginx   5 S www-data 19911 19910  0  80   0 - 21576 ep_pol Jul29 ?        00:01:55 nginx: worker process   5 S www-data 19912 19910  0  80   0 - 21576 ep_pol Jul29 ?        00:02:05 nginx: worker process   5 S www-data 19914 19910  0  80   0 - 21576 ep_pol Jul29 ?        00:02:00 nginx: worker process   5 S www-data 19915 19910  0  80   0 - 21576 ep_pol Jul29 ?        00:02:08 nginx: worker process  
  3. The value is 20 in top -b -n 1 -p

     top -b -n 1 -p 19910                                 top - 09:57:13 up 435 days, 19 min,  2 users,  load average: 0.00, 0.00, 0.00   Tasks:   1 total,   0 running,   1 sleeping,   0 stopped,   0 zombie   %Cpu(s):  0.1 us,  0.1 sy,  0.0 ni, 99.9 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st   KiB Mem:   8175360 total,  4617480 used,  3557880 free,   167444 buffers   KiB Swap:  8384508 total,    10408 used,  8374100 free.  3955108 cached Mem       PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND   19910 root      20   0   85948   2944   1784 S   0.0  0.0   0:00.00 nginx  

My question is as follows:

  1. Why the output is totally different in two different ps command?
  2. What's the difference of PRI between ps and top?

I'll appreciate if anyone can explain it to me.

PPP null modem Raspberry Pi to Windows 10

Posted: 30 Aug 2021 09:22 AM PDT

I have successfully setup a PPP connection between a Raspberry Pi 3B (Raspbian Buster) and Ubuntu (20.03.2 LTS). I would like to do the same between Raspberry PI and Windows 10. The serial connection is done using a Silicon Labs CP210x USB to UART Bridge.

On the Raspberry PI I run: sudo pppd /dev/ttyS0 57600 10.0.5.2:10.0.5.1 local noauth debug nodetach dump nocrtscts persist maxfail 0 holdoff 1 On Ubuntu I run: sudo pppd /dev/ttyS0 57600 10.0.5.1:10.0.5.2 proxyarp local noauth debug nodetach dump nocrtscts passive persist maxfail 0 holdoff 1 The works well and I am able to ping from both sides and I'm using mqtt to pass data between the two.

I used the following instructions to setup a Windows 10 laptop instead of a Ubuntu laptop. But it fails with error 777.

Configuring Windows Dial Up Networking

Installing and configuring a PPP null-modem connection

Does anybody have instructions for the Linux to Windows PPP null modem that works.

error: Malformed line 1 in source list /etc/apt/sources.list.d/ugene-ubuntu-ugene.list (type)

Posted: 30 Aug 2021 09:42 AM PDT

0

I am working in a linux terminal, debian 10, python3. I am attempting to install pip3. Whenever i type any command, i recive the following error: Malformed line 1 in source list /etc/apt/sources.list.d/ugene-ubuntu-ugene.list (type)

This error occurs with every command, eg. sudo apt update command generates this error. I have tried deleting and reinstalling the ugene repository, and the error persists. If any one has any idea how to solve this error i would be very grateful.

How to split partition /dev/sda on Ubuntu

Posted: 30 Aug 2021 09:26 AM PDT

I'm figuring how can I split partition of /dev/sda1/ into /dev/sda1 and /dev/sda2 of my Ubuntu virtual box.

Right now, every time I create a new instance of Virtual Server with vagrant, I allocated 40GB of disk space to it and all of the disk spaces is alloted to /dev/sda1

I need a way to split /dev/sda1 partition into 2 with terminal (remote ssh).

So what I've tried so far is

// Step 1  root@server-1:~# fdisk /dev/sda    // Step 2 Delete sda1  Welcome to fdisk (util-linux 2.34).  Changes will remain in memory only, until you decide to write them.  Be careful before using the write command.    Command (m for help): d  Selected partition 1  Partition 1 has been deleted.    // Step 3 Create 2 new Partition  Command (m for help): n  Partition type     p   primary (0 primary, 0 extended, 4 free)     e   extended (container for logical partitions)  Select (default p):p  Partition number (1-4, default 1):  First sector (2048-83886079, default 2048):  Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-83886079, default 83886079): 61440000    Created a new partition 1 of type 'Linux' and of size 29.3 GiB.  Partition #1 contains a ext4 signature.    Do you want to remove the signature? [Y]es/[N]o: N  Command (m for help): n  Partition type     p   primary (1 primary, 0 extended, 3 free)     e   extended (container for logical partitions)  Select (default p): p  Partition number (2-4, default 2):  First sector (61440001-83886079, default 61442048):  Last sector, +/-sectors or +/-size{K,M,G,T,P} (61442048-83886079, default 83886079):    Created a new partition 2 of type 'Linux' and of size 10.7 GiB.    // Step 4 and last step is write it to disk  Command (m for help): w  

So this way works as I want, but if I ran a fsck on /dev/sda1 I get an invalid checksum on the filesystem and whenever I rebooted the vm, the SSH refused to connect. It didn't even respond.

Is what I do correct ? is the partition corrupted ? is there any way to fix it ?

System stuck with "Fixing recursive fault, reboot is required"

Posted: 30 Aug 2021 08:34 AM PDT

I have recently installed Mint 20.2 on my Lenovo G50-80 . Sometimes when I shutdown , system get stuck with below screen and i have to long press power button to shutdown. It seems the issue has to do with radeon graphics. I have integrated intel graphics . I have had issues with radeon driver in earlier Mint version as well and I think only Intel graphics is being used. screen

inxi -Fxxxz  System:    Kernel: 5.4.0-81-generic x86_64 bits: 64 compiler: gcc v: 9.3.0 Desktop: Cinnamon 5.0.5 wm: muffin 5.0.1              dm: LightDM 1.30.0 Distro: Linux Mint 20.2 Uma base: Ubuntu 20.04 focal   Machine:   Type: Laptop System: LENOVO product: 80E5 v: Lenovo G50-80 serial: <filter> Chassis: type: 10 v: Lenovo G50-80              serial: <filter>              Mobo: LENOVO model: Lenovo G50-80 v: NO DPK serial: <filter> UEFI: LENOVO v: B0CN97WW date: 01/08/2016   Battery:   ID-1: BAT0 charge: 23.0 Wh condition: 23.0/37.6 Wh (61%) volts: 16.3/14.4 model: Lenovo IdeaPad type: Unknown              serial: <filter> status: Full   CPU:       Topology: Dual Core model: Intel Core i5-5200U bits: 64 type: MT MCP arch: Broadwell rev: 4 L2 cache: 3072 KiB              flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 17558              Speed: 1329 MHz min/max: 500/2700 MHz Core speeds (MHz): 1: 864 2: 973 3: 884 4: 1125   Graphics:  Device-1: Intel HD Graphics 5500 vendor: Lenovo driver: i915 v: kernel bus ID: 00:02.0 chip ID: 8086:1616              Device-2: AMD Sun XT [Radeon HD 8670A/8670M/8690M / R5 M330 / M430 / Radeon 520 Mobile] vendor: Lenovo              driver: radeon v: kernel bus ID: 04:00.0 chip ID: 1002:6660              Display: x11 server: X.Org 1.20.11 driver: ati,modesetting,radeon unloaded: fbdev,vesa resolution: 1366x768~60Hz              OpenGL: renderer: Mesa Intel HD Graphics 5500 (BDW GT2) v: 4.6 Mesa 21.0.3 direct render: Yes   Audio:     Device-1: Intel Broadwell-U Audio vendor: Lenovo driver: snd_hda_intel v: kernel bus ID: 00:03.0 chip ID: 8086:160c              Device-2: Intel Wildcat Point-LP High Definition Audio vendor: Lenovo driver: snd_hda_intel v: kernel              bus ID: 00:1b.0 chip ID: 8086:9ca0              Sound Server: ALSA v: k5.4.0-81-generic   Network:   Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: Lenovo driver: r8169 v: kernel port: 4000              bus ID: 02:00.0 chip ID: 10ec:8168              IF: enp2s0 state: down mac: <filter>              Device-2: Intel Wireless 3160 driver: iwlwifi v: kernel port: 4000 bus ID: 03:00.0 chip ID: 8086:08b4              IF: wlp3s0 state: up mac: <filter>              IF-ID-1: virbr0 state: down mac: <filter>              IF-ID-2: virbr0-nic state: down mac: <filter>   Drives:    Local Storage: total: 931.51 GiB used: 390.99 GiB (42.0%)              ID-1: /dev/sda vendor: Western Digital model: WD10JPCX-24UE4T0 size: 931.51 GiB speed: 6.0 Gb/s rotation: 5400 rpm              serial: <filter> rev: 1A01 scheme: MBR   Partition: ID-1: / size: 91.17 GiB used: 32.19 GiB (35.3%) fs: ext4 dev: /dev/sda5              ID-2: /home size: 809.06 GiB used: 358.79 GiB (44.3%) fs: ext4 dev: /dev/sda7              ID-3: swap-1 size: 14.90 GiB used: 0 KiB (0.0%) fs: swap dev: /dev/sda6   Sensors:   System Temperatures: cpu: 47.0 C mobo: N/A gpu: radeon temp: 40 C              Fan Speeds (RPM): N/A   

When I went through journalctl of the shutdown I see the below errors and warns

journalctl -rb -1  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: Fixing recursive fault but reboot is needed!  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: CR2: 00007f0d38f1e29c CR3: 000000011ee0a004 CR4: 00000000003606e0  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: FS:  0000000000000000(0000) GS:ffff9df316b80000(0000) knlGS:0000000000000000  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: R13: ffff9df30391c000 R14: ffff9df304d32800 R15: ffff9df304d32848  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: R10: ffff9df308c48600 R11: 0000000000000001 R12: ffff9df30391c000  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: RBP: ffffc24b823f7d28 R08: 0000000000000000 R09: ffffffffc0194100  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: RDX: ffff9df30b4f8000 RSI: ffff9df304d32800 RDI: ffff9df304d32820  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: RAX: 0000000000000000 RBX: ffff9df304d32800 RCX: 0000000000000000  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: RSP: 0018:ffffc24b823f7cf0 EFLAGS: 00010246  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: Code: 50 02 00 00 49 8d b7 50 02 00 00 48 39 c6 0f 85 fa fe ff ff 49 8d 7f 68 e8 c1 f3 cd ff e9 f7 fe ff ff 48 8b 43 48 4c 8d >  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: RIP: 0010:radeon_vm_fini+0x16c/0x250 [radeon]  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: ---[ end trace 6e19a400c1111ea8 ]---  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: CR2: 0000000000000000  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel:  serio_raw mac_hid acpi_pad sch_fq_codel msr parport_pc ppdev lp parport ip_tables x_tables autofs4 btrfs xor zstd_compress ra>  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: Modules linked in: rfcomm xt_CHECKSUM xt_MASQUERADE xt_conntrack ipt_REJECT nf_reject_ipv4 xt_tcpudp ip6table_mangle ip6table_>  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: R13: 00000000000008c0 R14: 00007f0d39028fc8 R15: 0000000000000000  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: R10: 00007f0d399c0eb0 R11: 0000000000003246 R12: 00007f0d39025610  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: RBP: 0000000000000000 R08: 00000000000000e7 R09: fffffffffffffc80  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: RDX: 0000000000000000 RSI: 000000000000003c RDI: 0000000000000000  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel:  serio_raw mac_hid acpi_pad sch_fq_codel msr parport_pc ppdev lp parport ip_tables x_tables autofs4 btrfs xor zstd_compress ra>  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: Modules linked in: rfcomm xt_CHECKSUM xt_MASQUERADE xt_conntrack ipt_REJECT nf_reject_ipv4 xt_tcpudp ip6table_mangle ip6table_>  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: R13: 00000000000008c0 R14: 00007f0d39028fc8 R15: 0000000000000000  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: R10: 00007f0d399c0eb0 R11: 0000000000003246 R12: 00007f0d39025610  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: RBP: 0000000000000000 R08: 00000000000000e7 R09: fffffffffffffc80  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: RDX: 0000000000000000 RSI: 000000000000003c RDI: 0000000000000000  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: RAX: ffffffffffffffda RBX: 00007f0d39025610 RCX: 00007f0d38f1e2c6  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: RSP: 002b:00007ffd90d58af8 EFLAGS: 00003246 ORIG_RAX: 00000000000000e7  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: Code: Bad RIP value.  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: RIP: 0033:0x7f0d38f1e2c6  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel:  entry_SYSCALL_64_after_hwframe+0x44/0xa9  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel:  do_syscall_64+0x57/0x190  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel:  __x64_sys_exit_group+0x18/0x20  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel:  do_group_exit+0x47/0xb0  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel:  do_exit+0x36e/0xaf0  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel:  task_work_run+0x8f/0xb0  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel:  ____fput+0xe/0x10  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel:  __fput+0xcc/0x260  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel:  drm_release+0xa5/0xe0 [drm]  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel:  drm_file_free.part.0+0x1d2/0x270 [drm]  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel:  radeon_driver_postclose_kms+0x1cc/0x1f0 [radeon]  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: Call Trace:  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: CR2: 0000000000000000 CR3: 000000011ee0a004 CR4: 00000000003606e0  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: FS:  0000000000000000(0000) GS:ffff9df316b80000(0000) knlGS:0000000000000000  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: R13: ffff9df30391c000 R14: ffff9df304d32800 R15: ffff9df304d32848  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: R10: ffff9df308c48600 R11: 0000000000000001 R12: ffff9df30391c000  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: RBP: ffffc24b823f7d28 R08: 0000000000000000 R09: ffffffffc0194100  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: RDX: ffff9df30b4f8000 RSI: ffff9df304d32800 RDI: ffff9df304d32820  Aug 30 02:02:00 raj-Lenovo-G50-80 kernel: RAX: 0000000000000000 RBX: ffff9df3  

I do see some errors on screen when I boot up my machine but havent faced any issues and not sure if its related

dmesg --level=err,warn  [    0.141485] MDS CPU bug present and SMT on, data leak possible. See https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/mds.html for more details.  [    0.141485]  #3  [    0.145500] ENERGY_PERF_BIAS: Set to 'normal', was 'performance'  [    0.210801] ACPI BIOS Error (bug): Could not resolve symbol [\_SB.PCI0.GFX0._DSM.ECR1], AE_NOT_FOUND (20190816/psargs-330)  [    0.210824] No Local Variables are initialized for Method [_DSM]  [    0.210825] Initialized Arguments for Method [_DSM]:  (4 arguments defined for method invocation)  [    0.210826]   Arg0:   000000008a71e6f3 <Obj>           Buffer(16) D0 37 C9 E5 53 35 7A 4D  [    0.210831]   Arg1:   000000002acc75b8 <Obj>           Integer 0000000000000003  [    0.210834]   Arg2:   00000000a3aca129 <Obj>           Integer 0000000000000009  [    0.210836]   Arg3:   00000000a9841925 <Obj>           Package 00000000a9841925  [    0.210839] ACPI Error: Aborting method \_SB.PCI0.GFX0._DSM due to previous error (AE_NOT_FOUND) (20190816/psparse-529)  [    0.261924] pci 0000:00:14.0: can't derive routing for PCI INT A  [    0.261926] pci 0000:00:14.0: PCI INT A: no GSI - using ISA IRQ 7  [    0.536001] DMAR: Failed to find handle for ACPI object \_SB.PCI0.SDMA  [    0.536008] DMAR: Failed to find handle for ACPI object \_SB.PCI0.SDHC  [    0.585677] xhci_hcd 0000:00:14.0: can't derive routing for PCI INT A  [    0.585679] xhci_hcd 0000:00:14.0: PCI INT A: no GSI - using ISA IRQ 7  [    0.607413] platform eisa.0: EISA: Cannot allocate resource for mainboard  [    0.607414] platform eisa.0: Cannot allocate resource for EISA slot 1  [    0.607415] platform eisa.0: Cannot allocate resource for EISA slot 2  [    0.607416] platform eisa.0: Cannot allocate resource for EISA slot 3  [    0.607417] platform eisa.0: Cannot allocate resource for EISA slot 4  [    0.607418] platform eisa.0: Cannot allocate resource for EISA slot 5  [    0.607419] platform eisa.0: Cannot allocate resource for EISA slot 6  [    0.607420] platform eisa.0: Cannot allocate resource for EISA slot 7  [    0.607421] platform eisa.0: Cannot allocate resource for EISA slot 8  [    0.659511] ACPI BIOS Error (bug): Could not resolve symbol [\_SB.PCI0.GFX0._DSM.ECR1], AE_NOT_FOUND (20190816/psargs-330)  [    0.659560] No Local Variables are initialized for Method [_DSM]  [    0.659562] Initialized Arguments for Method [_DSM]:  (4 arguments defined for method invocation)  [    0.659563]   Arg0:   0000000076b917d5 <Obj>           Buffer(16) D0 37 C9 E5 53 35 7A 4D  [    0.659569]   Arg1:   0000000073cc9cf8 <Obj>           Integer 0000000000000002  [    0.659572]   Arg2:   00000000bd3a6fbf <Obj>           Integer 0000000000000000  [    0.659575]   Arg3:   0000000092f18021 <Obj>           Package 0000000092f18021  [    0.659579] ACPI Error: Aborting method \_SB.PCI0.GFX0._DSM due to previous error (AE_NOT_FOUND) (20190816/psparse-529)  [    0.824668] r8169 0000:02:00.0: can't disable ASPM; OS doesn't have ASPM control  [    0.900342] ATPX version 1, functions 0x00000033  [    0.900596] ATPX Hybrid Graphics  [    0.945041] ACPI BIOS Error (bug): Could not resolve symbol [\_SB.PCI0.GFX0._DSM.ECR1], AE_NOT_FOUND (20190816/psargs-330)  [    0.945054] No Local Variables are initialized for Method [_DSM]  [    0.945055] Initialized Arguments for Method [_DSM]:  (4 arguments defined for method invocation)  [    0.945056]   Arg0:   000000008a37f7e1 <Obj>           Buffer(16) D3 73 D8 7E D0 C2 4F 4E  [    0.945063]   Arg1:   00000000811550e4 <Obj>           Integer 0000000000000001  [    0.945065]   Arg2:   0000000016f862df <Obj>           Integer 0000000000000000  [    0.945067]   Arg3:   0000000074fa87cf <Obj>           Package 0000000074fa87cf  [    0.945071] ACPI Error: Aborting method \_SB.PCI0.GFX0._DSM due to previous error (AE_NOT_FOUND) (20190816/psparse-529)  [    1.207485] ATPX version 1, functions 0x00000033  [    1.207628] ATPX Hybrid Graphics  [    1.207700] CRAT table not found  [   17.207058] systemd-journald[348]: File /var/log/journal/dafd9a61376b4676aa8b190bc1ed4b43/system.journal corrupted or uncleanly shut down, renaming and replacing.  [   21.333654] Bluetooth: hci0: unexpected event for opcode 0xfc2f  [   31.154088] kauditd_printk_skb: 16 callbacks suppressed  [   40.575043] vboxdrv: loading out-of-tree module taints kernel.  [   40.675280] VBoxNetFlt: Successfully started.  [   40.767639] VBoxNetAdp: Successfully started.  [   41.050390] Started bpfilter  [   53.930097] systemd-journald[348]: File /var/log/journal/dafd9a61376b4676aa8b190bc1ed4b43/user-1000.journal corrupted or uncleanly shut down, renaming and replacing.  

I have seen few such issues but none of them had a solution. I am considering trying kernel update to 5.8 or disabling radeon as the last step. Everything except this random shutdown issue works pretty well so any suggestion to fix this bug would be welcome.

Are there any other standard ways of bringing network interfaces up at boot, apart from using /etc/network/interfaces?

Posted: 30 Aug 2021 08:25 AM PDT

I'm working with a Yocto based embedded system and I want all external network interfaces to default to being disabled at boot.

Normally, I'd assume that they go up at boot because /etc/network/interfaces has an auto <INTERFACE_NAME> line in it but that doesn't seem to be the case. In fact, there is no mention of the interfaces in question there. I've searched far and wide for the culprit responsible for turning those interfaces off but I'm running out of ideas.

Are there any other standard tools which could be bringing network interfaces up at boot?

When connected to Wifi I am unable to ping directly connected computer

Posted: 30 Aug 2021 10:14 AM PDT

I'm running the latest version of Pop! Os.

I have a laptop connected to my main computer via an ethernet cable.

The laptop IP is 169.254.83.40 and my main computer IP is 169.254.83.50 on the connected interface. My wifi interface is 192.168.0.20 on the main computer.

When I am connected to wifi and I attempt to ping my laptop from my main computer I get the following.

    PING 169.254.83.40 (169.254.83.40) 56(84) bytes of data.      From 192.168.0.20 icmp_seq=1 Destination Host Unreachable      From 192.168.0.20 icmp_seq=2 Destination Host Unreachable      From 192.168.0.20 icmp_seq=3 Destination Host Unreachable  

When disconnected from wifi I can ping successfully. Below is my output from ifconfig.

    enp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500      inet 192.168.0.20  netmask 255.255.255.0  broadcast 192.168.0.255      ether e8:4e:06:7d:d7:8f  txqueuelen 1000  (Ethernet)      RX packets 38305  bytes 36156135 (36.1 MB)      RX errors 0  dropped 1  overruns 0  frame 0      TX packets 26255  bytes 3680006 (3.6 MB)      TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0        enp4s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500      inet 169.254.83.50  netmask 255.0.0.0  broadcast 169.255.255.255      ether a8:a1:59:2b:6c:ee  txqueuelen 1000  (Ethernet)      RX packets 1294  bytes 87685 (87.6 KB)      RX errors 0  dropped 0  overruns 0  frame 0      TX packets 1818  bytes 121833 (121.8 KB)      TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0        lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536      inet 127.0.0.1  netmask 255.0.0.0      inet6 ::1  prefixlen 128  scopeid 0x10<host>      loop  txqueuelen 1000  (Local Loopback)      RX packets 12029  bytes 1257930 (1.2 MB)      RX errors 0  dropped 0  overruns 0  frame 0      TX packets 12029  bytes 1257930 (1.2 MB)      TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0    netstat -nr  Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface  0.0.0.0         192.168.0.1     0.0.0.0         UG        0 0          0 enp3s0  0.0.0.0         169.254.83.50   0.0.0.0         UG        0 0          0 enp4s0  169.0.0.0       0.0.0.0         255.0.0.0       U         0 0          0 enp4s0  169.0.0.0       169.254.83.50   255.0.0.0       UG        0 0          0 enp4s0  169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 enp3s0  192.168.0.0     0.0.0.0         255.255.255.0   U         0 0          0 enp3s0  

How to use multiple variable in bash

Posted: 30 Aug 2021 08:45 AM PDT

I have a file (user.txt) with the below content with 90+ users

  • example file content
    user: Ronaldo  id:7  endpoint:manutd.com  user: Messi  id:30  endpoint:psg.com  user: Neymar  id:10  endpoint:psg.com  
  • desired output:
    Ronaldo is in manutd.com and wears no 7  Messi is in psg.com and wears no 30  .  .  
    and so on for all the users

How can I print this way via a Bash script?

Show month of a file's creation (Grouping files by quadrant of creation)

Posted: 30 Aug 2021 10:02 AM PDT

I'm trying to group files by the quadrant of their creation. What I'm trying to do is determine when a file was created - for example, if I had a file that looks like this:

-rwxr-xr-x 1 root wheel 208 Aug 30 16:24 q.sh

I'd like the output to be nothing but the month it was created - in this case, 8.

Once I figure this value out, I can toss it into a simple case statement which will sort it - currently I came up with this:

#FILE_DATE would be the value I figure out above  case $FILE_DATE in   [1-3])          echo "Quadrant 1"          ;;  [4-6])          echo "Quadrant 2"          ;;  [7-9])          echo "Quadrant 3"          ;;  [10-12])          echo "Quadrant 4"          ;;  esac  

I've tried using the stat command, as well as filtering output of ls, but have not figured out how to do this reliably.

Any help would be greatly appreciated.

Thanks!

Keeping two folders in sync with rsync

Posted: 30 Aug 2021 08:51 AM PDT

I have two external drives. One of the drives is named "drive2" and it contains a folder named "Music." This folder has the following structure:

drive2/      /Music/             Pink Floyd/                        1982 - Album Name/                                          01 - Track.flac                                          02 - Track2.flac                                          and so on..  

So, because of the folder hierarchy I guess I need a recursive sync.

I need the entire Music folder from drive2 to be copied to drive1. I think I can use something like this:

rsync -av drive2/Music/ drive1/Music/  

However, there are situations when I modify the metadata of certain songs. Those metadata modifications are small like changing the title of the album, and those modification don't necessarily change the size of the FLAC files, but their md5 fingerprint definitely changes because of altering the metadata. Right?

I noticed that when I use rsync -a, the rsync utility notices the metadata changes of FLAC files on drive2 and updates the files on drive1 as well to be in sync. Only the changed files gets transferred, which is exactly the behaviour I want. It seems to me that the -a (archive) flag implies the -u which tells to only update changed files.

However, I'm curious when rsync transfers the files that got their metadata updated, does the old files get overwritten completely on drive1? I mean they are replaced completely? Are the old files removed before the new ones are copied?

Merge sorted files on 2 columns

Posted: 30 Aug 2021 08:14 AM PDT

I want to merge some pre-sorted tab-delimited files:

  • file bygroup.0:
    ancient-american    mercury 1   164  ancient-american    mh25    2   8717664  ancient-neolith tk11    262 40074321970  ancientdna  jk21    6936    17069206689  ancientdna  rm20    11267   372606702813  ancientgen  ab34    1573    27800468142  ancientgen  dg11    3516    45081427920  ancientgen  fa8 7179    462396221983  ancientgen  mp15    41  10248223517  ancientgen  mp18    254 1049351143  ancientgen  rm20    15100   1565340401  ancientgen  tc9 1695    89861489631  
  • file bygroup.2:
    ancient-american    mercury 1   160  ancient-american    mh25    2   10362712888  ancient-neolith tk11    264 43842268110  ancientdna  jk21    6919    16379509855  ancientdna  rm20    11268   324906365415  ancientgen  ab34    1577    33947364202  ancientgen  dg11    3518    48092138390  ancientgen  fa8 7174    472364587220  ancientgen  mp15    39  32487920045  ancientgen  mp18    254 1058177852  ancientgen  rm20    15104   998615135  ancientgen  tc9 1692    94858351562  

You can see the 2 files have the same number of lines, and are in the same order based on columns 1 and 2, and the entries in those columns are the same.

Now I want to merge them so that all the lines with the same values in the first 2 columns are output sequentially.

I thought sort -m would be all I'd need, but:

$ sort -m bygroup.*  ancient-american    mercury 1   160  ancient-american    mercury 1   164  ancient-american    mh25    2   10362712888  ancient-american    mh25    2   8717664  ancient-neolith tk11    262 40074321970  ancientdna  jk21    6936    17069206689  ancientdna  rm20    11267   372606702813  ancientgen  ab34    1573    27800468142  ancientgen  dg11    3516    45081427920  ancientgen  fa8 7179    462396221983  ancientgen  mp15    41  10248223517  ancientgen  mp18    254 1049351143  ancientgen  rm20    15100   1565340401  ancientgen  tc9 1695    89861489631  ancient-neolith tk11    264 43842268110  ancientdna  jk21    6919    16379509855  ancientdna  rm20    11268   324906365415  ancientgen  ab34    1577    33947364202  ancientgen  dg11    3518    48092138390  ancientgen  fa8 7174    472364587220  ancientgen  mp15    39  32487920045  ancientgen  mp18    254 1058177852  ancientgen  rm20    15104   998615135  ancientgen  tc9 1692    94858351562  

(I get the same results with other options I added, eg. sort -k 1,2 -ifm.)

It does what I expected for ancient-american, but not for the others. What's going on, and is there another fast and efficient way of doing this without resorting to a full sort (sort works without the -m here).

Alternative to sed -i that does not write temporary files

Posted: 30 Aug 2021 09:10 AM PDT

I have several scripts that edit template text files, by removing a "tag" and replacing it with e.g. a number. To do this I use the

sed -i  

command. However, I have an issue with write/read times on the server where I execute the scripts, making the scripts take a long time to run, since the sed -i command writes a temporary file to disk for every execution.

Is there an alternative approach that I could use, where a temporary file is not written to disk for every single replacement? Can the text file be edited in the memory and only written once all the replacements have been executed, or could I stack several replacements into the same sed command?

To clarify, the script is of the following form:

input=shiftLeft.txt  while IFS= read -r line  do      sed -i "s/install, element = $line, at=/install, element = $line, at= -0.001 +/g" processedFiles/layoutDB.seq  done < "$input"  

That is, I read values from one text file, and then I do some changes in another text file depending on these values. This is done repeatedly for a large number of values.

Unable to mount cloned compact flash after using dd to clone bootable compact flash

Posted: 30 Aug 2021 08:42 AM PDT

I'm trying to clone a bootable 1GB compactflash to a second 1GB complactflash, but when I try to mount it, i get an error like so,

sudo mount /dev/sdb1 /media/frank/cloned/

frank@ThinkPad2:~$ sudo mount /dev/sdb1 /media/frank/cloned/  mount: /media/frank/cloned: wrong fs type, bad option, bad superblock on /dev/sdb1,   missing codepage or helper program, or other error.  

I'm using a single USB CF drive and swapping the original and target CF. It seems to be copying everything, even down to the UUID (not sure if this is bad), but I'm unable to mount the cloned CF, or explore it. Below are the steps I'm taking.

The CF I'm cloning is ext3. When I stick the card in the drive it mounts automatically and shows up as **/dev/sdb1 mounted in /media/frank/c44c8412-bf87-4fa4-a6fa-8259aa78bd24 **

I formatted the target CF with the command mkfs.ext3 /dev/sdb1

Then copied form the original CF using dd if=dev/sdb1 of=/home/frank/CFdisk.image

To check that the image was good: mount -o loop CFdisk.image /media/frank/compactflash

Then.. ls /media/frank/compactflash

frank@ThinkPad2:~$ ls /media/frank/compactflash/   bin   etc    lib         mnt    proc  sbin   sys  var  boot  fifos  lost+found  opt    root  share  tmp  vmcores   dev   home   media       overlay  run   srv    usr www  

So it looks like the CFdisk.image file has been copied correctly.

Then putting the target CF in the drive, running lsblk i get see it is at /dev/sdb1

The use dd if=CFdisk.image /dev/sdb1

Afterwards it doesn't automaticly mount. And if I try to mount it manually to a directory, sudo mount /dev/sdb1 /media/frank/cloned/ then I get the error....

frank@ThinkPad2:~$ sudo mount /dev/sdb1 /media/frank/cloned/  mount: /media/frank/cloned: wrong fs type, bad option, bad superblock on /dev/sdb1,   missing codepage or helper program, or other error.  

The command lsblk -f shows that it on the system the cloned CF is...

sdb                                                                     └─sdb1       ext3         c44c8412-bf87-4fa4-a6fa-8259aa78bd24      

On the original CF lsblk -f shows

sdb                                                                         └─sdb1 ext3           c44c8412-bf87-4fa4-a6fa-8259aa78bd24  311.2M    60% /media/frank/c44c8412-bf87-4fa4-a6fa-8259aa78b  

So, what am I not doing correctly?

Noninteractively identify processes using up a lot of CPU-time

Posted: 30 Aug 2021 10:13 AM PDT

I have a weird issue: sometimes (always?) when my monitor is turned off, the fans are running loud, even when there shouldn't be much usage of the CPU on the system as far as I know.

But as soon as I move my mouse and start top to try to diagnose this, the activity, whatever it is, stops; with the fans winding down.

So I want a script/program/method that I could start at some point in time, leave the computer unattended while this program is recording CPU activity of processes, then when I resume operating the computer I should be able to read the program's report from which I would quickly know what processes are making the fans work hard.

How to I properly set the advanced FZF_DEFAULT_COMMAND environment variable to get it working properly with ohmyz.sh with fzf plugin installed?

Posted: 30 Aug 2021 08:42 AM PDT

I'm new to z shell and ohmyz.sh.

I have the following in my zshrc to integrate fzf with rg. This is exactly how it appears in the fzf readme:

FZF_BASE=/usr/local/bin  DISABLE_FZF_AUTO_COMPLETION="true"  DISABLE_FZF_KEY_BINDINGS="true"  INITIAL_QUERY=""  RG_PREFIX="rg --column --line-number --no-heading --color=always --smart-case "  FZF_DEFAULT_COMMAND="$RG_PREFIX '$INITIAL_QUERY'" \    fzf --bind "change:reload:$RG_PREFIX {q} || true" \        --ansi --disabled --query "$INITIAL_QUERY" \        --height=50% --layout=reverse  

It kind of works but I'm seeing some weird and broken behavior:

  1. The weird behavior is that when I reload zshell, fzf fires up immediately without me hitting a key or typing in the command. It works perfectly, otherwise, though.

  2. The broken behavior is that when I manually type in fzf, the search is initiated but FZF_DEFAULT_COMMAND is set to what the plugin uses.

I tried fixing this behavior by slapping export in front of FZF_DEFAULT_COMMAND but then when I reload zsh, I get an error:

/Users/me/.zshrc:export:313: not valid in this context: --bind

Next I turned the ohmyzsh plugin off and modified my code to this:

FZF_DEFAULT_COMMAND="$RG_PREFIX '$INITIAL_QUERY'" \    fzf --bind "change:reload:$RG_PREFIX {q} || true" \        --ansi --disabled --query "$INITIAL_QUERY" \        --height=50% --layout=reverse  export FZF_DEFAULT_COMMAND  

This kind of works, but again, it fires up fzf as soon as I load zsh. And the formatting of the search is mangled and ugly with ansi characters.

Bash script to restart java application after Jenkins compiling

Posted: 30 Aug 2021 09:19 AM PDT

I'm noob in linux! I have my server and installed jenkins. I need to create bash script, which should run application(or will restart if it has already been started) after jenkins compile it. I tried to use screen util in linux, but it's not working for me. I wrote this script:

screen -X -S JavaTelegramBot quit  screen -d -m -S JavaTelegramBot  screen -X -S JavaTelegramBot java -jar "path/to/jar"   

When I tip screen -ls , it's empty, so application not working. I even tried to use nohup. It's only launch application for few seconds, until jenkins finished his build. Scripts starting by using cmd command in jenkins after build

How to compare two tsv extract in Unix and print differences with key and header?

Posted: 30 Aug 2021 08:56 AM PDT

I have two files with same header and structure and the first column is a key.

File 1:

key    val1 val2 val3 val4 val5  Item1  10   12   44   88   22  Item2  33   33   43   77   22  Item3  28   44   55   22   11  Item4  12   55   55   14   44  

File2:

key    val1 val2 val3 val4 val5  Item1  10   11   44   99   22  Item2  33   33   43   77   22  Item3  28   44   55   22   11  Item4  12   55   55   14   00  

As you noticed in above file, there are two differences in the files:

  • val2 and val4 of item1 is different
  • val5 of item 4 is different

So I would like to produce a comparison output which should tell me which fields of which item are different. The output should be something similar to :

Item1: val2,val4  Item4: val5  

How to use sed to replace a string in double quotes with a variable?

Posted: 30 Aug 2021 09:59 AM PDT

I have a file that includes this line:

  master_green_cloud_init_version = "v1.16/"  

My bash script will have a parameter like userdata_version=v2.21.

How can I use sed to replace anything between the "" (i.e. "v1.16/") with $userdata_version?

I cannot hard code v1.16 as it keeps on changing.

no user id for key signature packet of class 10

Posted: 30 Aug 2021 08:55 AM PDT

So, I was installing some packages with pacman (Arch Linux) and noticed this error (no user id for key signature packet of class 10). Everything went fine, but what does this mean?

Execute a script on ethernet connection/disconnection with systemd

Posted: 30 Aug 2021 09:03 AM PDT

I have an embedded device that will connect with systemd-networkd to a DHCP server if connected to the local network and will fall back to being a DHCP server if not. I didn't implement it yet but plan using the answer described here https://unix.stackexchange.com/a/309046/114497 .

This answer points to use a script that will be started on boot. I was wondering what if the user unplugs the network cable and connects it to a PC at runtime, he'd need to restart the board for the script to start. So the question is: is there a way to start a script when there's an interface change with systemd?

PS: I tried using networkd-dispatcher without success. I tried restarting the systemd-networkd service, unplug the ethernet cable but the script I wrote located in /usr/lib/networkd-dispatcher is not executed.

No wireless extensions arch linux

Posted: 30 Aug 2021 09:49 AM PDT

I am having a problem with configuring wifi on Arch. There are completely no wireless extensions. When I run iwconfig the result is:

lo     no wireless extensions  eno1   no wireless extensions  

Anyone with a solution?

locale issue on newly CentOS install

Posted: 30 Aug 2021 10:04 AM PDT

I made several CentOS 7 install lately using the NetInstall CD and all is going well, installation finishes, I can access the server. However when I try to connect to the server using ssh afterwards, I get :

-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory  

indeed typing "locale" I get:

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

Set up is:

# cat /etc/locale.conf  LANG="en_US.utf8"  [root@moria ~]# localectl list-locales | grep en_US  en_US  en_US.iso88591  en_US.iso885915  en_US.utf8  

So nothing fancy, it's a fresh out of the box updated CentOS.

Trying to set it I get :

# localectl set-locale LC_TYPE=en_US.utf8  Failed to issue method call: Invalid Locale data.  

So my question: What am I missing? How to set this up correctly. Many thanks!

mv: add number to file name if the target exists

Posted: 30 Aug 2021 08:13 AM PDT

I'm moving a file to a different folder and would like to add some kind of index to the newly moved file if a file with the same name exists already (the old one should remain untouched). For example, if file.pdf existed I would prefer something like file1.pdf or file_1.pdf for the next file with the same name.

Here I've found a variant for the opposite idea — but I don't want to make a "backup".

Does mv have some parameters out of the box for that scenario? I use Ubuntu Linux.

Socat exec script in tunnel

Posted: 30 Aug 2021 09:51 AM PDT

I am running a tunnel like this:

socat TCP-LISTEN:9090,fork TCP:192.168.1.3:9090  

I would like to run a script to execute code with the strings passing through the tunnel.

The script does not change the strings, only processes strings independently but allows passage without changing between both ends.

Is this possible?

What is the difference between find . and find . -print

Posted: 30 Aug 2021 08:49 AM PDT

What is the difference between:

find .  

and

find . -print  

What does -print actually do?

$ find .  .  ./hello.txt  ./hello  ./hello/txt  ./hello/hello2  ./hello/hello2/hello3  ./hello/hello2/hello3/txt  ./hello/hello2/txt  $ find . -print  .  ./hello.txt  ./hello  ./hello/txt  ./hello/hello2  ./hello/hello2/hello3  ./hello/hello2/hello3/txt  ./hello/hello2/txt  

How to share Windows clipboard with Linux using TightVNC?

Posted: 30 Aug 2021 09:25 AM PDT

I'm connecting to my Debian squeeze server through the Windows TightVNC viewer and tightvncserver on Linux. I have put the following line in my ~/.vnc/xstartup file:

autocutsel -fork  

However, this only seems to allow 1-way clipboard synchronization; the remote Linux content can be copied to the Windows clipboard, but not the other way around.

Is there some way I can copy Windows clipboard content and paste it in Linux through TightVNC?

No comments:

Post a Comment