LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 10-12-2015, 02:26 PM   #1
SicnarfSteele
LQ Newbie
 
Registered: May 2007
Location: Washington State
Distribution: slackware 14.0
Posts: 29

Rep: Reputation: 0
Migrated Slack 14 installation to new drive now crontab error cant execute binary fil


Hi all, I just migrated my server to a new larger SATA hard drive and have been working out the permission issues I have run into so far. I found that some permissions did not copy correctly. I fix them as I find them, /var seemed to be the worst, fortunately I have been checking permissions and ownership from my original drive and fixing things as they pop up.
However I am unable to get crontab to run to show me anything. I cant use the list, edit or user flags.
I receive the error at all attempts when trying to run as root:
crontab -u
bash: /usr/bin/crontab: cannot execute binary file

Searching on the web I get tons of information on errors when running a script from within cron but cant seem to find where the permission problem is located. Can anyone point me to where I can find where crontab should run and what permissions I need please?

Cheers and thank you.
John
 
Old 10-12-2015, 02:54 PM   #2
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,058

Rep: Reputation: Disabled
To help investigate, please append to your next post the full output of following commands:
Code:
file /usr/bin/crontab
stat /usr/bin/crontab
uname -a
 
Old 10-13-2015, 03:04 AM   #3
niallb
LQ Newbie
 
Registered: Sep 2003
Location: Dunsany, Ireland
Distribution: Debian, Ubuntu, Redhat, OpenELEC
Posts: 10

Rep: Reputation: 1
Cool

Hi.
Do you have the commands getfacl and setfacl available to you on both systems ?
If you do you could try transferring permissions via a file.
On the source machine you'd run something like:

getfacl -R / >/mnt/somewhere-accesible/permissions-from-source-system.facl

Then transfer that file to the new system and run

setfacl --restore /mnt/somewhere-accesible/permissions-from-source-system.facl

Be careful when you do this that your userids and group ids are consistent between the systems.
If you continue to have problems, I think you should run the system copy again, taking care to match the systems more correctly.
Good ways of achieving that are with tar or rsync, and if you can boot the devices externally, clonezilla is an excellent tool.

Good luck getting it sorted!
 
Old 10-13-2015, 02:08 PM   #4
SicnarfSteele
LQ Newbie
 
Registered: May 2007
Location: Washington State
Distribution: slackware 14.0
Posts: 29

Original Poster
Rep: Reputation: 0
Here go:
root@fs:/home/j# file /usr/bin/crontab
/usr/bin/crontab: setuid data

root@fs:/home/j# stat /usr/bin/crontab
File: '/usr/bin/crontab'
Size: 10096 Blocks: 0 IO Block: 4096 regular file
Device: 802h/2050d Inode: 8941028 Links: 1
Access: (4711/-rws--x--x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2015-10-14 02:54:53.321822874 -0700
Modify: 2012-09-07 13:24:47.000000000 -0700
Change: 2015-10-08 05:04:11.524910370 -0700
Birth: -

root@fs:/home/j# uname -a
Linux francis 3.2.29-smp #2 SMP Mon Sep 17 13:16:43 CDT 2012 i686 AMD FX(tm)-8300 Eight-Core Processor AuthenticAMD GNU/Linux
root@fs:/home/j#

I do have the getfacl/setfacl command and I'm checking into it now. For my situation where my initial root source disc is mounted at /sdb1 I assume it would be
getfacl -R /sdb1 > getfacl.info.from.sdb1
setfacl --restore getfacl.info.from.sdb1 (current root drive is the understood as the target?)

Thanks for the help Didier Spaier and niallb! I love reading these forums helps me learn so much more.
Cheers!
 
Old 10-13-2015, 02:18 PM   #5
niallb
LQ Newbie
 
Registered: Sep 2003
Location: Dunsany, Ireland
Distribution: Debian, Ubuntu, Redhat, OpenELEC
Posts: 10

Rep: Reputation: 1
Thumbs up

Quote:
Originally Posted by SicnarfSteele View Post
...

I do have the getfacl/setfacl command and I'm checking into it now. For my situation where my initial root source disc is mounted at /sdb1 I assume it would be
getfacl -R /sdb1 > getfacl.info.from.sdb1
setfacl --restore getfacl.info.from.sdb1 (current root drive is the understood as the target?)

Thanks for the help Didier Spaier and niallb! I love reading these forums helps me learn so much more.
Cheers!
That should be right from that location. Just make sure you 'cd /' before you restore and be in the sdb1 directory when you you run the getfacl.

cd /sdb1 ; getfacl -R . >getfacl.info.from.sdb1

That should give you the easiest file to work with.
If both drives are in the same box, rsync might originally have been an easier way to copy the filesystem,
but copying the facl should solve most of your problems.
Good luck!

Last edited by niallb; 10-13-2015 at 02:25 PM.
 
Old 10-13-2015, 06:56 PM   #6
SicnarfSteele
LQ Newbie
 
Registered: May 2007
Location: Washington State
Distribution: slackware 14.0
Posts: 29

Original Poster
Rep: Reputation: 0
Thanks niallb, great stuff, I had not used this before always learning new stuff.

One funny thing I found the time stamp for both the /usr/bin/crontab and the /sdb1/usr/bin/crontab file to be:

-rws--x--x 1 root root 10096 Sep 7 2012 /usr/bin/crontab

While on an old backup directory I found the /usr/bin/crontab time stamp to be:

-rwx--x--x 1 root root 10096 Nov 14 2013 /sdb1/backup-old-system/usr/bin/crontab

I am able to run this file with no errors.

sudo crontab -l
10 0 * * * /usr/local/bin/freshclam 1 2> /dev/null #update clamav database
0 11 * * * cd / ; /usr/local/bin/clamscan -l /home/j/clamscan.out --recursive=yes --bell --scan-mail=yes 1 2> /dev/null
0 0 * * * /etc/webmin/mysql/backup.pl --all
0 0 * * * webalizer -c /etc/webalizer/webalizer.conf

Could it be that the crontab file is 64bit or the system thinks it is?

Cheers!
 
Old 10-13-2015, 08:58 PM   #7
niallb
LQ Newbie
 
Registered: Sep 2003
Location: Dunsany, Ireland
Distribution: Debian, Ubuntu, Redhat, OpenELEC
Posts: 10

Rep: Reputation: 1
You could copy over the working crontab binary into your /usr/bin directory, though I'd really be looking at rebuilding the whole system in light of it not transferring properly.

When you ran 'file' on crontab earlier for Didier, it would have told you then if it identified it as a 32bit or 64bit binary, but it just listed it as 'data'.
This suggests the file was corrupted in some way.

If it was a 64bit binary, the description would read more like this:
/usr/bin/crontab: setgid ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.26
 
Old 10-13-2015, 10:01 PM   #8
Rinndalir
Member
 
Registered: Sep 2015
Posts: 733

Rep: Reputation: Disabled
I am curious how you migrated your server.
 
Old 10-14-2015, 03:18 AM   #9
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,058

Rep: Reputation: Disabled
Here:
Code:
~$ file /usr/bin/crontab 
/usr/bin/crontab: setuid executable, regular file, no read permission
~$
So, as stat gives an output similar to yours, I assume that the reason this file be not considered as executable by the file utility is that it is not for your system's Arch.
 
Old 10-16-2015, 12:38 PM   #10
SicnarfSteele
LQ Newbie
 
Registered: May 2007
Location: Washington State
Distribution: slackware 14.0
Posts: 29

Original Poster
Rep: Reputation: 0
Thanks for the help guys. I have copied over the working crontab file from the old backup directory and it is working correctly. Not sure why the copy failed but I used the cp -r -d I believe I did try it a few times. I was having difficulties after upgrading my 10+ motherboard/cpu with a newer setup to accept the new 1T SATA drive. I was moving from a small PATA IDE drive and it took a while to get the drives to play happily together.
As I have read perhaps using the dd command or the tar command would have been a better approach to migrate to the new drive.
Again thanks for all the help. Everything seems to be functioning and playing well together at this time but when I find things being weird it becomes an opportunity to learn more. I do this for my own fun and experience and not for any production value.
Cheers to all!
John
 
  


Reply



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
getting error 'cannot execute binary file' kapilbajpai88 Linux - Newbie 15 09-20-2010 06:00 AM
GID installation issues can not execute binary file gourik Linux - Newbie 5 02-09-2009 06:34 AM
Java Installation, Fedora Core5. Cannot Execute Binary File. JordanD Linux - Newbie 2 03-03-2008 01:29 PM
cannot execute binary installation file kpachopoulos Linux - General 5 06-14-2005 05:26 AM
j2sdk installation issue - cannot execute binary file mcolley73 Linux - Software 2 04-18-2004 12:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration