FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 12-26-2009, 10:45 AM
Ralf Mardorf
 
Default Problem with sudo

Gustin Johnson wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Ralf Mardorf wrote:
>
>> Hi
>>
>> in a script I want to set a value by "echo 1024 >
>> /proc/sys/dev/hpet/max-user-freq".
>> This is fine when I manually run "sudo -i", followed by writing the
>> value, but not if I try to do it in one line, resp. in a script.
>>
>> spinymouse-sudo@64studio:~/Desktop$ cat /proc/sys/dev/hpet/max-user-freq
>> 64
>> spinymouse-sudo@64studio:~/Desktop$ sudo echo 1024 >
>> /proc/sys/dev/hpet/max-user-freq
>> bash: /proc/sys/dev/hpet/max-user-freq: Permission denied
>> spinymouse-sudo@64studio:~/Desktop$ sudo -i echo 1024 >
>> /proc/sys/dev/hpet/max-user-freq
>> bash: /proc/sys/dev/hpet/max-user-freq: Permission denied
>> spinymouse-sudo@64studio:~/Desktop$ sudo -i
>> root@64studio:~# echo 1024 > /proc/sys/dev/hpet/max-user-freq
>> root@64studio:~# logout
>> spinymouse-sudo@64studio:~/Desktop$ cat /proc/sys/dev/hpet/max-user-freq
>> 1024
>>
>> Any hints are welcome!
>>
>>
> Put the script in root's crontab.

It's not the complete script. It should become a script to restore an
audio session, resp. there might be different scripts and I want to be
able to launch them quickly from the terminal. A cronjob isn't wanted.

> sudo is designed as an interactive
> utility. The script should be run by a user with sufficient privileges
> to do what it needs to do. You can use sudo to run the script, but it
> should not be within the script.
>

Those are fine in the script:

sudo chgrp audio /dev/hpet
sudo modprobe snd-hrtimer

Just this isn't fine:

sudo echo $hpet_max_user_freq >/proc/sys/dev/hpet/max-user-freq



If I should run the script with sudo, than this ...

jackd -Rch -dalsa -dhw:0 -r96000 -p512 -n2 -Xseq &
qtractor

... etc. must become ...

su username jackd -Rch -dalsa -dhw:0 -r96000 -p512 -n2 -Xseq &
su username qtractor
etc. unfortunately using the UID instead of the username doesn't work. Any way I won't run the script with sudo.

Hm, if there's no way to run
echo $hpet_max_user_freq >/proc/sys/dev/hpet/max-user-freq
in this script, I should separate the HR timer stuff from restoring the session or I should install a root account to 64 Studio version Ubuntu.

su -c "echo $hpet_max_user_freq >/proc/sys/dev/hpet/max-user-freq"
should be fine, when having a root account.

Isn't it fine because the group isn't allowed to write?

spinymouse-sudo@64studio:~$ ls -l /dev/hpet
crw-rw---- 1 root audio 10, 228 2009-12-26 00:55 /dev/hpet
spinymouse-sudo@64studio:~$ ls -l /proc/sys/dev/hpet/max-user-freq
-rw-r--r-- 1 root root 0 2009-12-26 01:46 /proc/sys/dev/hpet/max-user-freq

Another issue is the frequency scaling. Normally it's "ondemand", but when restoring a session it should become "performance".

On Suse I'v got this for the terminal:

alias cpu-o="su -c"cpufreq-set -gondemand""
alias cpu-p="su -c"cpufreq-set -gperformance""

spinymouse-sudo@64studio:~$ cpufreq-set --help
The program 'cpufreq-set' is currently not installed. You can install it by typing:
sudo apt-get install cpufrequtils
bash: cpufreq-set: command not found

But, oops, okay, I see ...

spinymouse-sudo@64studio:~$ cpufreq-selector --help
Usage:
cpufreq-selector [OPTION...] - CPUFreq Selector

Help Options:
-?, --help Show help options

Application Options:
-c, --cpu CPU Number
-g, --governor Governor
-f, --frequency Frequency in KHz

spinymouse-sudo@64studio:~$ sudo cpufreq-selector -g performance
spinymouse-sudo@64studio:~$ sudo cpufreq-selector -g ondemand

... is fine for 64 Studio .

_______________________________________________
64studio-users mailing list
64studio-users@lists.64studio.com
http://lists.64studio.com/mailman/listinfo/64studio-users
 
Old 12-26-2009, 11:17 AM
Ralf Mardorf
 
Default Problem with sudo

Gustin Johnson wrote:
> You can use sudo to run the script, but it
> should not be within the script.

Okay, I decided to separate setting up HPET and restoring the session
and it's fine.

Thank you . However, I still guess it's not optimal. I prefer to run
the script one time and not 2 times and I don't want restore an audio
session by running the script with sudo and launching applications in
the script by su username command.

spinymouse-sudo@64studio:~/Desktop$ cat start-session
#!/bin/sh
[snip]
if [ $USER = "root" ] ; then
[snip (HPET)]
else
[snip (session handling)]
fi
exit 0

spinymouse-sudo@64studio:~/Desktop$ sudo sh start-session

/etc/sysctl.conf
dev.hpet.max-user-freq Value=

/proc/sys/dev/hpet/max-user-freq Value=64

Make sure that the value is set to 1024

/proc/sys/dev/hpet/max-user-freq Value=1024

spinymouse-sudo@64studio:~/Desktop$ sh start-session

Restoring session

################################################## ####################
# Project/ song: /mnt/music/[snip]/[snip]
# Dec/26/2009 Ralf Mardorf
# ralf.mardorf at alice-dsl dot net
#
# License for all artwork in the folder /[snip]:
# Creative Commons
# by-nc-sa = Attribution-NonCommercial- ShareAlike
# http://creativecommons.org/licenses/by-nc-sa/3.0/
# Namensnennung-NichtKommerziell-Weitergabe unter gleichen Bedingungen
# http://creativecommons.org/licenses/by-nc-sa/3.0/de/
################################################## ####################


jackd -Rch -dalsa -dhw:0 -r96000 -p512 -n2 -Xseq
jackdmp 1.9.3
[snip]
_______________________________________________
64studio-users mailing list
64studio-users@lists.64studio.com
http://lists.64studio.com/mailman/listinfo/64studio-users
 
Old 12-26-2009, 06:11 PM
Gustin Johnson
 
Default Problem with sudo

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ralf Mardorf wrote:
<snip>
>
> Those are fine in the script:
>
> sudo chgrp audio /dev/hpet
> sudo modprobe snd-hrtimer
>
> Just this isn't fine:
>
> sudo echo $hpet_max_user_freq >/proc/sys/dev/hpet/max-user-freq
>
Have you considered sysctl?
sudo sysctl -w dev.hpet.max-user-freq=$hpet_max_user_freq

Having said that, why not have a script that runs at boot time to set
this parameter? This is in fact how I accomplish the same task.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAks2X/kACgkQwRXgH3rKGfPpxgCgrMmTyRIw625PnyMo6+gud1hz
A4IAn3b0of2Csldzq59vtdaaXIUf9cDX
=HqHM
-----END PGP SIGNATURE-----
_______________________________________________
64studio-users mailing list
64studio-users@lists.64studio.com
http://lists.64studio.com/mailman/listinfo/64studio-users
 
Old 12-26-2009, 06:34 PM
Ralf Mardorf
 
Default Problem with sudo

Gustin Johnson wrote:
> Have you considered sysctl?
> sudo sysctl -w dev.hpet.max-user-freq=$hpet_max_user_freq
>

Yesno . Doing this I've to reboot, right?

> Having said that, why not have a script that runs at boot time to set
> this parameter? This is in fact how I accomplish the same task.
>

In general you're right, but I'll test several settings.

Btw., what are "good" settings for hpet_max_user_freq?

Should it be 64, 1024, 2048, 3072 or any other value?

Cheers,
Ralf

--
News

There are some nice audio applications, that aren't available as
packages for 64 Studio 3.0-beta3. The good news are, that it's posible
to compile those apps, e.g. today one coder bumped down the GTK+
dependency in the GtkBuilder file to 2.12. Dunno if his app is one of
the good apps, but deffo he made his app available for outdated
dependencies .

Information, there's a bug for Ubuntu

spinymouse-sudo@64studio:/usr/src/2_lv2fil$ git clone
http://nedko.arnaudov.name/git/lv2fil.git
Initialized empty Git repository in /usr/src/2_lv2fil/lv2fil/.git/
/usr/bin/git-clone: 374: curl: not found
spinymouse-sudo@64studio:/usr/src/2_lv2fil$ sudo apt-get install curl
[snip]
spinymouse-sudo@64studio:/usr/src/2_lv2fil$ git clone
http://nedko.arnaudov.name/git/lv2fil.git
Initialized empty Git repository in /usr/src/2_lv2fil/lv2fil/.git/
[snip]
After installing curl it is fine.

Bug Description

curl should be installed along with git-core since git-clone depends on
curl. However it is not installed by default. It is only recommended.
_______________________________________________
64studio-users mailing list
64studio-users@lists.64studio.com
http://lists.64studio.com/mailman/listinfo/64studio-users
 
Old 12-26-2009, 06:56 PM
Gustin Johnson
 
Default Problem with sudo

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ralf Mardorf wrote:
> Gustin Johnson wrote:
>> Have you considered sysctl?
>> sudo sysctl -w dev.hpet.max-user-freq=$hpet_max_user_freq
>>
>
> Yesno . Doing this I've to reboot, right?

No. If you "cat /proc/sys/dev/hpet/max-user-freq" you will see the
updated value. If you reboot you will loose this change unless you put
this value into /etc/sysctl.conf or configure it via a script which runs
at boot time. The default value is 64 and my main DAW this is what I
use. On my primary DAW I prefer to change as little as is necessary.
>
>> Having said that, why not have a script that runs at boot time to set
>> this parameter? This is in fact how I accomplish the same task.
>>
To be specific, I use the /etc/sysctl.conf file to set various
parameters at boot, mostly things related to networking (TCP window
scaling, source address verification and some other more esoteric things
because I am a network geek as well).
>
> In general you're right, but I'll test several settings.
>
> Btw., what are "good" settings for hpet_max_user_freq?

For this specific variable, I use the default of 64. In fact I did not
know about this particular variable until you posted to this list. Does
it make a difference in audio?
>
> Should it be 64, 1024, 2048, 3072 or any other value?
>
No idea really. As far as I know, the timer for modern PCs is 1000, for
DEC Alpha it was 1024, and for PIII and older it was 100 (all values in
Hz).

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAks2alkACgkQwRXgH3rKGfMetQCgqqguIajZc7 LM+O4eGwSQ0OvC
hf0An2idIgtwzC5Xjd0GLPeoYCWezzr2
=9UfO
-----END PGP SIGNATURE-----
_______________________________________________
64studio-users mailing list
64studio-users@lists.64studio.com
http://lists.64studio.com/mailman/listinfo/64studio-users
 
Old 12-26-2009, 07:32 PM
Ralf Mardorf
 
Default Problem with sudo

Gustin Johnson wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Ralf Mardorf wrote:
>
>> Gustin Johnson wrote:
>>
>>> Have you considered sysctl?
>>> sudo sysctl -w dev.hpet.max-user-freq=$hpet_max_user_freq
>>>
>>>
>> Yesno . Doing this I've to reboot, right?
>>
>
> No. If you "cat /proc/sys/dev/hpet/max-user-freq" you will see the
> updated value. If you reboot you will loose this change unless you put
> this value into /etc/sysctl.conf or configure it via a script which runs
> at boot time. The default value is 64 and my main DAW this is what I
> use. On my primary DAW I prefer to change as little as is necessary.
>
>>> Having said that, why not have a script that runs at boot time to set
>>> this parameter? This is in fact how I accomplish the same task.
>>>
>>>
> To be specific, I use the /etc/sysctl.conf file to set various
> parameters at boot, mostly things related to networking (TCP window
> scaling, source address verification and some other more esoteric things
> because I am a network geek as well).
>
>> In general you're right, but I'll test several settings.
>>
>> Btw., what are "good" settings for hpet_max_user_freq?
>>
>
> For this specific variable, I use the default of 64. In fact I did not
> know about this particular variable until you posted to this list. Does
> it make a difference in audio?
>
>> Should it be 64, 1024, 2048, 3072 or any other value?
>>
>>
> No idea really. As far as I know, the timer for modern PCs is 1000, for
> DEC Alpha it was 1024, and for PIII and older it was 100 (all values in
> Hz).

System timer is at 1,000 Hz for real-time kernels, while HR timer is at
1,000,000,000 Hz. I don't know what's the meaning of hpet_max_user_freq,
resp. it's a factor, but I don't know what kind of factor, e.g. 1
what-ever / 64 what-another-ever or 1,000,000,000 Hz / 64 what-ever or
64 what-ever / 1,000,000,000 Hz?
I do know that MIDI jitter by Linux to equipment external the computer
will decrease when using HR timer instead of System timer. I don't know
the impact of the value for hpet_max_user_freq.
On another list somebody once wrote, that he has to change the value,
because mplayer wasn't fine, after he set it to 1024 mplayer was fine.
I've got no idea, but to be honest after compiling and installing rtirq,
4 little apps and latest Qtractor, I'll backup my 64 Studio again and
then make music without using HPET. This should be tomorrow. I planed to
do this yesterday.

I saw that Phasex has got an input. Instead of using the oscillators the
synth seems to be able to use any input signal for the wave. Toying with
some new apps might be more pleasant than making tests with HPET.
_______________________________________________
64studio-users mailing list
64studio-users@lists.64studio.com
http://lists.64studio.com/mailman/listinfo/64studio-users
 
Old 12-26-2009, 07:35 PM
Ralf Mardorf
 
Default Problem with sudo

> after compiling and installing rtirq,
> 4 little apps and latest Qtractor, I'll backup my 64 Studio again and
> then make music without using HPET.

I already build some new stuff before, this are only the last things
I've got to do .
_______________________________________________
64studio-users mailing list
64studio-users@lists.64studio.com
http://lists.64studio.com/mailman/listinfo/64studio-users
 
Old 12-26-2009, 08:18 PM
Gustin Johnson
 
Default Problem with sudo

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ralf Mardorf wrote:
<snip>
>>>
>> No idea really. As far as I know, the timer for modern PCs is 1000, for
>> DEC Alpha it was 1024, and for PIII and older it was 100 (all values in
>> Hz).
>
> System timer is at 1,000 Hz for real-time kernels, while HR timer is at
> 1,000,000,000 Hz. I don't know what's the meaning of hpet_max_user_freq,

The high resolution timer is built in to the motherboard/CPU. AFAIK all
we can do is set what resolution the kernel supports which is limited by
what the physical hardware can do.

> resp. it's a factor, but I don't know what kind of factor, e.g. 1
> what-ever / 64 what-another-ever or 1,000,000,000 Hz / 64 what-ever or
> 64 what-ever / 1,000,000,000 Hz?
> I do know that MIDI jitter by Linux to equipment external the computer
> will decrease when using HR timer instead of System timer. I don't know
> the impact of the value for hpet_max_user_freq.

What is the difference?

> On another list somebody once wrote, that he has to change the value,
> because mplayer wasn't fine, after he set it to 1024 mplayer was fine.

I just tried it and the system seemed a little laggy, especially when
switching applications.

> I've got no idea, but to be honest after compiling and installing rtirq,
> 4 little apps and latest Qtractor, I'll backup my 64 Studio again and
> then make music without using HPET. This should be tomorrow. I planed to
> do this yesterday.
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAks2faIACgkQwRXgH3rKGfO1mACfUtL0g01WEx y0QxraUX0fZ3rO
gcQAnijelBurz5V3bVhosW9RjkC3WpCS
=6Q41
-----END PGP SIGNATURE-----
_______________________________________________
64studio-users mailing list
64studio-users@lists.64studio.com
http://lists.64studio.com/mailman/listinfo/64studio-users
 
Old 12-26-2009, 09:08 PM
Ralf Mardorf
 
Default Problem with sudo

>> I do know that MIDI jitter by Linux to equipment external the computer
>> will decrease when using HR timer instead of System timer. I don't know
>> the impact of the value for hpet_max_user_freq.
>>
>
> What is the difference?
>

http://www.mail-archive.com/64studio-users@lists.64studio.com/msg01458.html

I can't remember if I used 64 or 1024 for hpet_max_user_freq, but IIRC
on LAD there was the advice to build the kernel with using 64 by
default, even if I should have used 1024, 64 might be the better value.

The rtirq script was the default 3.0-beta3 script, just one line was
changed to "RTIRQ_NAME_LIST="rtc snd usb3 i8042"".

>> On another list somebody once wrote, that he has to change the value,
>> because mplayer wasn't fine, after he set it to 1024 mplayer was fine.
>>
>
> I just tried it and the system seemed a little laggy, especially when
> switching applications.

There's no difference for the desktop performance between 64 and 1024 on
my GNOME desktop.

_______________________________________________
64studio-users mailing list
64studio-users@lists.64studio.com
http://lists.64studio.com/mailman/listinfo/64studio-users
 
Old 12-26-2009, 10:02 PM
Gustin Johnson
 
Default Problem with sudo

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ralf Mardorf wrote:
>>> I do know that MIDI jitter by Linux to equipment external the computer
>>> will decrease when using HR timer instead of System timer. I don't know
>>> the impact of the value for hpet_max_user_freq.
>>>
>> What is the difference?
>>
>
> http://www.mail-archive.com/64studio-users@lists.64studio.com/msg01458.html
>
To be more specific, define for me "System Timer" and "High Performance
Event Timer" (HPET) and how they are different.

Interestingly Windows XP does not support HPET even if the hardware is
equipped with it.

> I can't remember if I used 64 or 1024 for hpet_max_user_freq, but IIRC
> on LAD there was the advice to build the kernel with using 64 by
> default, even if I should have used 1024, 64 might be the better value.

That does not seem like good advice if we are talking about the same
thing.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAks2lh0ACgkQwRXgH3rKGfNZNQCfb/wQM3NAiRE8XggoQ8FUXgLC
5j0AoK/bbvw1zsF4Ut+O0YvM7h6A8VsQ
=PXR9
-----END PGP SIGNATURE-----
_______________________________________________
64studio-users mailing list
64studio-users@lists.64studio.com
http://lists.64studio.com/mailman/listinfo/64studio-users
 

Thread Tools




All times are GMT. The time now is 01:20 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org