Monday, May 24, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


unable to connect socket: connection refused(10061)

Posted: 24 May 2021 10:13 AM PDT

I am trying to run '''kex --win -s''' in kali linux in order to get the GUI but I am getting an error message:

Error: unable to connect socket: connection refused(10061)

Can you help

I have tried the following: Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

wsl --set-default-version 2

wsl --set-version kali-linux 2

sudo apt install -y kali-win-kex

kex --win -s

Start the vncserver to accept connection from all network address: vncserver -localhost no

Check the status of the kex again by: kex --status It should now list the vnc sessions

Type the following command to start the kali windows: kex --win -sl

If I run '''vncserver -localhost no''' I get the following:

Killing Xtigervnc process ID 29... success!

=================== tail /home/vi/.vnc/Vik.localdomain:5901.log ===================

Xvnc TigerVNC 1.11.0 - built 2021-03-22 21:21 Copyright (C) 1999-2020 TigerVNC Team and many others (see README.rst) See https://www.tigervnc.org for information on TigerVNC. Underlying X server release 12010000, The X.Org Foundation

Mon May 24 18:42:53 2021 vncext: VNC extension running! vncext: Listening for VNC connections on all interface(s), port 5901 vncext: created VNC server for screen 0

Mon May 24 18:43:24 2021 ComparingUpdateTracker: 0 pixels in / 0 pixels out ComparingUpdateTracker: (1:-nan ratio)

vncserver: /usr/bin/Xtigervnc did not start up, please look into '/home/vi/.vnc/Vik.localdomain:5901.log' to determine the reason! -1

Am new to kali linux

error in .bashrc file Linux bash: /usr/share/bash-completion/bash_completion: line 217: syntax error near unexpected token `done'

Posted: 24 May 2021 10:10 AM PDT

I am using ubuntu 20.04 and can someone tell me what is the solution of the following problem :- bash: /usr/share/bash-completion/bash_completion: line 217: syntax error near unexpected token ``done

bash: /usr/share/bash-completion/bash_completion: line 217: done' enter image description here

My .bashrc file is as follows :-

# ~/.bashrc: executed by bash(1) for non-login shells.  # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)  # for examples    # If not running interactively, don't do anything  case $- in      *i*) ;;        *) return;;  esac    # don't put duplicate lines or lines starting with space in the history.  # See bash(1) for more options  HISTCONTROL=ignoreboth    # append to the history file, don't overwrite it  shopt -s histappend    # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)  HISTSIZE=1000  HISTFILESIZE=2000    # check the window size after each command and, if necessary,  # update the values of LINES and COLUMNS.  shopt -s checkwinsize    # If set, the pattern "**" used in a pathname expansion context will  # match all files and zero or more directories and subdirectories.  #shopt -s globstar    # make less more friendly for non-text input files, see lesspipe(1)  [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"    # set variable identifying the chroot you work in (used in the prompt below)  if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then      debian_chroot=$(cat /etc/debian_chroot)  fi    # set a fancy prompt (non-color, unless we know we "want" color)  case "$TERM" in      xterm-color|*-256color) color_prompt=yes;;  esac    # uncomment for a colored prompt, if the terminal has the capability; turned  # off by default to not distract the user: the focus in a terminal window  # should be on the output of commands, not on the prompt  #force_color_prompt=yes    if [ -n "$force_color_prompt" ]; then      if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then      # We have color support; assume it's compliant with Ecma-48      # (ISO/IEC-6429). (Lack of such support is extremely rare, and such      # a case would tend to support setf rather than setaf.)      color_prompt=yes      else      color_prompt=      fi  fi    if [ "$color_prompt" = yes ]; then      PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '  else      PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '  fi  unset color_prompt force_color_prompt    # If this is an xterm set the title to user@host:dir  case "$TERM" in  xterm*|rxvt*)      PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"      ;;  *)      ;;  esac    # enable color support of ls and also add handy aliases  if [ -x /usr/bin/dircolors ]; then      test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"      alias ls='ls --color=auto'      #alias dir='dir --color=auto'      #alias vdir='vdir --color=auto'        alias grep='grep --color=auto'      alias fgrep='fgrep --color=auto'      alias egrep='egrep --color=auto'  fi    # colored GCC warnings and errors  #export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'    # some more ls aliases  alias ll='ls -alF'  alias la='ls -A'  alias l='ls -CF'    # Add an "alert" alias for long running commands.  Use like so:  #   sleep 10; alert  alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'    # Alias definitions.  # You may want to put all your additions into a separate file like  # ~/.bash_aliases, instead of adding them here directly.  # See /usr/share/doc/bash-doc/examples in the bash-doc package.    if [ -f ~/.bash_aliases ]; then      . ~/.bash_aliases  fi    # enable programmable completion features (you don't need to enable  # this, if it's already enabled in /etc/bash.bashrc and /etc/profile  # sources /etc/bash.bashrc).  if ! shopt -oq posix; then    if [ -f /usr/share/bash-completion/bash_completion ]; then      . /usr/share/bash-completion/bash_completion    elif [ -f /etc/bash_completion ]; then      . /etc/bash_completion    fi  fi  #shubhi aliases :-    #shubhi directories:-  alias friends="cd ~/friends/"  alias d="cd ~/Desktop/"  alias cu="cd ~/Desktop/shubhi/ShubhiCUWorksheets/semester2/"  alias oop="cd ~/Desktop/shubhi/ShubhiCUWorksheets/semester2/ooplab"  alias de="cd ~/Desktop/shubhi/ShubhiCUWorksheets/semester2/delab"  alias iot="cd ~/Desktop/shubhi/ShubhiCUWorksheets/semester2/iotlab"  alias cw="cd ~/Desktop/shubhi/ShubhiCUWorksheets/semester2/computerworkshop"  alias songs="cd ~/Desktop/shubhi/shubhi_songs"  alias c="clear"  alias s="cd ~/Desktop/shubhi"  alias p="cd ~/Desktop/shubhi/python"  alias r="cd ~/Desktop/shubhi/Rap"  alias bh="cd ~/Desktop/shubhi/shubhi_bootcamp/html_bootcamp"  alias bp="cd ~/Desktop/shubhi/shubhi_bootcamp/python_bootcamp"  alias a="cd ~/Desktop/shubhi/csall"  alias doo="cd ~/Downloads"  #volume booster:-  alias v1="pactl set-sink-volume 1 120%"  alias v2="pactl set-sink-volume 1 150%"  alias v3="pactl set-sink-volume 1 200%"  alias v4="pactl set-sink-volume 1 250%"  alias v5="pactl set-sink-volume 1 300%"      #shubhi  alias 5m="sleep 5m && play ~/Desktop/shubhi/shubhi_songs/'Alarm Clock For Heavy Sleepers (Loud)-fpQHabt6e-w.mp3'"  alias 10m="sleep 10m && play ~/Desktop/shubhi/shubhi_songs/'Alarm Clock For Heavy Sleepers (Loud)-fpQHabt6e-w.mp3'"  alias 20m="sleep 20m && play ~/Desktop/shubhi/shubhi_songs/'Alarm Clock For Heavy Sleepers (Loud)-fpQHabt6e-w.mp3'"  alias 30m="sleep 30m && play ~/Desktop/shubhi/shubhi_songs/'Alarm Clock For Heavy Sleepers (Loud)-fpQHabt6e-w.mp3'"  alias 1m="sleep 1m && play ~/Desktop/shubhi/shubhi_songs/'Alarm Clock For Heavy Sleepers (Loud)-fpQHabt6e-w.mp3'"  alias 1h="sleep 1h && play ~/Desktop/shubhi/shubhi_songs/'Alarm Clock For Heavy Sleepers (Loud)-fpQHabt6e-w.mp3'"  alias 1s="sleep 1s && play ~/Desktop/shubhi/shubhi_songs/'Alarm Clock For Heavy Sleepers (Loud)-fpQHabt6e-w.mp3'"  alias m="cd ~/Desktop/shubhi/movies"      #shubhi functions:-      #1) function that creates directory folder and jump into it  mkcd ()  {    mkdir -p -- "$1" && cd -P -- "$1"  }          # >>> conda initialize >>>  # !! Contents within this block are managed by 'conda init' !!  __conda_setup="$('/home/shubharthak/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"  if [ $? -eq 0 ]; then      eval "$__conda_setup"  else      if [ -f "/home/shubharthak/miniconda3/etc/profile.d/conda.sh" ]; then          . "/home/shubharthak/miniconda3/etc/profile.d/conda.sh"      else          export PATH="/home/shubharthak/miniconda3/bin:$PATH"      fi  fi  unset __conda_setup  # <<< conda initialize <<<      

Can somebody help me out. Surprisingly, there's no line number 217 in my .bashrc file, Am new here kindly help Thank you

AIX 7 - Command To Check Histsize Is Set Correctly For All Users

Posted: 24 May 2021 09:36 AM PDT

I am checking to see if the minimum password history setting is set to 6.

Using the command below, I am able to check the default stanza:

lssec -f /etc/security/user -s default -a histsize  

Can this command be enhanced to view all user settings to ensure it is set to 6?

/root/.bashrc:157: = not found

Posted: 24 May 2021 09:59 AM PDT

#Get client IP base on current logged in user  if [ $USER == 'root' ]  then      ip="$(last | awk 'NR==1 {print $3}')"  else      ip="$(echo $SSH_CONNECTION | cut -d " " -f 1)"  fi  

/root/.bashrc:157: = not found

Line 157

enter image description here


Note

I appended this line source ~/.bashrc to my .zshrc to

vi .zshrc  source ~/.bashrc  # import all my quick aliases and fns  

rsyslog custom log file permissions

Posted: 24 May 2021 09:58 AM PDT

I have haproxy service running on the server. For haproxy logging created following /etc/rsyslog.d/haproxy.conf file with content mentioned below:

$ModLoad imudp  $UDPServerAddress 127.0.0.1  $UDPServerRun 514  $FileCreateMode 0600    local0.* /var/log/my-haproxy-2.log  

I consider that with this configuration my-haproxy-2.log file permissions should be set 0600 but it is 0644.

Is there anything in the configuration that I am missing?

using VXLAN and kvm, can't access internet

Posted: 24 May 2021 08:39 AM PDT

So I do not have very much experience using VXLan and its been pretty difficult finding information about this topic. I am trying to build an Overlay network for kvm networks. The purpose is for multi tenant cloud hosting. Below i will describe my kvm lab environment. Anyways, I have done this...

ip link add vxlan1 type vxlan id 1 group 239.1.1.1 dstport 0 dev eno1  ip link add br-vxlan1 type bridge  ip link set vxlan1 master br-vxlan1  ip link set vxlan1 up  ip link set br-vxlan1 up  ip addr add 192.168.10.1/24 broadcast + dev br-vxlan1  

Here is what it looks like...

enter image description here

here is my network for virsh virsh net-edit net1

<network>    <name>net1</name>    <uuid>d73828b1-1179-48e4-90c0-42e27bad6216</uuid>    <forward mode='bridge'/>    <bridge name='br-vxlan1'/>  </network>  

I am able to SSH into an ubuntu 20.04 cloud image using the static IP i assigned it in the network config. Here is what it looks like. enter image description here

The problem is, the VM cannot communicate with anything outside of the 192.168.10.0 network. For example, I cannot ping 8.8.8.8 If there is other configuration details I missed, please feel free to ask.

Also, I am following this guide on how to setup a VXLAN https://ilearnedhowto.wordpress.com/2017/02/16/how-to-create-overlay-networks-using-linux-bridges-and-vxlans/ At the bottom, there is an example of creating 2 veth devices on different hosts using the vxlan config. I already successfully tested that.

syntax error near unexpected token `elif' on 2 levels if-else check

Posted: 24 May 2021 09:03 AM PDT

I kept getting this error when I SSHed into my box.

-bash: /root/.bashrc: line 65: syntax error near unexpected token `elif'                                                                            -bash: /root/.bashrc: line 65: `elif [ -n "$BASH_VERSION" ]; then'   

This is what I have on these lines

if [ -n "$ZSH_VERSION" ]; then     # assume Zsh  elif [ -n "$BASH_VERSION" ]; then      PS1="⚡️$yellow $dircolor \W $lightpurple $white"      if [ $USER == 'root' ]      then          export PS1="$white┌──[$red\u$white@$red\h$white]──$white[$red\w$white] \n└── $white"      else          export PS1="$white┌──[$lightgreen\u$white@$lightgreen\h$white]──$white[$lightgreen\w$white] \n└── $white"      fi  else      # assume something else  fi  

I'm only check if zsh/bash and set my PS1 accordingly.

Am I doing something wrong on my syntax ?

Asus ROG GL553VW Keyboard Backlight, Fan Control and Keyboard Shortcuts working thanks to Zlynt but now the touchpad isn't recognized

Posted: 24 May 2021 08:14 AM PDT

Zlynt's fix corrects the Keyboard Backlight, Fan Control and Keyboard Shortcuts but now the touchpad isn't recognized. Before this fix the touchpad worked as it should. Please help.

Edit: Issue solved by rebuilding the lastest stable Linux Kernel and changing the file drivers/hid/hid-ids.h in the Linux kernel with the following changes (accoding to apeelme at https://bugzilla.kernel.org/show_bug.cgi?id=194557):

-#define USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD2 0x1837

+#define USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD2 0x8176

Using systemd to mount remote filesystems in user-space

Posted: 24 May 2021 08:38 AM PDT

I'd like to mount a directory from a remote machine in my /home/stew/shared. After installing sshfs and using ssh-copy-id to my remote machine, I can do this:

stew@stewbian:~$ sshfs stew@192.168.1.9:/path/to/remote-dir ~/shared  

and then unmount with

stew@stewbian:~$ umount ~/shared  

or

stew@stewbian:~$ fusermount -u ~/shared  

Works great, but I'd like to mount this automatically when stew logs in, and unmount it when stew logs out. One working option is to use a systemd .service on the user bus:

# ~/.config/systemd/user/shared.service  [Unit]  Description=Mount ~/shared    [Service]  Type=oneshot  RemainAfterExit=yes  ExecStart=sshfs %u@192.168.1.9:/path/to/remote-dir %h/shared  ExecStop=umount %h/shared    [Install]  WantedBy=default.target  

systemctl --user {start,stop} shared.service also works great! But I'm wondering if .mount units would be more robust.


I tried using a mount unit like so:

# ~/.config/systemd/user/home-stew-shared.mount   [Unit]  Description=~/shared    [Mount]  What=%u@192.168.1.9:/path/to/remote-dir  Where=%h/shared  Type=fuse.sshfs    [Install]  WantedBy=default.target  

Starting this mount unit works great, but stopping it causes this:

$ systemctl --user status home-stew-shared.mount  ● home-stew-shared.mount - ~/shared       Loaded: loaded (/home/stew/.config/systemd/user/home-stew-shared.mount; static)       Active: active (mounted) (Result: exit-code) since Mon 2021-05-24 16:49:40 CEST; 6min ago       ...  May 24 16:49:40 stewbian systemd[1046]: Unmounting ~/shared...  May 24 16:49:40 stewbian umount[22256]: umount: /home/stew/shared: must be superuser to unmount.  May 24 16:49:40 stewbian systemd[1046]: home-stew-shared.mount: Mount process exited, code=exited, status=32/n/a  May 24 16:49:40 stewbian systemd[1046]: Failed unmounting ~/shared.  

I can $ umount ~/shared to unmount the directory and fail the unit.


Questions:

  1. Is there a reason why I should prefer *.mount units over *.service units?
  2. If I really should be using *.mount, is there a trick to getting this to work on the user-bus, or do I need to go to the system bus and figure out how to do lazy mounting and manually set UIDs and GIDs?

One of the nice things about using the *.service is that I can add this service to the skel, so each user will automount their own private shared directories which are effectively sync'd between all machines in the house. The *.mount files need the username in the filename to access the correct home.

How do I use FZF's keybinding in ZSH's vi mode?

Posted: 24 May 2021 08:00 AM PDT

After applying the command: set -o vi in ZSH, I can't get FZF keybinding works as before, ex ^CR for reverse history search.. How can I make this works again?

Asus AC3100(RT-AC88U) Router - IPERF3

Posted: 24 May 2021 07:52 AM PDT

I am looking to install iperf3 on my Asus router BusyBox v1.7.2 (2018-08-07 19:44:13 CEST) built-in shell (ash) Linux 2.6.36 (armv7l) is ther any package I can dowload and install it throught winscp/telnet ? i cannot find any instruction Thanks

Gnome40: how to move window to specific non-primary monitor on another workspace?

Posted: 24 May 2021 08:28 AM PDT

I do recognise How to move windows across displays in Gnome 3 with keyboard? - but it does not address the following variation:

I regularly use both multiple monitors (l,c,r) and multiple workspaces (1,2). c is the primary monitor.

My observation is that whenever I move a window (on l1) to another workspace (2), it gets sent to the primary monitor (c2).

How can I send it straight from l1 to l2? or say from l1 to r2?

I am looking for keyboard shortcuts or even to a single drag&drop operation.

Trying to disable the touchpad at wakeup

Posted: 24 May 2021 06:49 AM PDT

I am using a Thinkpad L13 Yoga and had the problem that the trackpoint stopped working after wakeup. So I followed the following hint (which basically reloads the psmouse module at wakeup): https://askubuntu.com/a/1159960/270792

After putting the file in place the trackpoint stopped failing at wakeup, however, the touchpad now was activated. I would like, however, to keep the touchpad deactivated since I sometimes touch it with my palms unintentionally.

So i tried to disable the touchpad at wakeup. Here is how my /lib/systemd/system-sleep/trackpoint-fix script currently looks like:

#!/bin/bash    case $1/$2 in    pre/*)      echo "Going to $2..."      # Place your pre suspend commands here, or `exit 0` if no pre suspend action required      modprobe -r psmouse      ;;    post/*)      echo "Waking up from $2..."      # Place your post suspend (resume) commands here, or `exit 0` if no post suspend action required      sleep 2      echo "Will now modprobe psmouse..."      modprobe psmouse      sleep 2      echo "Will now disable the touchpad..."      DISPLAY=:0 xinput disable 'Elan Touchpad'      sleep 2      echo "Will now show touchpad state..."      DISPLAY=:0 xinput list-props 'Elan Touchpad' | grep 'Device Enabled'      ;;  esac  

This is what I find in my logs:

Mai 24 15:13:42 ThinkpadL13Yoga systemd-sleep[2919]: Going to suspend...  Mai 24 15:13:42 ThinkpadL13Yoga systemd-sleep[2916]: Suspending system...  Mai 24 15:13:50 ThinkpadL13Yoga systemd-sleep[2916]: System resumed.  Mai 24 15:13:50 ThinkpadL13Yoga systemd-sleep[3073]: Waking up from suspend...  Mai 24 15:13:52 ThinkpadL13Yoga systemd-sleep[3073]: Will now modprobe psmouse...  Mai 24 15:13:54 ThinkpadL13Yoga systemd-sleep[3073]: Will now disable the touchpad...  Mai 24 15:13:56 ThinkpadL13Yoga systemd-sleep[3073]: Will now show touchpad state...  Mai 24 15:13:56 ThinkpadL13Yoga systemd-sleep[3326]:         Device Enabled (184):        0  

So, looking at the last line, it seems like the touchpad device has been disabled successfully. However, the touchpad is still active. If I check the state of the touchpad inside the X session after wakeup, it tells me that the device is indeed enabled:

$ DISPLAY=:0 xinput list-props 'Elan Touchpad' | grep 'Device Enabled'      Device Enabled (184):   1  

I absolutely don't understand how the touchpad gets enabled again and would like to keep it disabled. Possibly, reloading psmouse isn't a suiting solution and there is a better approach to keep the trackpoint enabled after wakeup.

How to make Bash/Zsh prompt show only the current directory and its parent?

Posted: 24 May 2021 06:30 AM PDT

How can I create a bash and a zsh prompt that shows only the current and parent directories?

For example, if I'm at the dir ~/pictures/photos/2021, it should show:

[photos/2021]$ echo hi  

That's all. Would like it for bash and for zsh.

is it applicable to install oracle db 19c on pacemaker cluster?

Posted: 24 May 2021 07:14 AM PDT

I want to install oracle 19 c on an RHEL Cluster. I configure 2 RHEL 7.7 with pacemaker cluster and all is working well for VIP IP and shared disk. Is it applicable to install the oracle database on this cluster?

rsync could not find xattr #1 for {file}... error in rsync protocol data stream

Posted: 24 May 2021 08:53 AM PDT

I have regular and frequent backups from a set of QNAP systems to a central backups repository. Backups are rsync over ssh, pulled from the central server. The QNAP filesystem is ext4, shared to my users via Samba. (QNAPs are based on Linux, and I'm fairly confident that for the purposes of this question you can treat them as such.) The filesystem on the backups server also handles extended attributes.

Recently I've been getting this fatal error from one of them

[sender] could not find xattr #1 for long_filename.xlsm  rsync error: protocol incompatibility (code 2) at xattrs.c(622) [sender=3.1.2]  rsync: [generator] write error: Broken pipe (32)  

The rsync command is driven from rsnapshot but it comes down to this

rsync -avzSAXiv --delete --numeric-ids --fake-super --fuzzy --delete-after --partial --link-dest=/path/to/previous user@remoteHost:/share/ /path/to/backup/  

Extended attributes on the source file

getfattr -d -m -long_filename.xlsm  # file: long_filename.xlsm  security.NTACL=0sAwADAA..........AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAASAZAAAAIAAAAAAAAAAnAAAAAEFAAAAAAAFFQAAABSYSwXsMclxQXR48kIFAAABBQAAAAAABR....................IBAgAAAgAc..........QA/wEfAAEBAAAAAAABAAAAAA==  user.DOSATTRIB=0sMH..............EQAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKZ........YBAAAAAAAAAAA=  user.qtier="io_aware"  

What is this xattr #1? Is it referring to extended attributes on the remote server or on the local destination? What might I be looking for, to identify the problem? The destination file doesn't exist, because that's where rsync crashed out, but 87000 or so other files successfully transferred. Nothing seems to be particularly special about the source file.

I'm currently trying to build an MRE but until I found the security.NTACL attribute I was failing dismally (getfattr only displays user.* attributes by default).

Thanks

Trying to create a program with several while loops but running into issues

Posted: 24 May 2021 08:12 AM PDT

I'm trying to create a program that would take input from a user and then repeat questions based on that variable.

Summary of code (or what it should do): User receives a question, user has to input a valid participant number between 5-20. Then, questions should be repeated based off the number of this input (if 5 participants, then repeat name and country questions 5 times). If the name is longer than 10 characters, or the country isn't Italy, then a warning message should appear to ask the user to repeat the question correctly.

Finally, after the applicant has input the correct information, both name and country inputs should be sent to an external file. This should repeat for each applicant.

I've tried to implement this, but the second While loop appears to repeat both name and country questions, even if one of the questions was incorrect...

I'm pretty much stuck on this question and don't know what else to do, so any help would be greatly appreciated!

#!/bin/sh    i=0    read -p "Welcome to the lottery program. Please enter a number of participants between 5-20." input    while [ $input -lt 5 ] || [ $input -gt 20 ]  do      read -rp "Number of people must be 5-20" input  done    while [ $i -lt $input ]  do      read -p "Enter name(max 10 characters)" name      read -p "Enter country(only for people outside of Italy)" country    while [ ${#name} -gt 10 ]  do  read -p "The name was too long (over 10 chars). Please re-enter: " name  done    while [ "$country" = "Italy" ]  do  read -p "Italy is not included within the program. Please try again" country  done    while [ ${#name} -le 10 ] && [ "$country" != "Italy" ]  do  echo $name $country >>echo.txt  i=$((i+1))        done  done    echo "The records have been saved $input times"            

(Linux md) RAIDs seem to have a 16TB limit, What are the ways to cope with it?

Posted: 24 May 2021 07:37 AM PDT

I've had a (linux-md) raid 6 on partitions on 2TB (WD green & blue) disks for years now, which I've extended multiple times by adding disks without any problems (up to now), but at some time, I started to replace my disks with 4TB disks, because the cost/GB changed and made the 4TB less expensive.

So, now, I have enough 4TB disks to end replacing all my disks (and make a backup), and I have replaced all the remaining 2TB with 4TB, on which I made 3.5TiB partitions for the raid (my general partitioning scheme is

  • [1-9] one 128GB linux filesystem (8300),
  • [20] one 1MB Bios boot partition (EF02)
  • [30] one 20 MB linux swap partition (8200)
  • [40-48] one 3.5TiB linux Raid partition (FD00)

(I have used variable partition numbers for the important partitions, in order to reduce the risks of mistakes when manipulating disks with dd)

So, at that time I tried to resize my RAID to occupy all the available size on my disks, but even if it "seems" to work, it appears something is very wrong, here.

Here is the initially reported size :

root@nas:~# cat /proc/mdstat  Personalities : [raid6] [raid5] [raid4]   md0 : active raid6 sdf40[9] sdc48[8](S) sdb42[14] sdd46[15] sda41[10] sdi45[13] sde43[12] sdh47[16] sdg44[11]        11702114304 blocks super 1.2 level 6, 512k chunk, algorithm 2 [8/8] [UUUUUUUU]        bitmap: 2/8 pages [8KB], 131072KB chunk    unused devices: <none>  

In order to check that the size is real, I read the last MB and one more, in order to confirm that this is the end of the accessible space. (This should report that ONE record has been read instead of the requested 2).

root@nas:~# dd if=/dev/md0 bs=1M skip=11427845 of=/dev/null count=2  1+0 records in  1+0 records out  1048576 bytes (1.0 MB) copied, 0.00472855 s, 222 MB/s  

Then, I've tried to expand the RAID to entirely fill my partition (Each disk has a 7503654543 sectors FD00 partition).

root@nas:~# mdadm --grow /dev/md0 --size=max  mdadm: component size of /dev/md0 has been set to 3751825920K  unfreeze  

mdadm seems to correctly reports have been extended each component to 3751825920K (=3663892.5MiB), which leaves 1351 (a little more than 1MiB) at the end of the disk.

/proc/mdstat reports 22510955520 1K block (=21983355MiB), which matches 6×3751825920K

root@nas:~# cat /proc/mdstat   Personalities : [raid6] [raid5] [raid4]   md0 : active raid6 sdf40[9] sdc48[8](S) sdb42[14] sdd46[15] sda41[10] sdi45[13] sde43[12] sdh47[16] sdg44[11]        22510955520 blocks super 1.2 level 6, 512k chunk, algorithm 2 [8/8] [UUUUUUUU]        bitmap: 0/14 pages [0KB], 131072KB chunk    unused devices: <none>  

However re-reading the end of device from before the resizing fails. Instead of being grown, the md0 device is even smaller than before

root@nas:~# dd if=/dev/md0 bs=1M skip=11427845 of=/dev/null count=2  0+0 records in  0+0 records out  0 bytes (0 B) copied, 0.000517452 s, 0,0 kB/s  

In fact, searching for the new volume end shown me that the real size, is not what is reported at all, but is now even less that half the previous value (5206139MiB)

root@nas:~# dd if=/dev/md0 bs=1M skip=5206138 of=/dev/null count=2   1+0 records in  1+0 records out  1048576 bytes (1,0 MB) copied, 0.00472265 s, 222 MB/s  

After this i was able to restore the original RAID size

root@nas:~# mdadm --grow /dev/md0 --size=1950352384K  mdadm: component size of /dev/md0 has been set to 1950352384K  unfreeze  

/proc/mdstat reports the right value.

root@nas:~# cat /proc/mdstalist=[["La couleur du cheval blanc de Napoléon ?","blanc"],["Symbole du Canada=?","Erable"],["5+1=?","6"]]t   Personalities : [raid6] [raid5] [raid4]   md0 : active raid6 sdf40[9] sdc48[8](S) sdb42[14] sdd46[15] sda41[10] sdi45[13] sde43[12] sdh47[16] sdg44[11]        11702114304 blocks super 1.2 level 6, 512k chunk, algorithm 2 [8/8] [UUUUUUUU]        bitmap: 2/8 pages [8KB], 131072KB chunk    unused devices: <none>  

And access to the end of md volume has been restored to the right length

root@nas:~# dd if=/dev/md0 bs=1M skip=11427845 of=/dev/null count=2  1+0 records in  1+0 records out  1048576 bytes (1.0 MB) copied, 0.00491362 s, 213 MB/s  

EDIT :

Ok, it appears that the theoretical size is 21983355MiB and the effective size is 5206139MiB = 21983355MiB - 16TiB... The problem is that the size is looped down 16TiB. Now How can I solve this. Some source say that it needs to completely rebuild the raid, but I will need to be able to shrink it back by removing some disks afterward...

apt command does not update the latest package (kali linux)

Posted: 24 May 2021 06:57 AM PDT

First, I encountered the error below when trying to install new packages.

sudo apt-get install mpack     Reading package lists... Done  Building dependency tree... Done  Reading state information... Done  Suggested packages:    mail-transport-agent inews  The following NEW packages will be installed:    mpack  0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.  Need to get 36.4 kB of archives.  After this operation, 93.2 kB of additional disk space will be used.  Err:1 http://http.kali.org/kali kali-rolling/main amd64 mpack amd64 1.6-8.2    404  Not Found [IP: 192.99.200.113 80]  E: Failed to fetch http://http.kali.org/kali/pool/main/m/mpack/mpack_1.6-8.2_amd64.deb  404  Not Found [IP: 192.99.200.113 80]  

This is just one example from many packages I'd tried to install. They all failed with the same error (fetching old-non-existent package version)

I noticed that the error said that I could not access to "http://http.kali.org/kali/pool/main/m/mpack/mpack_1.6-8.2_amd64.deb" (on the last line)

So, I tried to access the URL directly on the browser and got 404 not found. What I did next was I went back one step on the URL, so I went to "http://http.kali.org/kali/pool/main/m/mpack/" and found that there was no this "mpack_1.6-8.2_amd64.deb" version. The file that my kali should fetch is "mpack_1.6-17_amd64.deb" (it is there on the mpack path)

I confirm that I have a correct sources.list file and did run the apt update.

my sources.list contains these 2 lines which should be correct and should not be the problem here.

deb http://http.kali.org/kali kali-rolling main non-free contrib  deb-src http://http.kali.org/kali kali-rolling main contrib non-free  

The commands that I ran so many times are:

apt update  apt-get update  sudo apt update  sudo apt-get update  

So I was so confused why my kali still keeps fetching the old package that it does not exist, and throws the error 404 not found to me?

Or has anybody encountered the same problem?

sudo apt update result:

$ sudo apt update  Get:1 http://mirror.kku.ac.th/kali kali-rolling InRelease [30.5 kB]  Get:2 http://mirror.kku.ac.th/kali kali-rolling/non-free Sources [135 kB]  Get:3 http://mirror.kku.ac.th/kali kali-rolling/main Sources [12.7 MB]  Get:4 http://mirror.kku.ac.th/kali kali-rolling/contrib Sources [63.7 kB]  Get:5 http://mirror.kku.ac.th/kali kali-rolling/main amd64 Packages [17.1 MB]  Get:6 http://mirror.kku.ac.th/kali kali-rolling/main amd64 Contents (deb) [36.3 MB]  Get:7 http://mirror.kku.ac.th/kali kali-rolling/contrib amd64 Packages [105 kB]  Get:8 http://mirror.kku.ac.th/kali kali-rolling/contrib amd64 Contents (deb) [105 kB]  Get:9 http://mirror.kku.ac.th/kali kali-rolling/non-free amd64 Packages [188 kB]  Get:10 http://mirror.kku.ac.th/kali kali-rolling/non-free amd64 Contents (deb) [911 kB]  Fetched 67.7 MB in 8s (8,332 kB/s)                                                                                                                                                                                   Reading package lists... Done  Building dependency tree... Done  Reading state information... Done  All packages are up to date.  

Pipe skip 99 lines out of every 100

Posted: 24 May 2021 09:32 AM PDT

I have a bash commands pipeline that produces a ton of logging text output. But mostly it repeats the previous line except for the timestamp and some minor flags, the main output data changes only once in a few hours. I need to store this output as a text file for future handling/research. What should I pipe it to in order to print only 1st line out of every X?

How to identify the Debian branch of a package shown in the output of `apt-cache show <pkg>`?

Posted: 24 May 2021 09:49 AM PDT

I want to install packages from the Debian testing branch, like tmux and git.

Therefore, I have configured APT with testing, but to use main as the default:

nlykkei@debian-parallels ~ $ cat /etc/apt/sources.list.d/testing.list  deb http://deb.debian.org/debian/ testing main  deb-src http://deb.debian.org/debian/ testing main  nlykkei@debian-parallels ~ $ cat /etc/apt/preferences.d/testing.pref  Package: *  Pin: release a=testing  Pin-Priority: 100  

Now, when I check the tmux versions available, both 3.1-c1 and 2.8-3 versions show up. In this case, it's obvious that 3.1c-1 is from testing, but how can I identify that in a more complicated output?

I need the branch name for apt-get install -t <branch> <pkg>..., which sets Pin-Priority: 990 for <branch>.

apt-cache show:

nlykkei@debian-parallels ~ $ apt-cache show tmux  Package: tmux  Version: 3.1c-1  Installed-Size: 830  Maintainer: Romain Francoise <rfrancoise@debian.org>  Architecture: amd64  Depends: libc6 (>= 2.27), libevent-2.1-7 (>= 2.1.8-stable), libtinfo6 (>= 6), libutempter0 (>= 1.1.5)  Description-en: terminal multiplexer   tmux enables a number of terminals (or windows) to be accessed and   controlled from a single terminal like screen. tmux runs as a   server-client system. A server is created automatically when necessary   and holds a number of sessions, each of which may have a number of   windows linked to it. Any number of clients may connect to a session,   or the server may be controlled by issuing commands with tmux.   Communication takes place through a socket, by default placed in /tmp.   Moreover tmux provides a consistent and well-documented command   interface, with the same syntax whether used interactively, as a key   binding, or from the shell. It offers a choice of vim or Emacs key   layouts.  Description-md5: dc6ff920cb9183a42694d0ea54835078  Homepage: https://tmux.github.io/  Tag: hardware::input:keyboard, implemented-in::c, interface::text-mode,   role::program, scope::application, works-with::software:running  Section: admin  Priority: optional  Filename: pool/main/t/tmux/tmux_3.1c-1_amd64.deb  Size: 362376  MD5sum: e0be6f85c58a244108eab29c9ee629cf  SHA256: 037f2f1f55c72e75e155cb54cdd9c41f4ac7575cef50a1427383b043cc8316e0    Package: tmux  Version: 2.8-3  Installed-Size: 681  Maintainer: Romain Francoise <rfrancoise@debian.org>  Architecture: amd64  Depends: libc6 (>= 2.27), libevent-2.1-6 (>= 2.1.8-stable), libtinfo6 (>= 6), libutempter0 (>= 1.1.5)  Description-en: terminal multiplexer   tmux enables a number of terminals (or windows) to be accessed and   controlled from a single terminal like screen. tmux runs as a   server-client system. A server is created automatically when necessary   and holds a number of sessions, each of which may have a number of   windows linked to it. Any number of clients may connect to a session,   or the server may be controlled by issuing commands with tmux.   Communication takes place through a socket, by default placed in /tmp.   Moreover tmux provides a consistent and well-documented command   interface, with the same syntax whether used interactively, as a key   binding, or from the shell. It offers a choice of vim or Emacs key   layouts.  Description-md5: dc6ff920cb9183a42694d0ea54835078  Homepage: https://tmux.github.io/  Tag: hardware::input:keyboard, implemented-in::c, interface::text-mode,   role::program, scope::application, works-with::software:running  Section: admin  Priority: optional  Filename: pool/main/t/tmux/tmux_2.8-3_amd64.deb  Size: 302084  MD5sum: 17d694a86ec7b0f46ac6ff60e0d843ff  SHA256: 9c247aef3c3c09d982d49a14091209d76bd06a3d2e699fc9d60ddcee203b456a  

apt-cache policy:

nlykkei@debian-parallels ~ $ apt-cache policy  Package files:   100 /var/lib/dpkg/status       release a=now   100 http://deb.debian.org/debian testing/main amd64 Packages       release o=Debian,a=testing,n=bullseye,l=Debian,c=main,b=amd64       origin deb.debian.org   500 http://deb.debian.org/debian buster-updates/main amd64 Packages       release o=Debian,a=stable-updates,n=buster-updates,l=Debian,c=main,b=amd64       origin deb.debian.org   500 http://security.debian.org/debian-security buster/updates/main amd64 Packages       release v=10,o=Debian,a=stable,n=buster,l=Debian-Security,c=main,b=amd64       origin security.debian.org   500 http://deb.debian.org/debian buster/main amd64 Packages       release v=10.9,o=Debian,a=stable,n=buster,l=Debian,c=main,b=amd64       origin deb.debian.org  Pinned packages:  

Update:

tmux:    Installed: 3.1c-1~bpo10+1    Candidate: 3.1c-1~bpo10+1    Version table:   *** 3.1c-1~bpo10+1 100          100 http://deb.debian.org/debian buster-backports/main amd64 Packages          100 /var/lib/dpkg/status       2.8-3 990          990 http://deb.debian.org/debian buster/main amd64 Packages  

How to fix "E: You don't have enough free space in /var/cache/apt/archives/."

Posted: 24 May 2021 09:27 AM PDT

E: You don't have enough free space in /var/cache/apt/archives/.  root@kali:~# df -H  Filesystem      Size  Used Avail Use% Mounted on  udev            2.0G     0  2.0G   0% /dev  tmpfs           406M  7.0M  399M   2% /run  /dev/sda6        12G   11G  480M  96% /  tmpfs           2.1G   78M  2.0G   4% /dev/shm  tmpfs           5.3M     0  5.3M   0% /run/lock  tmpfs           2.1G     0  2.1G   0% /sys/fs/cgroup  /dev/sda8        58G  114M   55G   1% /home  tmpfs           406M   37k  406M   1% /run/user/0  

"You may not install to this volume because it is a Mac in target disk mode" error when installing Catalina on a mac in TDM

Posted: 24 May 2021 09:01 AM PDT

Hello Unix/Linux community, looking for your help. I am running into an issue where I am trying to install Catalina 10.15.2 on a machine that has been wiped. The machine is in target disk mode and I am using the "Install macOS Catalina" app to image this mac. When I launch the app I see all of my mounted devices including the machine that is in TDM but when I select it as the disk where I want Catalina installed I get a message that states that: "You may not install to this volume because it is a Mac in target disk mode". Is it not possible to image a mac that is in TDM? BTW I have tried imaging the disk as APFS and Mac Os Extended (Journaled). Any help/guidance is appreciated. Thank you.

External Monitor on HDMI with a Hybrid (Nvidia Optimus) laptop

Posted: 24 May 2021 07:05 AM PDT

Linux - Debian uname -a >> output

Linux HomeLT 4.19.0-6-amd64 #1 SMP Debian 4.19.67-2+deb10u2 (2019-11-11) x86_64 GNU/Linux  

I have a ASUS TUF FX504 GM. It has a Intel i7 8750H and a GTX 1060 The problem is .. I can't use the external monitor I would plug into the HDMI port, by default. The Intel iGPU, UHD 630 is the default one that gets used unless I use this config file as specified in the following guide..

I have the "nvidia-driver" package installed.

http://us.download.nvidia.com/XFree86/Linux-x86/375.26/README/randr14.html

/etc/X11/xorg.conf.d/10-nvidia.conf

Section "ServerLayout"      Identifier "layout"      Screen 0 "nvidia"      Inactive "intel"  EndSection    Section "Device"      Identifier "nvidia"      Driver "nvidia"      BusID "PCI:1:0:0"  EndSection    Section "Screen"      Identifier "nvidia"      Device "nvidia"      Option "AllowEmptyInitialConfiguration"  EndSection    Section "Device"      Identifier "intel"      Driver "modesetting"      BusID "PCI:0:2:0"  EndSection    Section "Screen"      Identifier "intel"      Device "intel"  EndSection  

Is there anyway to change this file to make it so that the computer books on the intel screen.. but also keeps the nvidia drivers "inactive" so that both monitors show up when I run the command "xrandr --auto"

I tried putting

Screen 0 "intel"  Inactive  "nvidia"  

But that doesn't work. Tried

Screen 0 "intel"  Screen 1 "nvidia  

" without the inactive line. That didn't quite work either.

I also have to run

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

after start up.

Can anyone help?

Similar topic intel driver on nvidia optimus laptop not recognizing internal display

Ubuntu Wifi Problems (No adapter found)

Posted: 24 May 2021 07:08 AM PDT

So I just installed minimal Ubuntu 18.04 on a Lenovo Legion Y720 to start using it as a daily driver, but WiFi fails to connect to the Internet despite having enabled Wireless LAN in BIOS/Setup.

lspci:

02:00.0 Network controller: Intel Corporation Wireless 8265/8275 (rev 78)  

lshw -C network: Both of the interfaces don't show the DISABLED notifications.

On the actually Ubuntu wifi settings it says unavailable under the word wifi and No wifi adapter found.

The firmware is loading correctly and I am currently out of ideas.

Thank you

How to create persistent VxLAN interface across reboots

Posted: 24 May 2021 09:46 AM PDT

On Redhat 7.3, I can create a VxLAN interface using -- ip link add vxlan type vxlan id 42 group 239.1.1.1 dev eth1 dstport 4789 and assign an IP address. It works. But, this interface is gone on a reboot.

My question is, how do I create a VxLAN interface persistent across reboots?

Forward proxy with Apache and SSL

Posted: 24 May 2021 08:06 AM PDT

At my company, I have to support a rather old application that does not support TLS 1.x. This application sends request to Salesforce, which is in the cloud (outside the company's secure perimeter). To do that, the application sends the request to a corporate proxy that then sends it to the cloud.

The problem now is that Salesforce will be deactivating SSL3 (which this application uses) and will be requiring this application to connect to it via TLS 1.1.

The only way I can think of sorting this out is putting a forward proxy in front of this application, change the request header to add it to be TLS based, and then it will take the request, forward it do the corporate proxy, that then sends to Salesforce.

So this is the configured VirualHost:

<VirtualHost _default_:12086>  # Put access log messages in a separate location  ErrorLog logs/FWDPROXY_UAT_SF_error_log      # Now configure the reverse proxy part  <IfModule mod_proxy.c>    # Enable forward proxy requests  ProxyRequests On    # Allows reverse proxying to https locations.  SSLProxyEngine On    RequestHeader set Front-End-Https "On"  ProxyPreserveHost On    # Allow requests from selected hosts or domains  <Proxy *>  Order Allow,Deny  Allow from all  </Proxy>    <Location />          Order allow,deny          Allow from all      </Location>    ProxyVia On  AllowCONNECT 80    # This is the main proxy configuration  ProxyPass / http://10.54.167.70:80/  ProxyPassReverse / http://10.54.167.70:80/    </IfModule>      </VirtualHost>  

10.54.167.7 is the corporate proxy. When testing this, the error I get is:

[Wed Feb 01 13:58:39 2017] [debug] mod_proxy_connect.c(122): proxy: CONNECT: connecting test.salesforce.com:443 to test.salesforce.com:443  [Wed Feb 01 13:58:39 2017] [error] [client 10.49.36.131] proxy: DNS lookup failure for: test.salesforce.com returned by test.salesforce.com:443  

It seems that my forward proxy is trying to resolve the salesforce hostname, while I simply want it to forward it to the corporate proxy.

Any recommendations? Thank you.

Is there a way of getting logs for startup processes in /etc/init.d?

Posted: 24 May 2021 07:12 AM PDT

Is there a way of getting logs for startup processes in /etc/init.d?

I am running Raspbian (Debian Wheezy).

dmesg shows boot log, but does not go far enough.

Some time ago I added a script to start tightvncserver and have seen similar scripts posted by others.

This never seems to start, but I am at a loss to find out why. I would like to see if there are any errors generated.

#!/bin/sh  ### BEGIN INIT INFO  # Provides:          tightvncserver  # Required-Start:    $local_fs  # Required-Stop:     $local_fs  # Default-Start:     2 3 4 5  # Default-Stop:      0 1 6  # Short-Description: Start/stop tightvncserver  ### END INIT INFO    # More details see:   # http://www.penguintutor.com/linux/tightvnc    ### Customize this entry  # Set the USER variable to the name of the user to start tightvncserver under  export USER='pi'  ### End customization required    eval cd ~$USER    case "$1" in    start)      su $USER -c '/usr/bin/tightvncserver :1'      echo "Starting TightVNC server for $USER "      ;;    stop)      pkill Xtightvnc      echo "Tightvncserver stopped"      ;;    *)      echo "Usage: /etc/init.d/tightvncserver {start|stop}"      exit 1      ;;  esac  exit 0  

How can I determine user base page limit for a printer?

Posted: 24 May 2021 10:03 AM PDT

I'm using Debian Linux. I want to determine user base page limit, different page limit for different users, for a printer.

I can determine page limit for printer with CUPS but can not determine page limit for single user.

How can I achieve this?

No comments:

Post a Comment