Active Topics

 


Reply
Thread Tools
Posts: 1,048 | Thanked: 1,127 times | Joined on Jan 2010 @ Amsterdam
#351
Yes, manually adding them, provided you take care of the xrw attributes, should work. After all, each program you install on a linux machine should provide it's own man page, that gets placed in /usr/share/man or whatever, at the time of installing. So that's not different. There is a pretty strict structure though.

http://www.schweikhardt.net/man_page_howto.html

This link will provide you with more information than you need but have a look anyway
 

The Following User Says Thank You to anthonie For This Useful Post:
Posts: 43 | Thanked: 45 times | Joined on Jun 2010 @ Sweden
#352
Had a look at the guide you provided but for some reason man just don't want to cooperate... I've set the MANPATH=/usr/share/man/man1:/usr/share/man (and used export) and placed the unpacked (was .gz in EasyDebian) man page for "find" -- "find.1" -- in the man1 dir but no go. "man find" still complains about "no entry" and "man -a" returns zero entries.

I guess there is another requisite to get man to find the pages. I'm no Linux whiz so I don't really know what to try next. If you have any ideas, let me know. Of course, I could install the man-db package as you mentioned but I would rather install individual man pages to limit the space required.

A little bit off topic: do you happen to know which .profile / startup script gets read when using "sudo gainroot" as opposed to "root"? I ask because I have some aliases set up in /etc/profile that works for user/root, but for some reason not when "sudo gainroot" is entered.
 
Estel's Avatar
Posts: 5,028 | Thanked: 8,613 times | Joined on Mar 2011
#353
man-db package should also assist in downloading new man pages from internet, shouldn't it?

iDont, Imve just noticed new update to busybox-power. I hope, that you won't forget about thumb users Thanks a lot for keeping it updated!

/Estel
__________________
N900's aluminum backcover / body replacement
-
N900's HDMI-Out
-
Camera cover MOD
-
Measure battery's real capacity on-device
-
TrueCrypt 7.1 | ereswap | bnf
-
Hardware's mods research is costly. To support my work, please consider donating. Thank You!
 
Posts: 1,048 | Thanked: 1,127 times | Joined on Jan 2010 @ Amsterdam
#354
@sowwhatyoureap

I'd need to look into that man-problem you're having there as I don't have it on my N900 at the moment. I'll see if I can do that later today.

About the root and gainroot differences;

There are three ways to elevate user rights:

1. Using sudo, elevates user rights to root-level, temporarely, without changing current work directory. E.g. /home/user (your prompt will look like $).

2. Using sudo gainroot, changes user from user to root, without changing current workdirectory.
E.g. /home/user (your prompt will look like #).

3. Using root, changes user from user to root, and changes directory to root.
E.g. /root (your prompt will look like #).

For options 2 and 3, one would have to type "exit" to get back to a normal user level, while sudo maintains it's prompt and doesn't need that.

Ad 2. You can see what gainroot does by
Code:
cat /usr/sbin/gainroot
It checks to see if you are already root, and if not, it executes x--use-su and "su" stands for "switch user".

Ad 3. You can see what what root does by
Code:
cat /usr/bin/root
It executes exec sudo gainroot --use-su

What that means, practically is that if you need root rights and you want to remain in the directory where you already are, sudo or sudo gainroot is more practical, as it saves type and tabbing.
 

The Following 2 Users Say Thank You to anthonie For This Useful Post:
Posts: 43 | Thanked: 45 times | Joined on Jun 2010 @ Sweden
#355
Originally Posted by anthonie View Post
@sowwhatyoureap

I'd need to look into that man-problem you're having there as I don't have it on my N900 at the moment. I'll see if I can do that later today.
Thanks, if you have the time it would be much appreciated.

And thx for the recap on root / gainroot, didn't know root actually executed sudo gainroot.

Although the question remains -- if the user is changed to root via sudo gainroot, why doesn't commands (such as alias) in /etc/profile get executed? From what I've read, /etc/profile is suppose to be global, so why does the "sudo gainroot" ignore that?
 
Posts: 1,048 | Thanked: 1,127 times | Joined on Jan 2010 @ Amsterdam
#356
Originally Posted by sowwhatyoureap View Post
Although the question remains -- if the user is changed to root via sudo gainroot, why doesn't commands (such as alias) in /etc/profile get executed? From what I've read, /etc/profile is suppose to be global, so why does the "sudo gainroot" ignore that?
I am not sure if I understood your question correctly and perhaps you could be more explicit about the format of the alias and/or the error message you get, but allow me speculate a bit.

If you would execute a command that needs to be executed as root, while you are already root, the sudo before that would in effect try to elevate rights that are already given. So, let's say you try and do this as root:

Code:
# sudo apt-get update
The error message coming back would be something along the lines of "root is not in sudoers file."

Like I said, I may have misunderstood your question completely, so perhaps it's just bollocks I am talking.

Sudo rules, by the way, can be found at

Code:
cat /etc/sudoers.d/01sudo
Files placed in that directory /etc/sudoers.d/ allow you to execute commands without sudo asking you for a password.

If you do an ls there, you'll notice the programs installed on your n900 that need sudo rights in so far they chose not to append an extra rule to the 01sudo file.

Edit: I'll try to have a look tonight at your man page thing. But the suggestion to simply install man-db really isn't a bad one allbeit less educational.

Last edited by anthonie; 2013-03-19 at 15:43.
 
Posts: 268 | Thanked: 1,053 times | Joined on May 2010 @ The Netherlands
#357
Originally Posted by sowwhatyoureap View Post
First, thanks iDont for the awesome job updating and improving the BusyBox package. I literally just today found out that this existed. Was thinking about switching to Bash a while earlier since I needed some utils from there, but seeing as they are available in this package it's all good.
Thanks!

Originally Posted by sowwhatyoureap View Post
I noticed that the command man is included in the package, and tried it out but there doesn't seem to be any man pages -- man -a returns nothing and /usr/share/man is empty (apart from README). Is it intentional and if so where can I find man pages for download? How much space would all man pages (for default commands and this package) require approximately?
Yes, the man pages are usually left out of Maemo's packages to save space. BusyBox' man page is ~92KiB and provides roughly the same content as "<busybox applet> --help" would show you.

MohammadAG created a man-db-n900 package that is configured to read man pages from /opt/man. He also created a second package - man-db-pages, which installs the actual man pages to /opt/man. But those man pages may not be (fully) applicable to BusyBox' applets, which often don't have the full capabilities of their bigger counterparts.

So if you're after BusyBox' own man page: IMO, I wouldn't bother. If you're after all the other man pages: installing man-db-n900 and man-db-pages would be your best bet.

You got me thinking, by the way. I could probably make busybox-power provide man-db-n900 and set it up so it will read man pages from /opt/man by default (and include BusyBox' man page by default in /opt/man/). This way, you won't have to install man-db-n900, as busybox-power provides everything you need. I smell a new feature for an upcoming busybox-power release .

Originally Posted by sowwhatyoureap View Post
Had a look at the guide you provided but for some reason man just don't want to cooperate... I've set the MANPATH=/usr/share/man/man1:/usr/share/man (and used export) and placed the unpacked (was .gz in EasyDebian) man page for "find" -- "find.1" -- in the man1 dir but no go. "man find" still complains about "no entry" and "man -a" returns zero entries.
Try setting "MANPATH=/usr/share/man". And don't extract the .gz archive, just place it in /usr/share/man/*/ as-is, e.g. /usr/share/man/man1/find.1.gz.
That should work.

Originally Posted by sowwhatyoureap View Post
Although the question remains -- if the user is changed to root via sudo gainroot, why doesn't commands (such as alias) in /etc/profile get executed? From what I've read, /etc/profile is suppose to be global, so why does the "sudo gainroot" ignore that?
Basically, the login shell is responsible for some several things, e.g. parsing /etc/profile and setting up your environment. When sudo is ran without -i (simulate initial login), the command you're trying to run as root won't get passed to root's default login shell, hence /etc/profile won't get parsed.

Something similar goes for su: when su is executed without -l, --login or a plain dash ("-"), the shell you're trying to start won't get started as a login shell, hence /etc/profile won't get parsed.

sudo gainroot = sudo /bin/sh (note the absence of -i)
root = sudo gainroot --use-su = su - (note the inclusion of the dash)

Therefore, "root" will parse your /etc/profile, but "sudo gainroot" won't .

FYI, how I got the above information:
cat /usr/bin/root
cat /usr/sbin/gainroot
man sudo
man su

Last edited by iDont; 2013-03-19 at 20:32.
 

The Following 6 Users Say Thank You to iDont For This Useful Post:
Posts: 268 | Thanked: 1,053 times | Joined on May 2010 @ The Netherlands
#358
Originally Posted by Estel View Post
iDont, Imve just noticed new update to busybox-power. I hope, that you won't forget about thumb users Thanks a lot for keeping it updated!

/Estel
Don't worry, I haven't forgotten about the -thumb users. Guess who runs cssu-thumb as well .

I don't have upload rights to the community-thumb, so each busybox-power -thumb release has to be manually processed by freemangordon. And as you probably know, he's always busy with all kinds of exciting stuff, so busybox-power is probably not his top priority. Therefore, it might take some time before a new busybox-power release ends up in the community-thumb repository.

Anyway, the -thumb Debian archive has been uploaded to busybox-power's garage page, so you can install it manually if you wish: https://garage.maemo.org/frs/?group_id=2216. Sorry for the delay.

Last edited by iDont; 2013-03-19 at 20:34.
 

The Following 6 Users Say Thank You to iDont For This Useful Post:
Posts: 43 | Thanked: 45 times | Joined on Jun 2010 @ Sweden
#359
Originally Posted by anthonie View Post
I am not sure if I understood your question correctly and perhaps you could be more explicit about the format of the alias and/or the error message you get, but allow me speculate a bit.
I probably wasn't being very clear, sorry. To be explicit, I've set up aliases for the ls command to make life easier on the N900, e.g. these:
Code:
alias ll='ls -lp'
alias l='ls -lAp'
As I've put them in /etc/profile, these get sourced properly for default user and running "root", yielding access to "l" and "ll" aliases from the terminal upon shell startup. The same does not apply to "sudo gainroot" as it appears -- iDont covers this in his post above.

Originally Posted by iDont View Post
You got me thinking, by the way. I could probably make busybox-power provide man-db-n900 and set it up so it will read man pages from /opt/man by default (and include BusyBox' man page by default in /opt/man/). This way, you won't have to install man-db-n900, as busybox-power provides everything you need. I smell a new feature for an upcoming busybox-power release .
Probably a good idea since barebone man seems to not function properly at the moment -- see below.

Originally Posted by iDont View Post
Try setting "MANPATH=/usr/share/man". And don't extract the .gz archive, just place it in /usr/share/man/*/ as-is, e.g. /usr/share/man/man1/find.1.gz.
That should work.
Tried that and it apparently did make man locate the page, however running "man find" again I instead get
Code:
sh: gtbl: not found
sh: nroff: not found
suggesting that I'm missing commands gtbl and nroff. Googling, these appear to be associated with formatting and rendering the manual pages. Looking at the description for the man-db-n900 package it says it uses the groff suite to format and display man pages, so I guess I'm better off just installing that.

Originally Posted by iDont View Post
Basically, the login shell is responsible for some several things, e.g. parsing /etc/profile and setting up your environment. When sudo is ran without -i (simulate initial login), the command you're trying to run as root won't get passed to root's default login shell, hence /etc/profile won't get parsed.
Appreciate the Linux lessons, learning more by the day.

Found this little post explaining the difference (using bash) between login and non-login shells regarding what it sources and also mentions (non-)interactive shells: http://www.linuxquestions.org/questi...983/#post66932

So if I've understood correctly: in the case of "sudo gainroot", since it doesn't enter a login shell, it should instead source "~/.bashrc" if it exists. This applies to bash shell, but what happens in the BusyBox case as it uses ash instead? Where should I put my custom commands to be sourced at startup, i.e. which file does it source for non-login shells? Briefly tried modifying /root/.bashrc and copied it to /home/user and but no go -- probably not so surprising as it's not running bash.
 
Posts: 1,808 | Thanked: 4,272 times | Joined on Feb 2011 @ Germany
#360
Originally Posted by sowwhatyoureap View Post
So if I've understood correctly: in the case of "sudo gainroot", since it doesn't enter a login shell, it should instead source "~/.bashrc" if it exists. This applies to bash shell, but what happens in the BusyBox case as it uses ash instead? Where should I put my custom commands to be sourced at startup, i.e. which file does it source for non-login shells? Briefly tried modifying /root/.bashrc and copied it to /home/user and but no go -- probably not so surprising as it's not running bash.
Busybox's shell (ash) sources the script referenced by the ENV variable, if set.

So you could put your aliases under /root/.bashrc, and then edit /usr/sbin/gainroot and change this line:
Code:
HISTFILE=/root/.ash_history /bin/sh
to
Code:
HISTFILE=/root/.ash_history ENV=/root/.bashrc /bin/sh
and you're set.

For a login shell ("root" = "sudo gainroot --use-su" == "sudo su -") /root/.profile will be sourced, which in turn will source /root/.bashrc.
 

The Following 6 Users Say Thank You to reinob For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 15:09.