LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   chmod: 1: Syntax error: "(" unexpected - what's this mean and how do I fix it? (https://www.linuxquestions.org/questions/linux-newbie-8/chmod-1-syntax-error-unexpected-whats-this-mean-and-how-do-i-fix-it-623031/)

SeriesOne 02-22-2008 08:01 AM

chmod: 1: Syntax error: "(" unexpected - what's this mean and how do I fix it?
 
Some background:

I' hacking a series 1 tivo. One of the things to do is create a file (rc.sysinit.author) and chmod it so it is executable. I am in the directory where the file is, and enter this:

/mnt7/bin/chmod: 755 rc.sysinit.author

and I get this error:

chmod: 1: Syntax error: "(" unexpected

I'm no dummy. I stared with a digicomp1 in the late 60's, passed through the ZXZ81-C64-cp/m-8088-8086-80286-etctera-etcetera, fiddle with pics, am completely comfortable with a command line, and so on. I am, however, new to Linux.

I have done quite a bit of googling to try to find what this error means, but have had no luck.

There is a possible hint in that the directions I'm following said to just enter:

chmod 755 rc.sysinit.author

but that gave me another error:

chmod: not found

which I could figure out how to fix, as above, by declaring the entire path in the command. Because of this, I have tried a number of variations on the chmod command - things like using +x instead of 755, including the whole filename with path for the rc.sysinit.author file, changing to the /mnt/bin directory and doing ./chmod 755 /the-whole-filepath-for-the-rc.sysyinit.author file. No luck.

I suppose I could edit the rc.sysinit file (runs first, then calls my file) which has the executable bit set but would rather know how to chmod.

hro 02-22-2008 08:45 AM

Command 'chmod 755 myfile' should work if path is set so that it contains /mnt7/bin and you own the file. Traditionally directory bin is under root so '/bin/chmod 755 myfile'. Check path by typing 'path'.

Ephracis 02-22-2008 08:46 AM

Quote:

Originally Posted by SeriesOne (Post 3066119)
/mnt7/bin/chmod: 755 rc.sysinit.author

Shouldn't it be /mnt7/bin/chmod 755 rc.sysinit.author ?

Quote:

Originally Posted by SeriesOne (Post 3066119)
chmod 755 rc.sysinit.author

but that gave me another error:

chmod: not found

This means that chmod is not in your path.
Check your path with

Quote:

$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
I am curious about the error you get from the first command, tho. You said you tried using other flags but did you try to run chmod on another file or directory than rc.sysinit.author? Cause otherwise it may be something odd with your chmod binary.

I have never worked on a Tivo before but if the rc.sysinit.author file is inside /mnt7 you could try to chroot into /mnt7 and try again.

SeriesOne 02-22-2008 09:05 AM

Quote:

Originally Posted by Ephracis (Post 3066163)
Shouldn't it be /mnt7/bin/chmod 755 rc.sysinit.author ?

Hmmm, this forum quoting thingy doesn't quote everything. I'm more used to usenet. I'm goint to preface you stuff with >

Yes, of course; there was no colon in the line I actually typed.

>This means that chmod is not in your path.
>Check your path with

echo $path gives a blank, which is why (I think) that typing the path + filename for chmod seemd to get chmod to work, instead of a not found error.


>I am curious about the error you get from the first command, tho. You >said you tried using other flags but did you try to run chmod on >another file or directory than rc.sysinit.author? Cause otherwise it >may be something odd with your chmod binary.

Just did that - made another file ("test") with the joe editor (looks exactly like VDE for cp/m) and

tried /mnt7/bin/chmod 755 test

- got the same error:

/mnt7/bin/chmod: 1: Syntax error: "(" unexpected

>I have never worked on a Tivo before but if the rc.sysinit.author file >is inside /mnt7 you could try to chroot into /mnt7 and try >again.

I don't seem to have a chroot command - went poking about in the directories but didn't find it. Just typing

chroot /mnt7

gives

chroot: not found.

slakmagik 02-22-2008 09:56 AM

Try 'file /mnt7/bin/chmod' - I'm trying to figure out how you can get an error that has nothing to do with your command and all I can think of is that your chmod is a shell script, for some reason, with a syntax error in it or something.

I have no idea about a tivo, though. Why 'mnt7'? Why is your path not reasonable? Etc. I'd go ahead and set a path with all the usual '*bin's and whatever unusual places I could think of but, like I say, 'tivo?' :)

-- Oh yeah - I dunno what all you're up to, so this may not suffice but you can run a script that isn't executable by giving it as an argument to your shell - $SHELL rc.sysinit.author. So if you absolutely can't get it chmod'ed, you can still run it. But if things are that weird there'd be a lot more to fix than just running the file.

SeriesOne 02-22-2008 01:18 PM

Quote:

Originally Posted by digiot (Post 3066225)
Try 'file /mnt7/bin/chmod' - I'm trying to figure out how you can get an error that has nothing to do with your command and all I can think of is that your chmod is a shell script, for some reason, with a syntax error in it or something.

I have no idea about a tivo, though. Why 'mnt7'? Why is your path not reasonable? Etc. I'd go ahead and set a path with all the usual '*bin's and whatever unusual places I could think of but, like I say, 'tivo?' :)

-- Oh yeah - I dunno what all you're up to, so this may not suffice but you can run a script that isn't executable by giving it as an argument to your shell - $SHELL rc.sysinit.author. So if you absolutely can't get it chmod'ed, you can still run it. But if things are that weird there'd be a lot more to fix than just running the file.

Well, I dunno about paths and shell scripts and so on...

One of the steps is to tell the tivo to start a telnet server when it boots. They advise you not to edit the rc.sysinit file as there is a lot of critical stuff there; but to edit the file that it supposedly looks for and hands off to if it exists - i.e. rc.sysinit.author.

I worked around it, sort of.

I copied the rc.sysinit file which has the correct permissions to re.sysinit.bak; then edited THAT file, then rm'd the rc.sysinit.author that could not be chmod'ed, then copied the rc.sysinit.bak to rc.sysinit.author.

LS -l shows all the correct permissions now.

Now I'm fighting with the ethernet adapter and trying to see if the telnet command (which is what in rc.sysinit.author) works. Sometimes my router gives the adapter an IP and sometimes not, and I have not yet seen a prompt over telnet. It's a pain not having a screen to look at what's going on in the box: take drive out, attach to extra pc, boot pc, edit file, put drive in tivo, boot tivo, wait and talk to router, try to telnet...; repeat ad inf.

Thanks all for replying.

Ephracis 02-22-2008 01:18 PM

Just to follow in the trail of digiot.. He may be on something about the chmod being a script.

Check if you can do something like
Quote:

$ /mnt7/bin/cat /mnt7/bin/chmod
Btw, it would help a lot if you told us the output of these commands:
Quote:

$ ls -l /
$ ls -l /mnt7
$ ls -l /mnt7/bin
As well as the content of the file called /etc/fstab (or /mnt7/etc/fstab, or something).

Also, are you following some guide on the internet when you are hacking on the Tivo? If so, it would be great if you posted a link to it.


All times are GMT -5. The time now is 06:57 PM.