tseemann / nullarbor

:floppy_disk: :page_with_curl: "Reads to report" for public health and clinical microbiology
GNU General Public License v2.0
136 stars 37 forks source link

Operation not permitted: ln: failed to create hard link #233

Closed cmkobel closed 5 years ago

cmkobel commented 5 years ago

Hello. When I run nullarbor on our HPC, i see it failing with the following message in the end of the output:

removed ‘/tmp/tmp.X4YUe1jiHM/prokka.log’
removed ‘/tmp/tmp.X4YUe1jiHM/prokka.fna’
removed ‘/tmp/tmp.X4YUe1jiHM/prokka.gff’
removed ‘/tmp/tmp.X4YUe1jiHM/prokka.faa’
removed ‘/tmp/tmp.X4YUe1jiHM/prokka.ffn’
removed ‘/tmp/tmp.X4YUe1jiHM/prokka.tbl’
removed ‘/tmp/tmp.X4YUe1jiHM/prokka.fsa’
removed ‘/tmp/tmp.X4YUe1jiHM/prokka.tsv’
removed ‘/tmp/tmp.X4YUe1jiHM/prokka.txt’
removed ‘/tmp/tmp.X4YUe1jiHM/prokka.sqn’
removed ‘/tmp/tmp.X4YUe1jiHM/prokka.err’
removed ‘/tmp/tmp.X4YUe1jiHM/prokka.gbk’
removed directory: ‘/tmp/tmp.X4YUe1jiHM’
ln -f 190621_HK_1822/contigs.gff 190621_HK_1822.gff
ln: failed to create hard link ‘190621_HK_1822.gff’ => ‘190621_HK_1822/contigs.gff’: Operation not permitted
make: *** [Makefile:108: 190621_HK_1822.gff] Error 1
make: Leaving directory '/faststorage/project/ClinicalMicrobio/nullarbor/output/batch1'

As I don't have root privileges, I don't see how I get around nullarbor trying to make hard links.

Is there a workaround?

cmkobel commented 5 years ago

I tried changing ln -f to cp in the makefile for the .gff-file.

Now I get a new error:

ERROR: Could not find .aligned.fa/.vcf in 190621_HK_1932
make: *** [Makefile:105: core.aln] Error 2
make: *** Waiting for unfinished jobs....

Does anyone have a clue as to whether this new error message is a symptom of my initial problem, or an independent problem?

andersgs commented 5 years ago

@cmkobel you might want to chat with your HPC administrators about the hard linking. In principle, as long as you own the folder and the file, and they have read/write permissions set you should be able to hard-link to it.

More here: https://unix.stackexchange.com/questions/233275/hard-link-creation-permissions

As to your second problem, it is quite possible they are linked. The Makefile for Nullarbor is quite complex, and while Torsten has made every effort to ensure the dependencies are all working nicely, some bugs do appear now and then. You may want to try make again then make.

Best of luck.

cmkobel commented 5 years ago

I tried changing ln -f to cp in the makefile for the .gff-file.

Now I get a new error:

ERROR: Could not find .aligned.fa/.vcf in 190621_HK_1932
make: *** [Makefile:105: core.aln] Error 2
make: *** Waiting for unfinished jobs....

Does anyone have a clue as to whether this new error message is a symptom of my initial problem, or an independent problem?

This problem turned out to be because of overlapping installations of kraken and kraken2. By removing nullarbor completely (conda environment) and reinstalling, the problem was solved.

Because I'm not able to create hardlinks on our server, i still use cp instead of ln -f in the makefile.

tseemann commented 5 years ago

Great news!

peflanag commented 4 years ago

@cmkobel @andersgs @tseemann

Hi Guys,

Is it possible to reopen this and ask a question? I've been having issues running nullarabor but manged to over come the others (I hope) and get further. The problem I know get is;

[14:37:09] Walltime used: 0.68 minutes [14:37:09] If you use this result please cite the Prokka paper: [14:37:09] Seemann T (2014) Prokka: rapid prokaryotic genome annotation. Bioinformatics. 30(14):2068-9. [14:37:09] Type 'prokka --citation' for more details. [14:37:09] Share and enjoy! '/tmp/tmp.KPmOYI7Khp/prokka.gff' -> 'E6214/contigs.gff' '/tmp/tmp.KPmOYI7Khp/prokka.gbk' -> 'E6214/contigs.gbk' removed '/tmp/tmp.KPmOYI7Khp/prokka.tsv' removed '/tmp/tmp.KPmOYI7Khp/prokka.gff' removed '/tmp/tmp.KPmOYI7Khp/prokka.fna' removed '/tmp/tmp.KPmOYI7Khp/prokka.faa' removed '/tmp/tmp.KPmOYI7Khp/prokka.log' removed '/tmp/tmp.KPmOYI7Khp/prokka.fsa' removed '/tmp/tmp.KPmOYI7Khp/prokka.txt' removed '/tmp/tmp.KPmOYI7Khp/prokka.tbl' removed '/tmp/tmp.KPmOYI7Khp/prokka.sqn' removed '/tmp/tmp.KPmOYI7Khp/prokka.ffn' removed '/tmp/tmp.KPmOYI7Khp/prokka.err' removed '/tmp/tmp.KPmOYI7Khp/prokka.gbk' removed directory '/tmp/tmp.KPmOYI7Khp' ln -f E6214/contigs.gff E6214.gff ln: failed to create hard link 'E6214.gff' => 'E6214/contigs.gff': Operation not permitted make: *** [Makefile:111: E6214.gff] Error 1 (base) peter@ubuntu:/media/psf/Home/IMRL_Sequencing/Tanya_MRSA/Nullarbor_Output$

From reading above, I should have admin rights on my machine as I am the admin users. I should explain that I have linux running in parallels desktop because Nullarbor wont work on macOS for me cause of an issue with it checking the --version of shovill

The way I am running Nullarbor is I am pointing the shell in linux to the files on the mac (which looks like external devices in the linux environment in parallels. Would this be the issue?

Cheers,

P

cmkobel commented 4 years ago

Hi @peflanag Have you tested manually creating a hard link from the linux shell on the mac-disk?

peflanag commented 4 years ago

Hi @cmkobel I don't know how to do that. Do you mean just open up the macOS volume directory in the linux environment and make a folder?

What I am currently running is nullarbor again but this time writing the outdir to the linux desktop in parallels while it reads the fastq files from the macOS volume.

cmkobel commented 4 years ago

To test whether you can hardlink, try the following:

$ touch A.txt
$ ln A.txt B.txt
$ echo "writing to A.txt" >> A.txt 
$ cat B.txt 
writing to A.txt 

If you can do this without problems, hardlinking is not a problem.

Writing to the virtualized linux drive sounds like a good idea, especially if you can't hardlink.

peflanag commented 4 years ago

This is probably a stupid question but when you say ”A.txt” should I make a text file on the desktop in the Linux environment that I should point too?

Cheers

cmkobel commented 4 years ago

This is just a way to emulate what Nullarbor does when it tries to make a symbolic link. This list of commands is just a suggestion on how to troubleshoot the problem. If you can make a symbolic link with these commands on the drive where nullarbor writes, Nullarbor probably can too.

peflanag commented 4 years ago

Cool I will try that. I thought I had to make a file first!

On the plus side Nullarbor worked when it wrote the output to the Desktop in the Linux environment in parallels. So at least I could copy that folder across to the macOS desktop.

I will try the command above you mentioned. Thanks for the help, I'll let you known how I get on!

cmkobel commented 4 years ago

Ah, then maybe I should just have added that touch A.txt creates the file. The command line can be confusing to learn how to use. Make sure that you change directory (cd) to the mac-disk where you plan for Nullarbor to write.

tseemann commented 4 years ago

Thank you @cmkobel for helping here!

There is an option that might help here:

  --link-cmd 'CMD'       Command to symlink/copy FASTQ files into --outdir ('ln -s -f')

Maybe re-run nullarbor.pl witj --link-cmd 'cp'

peflanag commented 4 years ago

Yup so looks like I cant write to the macOS home directory when in Linux in parallels. Nor can I write to any of the macOS "drives" that appear in the linux parallels desktop!

Screenshot 2020-02-25 at 08 39 29

Im uncertain as to what the script is that you have written @tseemann

In a shell do I just type;

nullarbor.pl --name X --mlst X --ref X --input X --link-cmd 'CMD' --outdir X ('ln -s -f')

I just don't understand were and when I write what you've said above.

tseemann commented 4 years ago

The filesystem parallels is giving you is not POSIX compliant and does not support hard-links. You need to use MacOS natively, or Linux natively. Bioconda works on MacOS.

Or, try --link-cmd 'cp'

peflanag commented 4 years ago

Hey @tseemann I figured I’ll have to use natively. With —link-cmd ‘cp’ do I just type that into a new shell?

The reason I was using parallels was because the program won’t run on macOS cause of issues with it calling shovill —version. I just sorted the IE12 sample you commented on my other thread with the makefile:133 error there about an hour ago and was just about to comment. But I’m just curious, for Mycobacteria as the mlst, does it look at TB? The resistome report doesn’t seem to have any of the genes I’d expect to see for TB such as rpoB etc.

I appreciate all the help by the way. I’m sure all my questions are annoying!

tseemann commented 4 years ago

no, it's a an option to the nullarbor.pl script. you'll have to run that again. you don't need to delete your data though. reuse the same output folder.

tseemann commented 4 years ago

nullarbor uses abricate. please read the abricate github page. it does NOT do snp-mediated resistance, only acquired genes. TB also has mixed populations an dlow frew alleles which snippy does not predict. Use TBProfiler or a TB specialist software tool. TB mlst is very new.

peflanag commented 4 years ago

Cool cheers. I was using MTBseq as well as snippy with a —mask option and just liked the look of the Nullarbor output that’s why I thought I would try it for TB as well as saureus and nessira

peflanag commented 4 years ago

I also owe you and the guys who have been helping me over the past few days a pint of ye are ever in Ireland!

tseemann commented 4 years ago

Still haven't made it to Ireland , but one day! In England/EU regularly though.

Nullarbor is a bit tricky to get past bad data I agree. My colleague is developing a cluster friendly version of Nullarbor We are using it internally. https://github.com/kristyhoran/bohra