Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issues with resolv.conf file #11

Open
oldkingcone opened this issue May 24, 2022 · 4 comments
Open

issues with resolv.conf file #11

oldkingcone opened this issue May 24, 2022 · 4 comments

Comments

@oldkingcone
Copy link

I noticed a few issues with the resolv file not being created/updated after any vpn connections. This causes a massive issue for updating/doing anything as most operations require internet connections to exist. I have created this script to assist with this issue, not sure if this is a bug in how the resolv system implementation through systemd is handled by parrotOS or not, but this appears to fix most issues:

#!/bin/bash

clear
while :; do
  ping -c1 google.com
  if [[ $? -eq 0 ]]; then
    echo "Connected!"
    break
  else
    clear
    date
    if ! [[ -f "/run/systemd/resolve/stub-resolv.conf" ]]; then
      echo -e "\033[0;31mAttempting to create file.\033[0m\n"
      if [[ -e "/run/systemd/resolve/" ]]; then
        sudo rm -rf /run/systemd/resolve/
        if [ $? -eq 0 ]; then
          echo "Removed previously created directory."
          echo
        else
          echo "Unable to remove previous directory....."
          echo
        fi
      fi
      sudo mkdir -p /run/systemd/resolve/
      sudo echo -e "search local\nnameserver 1.1.1.1\nnameserver 1.0.0.1" > /run/systemd/resolve/stub-resolv.conf
      if [ $? -eq 0 ]; then
        echo "File created!"
        echo
        file /run/systemd/resolve/stub-resolv.conf
      else
        echo -e "\033[0;31mFile creation failed!!!\033[0m"
        echo
      fi
    else
      echo "File exists, not sure why there is no internet. Check host system to ensure that the host has actual internet connection."
    fi
  fi
  sleep 1
done

This script will need to be run as the root user in order to correct the issue presented by the broken link from /etc/resolv.conf -> ../run/systemd/resolv/stub-resolv.conf

@LemonTree1989
Copy link

: not found2:
: not found3: clear
******,sh: 40: Syntax error: end of file unexpected (expecting "then")

@oldkingcone
Copy link
Author

: not found2: : not found3: clear ******,sh: 40: Syntax error: end of file unexpected (expecting "then")

sounds like you copied from a windows host into a vm. use nano to copy it, or if you can use vim.

@LemonTree1989
Copy link

LemonTree1989 commented Jul 17, 2022

My ParrotOS computer won't go inline at all sue to this issue and I don't know how to transfer it except a usb drive. I have Kali on WSL in Widows and the GUI/Kex version but with no internet on ParrotOS computer. I had this issue a couple years ago on Kali and it ultimately kept me from Linux but I love it so I gave it another try. I'm surprised the same issue is still there and even more surprised that a lot more people aren't pushing this issue in droves. I'm staying in for the long haul. Thank you for your help! I guess I could ssh in but due to this issue I'm down to using ParrotOS live.

@oldkingcone
Copy link
Author

bash is very space complainy. so put the script into vs code, because it sounds like the spacing and tabbing is messed up between how you copied it, and how it looks when you open it on the parrot system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants