LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-21-2015, 02:45 AM   #1
akashi
LQ Newbie
 
Registered: Dec 2010
Posts: 20

Rep: Reputation: 0
Programs Cannot Make Directories or Files


I'm using Raspbian on a Raspberry Pi which is based on Debian and have encountered a strange problem.

I compiled a program called aria2 from source and installed it with make install.

On the config file
Code:
/etc/aria2.conf
I asked it to save it's session file to
Code:
/home/pi/.aria2/session.dat
However, when I run the start-up script
Code:
/etc/init.d/aria2.sh start
It does not run.

If I first make the directory and create an empty file called session.dat, it starts perfectly.

This is not the only program I have noticed has this behaviour.

When you create a mount point in fstab file, it fails to mount unless the directory mentioned already exists.

I am running everything as root so permission cannot be a problem.

Please help me understand if this is normal Linux behaviour or I am missing something.

Thanks in advance.
 
Old 06-21-2015, 02:59 AM   #2
ButterflyMelissa
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,766
Blog Entries: 23

Rep: Reputation: 411Reputation: 411Reputation: 411Reputation: 411Reputation: 411
editted out I negleted to read some crucial info..
 
Old 06-21-2015, 04:23 AM   #3
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Quote:
When you create a mount point in fstab file, it fails to mount unless the directory mentioned already exists.
You definitely need a directory so some filesystem can mount over it.

What is in your aria2.sh init file? Have you inspected it for possible reasons?
 
1 members found this post helpful.
Old 06-21-2015, 07:21 AM   #4
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware64 15; SlackwareARM-current (aarch64); Debian 12
Posts: 8,298
Blog Entries: 61

Rep: Reputation: Disabled
Did you have some reason for compiling aria2 yourself, and not getting the ready made package?
https://packages.debian.org/wheezy/aria2
 
Old 06-21-2015, 12:22 PM   #5
akashi
LQ Newbie
 
Registered: Dec 2010
Posts: 20

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by veerain View Post
You definitely need a directory so some filesystem can mount over it.

What is in your aria2.sh init file? Have you inspected it for possible reasons?
Thanks, here is the start-up script:

Code:
#!/bin/sh
### BEGIN INIT INFO
# Provides: aria2
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: aria2c init script.
# Description: Starts and stops aria2 daemon.
### END INIT INFO

USER="root"
DAEMON=/usr/local/bin/aria2c
CONF=/etc/aria2.conf

start() {
if [ -f $CONF ]; then
echo "Starting aria2 daemon"
start-stop-daemon -S -c $USER -x $DAEMON -- -D --enable-rpc --conf-path=$CONF
else
echo "Couldn't start aria2 daemon for $USER (no $CONF found)"
fi
}

stop() {
start-stop-daemon -o -c $USER -K -u $USER -x $DAEMON
}
status() {
dbpid=`pgrep -fu $USER $DAEMON`
if [ -z "$dbpid" ]; then
echo "aria2c daemon for USER $btsuser: not running."
else
echo "aria2c daemon for USER $btsuser: running (pid $dbpid)"
fi
}

case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload|force-reload)
stop
start
;;
status)
status
;;
*)
echo "Usage: /etc/init.d/aria2 {start|stop|reload|force-reload|restart|status}"
exit 1
esac

exit 0
 
Old 06-21-2015, 12:24 PM   #6
akashi
LQ Newbie
 
Registered: Dec 2010
Posts: 20

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by brianL View Post
Did you have some reason for compiling aria2 yourself, and not getting the ready made package?
https://packages.debian.org/wheezy/aria2
I compiled the program from source to get the latest version as well as learn compiling.
 
Old 06-21-2015, 09:27 PM   #7
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by akashi View Post
I am running everything as root so permission cannot be a problem.
This is not a correct assumption. The program in question (/usr/local/bin/aria2c) may become an unprivileged user after doing some initial setup. This is good practice to avoid security problems.

Also, the program may simply not create the directory. It could be a bug, or a deliberate measure.

To understand the situation better, there are number of options: Check if aria2c creates a log file with error messages. Or if it can be run with a verbose or debug flag to provide more information. Check under which user ID it runs. Using the source code or a system call trace (strace command), find whether it issues a mkdir system call, and if yes, how it fails.

And then if all else fails you might even consider reading the documentation
 
1 members found this post helpful.
Old 06-25-2015, 09:36 PM   #8
akashi
LQ Newbie
 
Registered: Dec 2010
Posts: 20

Original Poster
Rep: Reputation: 0
berndbausch, thank you for this information.

I read the manual for aria2 and found I made a mistake on the configuration file.

The reason this directory and file was not being created was because it was an actual input file for aria2 to load urls from.

Thanks to everyone who helped.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to store files/directories in different different directories!! anishkumarv Linux - Newbie 7 03-23-2011 05:26 PM
[SOLVED] Make list of directories which contain files other than subdirs zainka Programming 9 10-21-2009 04:20 AM
How to make the directories and files in color in the terminal leonall Linux - Newbie 1 03-09-2006 09:13 PM
CHMOD directories.sub-directories.files zerojosh Linux - Software 2 11-19-2005 03:22 PM
installed programs & directories karan101 Linux - Newbie 3 11-07-2004 12:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration