0

I have cloned one of my servers (that is about to be shut down) into a VirtualBox machine. I used rsync for that, remembering to keep the relevant attributes etc. I also modified fstab. I have cloned a server like that before with success.

The virtual server can boot but only read-only. This is some of the output:

Loading, please wait...
INIT: version 2.86 booting
mount: only root can do that
touch: cannot touch '/lib/init/rw/.ramfs': Read-only file system
mkdir: cannot create directory '/lib/init/rw/sendsigs.omit.d/ : File exists
mount: only root can do that
Starting the hotplug events dispatcher: udevd
Synthesizing the initial hotplug events...done
Waiting for /dev to be fully populated... [  6.435055] piix4_smbus 0000:00:08.0
: SMB base address uninitialized - upgrade BIOS or use force_addr=0xaddr
[   6.609103] Error: Driver 'pcspkr' is already registed, aborting.....

It goes on like this a while with tons of errors related to the read-only filesystem, but eventually I get to the login prompt.

I can login, but the system is severely crippled. For example, even though I login as root, for most commands I get "Only root can do that".

I have tried an fsck but that didn't help.

Any ideas to make it boot normally would be much appreciated.

It's an quite old Debian Lenny, by the way.

EDIT: This is the rsync command:

rsync -azhv  --exclude-from=exclude.lst / [email protected]:/backup/

exclude.lst contains the following:

# Exclude
- /dev/*
- /proc/*
- /sys/*
- /tmp/*
- lost+found/
- /media/*
- /mnt/*
10
  • Could you please edit your post and add the rsync commands that you have used for that?
    – Danduk82
    Jun 26, 2015 at 13:38
  • @Danduk82: I have added the rsync command.
    – marlar
    Jun 26, 2015 at 20:32
  • Is /sbin/init owned by root ?
    – steve
    Jun 30, 2015 at 7:03
  • 1
    OK, you've created a backup of your files but... how did you create your new system from that backup? after you copy files, you need to create a file system in the destination HD, copy files with permissions (I guess [email protected]:/backup/ is not the place where your server is going to boot from, is it? modify your MBR (with Grub for instance) to make it point to your new system. Modify Grub config so that the UUIDs are those of the new drives, modify /etc/fstab so that it points to the nue UUIDs, and so on... have you done all that?
    – YoMismo
    Jun 30, 2015 at 7:22
  • I rsync'ed the files to / on the virtual disk, ran an grub-install, modified fstab. And remember, it does boot! I get a login prompt, but the system is severely crippled because a lot of stuff couldn't start due to the read-only filesystem. For example, even though I am root, I get the "Only root can do that" error when I try do root-stuff.
    – marlar
    Jun 30, 2015 at 9:42

1 Answer 1

1
+50

Is /sbin/init owned by root, or by some other user instead ?

Likely its owned by a non-root user, along with files like /bin/mount. Which means when they run (they have the SUID bit set) they run as non-root.

Example below. See how mount and mount.steve have the same contents but mount.steve is owned by steve. So mount.steve fails with the "only root can do that" because it's SUIDing to steve rather than root.

[root@localhost bin]# ls -l mount mount.steve
-rwsr-xr-x. 1 root  root  44208 Nov 27  2014 mount
-rwsr-xr-x. 1 steve users 44208 Jun 30 14:11 mount.steve
[root@localhost bin]# ./mount /foo /foo
mount: mount point /foo does not exist
[root@localhost bin]# ./mount.steve /foo /foo
mount.steve: only root can do that (effective UID is 1000)
[root@localhost bin]#

(I'm new around here, didn't understand the whole comments vs answers thing, thanks for the coaching folks)

2
  • Before he can accept this as an answer, you need to explain why this is the answer. I'd do it, but you need the bounty... Welcome!
    – eyoung100
    Jun 30, 2015 at 20:40
  • Thanks Steve. You deserve the bounty as your tip about the ownership saved my day. As noted in my other comment, I fixed the problem by mounting the volume in Virtualbox with SysRescueDisc and doing this command: find /mnt/rootfs -user 11233 -exec chown -h root:root {} \; The -h option is necessary in order to change the owner of symlinks that are dangling because the filesystem is mounted temporarily in another place.
    – marlar
    Jul 1, 2015 at 9:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .