maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   shell commands fail w/o notice ? (https://talk.maemo.org/showthread.php?t=67847)

xaccrocheur 2011-01-04 11:07

shell commands fail w/o notice ?
 
I'm quite confused with the Xterm interface on my Maemo5 N900 : It's there, it looks like a useful shell, but when I try to actually do something with it it behaves weirdly...

Consider this :

~/MyDocs/.documents $ ls -la myfile
-rw-r--r-- 1 user root 579498 Jan 6 02:14 myfile
~/MyDocs/.documents $ chmod 755 myfile
~/MyDocs/.documents $ ls -la myfile
-rw-r--r-- 1 user root 579498 Jan 6 02:14 myfile


Why is the file still non-executable ? And why did the shell not issue some kind of error ? I tried to
~/MyDocs/.documents $ sudo chmod 755 myfile
But that w/ the exact same result : Job not done and no error.

When I issue a "which chmod" I get a reassuring
/bin/chmod...

I'm obviously missing something, a week ago I tried to create a simple symlink but to no avail...

Please point me in the right direction, as for now I can't do much w/ the shell :(

Cue 2011-01-04 11:20

Re: shell commands fail w/o notice ?
 
because you are in mydocs which is FAT32 you cannot do the same linux permission stuff there as you can with your linux partition.

xaccrocheur 2011-01-04 11:24

Re: shell commands fail w/o notice ?
 
Arg ! This is happening to me all the time, I forgot wich FSystem I'm working on...! Thanks !

anthonie 2011-01-04 11:46

Re: shell commands fail w/o notice ?
 
Actually you can chmod files on the MyDocs partition, unless I am misunderstanding your problem. But every time I run into the problem you describe, I have to do a filesystemcheck because the superblock got corrupted, one way or another.

So, when I run into that problem, I unmount the MyDocs partition, fsck -a the now unmounted partition and remount after that.

gregoranderson 2011-01-04 12:13

Re: shell commands fail w/o notice ?
 
The mount options for /home/user/MyDocs specify noexec along with a fmask to ensure files are 644 (note dmask sets chmod 7777 for directories); see here:

Code:

~ $ grep MyDocs /etc/fstab
/dev/mmcblk0p1 /home/user/MyDocs vfat noauto,nodev,noexec,nosuid,noatime,nodiratime,utf8,uid=29999,shortname=mixed,dmask=000,fmask=0133,rodir 0 0
~ $

You'll need to either:

a) Remove the noexec option and alter the fmask to force any file to be executable from with /etc/fstab (which is autogenerated, so this will need to be altered every time you boot?)

or

b) unmount manually /home/user/MyDocs and then manually remount with your preferred mount options.

Check the mount manpage for more details on mount options

http://linux.die.net/man/8/mount

There may be other threads on here regarding the specifics of fstab manipulation - give the search option a whirl.

gregoranderson 2011-01-04 12:15

Re: shell commands fail w/o notice ?
 
Quote:

Originally Posted by anthonie (Post 911383)
Actually you can chmod files on the MyDocs partition, unless I am misunderstanding your problem. But every time I run into the problem you describe, I have to do a filesystemcheck because the superblock got corrupted, one way or another.

So, when I run into that problem, I unmount the MyDocs partition, fsck -a the now unmounted partition and remount after that.

Are you subsequently mounting with defaults rather than the directives from fstab?

anthonie 2011-01-04 12:30

Re: shell commands fail w/o notice ?
 
Quote:

Originally Posted by gregoranderson (Post 911400)
Are you subsequently mounting with defaults rather than the directives from fstab?

Yesterday I had to chmod some files in a subdir from MyDocs. Experienced the same problems as OP, no error message from the terminal, but no changed file permissions either.

So, in order to get the job done, I did the following

Code:

sudo gainroot
umount /home/user/MyDocs
fsck -a /dev/mmcblk0p1
mount /home/user/MyDocs

That did the trick for me. Personally, I'd rather not change fstab entries, and even though I don't use Windows, I prefer maximum compatibility with OS's, so I kept the FAT32 as it is.

AFAIK, sh scripts can be run from a noexec partition. Binaries not.

So the answer is, yes, I use defaults.

gregoranderson 2011-01-04 13:16

Re: shell commands fail w/o notice ?
 
Thinking out loud, the only reason I can see you wanting to use the large partition for executables would be if you had ran out of room in /dev/mmcblk0p2 and wanted to store a large executable in there (although the original poster never stated any specific intentions).

If so, one solution would be to create a ext3 device with dd in /home/user/MyDocs/somewhere, and loopmount then add to your path. You can then symlink like a crazy mofo.

I'll use my mounted SD card just to be safe

Use DD to create a block device (in this case 500MB).

Code:

Nokia-N900:~# dd if=/dev/zero of=/media/mmc1/bigbin bs=1024 count=512000
512000+0 records in
512000+0 records out
Nokia-N900:~# ls -l /media/mmc1/
drwxrwxrwx    2 user    root        24576 Dec 31 23:30 DCIM
drwxrwxrwx  41 user    root        4096 Nov 20 23:02 Music
drwxrwxrwx    2 user    root        4096 Dec 31 16:47 Video
-rw-r--r--    1 user    root    524288000 Jan  4 13:01 bigbin

Use mkfs.ext3 to create a filesystem.

Code:

Nokia-N900:~# mkfs.ext3 /media/mmc1/bigbin
mke2fs 1.41.3.maemo0 (12-Oct-2008)
/media/mmc1/bigbin is not a block special device.
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
128016 inodes, 512000 blocks
25600 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67633152
63 block groups
8192 blocks per group, 8192 fragments per group
2032 inodes per group
Superblock backups stored on blocks:
        8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409

Writing inode tables: done                           
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 38 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
Nokia-N900:~#

Create a mount point:

Code:

Nokia-N900:~# mkdir /home/user/bin
Nokia-N900:~# chown user:users /home/user/bin

And mount:
Code:

Nokia-N900:~# mount -o loop /media/mmc1/bigbin /home/user/bin
Create a script for the normal user:
Code:

Nokia-N900:~# su - user

BusyBox v1.10.2 (Debian 3:1.10.2.legal-1osso30+0m5) built-in shell (ash)
Enter 'help' for a list of built-in commands.

~ $ echo "date" > bin/test.sh ; chmod u+x bin/test.sh

And test:
Code:

~ $ PATH=$PATH:/home/user/bin
~ $ test.sh
Tue Jan  4 13:03:50 GMT 2011


anthonie 2011-01-04 13:39

Re: shell commands fail w/o notice ?
 
Interesting. I am on the verge of completely wiping my device for the first time since I got it, and I must admit your approach sounds tempting.

I might actually follow that path.

PS: Forgot to ask, are there any repercussions, removing the noexec paramater from fstab?


All times are GMT. The time now is 19:45.

vBulletin® Version 3.8.8