LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 06-21-2011, 11:53 AM   #1
samineru
LQ Newbie
 
Registered: Apr 2010
Posts: 15

Rep: Reputation: 0
Strange error on bash launch


I get the following error whenever I launch bash:
Code:
mkdir: cannot create directory `/dev/cgroup/cpu/user/5900': No such file or directory
bash: /dev/cgroup/cpu/user/5900/tasks: No such file or directory
bash: /dev/cgroup/cpu/user/5900/notify_on_release: No such file or directory
It seems like it's probably from this part of .bashrc:
Code:
if [ "$PS1" ] ; then
   mkdir -m 0700 /dev/cgroup/cpu/user/$$
   echo $$ > /dev/cgroup/cpu/user/$$/tasks
   echo "1" > /dev/cgroup/cpu/user/$$/notify_on_release
fi
What does this code do, why, and what's causing it to go wrong?
 
Old 06-21-2011, 12:01 PM   #2
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,488

Rep: Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956
If you don't know what this code is supposed to do, you can just ignore it and comment it out (until you find why it's there). Anyway, it should create a directory whose name is the process ID of the current shell ($$). It fails because the parent directory /dev/cgroup/cpu/user does not exist. The if [ "$PS1" ] part denotes it must be an interactive shell, PS1 being the environment variable which sets the appearance of the shell prompt.
 
Old 06-21-2011, 12:03 PM   #3
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,509
Blog Entries: 2

Rep: Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018Reputation: 4018
Did you install a custom kernel? Seems to me that your kernel lacks the support for cgroups.
 
Old 06-21-2011, 12:03 PM   #4
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 5,973
Blog Entries: 5

Rep: Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777
At a guess I'd say its failing because you're logging in as a non-root user and trying to write to /dev which typically is not set to allow such writes.

As to why it is in your .bashrc in the first place I can't say. Did you maybe copy this from an older system? Is this a new user and it got copied in from /etc/skel?

The "$$" is the process ID for the bash shell that ran it which was 5900 when you ran it but would be different the next time.

What Linux distro are you running? (RHEL? SUSE? Ubuntu? Something Else?) What version of that distro?

What does "ls -ld /dev" show?

What does "df -h /dev" show?

/dev isn't a real filesystem so has no mount device. Its purpose is to hold all the special devices for various hardware on the system such as your hard drives (/dev/sd*, /dev/hd*), your serial ports (/dev/tty*) your pseudo terminals (/dev/pts/*) and a slew of others. Typically user processes wouldn't be creating anything in /dev though they are doing quite a bit of interaction with the devices that are already there.
 
Old 06-21-2011, 05:07 PM   #5
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 248Reputation: 248Reputation: 248
You will not be able to succeed because you usually need root privileges to write to the /dev directory. What user is the .bashrc running as ?

Last edited by smoker; 06-21-2011 at 05:08 PM.
 
Old 06-21-2011, 05:25 PM   #6
samineru
LQ Newbie
 
Registered: Apr 2010
Posts: 15

Original Poster
Rep: Reputation: 0
I did not install a custom kernel.

I am using ElementaryOS an Ubuntu derivative based off of 10.04

Code:
$ ls -ld /dev 
drwxr-xr-x 20 root root 3.8K 2011-06-21 18:00 /dev/
Code:
$ df -h /dev 
Filesystem            Size  Used Avail Use% Mounted on
none                  1.9G  308K  1.9G   1% /dev
This is .bashrc as called by gnome-terminal so I assume it is running as my standard user account.

if [ "$PS1" ] ; then
mkdir -m 0700 /dev/cgroup/cpu/user/$$
echo $$ > /dev/cgroup/cpu/user/$$/tasks
echo "1" > /dev/cgroup/cpu/user/$$/notify_on_release
fi
 
Old 06-21-2011, 07:49 PM   #7
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,261

Rep: Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028
Don't assume: who did you login as? Also, for confirmation try the id http://linux.die.net/man/1/id cmd.
As above, it's an odd place to create a dir from the cmd line & you'd have to be root to do it.
Is there a particular reason you are trying to do this? If not, as above, just comment that block out, or even delete it...
 
Old 06-21-2011, 09:41 PM   #8
samineru
LQ Newbie
 
Registered: Apr 2010
Posts: 15

Original Poster
Rep: Reputation: 0
I logged in through my graphical login manager, when running gnome-terminal I do not log in again. I am not trying to do this, it was in my .bashrc by default. I will contact them I guess.
 
  


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 launch clean bash session locus84 Linux - Newbie 2 04-25-2011 02:21 PM
Strange error in bash horacioemilio Linux - Newbie 4 06-12-2009 06:23 AM
Strange script error - any ideas (bash hanging) bagpussnz Linux - General 1 01-30-2009 10:29 PM
Strange if statement behaviour when using bash/bash script freeindy Programming 7 08-04-2008 06:00 AM
strange bash login error figmentium Linux - Newbie 3 08-11-2003 04:27 PM


All times are GMT -5. The time now is 03:40 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration