LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 02-22-2008, 09:01 AM   #1
SeriesOne
LQ Newbie
 
Registered: Feb 2008
Posts: 3

Rep: Reputation: 0
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.
 
Old 02-22-2008, 09:45 AM   #2
hro
LQ Newbie
 
Registered: Jan 2008
Distribution: OpenSuse 10.3, SLED 10 SP2, Ubuntu 8.04 and 9.04
Posts: 23

Rep: Reputation: 15
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'.
 
Old 02-22-2008, 09:46 AM   #3
Ephracis
Senior Member
 
Registered: Sep 2004
Location: Sweden
Distribution: Ubuntu, Debian
Posts: 1,109

Rep: Reputation: 49
Quote:
Originally Posted by SeriesOne View Post
/mnt7/bin/chmod: 755 rc.sysinit.author
Shouldn't it be /mnt7/bin/chmod 755 rc.sysinit.author ?

Quote:
Originally Posted by SeriesOne View Post
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.
 
Old 02-22-2008, 10:05 AM   #4
SeriesOne
LQ Newbie
 
Registered: Feb 2008
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Ephracis View Post
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.
 
Old 02-22-2008, 10:56 AM   #5
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
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.

Last edited by slakmagik; 02-22-2008 at 11:01 AM. Reason: late thought
 
Old 02-22-2008, 02:18 PM   #6
SeriesOne
LQ Newbie
 
Registered: Feb 2008
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by digiot View Post
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.
 
Old 02-22-2008, 02:18 PM   #7
Ephracis
Senior Member
 
Registered: Sep 2004
Location: Sweden
Distribution: Ubuntu, Debian
Posts: 1,109

Rep: Reputation: 49
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.
 
  


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
Backup Script error "line 31: syntax error: unexpected end of file" eswanepoel General 7 12-07-2007 10:28 AM
Simple bash script "unexpected end of line error" snowman81 Programming 11 11-11-2007 10:31 AM
bash "unexpected end of file" script error Runge_Kutta Linux - General 6 05-23-2007 04:36 PM
Error Our attempts to find your SCHEMA for "attributetypes" has return UNEXPECTED res Niceman2005 Linux - Software 0 03-04-2007 08:49 PM
Why there is an error like "Xlib:unexpected async reply" icoming Programming 0 02-17-2005 12:23 AM


All times are GMT -5. The time now is 01:18 AM.

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