Problem:
W: An error occurred during the signature verification.
The repository is not updated and the previous index files will be used.
GPG error: http://packages.ros.org/ros/ubuntu xenial InRelease:
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F42ED6FBAB17C654
W: Failed to fetch http://packages.ros.org/ros/ubuntu/dists/xenial/InRelease The following signatures couldn't be verified because the public key is not available:
NO_PUBKEY F42ED6FBAB17C654
Solution :
sudo apt-get clean
sudo mv /var/lib/apt/lists /tmp
sudo mkdir -p /var/lib/apt/lists/partial
sudo apt-get clean
sudo apt-get update
and then
sudo apt-key del 421C365BD9FF1F717815A3895523BAEEB01FA116
# add the new key
sudo -E apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
finally
sudo apt-get update