What does shopt histreedit do? Posted: 27 Mar 2021 10:34 AM PDT shopt histreedit is supposed to allow the user to re-edit a failed history substitution. How can a history substitution fail? How is histreedit different from histverify ? |
how to output all possibilities in linux without tab? Posted: 27 Mar 2021 09:38 AM PDT I'm a linux beginner I want to filter the possibilities in of a linux command , for example , how can i output the possibilities of 'service'? I hope that was clear enough thanks |
How to list readline variables with their current value Posted: 27 Mar 2021 10:16 AM PDT I'd like to be able to see if, for example, show-all-if-unmodified is enabled in the current session. |
Newbie problem with cron and server_start.sh Posted: 27 Mar 2021 09:35 AM PDT I decided to put my Valheim Dedicated Server to my second computer which is running on Xfce desktop environment. I got it running fine and and decided to try using cron first time. I made bash file that closes the server and reboots the computer and it is running fine on cron. After that I wanted cron to start my server by using start_server.sh file which I'm at this moment using via terminal to start up the Valheim server. I tried to do it with @reboot but it doesn't seem to work at all. I'd assume it has something to do how the server_start.sh works, since I checked it has all the rights and so on. Here is the crontab I made for this: #Set the hardware clock to keep it in sync with the more accurate system clock. 55 07 * * * /sbin/hwclock --systohc #Run restnboot.sh that closes Valheim server and restarts computer. 50 08 * * * /home/restnreboot.sh #Starts Valheim server at reboot. @reboot sleep 240 && /home/X/steamcmd/start_server.sh I also tried to add #!/bin/sh in to the sh file. Here is the start_server.sh: #!/bin/sh export templdpath=$LD_LIBRARY_PATH export LD_LIBRARY_PATH=./linux64:$LD_LIBRARY_PATH export SteamAppId=892970 echo "Starting server PRESS CTRL-C to exit" ./valheim_server.x86_64 -name "name" -port 2456 -world "name" -password "password" -nographics -batchmode -public 1 export LD_LIBRARY_PATH=$templdpath If anyone has any idea what I should do next, that would be appreciated. Thanks for your time! |
Impossible to set A2DP profile on bluetooth headset on Ubuntu 20.04 Posted: 27 Mar 2021 08:13 AM PDT I know this was asked a lot of times, but honestly I've tried everything that I could find over the internet and still couldn't resolve this. I am a beginner user of Ubuntu 20.04 and I am having issues setting A2DP profile for a pair of bluetooth headset, and the quality is very bad. - I have paired, trusted and connected the headphones via terminal
bluetoothctl then pair , trust , connect , didn't work - also installed
Blueman and did the same process there again with no luck After this I've tried to: - set the profile A2DP firstly from OS GUI that didn't work
- then I've tried from
Blueman but no success here either -> (Failed to change profile to a2dp_sink) - installed
pavucontrol and tried again from there - in pavucontrol I go to Config tab and in headphone's profile dropdown I can see High Fidelity Playback (A2DP Sink)(unavailable) so of course, I cannot set it here also I have also checked pacmd list-cards , checked the index of headphones, then pacmd set-card-profile <index> a2dp_sink but I get Failed to set card profile to 'a2dp_sink'. . I've also tried to sudo pacmd set-card-profile <index> a2dp_sink and now I get No PulseAudio daemon running, or not running as session daemon. PulseAudio is installed, I've checked with pulseaudio --version pulseaudio 13.99.1 . I've edited the /etc/bluetooth/audio.conf file and added this line in the end of it: Disable=Headset , this didn't work. I've also tried to add same line in main.conf - no success. With bluez installed, I've also enabled this line Name = BlueZ in /etc/bluetooth/main.conf , again nothing. In /etc/bluetooth/main.conf I've also uncommented #MultiProfile = off and changed it to MultiProfile = multiple , nothing happened. So after mixing all the steps above and restarted bluetooth and re paired headphone a million times, I gave up and I'm writing for help. Please give any hint on what could be the issue. Thanks |
how to fix tmux keybinding? (after upgrading to 3.0a) Posted: 27 Mar 2021 08:14 AM PDT I was previously using tmux in Kubuntu 19.10 (where my keybinding worked) and just upgraded to Kubuntu 20.04 (where the binding no longer works). I don't know the previous tmux version but currently it's tmux 3.0a . The broken keybinding is: bind-key \ split-window -h -c '#{pane_current_path}' . I can manually invoke split-window -h -c '#{pane_current_path}' to create the new pane, but that's nearly impossible to remember&type. The similar keybinding: bind-key - split-window -v -c '#{pane_current_path}' still works. And all my other config seems to still be working. I've tried bind-key -n \ split-window... guessing that the -n argument might help, but it did not. I don't know any other possibilities to try, or how to troubleshoot/debug this. |
nginx re-direct to API server in EC2 Posted: 27 Mar 2021 08:02 AM PDT I have an EC2 server (in Private subnet) from where I run some Python microservice. From my application running on an Apps EC2 (in public subnet) I am trying to access the Python microservices. I setup nginx as reverse proxy on Apps EC2 (public subnet) . From my minimal understanding of nginx I added a conf file as below : server { listen 80; server_name 3.23.xxx.xxx EC2-public.test.com; location / { root /var/www/Myapp/App; index index.php index.html index.htm; autoindex on; } #Application APIs on EC2 public location /api { proxy_pass http://myappsip-EC1.:4000; } #My second EC2 Python microservice APIs location /pyserv { proxy_pass http://myprivateEC2-IP:5000/; } } The issue is that from my public url I am able to access the service on the microservice EC2 if I give the absolute path in proxy_pass but any path relative to it I am not able to access. Any relative path seems to be picked by from the Primary EC2s root path. => EC2-public.test.com/ (primary application - works) => EC2-public.test.com/pyserv (API1 on second EC2 - http://myprivateEC2-IP:5000/- works since given in proxy_pass) => EC2-public.test.com/pyserv/srv1 (API 2 on second EC2 - http://myprivateEC2-IP:5000/srv1 - does not work) I know I am missing something in that I don't seem to have referred to the second EC2 root path. But I am not able to figure out how. Thanks |
ssh with X11 forwarding silently fails: DISPLAY is getting set, yet window still opens on server Posted: 27 Mar 2021 07:52 AM PDT I'm just trying to forward a simple gedit window from one Fedora laptop to another. The gedit command opens a gedit window on the "server" laptop, instead of opening a forwarded X11 window on the "client" laptop. server /etc/ssh/sshd_config X11Forwarding yes X11DisplayOffset 10 client .ssh/config ForwardX11 yes ForwardX11Trusted yes display test command: > ssh -X me@server "echo $DISPLAY" :0 command on the client: ssh -vvv -X me@server "/usr/bin/gedit" command output OpenSSH_8.3p1, OpenSSL 1.1.1i FIPS 8 Dec 2020 debug1: Reading configuration data /home/folio/.ssh/config debug1: Reading configuration data /etc/ssh/ssh_config debug3: /etc/ssh/ssh_config line 54: Including file /etc/ssh/ssh_config.d/50-redhat.conf depth 0 debug1: Reading configuration data /etc/ssh/ssh_config.d/50-redhat.conf debug2: checking match for 'final all' host 10.0.0.5 originally 10.0.0.5 debug3: /etc/ssh/ssh_config.d/50-redhat.conf line 3: not matched 'final' debug2: match not found debug3: /etc/ssh/ssh_config.d/50-redhat.conf line 5: Including file /etc/crypto-policies/back-ends/openssh.config depth 1 (parse only) debug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config debug3: gss kex names ok: [gss-curve25519-sha256-,gss-nistp256-sha256-,gss-group14-sha256-,gss-group16-sha512-,gss-gex-sha1-,gss-group14-sha1-,gss-group1-sha1-] debug3: kex names ok: [curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha> debug1: configuration requests final Match pass debug2: resolve_canonicalize: hostname 10.0.0.5 is address debug1: re-parsing configuration debug1: Reading configuration data /home/folio/.ssh/config debug1: Reading configuration data /etc/ssh/ssh_config debug3: /etc/ssh/ssh_config line 54: Including file /etc/ssh/ssh_config.d/50-redhat.conf depth 0 debug1: Reading configuration data /etc/ssh/ssh_config.d/50-redhat.conf debug2: checking match for 'final all' host 10.0.0.5 originally 10.0.0.5 debug3: /etc/ssh/ssh_config.d/50-redhat.conf line 3: matched 'final' debug2: match found debug3: /etc/ssh/ssh_config.d/50-redhat.conf line 5: Including file /etc/crypto-policies/back-ends/openssh.config depth 1 debug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config debug3: gss kex names ok: [gss-curve25519-sha256-,gss-nistp256-sha256-,gss-group14-sha256-,gss-group16-sha512-,gss-gex-sha1-,gss-group14-sha1-,gss-group1-sha1-] debug3: kex names ok: [curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha> debug2: ssh_connect_direct debug1: Connecting to 10.0.0.5 [10.0.0.5] port 22. debug1: Connection established. debug1: identity file /home/folio/.ssh/id_rsa type 0 debug1: identity file /home/folio/.ssh/id_rsa-cert type -1 debug1: identity file /home/folio/.ssh/id_dsa type -1 debug1: identity file /home/folio/.ssh/id_dsa-cert type -1 debug1: identity file /home/folio/.ssh/id_ecdsa type -1 debug1: identity file /home/folio/.ssh/id_ecdsa-cert type -1 debug1: identity file /home/folio/.ssh/id_ecdsa_sk type -1 debug1: identity file /home/folio/.ssh/id_ecdsa_sk-cert type -1 debug1: identity file /home/folio/.ssh/id_ed25519 type -1 debug1: identity file /home/folio/.ssh/id_ed25519-cert type -1 debug1: identity file /home/folio/.ssh/id_ed25519_sk type -1 debug1: identity file /home/folio/.ssh/id_ed25519_sk-cert type -1 debug1: identity file /home/folio/.ssh/id_xmss type -1 debug1: identity file /home/folio/.ssh/id_xmss-cert type -1 debug1: Local version string SSH-2.0-OpenSSH_8.3 debug1: Remote protocol version 2.0, remote software version OpenSSH_8.4 debug1: match: OpenSSH_8.4 pat OpenSSH* compat 0x04000000 debug2: fd 5 setting O_NONBLOCK debug1: Authenticating to 10.0.0.5:22 as 'bhawkins' debug3: hostkeys_foreach: reading file "/home/folio/.ssh/known_hosts" debug3: record_hostkey: found key type ECDSA in file /home/folio/.ssh/known_hosts:8 debug3: load_hostkeys: loaded 1 keys from 10.0.0.5 debug3: order_hostkeyalgs: prefer hostkeyalgs: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@op> debug3: send packet: type 20 debug1: SSH2_MSG_KEXINIT sent debug3: receive packet: type 20 debug1: SSH2_MSG_KEXINIT received debug2: local client KEXINIT proposal debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sh> debug2: host key algorithms: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sh> debug2: ciphers ctos: aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-ctr,aes256-cbc,aes128-gcm@openssh.com,aes128-ctr,aes128-cbc debug2: ciphers stoc: aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-ctr,aes256-cbc,aes128-gcm@openssh.com,aes128-ctr,aes128-cbc debug2: MACs ctos: hmac-sha2-256-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha2-256,hmac-sha1,umac-1> debug2: MACs stoc: hmac-sha2-256-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha2-256,hmac-sha1,umac-1> debug2: compression ctos: none,zlib@openssh.com,zlib debug2: compression stoc: none,zlib@openssh.com,zlib debug2: languages ctos: debug2: languages stoc: debug2: first_kex_follows 0 debug2: reserved 0 debug2: peer server KEXINIT proposal debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sh> debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519 debug2: ciphers ctos: aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-ctr,aes128-gcm@openssh.com,aes128-ctr debug2: ciphers stoc: aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-ctr,aes128-gcm@openssh.com,aes128-ctr debug2: MACs ctos: hmac-sha2-256-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha2-256,hmac-sha1,umac-1> debug2: MACs stoc: hmac-sha2-256-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha2-256,hmac-sha1,umac-1> debug2: compression ctos: none,zlib@openssh.com debug2: compression stoc: none,zlib@openssh.com debug2: languages ctos: debug2: languages stoc: debug2: first_kex_follows 0 debug2: reserved 0 debug1: kex: algorithm: curve25519-sha256 debug1: kex: host key algorithm: ecdsa-sha2-nistp256 debug1: kex: server->client cipher: aes256-gcm@openssh.com MAC: <implicit> compression: none debug1: kex: client->server cipher: aes256-gcm@openssh.com MAC: <implicit> compression: none debug1: kex: curve25519-sha256 need=32 dh_need=32 debug1: kex: curve25519-sha256 need=32 dh_need=32 debug3: send packet: type 30 debug1: expecting SSH2_MSG_KEX_ECDH_REPLY debug3: receive packet: type 31 debug1: Server host key: ecdsa-sha2-nistp256 SHA256:+V6XgNHheNBHFL99Ifdm4uNjzraZZBADjytLzbYOueU debug3: hostkeys_foreach: reading file "/home/folio/.ssh/known_hosts" debug3: record_hostkey: found key type ECDSA in file /home/folio/.ssh/known_hosts:8 debug3: load_hostkeys: loaded 1 keys from 10.0.0.5 debug1: Host '10.0.0.5' is known and matches the ECDSA host key. debug1: Found key in /home/folio/.ssh/known_hosts:8 debug3: send packet: type 21 debug2: set_newkeys: mode 1 debug1: rekey out after 4294967296 blocks debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug3: receive packet: type 21 debug1: SSH2_MSG_NEWKEYS received debug2: set_newkeys: mode 0 debug1: rekey in after 4294967296 blocks debug1: Will attempt key: /home/folio/.ssh/id_rsa RSA SHA256:59270Q20FVNukCiDfYNCBRFOOYYK/bvUTkL+H9sT518 agent debug1: Will attempt key: /home/folio/.ssh/id_dsa debug1: Will attempt key: /home/folio/.ssh/id_ecdsa debug1: Will attempt key: /home/folio/.ssh/id_ecdsa_sk debug1: Will attempt key: /home/folio/.ssh/id_ed25519 debug1: Will attempt key: /home/folio/.ssh/id_ed25519_sk debug1: Will attempt key: /home/folio/.ssh/id_xmss debug2: pubkey_prepare: done debug3: send packet: type 5 debug3: receive packet: type 7 debug1: SSH2_MSG_EXT_INFO received debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nis> debug3: receive packet: type 6 debug2: service_accept: ssh-userauth debug1: SSH2_MSG_SERVICE_ACCEPT received debug3: send packet: type 50 debug3: receive packet: type 51 debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password debug3: start over, passed a different list publickey,gssapi-keyex,gssapi-with-mic,password debug3: preferred gssapi-with-mic,publickey,keyboard-interactive,password debug3: authmethod_lookup gssapi-with-mic debug3: remaining preferred: publickey,keyboard-interactive,password debug3: authmethod_is_enabled gssapi-with-mic debug1: Next authentication method: gssapi-with-mic debug1: Unspecified GSS failure. Minor code may provide more information No Kerberos credentials available (default cache: KCM:) debug1: Unspecified GSS failure. Minor code may provide more information No Kerberos credentials available (default cache: KCM:) debug2: we did not send a packet, disable method debug3: authmethod_lookup publickey debug3: remaining preferred: keyboard-interactive,password debug3: authmethod_is_enabled publickey debug1: Next authentication method: publickey debug1: Offering public key: /home/folio/.ssh/id_rsa RSA SHA256:59270Q20FVNukCiDfYNCBRFOOYYK/bvUTkL+H9sT518 agent debug3: send packet: type 50 debug2: we sent a publickey packet, wait for reply debug3: receive packet: type 60 debug1: Server accepts key: /home/folio/.ssh/id_rsa RSA SHA256:59270Q20FVNukCiDfYNCBRFOOYYK/bvUTkL+H9sT518 agent debug3: sign_and_send_pubkey: RSA SHA256:59270Q20FVNukCiDfYNCBRFOOYYK/bvUTkL+H9sT518 debug3: sign_and_send_pubkey: signing using rsa-sha2-256 SHA256:59270Q20FVNukCiDfYNCBRFOOYYK/bvUTkL+H9sT518 debug3: send packet: type 50 debug3: receive packet: type 52 debug1: Authentication succeeded (publickey). Authenticated to 10.0.0.5 ([10.0.0.5]:22). debug2: fd 7 setting O_NONBLOCK debug3: fd 8 is O_NONBLOCK debug1: channel 0: new [client-session] debug3: ssh_session2_open: channel_new: 0 debug2: channel 0: send open debug3: send packet: type 90 debug1: Requesting no-more-sessions@openssh.com debug3: send packet: type 80 debug1: Entering interactive session. debug1: pledge: exec debug3: receive packet: type 80 debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0 debug3: receive packet: type 4 debug1: Remote: /home/bhawkins/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding debug3: receive packet: type 4 debug1: Remote: /home/bhawkins/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding debug3: receive packet: type 91 debug2: channel_input_open_confirmation: channel 0: callback start debug2: x11_get_proto: /usr/bin/xauth list :0 2>/dev/null debug1: Requesting X11 forwarding with authentication spoofing. debug2: channel 0: request x11-req confirm 1 debug3: send packet: type 98 debug2: fd 5 setting TCP_NODELAY debug3: ssh_packet_set_tos: set IP_TOS 0x48 debug2: client_session2_setup: id 0 debug1: Sending env XMODIFIERS = @im=ibus debug2: channel 0: request env confirm 0 debug3: send packet: type 98 debug1: Sending env LANG = fr_FR.UTF-8 debug2: channel 0: request env confirm 0 debug3: send packet: type 98 debug1: Sending command: /usr/bin/gedit debug2: channel 0: request exec confirm 1 debug3: send packet: type 98 debug2: channel_input_open_confirmation: channel 0: callback done debug2: channel 0: open confirm rwindow 0 rmax 32768 debug3: receive packet: type 99 debug2: channel_input_status_confirm: type 99 id 0 debug2: X11 forwarding request accepted on channel 0 debug2: channel 0: rcvd adjust 2097152 debug3: receive packet: type 99 debug2: channel_input_status_confirm: type 99 id 0 debug2: exec request accepted on channel 0 debug3: receive packet: type 96 debug2: channel 0: rcvd eof debug2: channel 0: output open -> drain debug2: channel 0: obuf empty debug2: channel 0: chan_shutdown_write (i0 o1 sock -1 wfd 7 efd 8 [write]) debug2: channel 0: output drain -> closed debug3: receive packet: type 98 debug1: client_input_channel_req: channel 0 rtype exit-status reply 0 debug3: receive packet: type 98 debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0 debug2: channel 0: rcvd eow debug2: channel 0: chan_shutdown_read (i0 o3 sock -1 wfd 6 efd 8 [write]) debug2: channel 0: input open -> closed debug3: receive packet: type 97 debug2: channel 0: rcvd close debug3: channel 0: will not send data after close debug2: channel 0: almost dead debug2: channel 0: gc: notify user debug2: channel 0: gc: user detached debug2: channel 0: send close debug3: send packet: type 97 debug2: channel 0: is dead debug2: channel 0: garbage collecting debug1: channel 0: free: client-session, nchannels 1 debug3: channel 0: status: The following connections are open: #0 client-session (t4 r0 i3/0 o3/0 e[write]/0 fd -1/-1/8 sock -1 cc -1) debug3: send packet: type 1 debug3: fd 1 is not O_NONBLOCK debug1: fd 2 clearing O_NONBLOCK Transferred: sent 3872, received 3272 bytes, in 0.2 seconds Bytes per second: sent 18702.6, received 15804.4 debug1: Exit status 0 |
What is the worst thing a usermode (ring3) virus could do to home linux installation? Posted: 27 Mar 2021 07:46 AM PDT I am interested to know whether is it a reasonable decision to try and restrict my own user account as much as possible to the point where I would need to use my own password much more frequently (now I use it only for mounting new disks and for system updates). For example I downloaded and opened a malicious program without administrative rights (sudo or etc.) on newly installed Ubuntu with default settings. Would this program be allowed for example: take a whole screenshot of my desktop, sniff my keystrokes (for later use for sudo as an example), listen or watch my microphone or webcam and adding itself in autostart (systemd service or gnome autostart folder, etc.) without me noticing? Of course neglecting the possibility of doing this through 0-day exploits. How dangerous could it get and is there any tips how I could secure my data in case of virus penetrating my system (except for backups and not launching malware in the first place)? TLDR: How many rights does the arbitrary usermode(ring3) program have in context of the current non-administrative user? |
How to run linux perf without root Posted: 27 Mar 2021 07:39 AM PDT I want to benchmark an application of mine. Up to now I used gnu time, but perf yields much better stats. As a matter of principle I would like to go the route of a decicated perf user instead of allowing all users some security-related things, not because I am aware of a specific danger but because I don't understand the security implications. Therefore I'd like to avoid lowering the paranoid setting for perf as discussed in this question. Reading kernel.org on perf-security (note that the document seems to imply that this should work with Linux 5.9 or later), I did this: # addgroup perf_users # adduser perfer # addgroup perfer perf_users # cd /usr/bin # chgrp perf_users perf # chmod o-rwx perf # setcap "cap_perfmon,cap_sys_ptrace,cap_syslog=ep" perf # setcap -v "cap_perfmon,cap_sys_ptrace,cap_syslog=ep" perf which returns perf: ok . # getcap perf returns perf cap_sys_ptrace,cap_syslog,cap_perfmon=ep . which is different from the link where they got perf = cap_sys_ptrace,cap_syslog,cap_perfmon+ep My Linux is 5.10.0-5-amd64 #1 SMP Debian 5.10.24-1 If I now run perf with user perfer I still get the error message Error: Access to performance monitoring and observability operations is limited. Consider adjusting /proc/sys/kernel/perf_event_paranoid setting to open access to performance monitoring and observability operations for processes without CAP_PERFMON, CAP_SYS_PTRACE or CAP_SYS_ADMIN Linux capability. More information can be found at 'Perf events and tool security' document: https://www.kernel.org/doc/html/latest/admin-guide/perf-security.html perf_event_paranoid setting is 3: -1: Allow use of (almost) all events by all users Ignore mlock limit after perf_event_mlock_kb without CAP_IPC_LOCK >= 0: Disallow raw and ftrace function tracepoint access >= 1: Disallow CPU event access >= 2: Disallow kernel profiling To make the adjusted perf_event_paranoid setting permanent preserve it in /etc/sysctl.conf (e.g. kernel.perf_event_paranoid = <setting>) which I tried to circumvent with all the above. Do any of you know, how to get perfer to run perf without lowering the paranoid setting? |
Why does this script work sparingly? Posted: 27 Mar 2021 07:50 AM PDT I have the following bash script that is running as a cronjob on OpenMediaVault: BACKUP_DIR='/srv/dev-disk-by-uuid-9EE055CFE055ADF1/Backup dir/' BACKUP_FILE_PATH="/srv/dev-disk-by-uuid-9EE055CFE055ADF1/Backup dir/Backup [ashen] ($(date +%d-%m-%Y)).tar.gz" SERVER_DIR=/var/lib/docker/volumes/49c9e5c53ea5b9c893c0a80117860da9b493484395c0$ MAX_BACKUPS_COUNT=4 tar -zcf "$BACKUP_FILE_PATH" $SERVER_DIR cd "$BACKUP_DIR" [[ $( ls | wc -l ) -gt $MAX_BACKUPS_COUNT ]] && rm "$(ls -t | tail -1)" The point of the script is to create a .tar.gz backup in the given location and, if there are more than 4 files in the backup directory, delete the oldest (the point being to keep only 4 recent backups). The last line/command doesn't always work. Running it manually in a terminal works as expected and sometimes the script will execute it but then sometimes it will stop until I manually try to run the script/line and then it seems to magically fix itself for some period of time. Does anyone know why it sporadically stops executing the last line? Even when I see that backups are being created. |
How to print the number of occurrences of consonants and vowels for each file with awk? Posted: 27 Mar 2021 08:39 AM PDT I am trying to count the occurrences of consonants and vowels in multiple files on Linux, but I want the number of occurrences to be separately calculated for each file. I use awk -v FS=""'{for ( i=1;i<=NF;i++){if($i ~/[bcdfghjklmnpqrtsvwxyzBCDEFGHJKLMNPQRTSVWXYZ]/)cout_c++ ;else if ($i ~/[aeiouAEIOU]/) count_v++}}END {print FILENAME,count_v,count_c}' file1 looks like this: bac Dfeg k87 eH tRe rt up file2 looks like this: hi rt2w PrOt but it prints the occurrences of both files: file2 7 19 How could I change this so the output would be like : file1 5 12 file2 2 7 |
How to print the number of occurrences of consonants for each file separately with awk? Posted: 27 Mar 2021 08:59 AM PDT I am trying to count the occurrences of consonants in multiple files but I want that the number of occurrences to be separately calculated for each file. I use awk -v FS="" '{for ( i=1;i<=NF;i++){if($i ~/[bcdfghjklmnpqrtsvwxyzBCDEFGHJKLMNPQRTSVWXYZ]/) count_c++}} END {print FILENAME,count_c}' file1 file2 file1 looks like this: bac Dfeg k87 eH tRe rt up file2 looks like this: hi rt2w Prt but it prints the occurrences of both files(output= file2 19 ). How could I change this so the output would be like : file1 12 file2 7 for the following code (provided by Ed Morton): awk '{ lc=tolower($0); cnt[FILENAME] += (gsub(/[[:alpha:]]/,"&",lc) - gsub(/[aeiou]/,"&",lc)) } END { for (i=1; i<ARGC; i++) print ARGV[i], cnt[ARGV[i]]+0 }' file1 file2 I get the folloing output: 0 file1 12 file2 7 |
How to show the incorrect checkum when the computed checksum did not match Posted: 27 Mar 2021 08:51 AM PDT Suppose I try to verify the checksum of a file using: echo '760382d5e8cdc5d0d079e8f754bce1136fbe1473be24bb885669b0e38fc56aa3 emacs-26.1.tar.gz' | \ sha256sum --check If the file is corrupt and the checksum is wrong, sha256sum will show this message: emacs-26.1.tar.gz: FAILED sha256sum: WARNING: 1 computed checksum did NOT match I would like to know the actual checksum of the file (i.e. incorrect checksum that caused this error message). What are my options? If possible, I do not want to compute the checksum twice (once to see the "FAILED" message, and a second time to see the incorrect checksum). (OS: Ubuntu 20.04) |
FFmpeg cannot write file to /dev/shm: Permission Denied Posted: 27 Mar 2021 09:05 AM PDT Issue: I have an FFmpeg command that I've been running for months now to stream video into the /dev/shm directory. It had been working fine until relatively recently (e.g. within a week), now it throws a permission issue. The command: ffmpeg -threads 2 -video_size 640x480 -i /dev/video2 -c:v libx264 -f dash -streaming 1 /dev/shm/manifest.mpd This is not the exact command (paired down for brevity), however the outcome is the same: libGL error: No matching fbConfigs or visuals found libGL error: failed to load driver: swrast X Error: GLXBadContext Request Major code 151 (GLX) Request Minor code 6 () Error Serial #57 Current Serial #56 ffmpeg version n4.3.1 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04) configuration: --prefix= --prefix=/usr --disable-debug --disable-doc --disable-static --enable-cuda --enable-cuda-sdk --enable-cuvid --enable-libdrm --enable-ffplay --enable-gnutls --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-libmp3lame --enable-libnpp --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopus --enable-libpulse --enable-sdl2 --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libv4l2 --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxvid --enable-nonfree --enable-nvenc --enable-omx --enable-openal --enable-opencl --enable-runtime-cpudetect --enable-shared --enable-vaapi --enable-vdpau --enable-version3 --enable-xlib libavutil 56. 51.100 / 56. 51.100 libavcodec 58. 91.100 / 58. 91.100 libavformat 58. 45.100 / 58. 45.100 libavdevice 58. 10.100 / 58. 10.100 libavfilter 7. 85.100 / 7. 85.100 libswscale 5. 7.100 / 5. 7.100 libswresample 3. 7.100 / 3. 7.100 libpostproc 55. 7.100 / 55. 7.100 Input #0, video4linux2,v4l2, from '/dev/video2': Duration: N/A, start: 1900.558740, bitrate: 147456 kb/s Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x480, 147456 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc Stream mapping: Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264)) Press [q] to stop, [?] for help [libx264 @ 0x55b15d8912c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 [libx264 @ 0x55b15d8912c0] profile High 4:2:2, level 3.0, 4:2:2 8-bit [libx264 @ 0x55b15d8912c0] 264 - core 152 r2854 e9a5903 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 [dash @ 0x55b15d88f600] No bit rate set for stream 0 [dash @ 0x55b15d88f600] Opening '/dev/shm/init-stream0.m4s' for writing Could not write header for output file #0 (incorrect codec parameters ?): Permission denied Error initializing output stream 0:0 -- Conversion failed! (tl;dr: Could not write header for output file #0 (incorrect codec parameters ?): Permission denied) For contrast, this version of the command (writing to the home directory) works fine (/tmp/ also works): ffmpeg -threads 2 -video_size 640x480 -i /dev/video2 -c:v libx264 -f dash -streaming 1 ~/manifest.mpd As mentioned above, the strange thing is that I have not (knowingly) changed permissions on anything or altered the application; it seemingly just stopped working (although, not ruling out that I caused it). The last time I remember it working was probably a week ago (~March 20th, 2021). What I tried: - Running ffmpeg as sudo (
sudo ffmpeg... ) - Result:
sudo: ffmpeg: command not found . This hasn't been necessary in the past, and it had the same output as before. sudo sysctl fs.protected_regular=0 - Ran the
ffmpeg ... command as su - chmod +777 /dev/shm
- Result: No change (
ls -tls reveals that the directory is indeed rwxrwxrwt ) - chown'd both root:root and my username on /dev/shm
touch /dev/shm/test.txt and sudo touch /dev/shm/test.txt - Result: The file is created without issue.
I've exhausted everything I could think of relating to permissions to get it to work. The Question What do I need to do to get FFmpeg write files to /dev/shm? Ideally, figuring out why this happened in the first place. If anyone has any ideas for commands I should run to help diagnose this issue, feel free to add a comment. System Info: - Kernel: 4.19.0-14-amd64
- Distro: Debian
- FFmpeg: version n4.3.1 (Was installed using Snapd, if it matters.)
|
Issues installing Docker on RHEL 7 Linux Server Posted: 27 Mar 2021 09:05 AM PDT I have been constantly running into this issue more and more lately, and finally need some assistance because I'm completely stuck. I just got access to a RHEL EC2 Linux server and I am just simply trying to install Docker. This process has been extremely painful lately. Tons of 404 HTTP Not Found errors when trying to follow the processes mentioned online According to https://docs.aws.amazon.com/AmazonECS/latest/developerguide/docker-basics.html, you can just simply run one of the following two commands: - sudo amazon-linux-extras install docker
- sudo yum install docker
However, neither one of these comands work, as shown in the output below: [root@d8de679d27f2454 myuser]# sudo amazon-linux-extras install docker sudo: amazon-linux-extras: command not found [root@d8de679d27f2454 myuser]# yum install docker Loaded plugins: amazon-id, search-disabled-repos No package docker available. Error: Nothing to do [root@d8de679d27f2454 myuser]# Here is a list of things I've tried to do : First Attempt (RE: https://stackoverflow.com/questions/53918841/how-to-install-docker-on-amazon-linux2) The second answer proposed in that you can just run the following: sudo yum update -y sudo yum -y install docker However, that doesn't work either, as shown in the output below: [root@d8de679d27f2454 myuser]# yum update -y Loaded plugins: amazon-id, search-disabled-repos No packages marked for update [root@d8de679d27f2454 myuser]# yum -y install docker Loaded plugins: amazon-id, search-disabled-repos No package docker available. Error: Nothing to do [root@d8de679d27f2454 myuser]# Second Attempt: Installing via get.docker.com When running curl https://get.docker.com | bash , that doesn't work either Third Attempt: https://computingforgeeks.com/install-docker-ce-on-rhel-7-linux/ Part of this article suggests running the following two commands: sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm sudo yum install -y yum-utils device-mapper-persistent-data lvm2 However, that doesn't work either: # yum install -y yum-utils device-mapper-persistent-data lvm2 Loaded plugins: amazon-id, product-id, search-disabled-repos, subscription-manager This system is not registered with an entitlement server. You can use subscription-manager to register. https://download.docker.com/linux/rhel/7/x86_64/stable/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found Trying other mirror. To address this issue please refer to the below knowledge base article https://access.redhat.com/articles/1320623 If above article doesn't help to resolve this issue please open a ticket with Red Hat Support. One of the configured repositories failed (Docker CE Stable - x86_64), and yum doesn't have enough cached data to continue. At this point the only safe thing yum can do is fail. There are a few ways to work "fix" this: 1. Contact the upstream for the repository and get them to fix the problem. 2. Reconfigure the baseurl/etc. for the repository, to point to a working upstream. This is most often useful if you are using a newer distribution release than is supported by the repository (and the packages for the previous distribution release still work). 3. Run the command with the repository temporarily disabled yum --disablerepo=docker-ce-stable ... 4. Disable the repository permanently, so yum won't use it by default. Yum will then just ignore the repository until you permanently enable it again or use --enablerepo for temporary usage: yum-config-manager --disable docker-ce-stable or subscription-manager repos --disable=docker-ce-stable 5. Configure the failing repository to be skipped, if it is unavailable. Note that yum will try to contact the repo. when it runs most commands, so will have to try and fail each time (and thus. yum will be be much slower). If it is a very temporary problem though, this is often a nice compromise: yum-config-manager --save --setopt=docker-ce-stable.skip_if_unavailable=true failure: repodata/repomd.xml from docker-ce-stable: [Errno 256] No more mirrors to try. https://download.docker.com/linux/rhel/7/x86_64/stable/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found Here's the output of my cat /etc/os-release command NAME="Red Hat Enterprise Linux Server" VERSION="7.9 (Maipo)" ID="rhel" ID_LIKE="fedora" VARIANT="Server" VARIANT_ID="server" VERSION_ID="7.9" PRETTY_NAME="Red Hat Enterprise Linux Server 7.9 (Maipo)" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:redhat:enterprise_linux:7.9:GA:server" HOME_URL="https://www.redhat.com/" BUG_REPORT_URL="https://bugzilla.redhat.com/" Any help would be greatly appreciated. It seems nearly impossible to install docker at this point. |
Run bash without user config while still able to set bindings Posted: 27 Mar 2021 10:07 AM PDT I would like to be able to run a script with the following two properties - Everything inside the script is run as if the bashrc was never sourced.
- I can still set bindings that will remain after the script has completed.
For example if my .bashrc looks like alias rm="echo don't use me" I want to be able to run the following script such that rm.me is removed - afterwards, running
fn will echo i am bound rm rm.me fn() { echo i am bound; } If I run bash my-script.sh then fn isn't bound And If I run . my-script.sh then my rm alias is used. |
sort based on the second field and then re-order the lines having the same first column but still keep the order on second field for each group Posted: 27 Mar 2021 09:51 AM PDT I want to sort a file. Input: I1, -2 I2, -6 I2, -9 I1, -8 I1, -1 I3, -7 I2, -4 I3, -4 Output : I2, -9 I2, -6 I2, -4 I1, -8 I1, -2 I1, -1 I3, -7 I3, -4 How to get the following output? |
mdadm RAID1: can you grow to 3 disks, then revert back to 2? Posted: 27 Mar 2021 09:46 AM PDT I have a Linux (CentOS7) software RAID1 system with two disks which are getting old. One has been starting to show signs of failure. I'd like to phase these disks out one at a time with new disks but always have a fully mirror active. I was thinking to add a third new disk for a 3-way mirror, then fail out an old disk, repeat with another new one, then fail out the second old disk. That way I'd always have a mirror and not wait for a raid rebuild after a fail event. This seems like it could work with num-devices=3 and grow, but, when I'm done how do I 'shrink' it back to two devices? I can't seem to find a reference to what I'm attempting. |
Using `printf` to output chars given some ASCII numbers Posted: 27 Mar 2021 07:57 AM PDT I've been trying to make printf output some chars, given their ASCII numbers (in hex)... something like this: #!/bin/bash hexchars () { printf '\x%s' $@ ;} hexchars 48 65 6c 6c 6f Expected output: Hello For some reason that doesn't work though. Any ideas? EDIT: Based on the answer provided by Isaac (accepted answer), I ended up with this function: chr () { local var ; printf -v var '\\x%x' $@ ; printf "$var" ;} Note, I rewrote his answer a bit in order to improve speed by avoiding the subshell. Result: ~# chr 0x48 0x65 0x6c 0x6c 0x6f Hello ~# chr 72 101 108 108 111 Hello ~# chr {32..126} !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|} I guess the inverse of the chr function would be a function like... asc () { printf '%d\n' "'$1" ;} asc A 65 chr 65 A Or, if we want strictly hex variants... chrx () { local var ; printf -v var '\\x%s' $@ ; printf "$var\n" ;} ascx () { printf '%x\n' "'$1" ;} chrx 48 65 6c 6c 6f Hello ascx A 41 Thank you! |
Make Kate to ask password only once, instead of asking it at every file saving? Posted: 27 Mar 2021 09:00 AM PDT I am using KDE and Kate editor. When I want to edit some common system files such as configs in /etc, I am asked for password to save my edits. When I am editing files, I often do several changes, then want to save file and continue to do changes. The problem is that after first file save, permission is not "cached". I need to reenter the my password for EVERY change! This is very annoying. Some time ago I had a configuration when I could enter password just once, then I could edit and save file without any additional password dialog. But it was several years ago, so I do not know if this was changed in source code or it was configured specifically in the system. Now I cannot find instructions regarding this. Is it possible to get such behavior again? I have found this topic, but it looks like they just disable password protection completely. |
How to install bluez-hid2hci? Posted: 27 Mar 2021 07:53 AM PDT I've been trying to connect my Debian computer to my Bluetooth speakers, using bluetoothctl . I managed to pair the devices, but can't seem to connect them. [bluetooth]# devices Device X:X:X:X:X:X BT_SPEAKERS [bluetooth]# connect X:X:X:X:X:X Attempting to connect to X:X:X:X:X:X Failed to connect: org.bluez.Error.Failed [bluetooth]# I found online various posts that tend to agree that installing bluez-hid2hci resolves the problem. However, I can't install this package, it doesn't seem to exist: apt-get install bluez-hid2hci E: Unable to locate package bluez-hid2hci How can I install this? |
Execute a command after some time if no input from user Posted: 27 Mar 2021 10:34 AM PDT Let's say I have the following in my ~/.bash_aliases to ask for confirmation before suspending the system: function suspend() { # echo "Please confirm/cancel system suspension:" select confirmation in "confirm" "cancel"; do case ${confirmation} in confirm ) echo "System suspending..." systemctl suspend break;; cancel ) echo "Canceled suspension." break;; esac done } I would like systemctl suspend to be still executed if no answer is given by the user. For example, after 10 seconds without user input, the content of the "confirm" case would be executed. I tried the following, with a backgrounded sleep in a subshell: function suspend() { # flag_cancel=0 echo "Please confirm/cancel system suspension:" ( sleep 10 && if [ $flag_cancel -eq 0 ]; then echo "System suspending..." systemctl suspend fi & ) select confirmation in "confirm" "cancel"; do case ${confirmation} in confirm ) echo "System suspending..." systemctl suspend break;; cancel ) flag_cancel=1 echo "Canceled suspension." break;; esac done } but a change of the value of flag_cancel is not taken into account, so the command is always executed after the sleep . How to achieve what I want? |
Help upgrading Qualcomm Atheros QCA6174 driver for Fedora for a more recent one Posted: 27 Mar 2021 10:01 AM PDT On my fedora 29, I have the following wifi pci device: 00:06.0 Network controller: Qualcomm Atheros QCA6174 802.11ac Wireless Network Adapter (rev 32) Subsystem: Bigfoot Networks, Inc. Device 1535 Kernel driver in use: ath10k_pci Kernel modules: ath10k_pci I'm getting disconnections when I download large files too fast. I'd like to try a more recent driver, but I know nothing about fedora (and I'm using an old fedora on purpose). How can I replace that driver by a new one? |
Bluetooth headphone's mic not working on Linux Mint Posted: 27 Mar 2021 10:09 AM PDT - I have a bluetooth headphones with a mic connected to Linux Mint. On blueman (bluetooth Manager) I am able to see the audio profile selected as A2DP sink so the output is working fine.
- I know for microphone to work I have to select the profile HSP/HFP but I am not able to select that option and get and error "Failed to change profile to headset_head_unit". I have tried all the hack provided on Linux forum like pulse audio, ofno but none of them worked as I haven't figured out the root cause yet.
- I am yet to find the steps where I can do this via running a script. I just ugraded to Linux 20 hoping the latest version of Mint would solve it.
|
explanation of RHEL/CentOS 7 yum repo gpg key Posted: 27 Mar 2021 10:00 AM PDT I do not understand how one gpg key can work for any of a thousand rpm's downloaded from a repository? For example, in RHEL/Centos 7.x - install EPEL (extra packages for enterprise linux); results in
/etc/yum.repos.d/epel.repo containing gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 - ok so that's one gpg key, in a file, how does this work for any rpm then downloaded from the EPEL repository?
- I thought the key was contained in the .rpm header, and that key is generated based on the contents of that rpm. But all rpm's are different so shouldn't there be a different key in each rpm? How does one
/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 apply to anything downloaded from the EPEL repo website? |
How start Telnet with systemctl in Debian Posted: 27 Mar 2021 09:16 AM PDT i to prove starting telnet with this command sudo systemctl start telnet.socket but i comme; Failed to start telnet.socket: Unit telnet.socket not found. So , i am little new with Linux as i have understand , the new's Linux version ,about a prozess new to start , now to use systemd . I can start telnet with sudo /etc/init.d/xinetd start but i want to learn how to do this with systemd, because with it i have moreeeee possibility... I have Debian Stretch |
why centos7 free command output available value less than free value Posted: 27 Mar 2021 09:01 AM PDT I ask a question, In my centos7, why available value less than free sometimes I think available value is equal to free+buff+cache, available means when start a app how many memory can use? [root@izuf6dbkdletdzecvyepl8z ~]# free -m total used free shared buff/cache available Mem: 992 160 380 342 451 44 Swap: 0 0 0 available Estimation of how much memory is available for starting new applications, without swapping. Unlike the data provided by the cache or free fields, this field takes into account page cache and also that not all reclaimable memory slabs will be reclaimed due to items being in use (MemAvailable in /proc/meminfo, available on kernels 3.14, emulated on kernels 2.6.27+, otherwise the same as free) |
Sending audio through network Posted: 27 Mar 2021 09:28 AM PDT This is a rather crazy idea. I am planing to set up a configuration that would send audio being played on my laptop to my home server via local network so that the sound is played on the server connected to a hi-fi with good speakers. It's supposed to serve the purpose of watching movies on the laptop with sound on the speakers without rearanging cables. I suppose it can be done similarly to writing text to a file mounted via sftp, but with the /dev/audio or /dev/mixer But I have no idea how to intercept the audio output. Looking forward to tips from Pros ;) |
No comments:
Post a Comment