can't run roscore 并且 sudo 指令返回 unable to resolve host

时间:2023-12-23 20:17:19

I'm using ubuntu14 LTS.

Problems:

1. When run roscore, got a mistake and an advice to ping the localhost.

2. Nearly every time I run a directive with sudo, I got a warning that unable to resolve host.

It turns out, the reason is I changed the ubuntu computer name some while ago.

Solutions: (must following this order)

1. edit ~/etc/hosts

  Navigate to the file locaiton, and type 'sudo nautilus .' in the terminal.

  You will see these two lines at the beginning of the file:

  127.0.0.1    localhost
  127.0.1.1    "here is your old computer name, which you think you have changed but not"  ->  change it to the current computer name.

  This should solve problem 2.

2. edit ~/.bashrc

  type 'gedit ~/.bashrc' in the terminal, and add the following two lines at the end of the file:

  export ROS_HOSTNAME="put your current computer name here"
  export ROS_MASTER_URI=http://"put your current computer name here":11311

  This should solve problem 1.