I have discovered an issue with PATH and /ect/apt/sources.list Please could you advise how to resolve it?
As I am very novice to coding and stack exchange please could you comment and let me know which parts to edit out of this question.
I recently began looking into assembling genomes using canu
Initially, I began using the full path to the command to utilize it i.e.~/Canu/canu/Linux-amd64/bin/canu
I tried using the -correct option, however, had no success.
I surmised that it may be due to the directory containing the command file (also containing several other command files) would need to be added to PATH.
Therefore, I added:
export PATH=$PATH:/localadmin/Canu/canu/Linux-amd64/bin/canuto the end of
~/.bashrcUpon running:
$ canu –help WARNING:root:could not open file '/etc/apt/sources.list'`I looked into the original issue and followed the answers from here;
sudo ln -s /etc/apt/sources.list.d/official-package-repositories.list /etc/apt/sources.listThis gave no output and trying
canu –helpgave the same error as before.sudo chmod -R 0644 /etc/apt/sources.list.d/This seemed to make things worse;
localadmin@dna-ws:~$canu --help WARNING:root:could not open file '/etc/apt/sources.list WARNING:root:could not open file '/etc/apt/sources.list.d/jonathonf-ubuntu-python-3_6-xenial.list' WARNING:root:could not open file /etc/apt/sources.list.d/mirror.oxfordnanoportal.com.list' WARNING:root:could not open file '/etc/apt/sources.list.d/xenial-dell-service.list' WARNING:root:could not open file '/etc/apt/sources.list.d/google-chrome.list' WARNING:root:could not open file '/etc/apt/sources.list.d/xenial-dell-matira-5-7.list' WARNING:root:could not open file '/etc/apt/sources.list.d/nanoporetech.sources.list' WARNING:root:could not open file '/etc/apt/sources.list.d/xenial-dell.list'`
I took a look in /ect/apt/ and found the following
localadmin@dna-ws:/etc/apt$ ls
apt.conf.d preferences.d sources.list~ sources.list.d sources.list.save trusted.gpg trusted.gpg~ trusted.gpg.d`At this point, I thought I’d make a couple of backups before I break anything else, this displayed the contents of sources.list.d (I thought this may be useful context)
localadmin@dna-ws:/etc/apt$ cp -r sources.list.d ~/sources.list.d.backup
cp: cannot stat 'sources.list.d/google-chrome.list': Permission denied
cp: cannot stat 'sources.list.d/xenial-dell.list': Permission denied
cp: cannot stat 'sources.list.d/mirror.oxfordnanoportal.com.list': Permission denied
cp: cannot stat 'sources.list.d/nanoporetech.sources.list': Permission denied
cp: cannot stat 'sources.list.d/mirror.oxfordnanoportal.com.list.save': Permission denied
cp: cannot stat 'sources.list.d/xenial-dell-service.list.save': Permission denied
cp: cannot stat 'sources.list.d/google-chrome.list.save': Permission denied
cp: cannot stat 'sources.list.d/xenial-dell-matira-5-7.list.save': Permission denied
cp: cannot stat 'sources.list.d/nanoporetech.sources.list.save': Permission denied
cp: cannot stat 'sources.list.d/xenial-dell.list.save': Permission denied
cp: cannot stat 'sources.list.d/jonathonf-ubuntu-python-3_6-xenial.list': Permission denied
cp: cannot stat 'sources.list.d/jonathonf-ubuntu-python-3_6-xenial.list.save': Permission denied
cp: cannot stat 'sources.list.d/xenial-dell-matira-5-7.list': Permission denied
cp: cannot stat 'sources.list.d/xenial-dell-service.list': Permission denied`I then managed to make a backup using sudo
EDIT: localadmin@dna-ws:~$ type -a canu
-bash: type: canu: not found
1 Answer
The PATH variable is a list of directories containing executables and not of executables themselves. You attempted to add the canu executable to your PATH:
export PATH=$PATH:/localadmin/Canu/canu/Linux-amd64/bin/canuThat makes your system look for a directory called /localadmin/Canu/canu/Linux-amd64/bin/canu in which it would then search for executables. Since there is no such directory (canu is a file), that command basically does nothing. What you wanted to do was:
export PATH="$PATH":/home/localadmin/Canu/canu/Linux-amd64/bin(also note the quotes, those are important in case you have a directory with a space in its name)
Everything you did after that was not really relevant, I'm afraid. I don't understand the error you are getting, but since canu wasn't actually in your PATH, the root:could not open file error has nothing to do with canu. I suspect you messed up your PATH and that's causing various issues.
So, undo the changes you made to your /etc/sources* stuff following the suggestions of @steeldriver, then remove the line you added to .bashrc and instead, add the right line I show above. Even better, don't add anything to .bashrc but use ~/.bash_profile instead since that's a better place for defining global variables.
Then, log out and log back in and re-run canu --help. It should all work now.