Can I set my virt-manager/QEMU VM (using virgl) to 144Hz? Posted: 05 Oct 2021 10:50 AM PDT I've created a Ubuntu 21.04 VM in virt-manager and I've set the graphics to use virgl instead of QXL because it's meant to be much smoother in the desktop. While it works fine, dragging windows about feels janky, probably because the screen refresh rate is set to 74.94Hz for some reason. I can't find any solid info on how to create a custom resolution is this, but it didn't work. Is virgl meant to be this janky or can I fix it? |
Installing Fedora on external hard drive Posted: 05 Oct 2021 10:17 AM PDT I am trying to shift to linux gradually, and I want to try Fedora. However, when I arrive at the place to install Fedora on my hard drive, the application could not detect my external hard drive but only my internal hard drives. I have no idea why that happened. May anyone give me a hand? |
pmap memory usage explanation Posted: 05 Oct 2021 09:52 AM PDT I'm a little confused about the results of this memory usage I'm seeing when using pmap (as a result of digging into the Apache2Buddy.pl script). I'm trying to determine the correct values for MaxRequestWorkers for Apache and some other parameters for PHP-FPM to appropriately size a workload for a few web servers. [root@server ~]# ps aux | grep httpd | grep -i apache USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND apache 23054 0.0 0.2 293108 9772 ? S Oct03 0:00 /usr/sbin/httpd -DFOREGROUND apache 23056 0.0 1.1 2258736 46348 ? Sl Oct03 3:17 /usr/sbin/httpd -DFOREGROUND apache 23058 0.2 1.2 2258876 48272 ? Sl Oct03 7:34 /usr/sbin/httpd -DFOREGROUND apache 23059 0.1 1.1 2422792 46832 ? Sl Oct03 4:20 /usr/sbin/httpd -DFOREGROUND apache 23304 0.4 1.3 2258912 53116 ? Sl Oct03 15:51 /usr/sbin/httpd -DFOREGROUND From my understanding VSZ is shared between all httpd processes and their associated libaries. If I run pmap and look specifically for the writable/private memory usage for these processes I get high values like below: process is 23054 mapped: 293112K writeable/private: 5928K shared: 348K process is 23056 mapped: 2258740K writeable/private: 760148K shared: 131420K process is 23058 mapped: 2258880K writeable/private: 762628K shared: 131420K process is 23059 mapped: 2422796K writeable/private: 925124K shared: 131420K process is 23304 mapped: 2258916K writeable/private: 766368K shared: 131420K Dividing those values by /1024 to get them in MB gives some values in the ranges of 700-900MB per Apache process. If I then use a tool such as ps_mem.py (https://github.com/pixelb/ps_mem) to get the total memory usage for a process - such as httpd - I get the following reported: 126.2 MiB + 15.2 MiB = 141.4 MiB httpd (6) Why is the value in pmap so high? It's causing me some confusion as the Apache2Buddy.pl script is reporting really high values for Apache memory utilisation that seemed to be obtained by looking at the values returned by pmap, but I can't match this up with what I think I'm seeing elsewhere. Apache2Buddy output for reference: 2021/10/05 16:50:28 Uptime: "26d 19h 57m 17s" Model: "Event" Memory: "3884 MB" Maxclients: "400" Recommended: "N\A" Smallest: "5.79 MB" Avg: "628.95 MB" Largest: "903.45 MB" Largest Apache process (by memory): 903 MB Any ideas where I might be looking at this wrong? |
How to identify unknown devices in traceroute or ping Posted: 05 Oct 2021 09:30 AM PDT In attempting to troubleshoot a failed ping from the Windows host to the IP address of one Linux guest virtual machine (192.168.1.19), I did a traceroute : $ traceroute 192.168.1.19 traceroute to 192.168.1.19 (192.168.1.19), 30 hops max, 60 byte packets 1 Samsung.station (192.168.1.17) 3132.517 ms !H 3132.491 ms !H 3132.489 ms !H $ ping 192.168.1.19 PING 192.168.1.19 (192.168.1.19) 56(84) bytes of data. From 192.168.1.17 icmp_seq=1 Destination Host Unreachable From 192.168.1.17 icmp_seq=2 Destination Host Unreachable $ ping hostname PING hostname (192.168.1.19) 56(84) bytes of data. From Samsung.station (192.168.1.17) icmp_seq=1 Destination Host Unreachable From Samsung.station (192.168.1.17) icmp_seq=2 Destination Host Unreachable I can ping the host IP (192.168.1.15) from the guest. The thing is, I know what I have on my network, but I have no idea what this Samsung.station machine is supposed to be. I've logged onto the Wi-Fi router and cannot identify any device with a "192.168.1.17" IP address. I have turned off or disconnected the Wi-Fi of all the few Samsung devices on the network, but I still get the same result. My end goal is to get the ping working both ways, but now I also would like to know if there is anything I can do to identify this mysterious device! I've seen a related question but I am not yet trying to block devices, I first want to learn what would be the best next step here, before I reboot the router. If someone can confidently say that there are no Linux tools that can help me solve this or gain further information, that is also a valid answer. Thank you. |
Unable to install kernel Posted: 05 Oct 2021 09:12 AM PDT I'm following this guide https://kernelnewbies.org/OutreachyfirstpatchSetup and when I try to install the kernel it fails on: update-initramfs: Generating /boot/initrd.img-5.9.0 W: Possible missing firmware /lib/firmware/i915/rkl_dmc_ver2_01.bin for module i915 Error 24 : Write error : cannot write compressed block E: mkinitramfs failure cpio 141 lz4 -9 -l 24 update-initramfs: failed for /boot/initrd.img-5.9.0 with 1. run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1 make[1]: *** [arch/x86/boot/Makefile:160: install] Error 1 make: *** [arch/x86/Makefile:274: install] Error 2 but it is very likely not related to the /boot space, because: Filesystem Size Used Avail Use% Mounted on tmpfs 2,4G 2,1M 2,4G 1% /run /dev/mapper/vgkubuntu-root 232G 201G 19G 92% / tmpfs 12G 16K 12G 1% /dev/shm tmpfs 5,0M 4,0K 5,0M 1% /run/lock tmpfs 4,0M 0 4,0M 0% /sys/fs/cgroup /dev/nvme0n1p2 705M 153M 501M 24% /boot /dev/nvme0n1p1 511M 44M 468M 9% /boot/efi tmpfs 2,4G 80K 2,4G 1% /run/user/1000 and I'm able to create and save file (named test) there: 4,0K . 244K config-5.9.0 4,0K grub 180K memtest86+.bin 5,4M System.map-5.8.0-63-generic 4,0K test 12M vmlinuz-5.9.0 4,0K .. 244K config-5.9.0.old 90M initrd.img-5.8.0-63-generic 184K memtest86+.elf 5,2M System.map-5.9.0 0 vmlinuz 12M vmlinuz-5.9.0.old 244K config-5.8.0-63-generic 4,0K efi 16K lost+found 184K memtest86+_multiboot.bin 5,2M System.map-5.9.0.old 14M vmlinuz-5.8.0-63-generic 0 vmlinuz.old Currently running 5.8.0-63-generic Could anyone help me, please? |
Disable Latptop Keyboard on Wayland/Gnome Posted: 05 Oct 2021 09:06 AM PDT I have an hp envy x360 convertible laptop running Arch Linux with Gnome installed via the default installer. I would like to be able to disable the keyboard and trackpad when the computer is flipped into tablet mode, but drivers do not exist for the the hinge sensor, so I need some way to toggle them manually. Any scripts I've found use xinput, and my googling hasn't shown any good way to toggle the keyboard without permissions. And I have found absolutely nothing about manually toggling Gnome's native tablet mode. |
OpenVPN and IPTABLES - How to assign lan (vpn) gateway to clients Posted: 05 Oct 2021 08:56 AM PDT I am trying to set up my openvpn network but I have a problem. My LAN configuration is as follows: - main router Zyxel 192.168.1.1 acting as gateway (vdsl connection) and access point;
- openwrt router TD-W8970 192.168.1.2 acting as access point and vpn server (10.212.79.1)
What I want to do is to create a VPN network with clients that must send internet requests only through my LAN gateway (192.168.1.1); in other words, I want that the clients public IP shown on internet is the one of my LAN gateway (192.168.1.1) and not the one assigned to them by their ISP. Here below my openvpn configuration. server.conf user nobody group nogroup dev tun port 1194 proto udp server 10.212.79.0 255.255.255.0 topology subnet client-to-client keepalive 10 60 persist-tun persist-key verb 3 push "persist-tun" push "persist-key" push "dhcp-option DNS 8.8.8.8" push "dhcp-option DNS 8.8.4.4" push "route 192.168.1.0 255.255.255.0" ca /etc/easy-rsa/pki/ca.crt cert /etc/easy-rsa/pki/issued/server.crt key /etc/easy-rsa/pki/private/server.key dh /etc/easy-rsa/pki/dh.pem tls-auth /etc/easy-rsa/pki/ta.key 0 client.conf dev tun proto udp remote myserver_xyz.com 1194 udp resolv-retry infinite nobind user nobody group nogroup persist-key persist-tun ca ca.crt cert client1.crt key client1.key remote-cert-tls server tls-auth ta.key 1 cipher AES-256-CBC verb 3 The openvpn network is established correctly and the client 10.212.79.2 is able to ping vpn server 10.212.79.1 and navigate in Internet. The problem is that the public client IP shown on Internet is the one assigned by its ISP and not the one of the LAN gateway (192.168.1.1) where the vpn server (192.168.1.2 / 10.212.79.1) is located. I tried to perform some changes in server configuration but with no success. I also tried to put push "redirect-gateway def1" or push "redirect-gateway autolocal" but in this cases the client stopped to navigate in internet at all. If it is not an openvpn issue, is it an issue related to the correct configuration of IPTABLES? Can you please help me? Thanks in advance :) |
Booting from real (UEFI) disk image on QEMU Posted: 05 Oct 2021 08:54 AM PDT Summary: I wish to boot QEMU with a disk image I created from a real machine running Ubuntu. After creating the image and trying to run QEMU, the VM hangs on "Booting from Hard Disk". Detailed Description I have a desktop x86_64 machine on which I have installed standard Ubuntu 20.04.3. As per the default, this also installed GRUB as the bootloader on the 1TiB HDD. The disk has a GPT, a EFI partition, plus a single ext4 partition (~50GiB). This system boots, runs and is fully functional. Running from a live-USB, I have created a raw image of the entire boot disk. Lets call the image ae.img . From a remote machine, I created the image by running ssh root@<IP> "dd if=/dev/sda bs=100M status=progress | xz -T 8 -1" | unxz | cp --sparse=always /proc/self/fd/0 ae.img Ignoring the xz /unxz which compressed the data over the network, essentially the entire disk was read by dd , sent over the network, and written to a sparse file ae.img by cp . For the running live USB, /dev/sda was the HDD. I have checked the partition table for the image using fdisk , and the data in the actual ext4 partition by mounting it as a loopback device. Challenge: I want to run a VM with this disk image on another (almost identical) system using QEMU. I think that if I specify this image as a drive on QEMU, it might try booting from it, then hit the GRUB bootloader, so on and so forth. To keep it identical, I am trying to boot it with a video output. The command I used was: -m 4G \ -machine type=q35,accel=kvm \ -smp 4 \ -drive format=raw,file=ae.img \ -cpu host \ -display default \ -vga virtio \ -show-cursor I have specified the image as a drive, given it a vga display, 4GB memory and 4 cores. Should be enough. Running this command gives me a QEMU window as displayed below. I am stuck on booting, with no further progress. htop reports that QEMU is consuming one core at 100%, with a bar 50% blue (low priority processes) and 50% red (kernel). How do I diagnose what is going on? Any suggested fixes? |
How to get best performance on Windows VM without gpu passtrough? Posted: 05 Oct 2021 08:30 AM PDT I'm using OpenSUSE as my main OS on work laptop (Ryzen 5850U, no additional GPU), however I need to have working Outlook desktop app, since some of our company communications are encrypted using S/MIME, which as far as I know is unsupported in OWA on systems other than Windows. We are using on-premise Exchange server. So I decided to setup Windows VM, I'm using libvirt for this. Here is my VM config: <domain type="kvm"> <name>RDPWindows</name> <uuid>350141fc-4158-43cc-afad-my-uuid</uuid> <metadata> <libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0"> <libosinfo:os id="http://microsoft.com/win/10"/> </libosinfo:libosinfo> </metadata> <memory unit="KiB">8388608</memory> <currentMemory unit="KiB">2097152</currentMemory> <vcpu placement="static">8</vcpu> <os> <type arch="x86_64" machine="pc-q35-5.2">hvm</type> <loader readonly="yes" type="pflash">/usr/share/qemu/ovmf-x86_64-ms-code.bin</loader> <nvram>/var/lib/libvirt/qemu/nvram/RDPWindows_VARS.fd</nvram> </os> <features> <acpi/> <apic/> <hyperv> <relaxed state="on"/> <vapic state="on"/> <spinlocks state="on" retries="8191"/> </hyperv> <vmport state="off"/> </features> <cpu mode="host-model" check="partial"> <topology sockets="1" dies="1" cores="4" threads="2"/> </cpu> <clock offset="localtime"> <timer name="hpet" present="yes"/> <timer name="hypervclock" present="yes"/> </clock> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>destroy</on_crash> <pm> <suspend-to-mem enabled="no"/> <suspend-to-disk enabled="no"/> </pm> <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> <disk type="file" device="cdrom"> <driver name="qemu" type="raw"/> <source file="/path/to/Windows.iso"/> <target dev="sdb" bus="sata"/> <readonly/> <address type="drive" controller="0" bus="0" target="0" unit="1"/> </disk> <disk type="file" device="cdrom"> <driver name="qemu" type="raw"/> <source file="/path/to/virtio-win-0.1.208.iso"/> <target dev="sdc" bus="sata"/> <readonly/> <address type="drive" controller="0" bus="0" target="0" unit="2"/> </disk> <disk type="file" device="disk"> <driver name="qemu" type="qcow2"/> <source file="/var/lib/libvirt/images/win10-office.qcow2"/> <target dev="vda" bus="virtio"/> <boot order="1"/> <address type="pci" domain="0x0000" bus="0x06" slot="0x00" function="0x0"/> </disk> <controller type="usb" index="0" model="qemu-xhci" ports="15"> <address type="pci" domain="0x0000" bus="0x03" slot="0x00" function="0x0"/> </controller> <controller type="sata" index="0"> <address type="pci" domain="0x0000" bus="0x00" slot="0x1f" function="0x2"/> </controller> <controller type="pci" index="0" model="pcie-root"/> <controller type="pci" index="1" model="pcie-root-port"> <model name="pcie-root-port"/> <target chassis="1" port="0x10"/> <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x0" multifunction="on"/> </controller> <controller type="pci" index="2" model="pcie-root-port"> <model name="pcie-root-port"/> <target chassis="2" port="0x11"/> <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x1"/> </controller> <controller type="pci" index="3" model="pcie-root-port"> <model name="pcie-root-port"/> <target chassis="3" port="0x12"/> <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x2"/> </controller> <controller type="pci" index="4" model="pcie-root-port"> <model name="pcie-root-port"/> <target chassis="4" port="0x13"/> <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x3"/> </controller> <controller type="pci" index="5" model="pcie-root-port"> <model name="pcie-root-port"/> <target chassis="5" port="0x14"/> <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x4"/> </controller> <controller type="pci" index="6" model="pcie-root-port"> <model name="pcie-root-port"/> <target chassis="6" port="0x15"/> <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x5"/> </controller> <controller type="virtio-serial" index="0"> <address type="pci" domain="0x0000" bus="0x04" slot="0x00" function="0x0"/> </controller> <interface type="network"> <mac address="52:54:00:77:ea:aa"/> <source network="default"/> <model type="e1000e"/> <address type="pci" domain="0x0000" bus="0x01" slot="0x00" function="0x0"/> </interface> <interface type="network"> <mac address="52:54:00:e8:2d:aa"/> <source network="link-local"/> <model type="virtio"/> <address type="pci" domain="0x0000" bus="0x02" slot="0x00" function="0x0"/> </interface> <serial type="pty"> <target type="isa-serial" port="0"> <model name="isa-serial"/> </target> </serial> <console type="pty"> <target type="serial" port="0"/> </console> <channel type="spicevmc"> <target type="virtio" name="com.redhat.spice.0"/> <address type="virtio-serial" controller="0" bus="0" port="1"/> </channel> <input type="tablet" bus="usb"> <address type="usb" bus="0" port="1"/> </input> <input type="mouse" bus="ps2"/> <input type="keyboard" bus="ps2"/> <graphics type="spice" autoport="yes"> <listen type="address"/> <image compression="off"/> <gl enable="no"/> </graphics> <sound model="ich9"> <address type="pci" domain="0x0000" bus="0x00" slot="0x1b" function="0x0"/> </sound> <video> <model type="virtio" heads="1" primary="yes"/> <address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x0"/> </video> <redirdev bus="usb" type="spicevmc"> <address type="usb" bus="0" port="2"/> </redirdev> <redirdev bus="usb" type="spicevmc"> <address type="usb" bus="0" port="3"/> </redirdev> <memballoon model="virtio"> <address type="pci" domain="0x0000" bus="0x05" slot="0x00" function="0x0"/> </memballoon> </devices> </domain> However I'm getting quite poor video performance, it is usable but definitely not convenient to use, so I'm wondering how to get better performance. I tried using https://github.com/Fmstrat/winapps, it gives slightly better performance, but there are visual bugs. I tried RDP with xfreerdp but it wasn't really better than SPICE. I have installed SPICE guest tools on that Windows. |
rsyslog discard message Posted: 05 Oct 2021 08:42 AM PDT I'm trying to discard any "kernel: nfs: Deprecated parameter 'intr'" messages from /var/log/messages Rsyslog version: 8.1911.0-6.el8 In my /etc/rsyslog.conf file I have the following: module(load="imuxsock" # provides support for local system logging (e.g. via logger command) SysSock.Use="off") # Turn off message reception via local log socket; # local messages are retrieved through imjournal now. module(load="imjournal" # provides access to the systemd journal StateFile="imjournal.state") # File to store the position in the journal global(workDirectory="/var/lib/rsyslog") module(load="builtin:omfile" Template="RSYSLOG_TraditionalFileFormat") include(file="/etc/rsyslog.d/*.conf" mode="optional") :msg, contains, "nfs: Deprecated parameter" stop *.info;mail.none;authpriv.none;cron.none /var/log/messages authpriv.* /var/log/secure mail.* -/var/log/maillog cron.* /var/log/cron *.emerg :omusrmsg:* uucp,news.crit /var/log/spooler local7.* /var/log/boot.log The line that should discard the messages is: :msg, contains, "nfs: Deprecated parameter" stop I still see that the messages getting logged. Any ideas? PS., I do have additional conf files in /etc/rsyslog.d/ if that matters. |
how to invoke sed from awk while following logfile? Posted: 05 Oct 2021 10:40 AM PDT I'm supposed to follow a logfile, I want to initiate a sed command to edit conffile upon appearance of certain line in the log. I did little research and found out that it can be done with awk . and the syntax is like: tail -f /path/to/serverLog | awk ' /Printer is on fire!/ { system("shutdown -h now") } /new USB high speed/ { system("echo \"New USB\" | mail admin") }' as proposed in this answer so I wrote my own like with a sed variant: tail -f logfile | awk '/^Jit ended**/ { system("sed -E '/^Jit/{s/enabled=false/enabled=true/; s/From=[0-9]+-[0-9]+-[0-9]+/From=2021-02-01/}' conffile") }' but it doesn't work, and throws errors like (^ syntax error|^ unterminated string) I guess this is to do something with {} in the sed command not getting compatible with awk syntax, but no idea where exactly, and how to get it work. |
How to recover files lost copying to another harddrive with insufficient space Posted: 05 Oct 2021 10:13 AM PDT This is yet another question on how to recover lost files. Still, I do not really know what happened that made me lose my files and can't find any help online. I will explain my situation: I am using Linux Mint 20.2. I have multiple hard drives installed and was copying something between them. fdisk -l outputs: Disk /dev/sda: 232,91 GiB, 250059350016 bytes, 488397168 sectors Disk model: Samsung SSD 860 Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x5d4322fb Device Boot Start End Sectors Size Id Type /dev/sda1 * 2048 1050623 1048576 512M b W95 FAT32 /dev/sda2 1052670 488396799 487344130 232,4G 5 Extended /dev/sda5 1052672 488396799 487344128 232,4G 83 Linux Disk /dev/sdb: 232,91 GiB, 250059350016 bytes, 488397168 sectors Disk model: Samsung SSD 860 Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x8035f05f Device Boot Start End Sectors Size Id Type /dev/sdb1 2048 488396799 488394752 232,9G 83 Linux Disk /dev/sdc: 465,78 GiB, 500107862016 bytes, 976773168 sectors Disk model: ST500DM002-1BD14 Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disklabel type: dos Disk identifier: 0x5a849229 Device Boot Start End Sectors Size Id Type /dev/sdc1 2048 976773119 976771072 465,8G 83 Linux sda is my linux hard drive, and sdb and sdc are internal data drives with only files on them. So today I plugged in my external harddrive (labeled "Backup" / sdd ) which has NTFS filesystem. It's not shown in the fdisk output because I disconnected it. I was copying something from this harddrive and to this harddrive simultaneously. I was copying the directory data/raw FROM sdd (Backup) TO the same folder on sdc . And I was copying the directory data/projects FROM sdc TO the same folder on sdd (the external Harddrive). I was doing this using the GUI file manager and drag and drop. I am pretty sure that I really did copy the files and not move them. While I was doing this, an error popped up, that unfortunately, I clicked away too fast, not noticing what option I chose and what it said. My sdc internal harddrive was full after this so I assume the error said I do not have enough space left. PROBLEM: After this error message, my entire data folder on the external hard drive was empty. I do not get why, as I was only copying from the subfolders of this directory in the two independent operations. I tried to look in the trash folders of the external and internal harddrives, which were empty unfortunately. I also tried using testdisk but it doesn't find any problems or deleted files. I have also tried using ntfsundelete to no avail. If I connect the external harddrive to a Windows system, it cannot open the data folder, telling me it is faulty. So I do not really know what happened or if and how to get back my files. They are nowhere else in the system and seem completely gone. Luckily I have backups of most of it but still I would like to know what happened and if there is any chance to rescue the data. EDIT: I thought about it some more. If, perhaps, I did a cut and not a copy, my harddrive ran out of space, and I would have clicked "try to copy anyway", could that have caused my data to become lost? But even if so, only the cut toward the full harddrive would be affected and not my whole data folder lost. |
Bash, finding functions whose contents match a search string Posted: 05 Oct 2021 09:11 AM PDT I want to search all defined functions in bash for some search string. The below is a start, but I want to then eliminate all terms that are not followed by whitespace on the next line (i.e. eliminate all entries that did not find $1 in the body of that function). fu() { declare -f | grep -e \(\) -e $1; } e.g. This output: ... tt () untargz () urlfix () ver () [ -f /etc/lsb-release ] && RELEASE="$(cat /etc/lsb-release | grep DESCRIPTION | sed 's/^.*=//g' | sed 's/\"//g') "; vi. () vi.su () ... would reduce to ... ver () [ -f /etc/lsb-release ] && RELEASE="$(cat /etc/lsb-release | grep DESCRIPTION | sed 's/^.*=//g' | sed 's/\"//g') "; ... An even much much better way (if possible) would be if every matching function could be determined and displayed in full. I envision that roughly as: - Collect the names of the functions with the search string in their body (the name of the function is always a single word on a line before the match, starting at
^ followed by a space then the line ending with ()$ ), then using command -V on each of those names, OR, doing a declare -f again but this time, using those names and matching everything after them from { to } (where { and } are on single lines by themselves at ^ - I know that grep/awk/sed can do amazing things to those that have such knowledge. End result would be running fu awk and it will show me the definition of every function that contains awk in the body of the function. |
Tmux changes to default preinstalled nano version instead of newly installed homebrew one Posted: 05 Oct 2021 08:58 AM PDT When i use nano in the terminal without enabling tmux, it shows the path for the brew version nano is an alias for /opt/homebrew/Cellar/nano However when i use tmux, type nano shows the same path but when nano is actually used it opens the preinstalled system version 2.0.6 . I'm not sure if that's an error in my tmux config or nano. |
Fusing files line by line in a directory according to their type Posted: 05 Oct 2021 11:07 AM PDT I have a function, save , that is been called by other functions in a for loop and the function in question is to fuse files of the same type in a particular directory (copy the contents of each of the files line by lines to a new file according to their types). The name of the fused file has the format ${x}_type_${y}.log where x and y are variables from the other functions where the function save is called and type is the type of the file. I tried using cat , echo and paste to fuse the file but none of them are functioning. When I run my script, the fused files carry the names as set in the code according to the type of files fused, but either the file fused is empty or it contains the names of the files which are supposed to be fused instead of their contents. for file in *; do type=$( echo "$file" | awk -F'[.-]' '{print $2}' ) save () { if [[ "$type" == "$type1" ]]; then cat "$file" >> "${x}_First_${y}.log" elif [[ "$type" == "$type2" ]]; then cat "$file" >> "${x}_Second_${y}.log" elif [[ "$type" == "$type3" ]]; then cat "$file" >> "${x}_Third_${y}.log" elif [[ "$type" == "$type4" ]]; then cat "$file" >> "${x}_Fourth_${y}.log" else echo "Nothing to do" fi } done I also tried this to try to copy the content of each file to a new file line by line but it didn't still work. for file in *; do type=$( echo "$file" | awk -F'[.-]' '{print $2}' ) save () { if [[ "$type" == "$type1" ]]; then while IFS= read -r line do echo "$line" echo -e "$line\n" >>"${x}_Request_${y}.log" done <"$file" elif [[ "$type" == "$type2" ]]; then while IFS= read -r line do echo "$line" echo -e "$line\n" >>"${x}_Error_${y}.log" done <"$file" elif [[ "$type" == "$type3" ]]; then while IFS= read -r line do echo "$line" echo -e "$line\n" >>"${x}_Critical_${y}.log" done <"$file" elif [[ "$type" == "$type4" ]]; then while IFS= read -r line do echo "$line" echo -e "$line\n" >>"${x}_Test_${y}.log" done <"filename" else echo "Nothing to do" fi } done This is the entire script #!/bin/bash env1="dev" env2="prod" type1="request" type2="error" type3="critical" type4="test" save () { if [[ "$type" == "$type1" ]]; then cat "$file" >> "${m}_Request_${w}.log" elif [[ "$type" == "$type2" ]]; then cat "$file" >> "${m}_Error_${w}.log" elif [[ "$type" == "$type3" ]]; then cat "$file" >> "${m}_Critical_${w}.log" elif [[ "$type" == "$type4" ]]; then cat "$file" >> "${m}_Test_${w}.log" else echo "Nothing to do" fi } week_range () { if [[ "$day" -ge 1 && "$day" -le 7 ]]; then w="Wk1" save elif [[ "$day" -ge 8 && "$day" -le 14 ]]; then w="Wk2" save elif [[ "$day" -ge 15 && "$day" -le 21 ]]; then w="Wk3" save elif [[ "$day" -ge 22 && "$day" -le 28 ]]; then w="Wk4" save elif [[ "$day" -ge 29 && "$day" -le 31 ]]; then w="Wk5" save else echo "Nothing to do" fi } month_range () { if [[ "$month" -eq 1 ]]; then m="Jan" week_range elif [[ "$month" -eq 2 ]]; then m="Feb" week_range elif [[ "$month" -eq 3 ]]; then m="Mar" week_range elif [[ "$month" -eq 4 ]]; then m="Apr" week_range elif [[ "$month" -eq 5 ]]; then m="May" week_range elif [[ "$month" -eq 6 ]]; then m="Jun" week_range elif [[ "$month" -eq 7 ]]; then m="Jul" week_range elif [[ "$month" -eq 8 ]]; then m="Aug" week_range elif [[ "$month" -eq 9 ]]; then m="Sep" week_range elif [[ "$month" -eq 10 ]]; then m="Oct" week_range elif [[ "$month" -eq 11 ]]; then m="Nov" week_range elif [[ "$month" -eq 12 ]]; then m="Dec" week_range else echo "Nothing to do" fi } for file in *.log; do env=$( echo "$file" | awk -F'[.-]' '{print $1}' ) type=$( echo "$file" | awk -F'[.-]' '{print $2}' ) month=$((10#$( echo "$file" | awk -F'[.-]' '{print $4}' ))) day=$((10#$( echo "$file" | awk -F'[.-]' '{print $5}' ))) if [[ "$env" == "$env1" ]]; then cd Env1 && { month_range; cd -; } elif [[ "$env" == "$env2" ]]; then cd Env2 && { month_range; cd -; } else echo "Nothing to do" fi done This is how my files look like dev.critical-2021-01-05.log prod.critical-2021-12-07.log dev.critical-2021-08-09.log prod.error-2021-02-21.log dev.error-2021-08-01.log prod.error-2021-07-29.log dev.error-2021-08-07.log prod.error-2021-10-22.log dev.request-2021-08-01.log prod.request-2021-01-02.log dev.request-2021-08-12.log prod.request-2021-04-10.log dev.test-2021-09-03.log This is what I expect to have for both dev and prod in different directories Jan_Critical_Wk1.log Jan_Request_Wk1.log Jun_Request_Wk1.log Mar_Critical_Wk2.log May_Error_Wk2.log Feb_Error_Wk3.log Apr_Request_Wk2.log Aug_Critical_Wk1.log Aug_Critical_Wk2.log Aug_Error_Wk1.log Aug_Error_Wk2.log Aug_Request_Wk1.log Aug_Request_Wk2.log Nov_Error_Wk3.log Oct_Error_Wk4.log Sep_Request_Wk4.log Jul_Error_Wk5.log Sep_Test_Wk1.log |
Any UNIX system that allow to move a file to a directory, rename file in the directory with +rw -x permission? Posted: 05 Oct 2021 10:46 AM PDT I'm trying to better understand how UNIX/LINUX file system works. file system-on-linux Compared to an inode, a directory structure contains a limited amount of information about a file. It only holds the file's inode number, name, and the length of the name. info '(coreutils) File permissions' - permission to read the file. For directories, this means permission to list the contents of the directory.
- permission to write to (change) the file. For directories, this means permission to create and remove files in the directory.
- permission to execute the file (run it as a program). For directories, this means permission to access files in the directory.
Now read and write permissions mean read and write directory, that is why with no x ls gives only names. x gives access files so one can read inode: file permissions, etc. and data - so a file can be accessed provided name is known beforehand. But why the system (Linux Mint 20 to be exact though as far as I recalled now many UNIX behave same way - but not all operating systems): ls -lad 1 drw-rw-rw- 2 alex alex 60 Oct 5 10:55 1 mv ./test ./1 mv: cannot stat './1/test': Permission denied mv 1/2 1/3 mv: failed to access '1/3': Permission denied mv a file to folder with +rw -x produced permission denied ? - I have write to directory, the system could have written hardlink to file along with name to the directory and r allow to check if file with that name already exists (renaming a file with mv produced similar result). Use case would be you can drop the file to directory but not be able to access/change it later. Any reason it does not work that way? Any UNIX systems that allow that? Added: mv is part of coreutils. I'm currently interested if just utils were written to check for x or system calls require x permission to add an entry to directory. |
small secure web server [closed] Posted: 05 Oct 2021 08:19 AM PDT Does anyone know what web server could be installed on a Raspberry Pi model 1b under Raspbian to manage HTTPS on a LAN (not exposed to internet)? The smaller and easier to install the better. The goal is to learn the basics of managing certificates for HTTPS. |
Recoll fails to index python files with py filename suffix Posted: 05 Oct 2021 10:36 AM PDT I use recoll 1.26.3 (french version) xapian 1.4.14 with mint 20.04 My recoll doesn't index files with py as filename suffix. - I have no "missing helper"
- I have no problem indexing
.odt , .rpg , .pdf , .txt and similar filetypes. In "index mime type" I find "text/x-python" but no way |
High latency on v4l2loopback Posted: 05 Oct 2021 09:32 AM PDT How do I combat the audio delay / latency here? https://s.natalian.org/2021-01-02/sync.mp4 I'm using a GH5 connected to my T14s running Archlinux with /lib/modules/5.10.3-arch1-1/extra/v4l2loopback.ko.xz I'm also using mpv av://v4l2:/dev/video2 --profile=low-latency --untimed |
Ubuntu 18.04 netplan configuration for WPA-EAP Posted: 05 Oct 2021 11:05 AM PDT Background I'm using Ubuntu 18.04 server (on a laptop, for development) and am trying to get my wifi configured to work with an WPA-EAP network. I've got netplan to work with an an open network, even with a password protected network, but haven't been able to get it to work with WPA-EAP where both an identity and password are required. Attempted Configuration I've tried this in my /etc/netplan/config.yaml file: network: wifis: wlp1s0: dhcp4: yes access-points: "My-Enterprise-Network": auth: key-management: eap identity: johndoe1 password: pass1234 But when I run netplan apply I get: Error in network definition /etc/netplan/config.yaml: unknown key auth From the Documentation From the online netplan documentation: The ``auth`` block supports the following properties: ``key-management`` (scalar) : The supported key management modes are ``none`` (no key management); ``psk`` (WPA with pre-shared key, common for home wifi); ``eap`` (WPA with EAP, common for enterprise wifi); and ``802.1x`` (used primarily for wired Ethernet connections). ``password`` (scalar) : The password string for EAP, or the pre-shared key for WPA-PSK. The following properties can be used if ``key-management`` is ``eap`` or ``802.1x``: ``method`` (scalar) : The EAP method to use. The supported EAP methods are ``tls`` (TLS), ``peap`` (Protected EAP), and ``ttls`` (Tunneled TLS). ``identity`` (scalar) : The identity to use for EAP. From man netplan access-points (mapping) This provides pre-configured connections to NetworkManager. Note that users can of course select other access points/SSIDs. The keys of the mapping are the SSIDs, and the values are mappings with the following supported properties: password (scalar) Enable WPA2 authentication and set the passphrase for it. If not given, the network is assumed to be open. **Other authentication modes are not currently supported.** Note the last line: Other authentication modes are not currently supported. Questions - What's the right way to use netplan with WPA-EAP?
- Does Ubuntu 18.04 ship with an outdated version of netplan? (
netplan --version is not supported ) Hence perhaps why the online documentation has options that the man version does not? - If so, can I upgrade netplan to a more cutting edge release?
- Or does netplan need to be used with something like a
wpa_supplicant.conf to specify additional parameters? |
Failed to mount Partitions - Not authorized to perform operation Posted: 05 Oct 2021 09:41 AM PDT I have Debian-9 dual booted with Windows-8. When I try to access to my hard-drive's partitions, it gives me : Failed to mount Not authorized to perform I tried mount /dev/sda4 mount: can't find /dev/sda4 in /etc/fstab My /etc/fstab # <file system> <mount point> <type> <options> <dump> <pass> # / was on /dev/sda3 during installation UUID=7393b8df-fc39-4649-9c0d-e818eb77fe8a / ext4 errors=remount-ro 0 1 /dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0 I added /dev/sda4 /media ext4 defaults 0 2 and it didnt boot. What am I missing here? usb drivers are mounted without any error. My system specs Linux userA 4.9.0-6-amd64 #1 SMP Debian 4.9.88-1+deb9u1 (2018-05-07) x86_64 GNU/Linux 9.4 Debian GNU/Linux 9 \n \l Thanks in advance. |
How do I use `cp -R` to copy all files to a subfolder without copying the subfolder as well? Posted: 05 Oct 2021 08:35 AM PDT I have an image folder which I am trying to copy into a subfolder of itself, so I can resize the images there. It looks something like this: Sephs-MacBook-Pro:photos seph$ ls 100x100 image1.png image2.png image3.png image4.png pic1.jpg The issue I have is when I run the function Sephs-MacBook-Pro:photos seph$ cp -R ./. 100x100 I get an error, which basically says I can't keep adding 100x100 folders to themselves: cp: 100x100/./100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/.DS_Store: name too long (not copied) How do I use cp -R to copy files to a subfolder without also copying the subfolder? |
yum update firefox in centos7 throwing `gpgme.GpgmeError: (7, 32870, u'Inappropriate ioctl for device')`? Posted: 05 Oct 2021 08:57 AM PDT Doing updates in centos7 and getting following error gpgme.GpgmeError: (7, 32870, u'Inappropriate ioctl for device') |
Intel Device 5912 graphic not recongnised on Mint 17.3 Posted: 05 Oct 2021 08:19 AM PDT I am trying to get my Dell Optiplex 7050 (uses an integrated Intel video processor) to recognize the graphic hardware Intel Device 5912. OS: Mint 17.3 Rosa When I run lspci -knn it says: 00:02.0 VGA compatible controller [0300]: Intel Corporation Device [8086:5912] (rev 04) Subsystem: Dell Device [1028:07a1] When I run inxi -b it says: Graphics: Card: Intel Device 5912 Display Server: X.Org 1.16.0 drivers: fbdev,intel (unloaded: vesa) Resolution: 1920x1080@77.0hz GLX Renderer: Gallium 0.4 on llvmpipe (LLVM 3.5, 256 bits) GLX Version: 3.0 Mesa 10.3.2 I download the older version of intel linux graphic installer from https://download.01.org/gfx/ubuntu/14.10/main/pool/main/i/intel-linux-graphics-installer/intel-linux-graphics-installer_1.1.0-0intel1_i386.deb and I run: sudo dpkg -i intel-linux-graphics-installer_1.1.0-0intel1_i386.deb ThenI got this error: dpkg: dependency problems prevent configuration of intel-linux-graphics-installer: intel-linux-graphics-installer depends on ttf-ancient-fonts. intel-linux-graphics-installer depends on aptdaemon. Any solutions? |
Is there any way to delay the driver initialization on Beaglebone Black? Posted: 05 Oct 2021 08:56 AM PDT I'd like to know how can I find the driver information. And I'd like to know if it's possible to delay driver initialization when I boot or reboot the Beaglebone Black. |
Pdf reader that supports XFA forms (while Adobe Reader for Linux is not supported anymore)? Posted: 05 Oct 2021 09:02 AM PDT XFA forms are features of a pdf file involving options to complete fields in certain documents - in many cases official documents. These options may open a calendar, for example, in order to select day, month and year, etc. Usually these forms ensure that a certain official format is used. I have seen that Okular displays a warning that XFA forms are not supported: More here. Selecting 'Show forms' in Okular those fields can be edited and changes can be saved, but comparing to what I see in Windows with Adobe Reader only some part of those are really accessed in this way: the calendar options are absent, and the separate fields of day/month/year are not present, which may raise questions on the correctness of the result. Adobe Reader 9 can still be installed in Ubuntu 14.04 but this seems like a very limited option. Is there a a native pdf reader that can use fully XFA forms? (If not, is Wine a solution?) The solution for Ubuntu 14.04 works in 16.04. too. The file I tested was here. |
OpenVPN connects to the Server successfuly but no internet access Posted: 05 Oct 2021 09:01 AM PDT I want to setup an OpenVPN Server and after a week of trying day and night (no Linux Knowledge) I was able to successfully connect to the Server using OpenVPN GUI but now that I can Connect there is no ping 8.8.8.8 and the webpages won't open. Server is Running: CentOS 7 X64 Client is Running: Windows 10 Pro Build 10586.17 X64 w/ Kaspersky Internet Security This is my server Config #change with your port port 1337 #You can use udp or tcp proto udp # "dev tun" will create a routed IP tunnel. dev tun #Certificate Configuration #ca certificate ca ca.crt #Server Certificate cert server.crt #Server Key and keep this is secret key server.key #See the size a dh key in /etc/openvpn/keys/ dh dh2048.pem #Internal IP will get when already connect server 192.168.200.0 255.255.255.0 #this line will redirect all traffic through our OpenVPN push "redirect-gateway def1" #Provide DNS servers to the client, you can use goolge DNS push "dhcp-option DNS 8.8.8.8" push "dhcp-option DNS 8.8.4.4" #Enable multiple client to connect with same key duplicate-cn keepalive 20 60 comp-lzo persist-key persist-tun daemon #enable log log-append /var/log/myvpn/openvpn.log #Log Level verb 3 This is my Client Config client dev tun proto udp remote MY_SERVER_IP_ADDRESS 1337 resolv-retry infinite nobind persist-key persist-tun mute-replay-warnings comp-lzo verb 3 <ca> -----BEGIN CERTIFICATE----- XXXXXXXXXXXXXXXXXXXXXXXXX -----END CERTIFICATE----- </ca> <cert> -----BEGIN CERTIFICATE----- XXXXXXXXXXXXXXXXXXXXXXXXX -----END CERTIFICATE----- </cert> <key> -----BEGIN PRIVATE KEY----- XXXXXXXXXXXXXXXXXXXXXXXXX -----END PRIVATE KEY----- </key> EDIT: so I added the below commands too. yum install iptables-services -y systemctl mask firewalld systemctl enable iptables systemctl stop firewalld systemctl start iptables iptables --flush iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE iptables-save > /etc/sysconfig/iptables nano /etc/sysctl.conf ADDEDD THIS TO sysctl.conf -> net.ipv4.ip_forward = 1 systemctl restart network.service systemctl -f enable openvpn@server.service systemctl start openvpn@server.service But still I can connect but I have no ping and can't open any website. Below is my route print after establishing the connection to my Server. Network Destination Netmask Gateway Interface Metric 0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.11 10 0.0.0.0 128.0.0.0 192.168.200.5 192.168.200.6 20 127.0.0.0 255.0.0.0 On-link 127.0.0.1 306 127.0.0.1 255.255.255.255 On-link 127.0.0.1 306 127.255.255.255 255.255.255.255 On-link 127.0.0.1 306 128.0.0.0 128.0.0.0 192.168.200.5 192.168.200.6 20 MY_SERVER_IP 255.255.255.255 192.168.1.1 192.168.1.11 10 169.254.0.0 255.255.0.0 On-link 169.254.61.91 276 169.254.61.91 255.255.255.255 On-link 169.254.61.91 276 169.254.255.255 255.255.255.255 On-link 169.254.61.91 276 192.168.1.0 255.255.255.0 On-link 192.168.1.11 266 192.168.1.11 255.255.255.255 On-link 192.168.1.11 266 192.168.1.255 255.255.255.255 On-link 192.168.1.11 266 192.168.183.0 255.255.255.0 On-link 192.168.183.1 276 192.168.183.1 255.255.255.255 On-link 192.168.183.1 276 192.168.183.255 255.255.255.255 On-link 192.168.183.1 276 192.168.200.1 255.255.255.255 192.168.200.5 192.168.200.6 20 192.168.200.4 255.255.255.252 On-link 192.168.200.6 276 192.168.200.6 255.255.255.255 On-link 192.168.200.6 276 192.168.200.7 255.255.255.255 On-link 192.168.200.6 276 192.168.230.0 255.255.255.0 On-link 192.168.230.1 276 192.168.230.1 255.255.255.255 On-link 192.168.230.1 276 192.168.230.255 255.255.255.255 On-link 192.168.230.1 276 224.0.0.0 240.0.0.0 On-link 127.0.0.1 306 224.0.0.0 240.0.0.0 On-link 192.168.1.11 266 224.0.0.0 240.0.0.0 On-link 169.254.61.91 276 224.0.0.0 240.0.0.0 On-link 192.168.200.6 276 224.0.0.0 240.0.0.0 On-link 192.168.230.1 276 224.0.0.0 240.0.0.0 On-link 192.168.183.1 276 255.255.255.255 255.255.255.255 On-link 127.0.0.1 306 255.255.255.255 255.255.255.255 On-link 192.168.1.11 266 255.255.255.255 255.255.255.255 On-link 169.254.61.91 276 255.255.255.255 255.255.255.255 On-link 192.168.200.6 276 255.255.255.255 255.255.255.255 On-link 192.168.230.1 276 255.255.255.255 255.255.255.255 On-link 192.168.183.1 276 |
Get date of next Saturday from a given date Posted: 05 Oct 2021 10:41 AM PDT I want the date of the coming Saturday after a given date. For example, for $date1="30-AUG-2015" , I want the result 05-SEP-2015. I have tried all the commands below with no success: samba@samba:~$ date1="30-AUG-2015" samba@samba:~$ date2=$(date --date='"$date1" +next Saturday') date: invalid date '"$date1" +next Saturday' samba@samba:~$ date1="30-AUG-2015" samba@samba:~$ date2=$(date --date1='next Saturday') date: unrecognized option '--date1=next Saturday' Try 'date --help' for more information. samba@samba:~$ date1="30-AUG-2015" samba@samba:~$ date -d "$date1 next saturday" Sun Aug 30 00:00:00 IST 2015 samba@samba:~$ $date1 -d "next saturday" 30-AUG-2015: command not found |
GStreamer and sample rate conversion Posted: 05 Oct 2021 10:06 AM PDT I have a soundcard that is only partially supported in Alsa, i.e. playback is only working in 48 kHz. Most of my audio files are in 44.1 kHz, and I would like to use Exaile as my audio player, as it has all the functionality that I need. The problem is, that gstreamer - the backend for exaile - does not convert the sample rate with my current settings, so playing back the audio files will result in a speed up, while playing the files with mplayer works just fine, mplayer does sample rate conversion on playback. Is there a way to get gstreamer to convert the sample rate? EDIT: The sound card in question is an E-MU 0404 PCI express, see http://alsa-project.org/main/index.php/Matrix:Vendor-Creative_Labs and http://alsa-project.org/main/index.php/Matrix:Module-emu10k1-fpga |
No comments:
Post a Comment