6

I made a really silly

sudo mv /* /some_folder

move command on my remote server vm ubuntu 12.04

that moved my boot folder to

/home/.../somefolder/boot

I can access this folder via a browser terminal that gives me grub rescue.

How can I move the entire folder back to root location so to boot normally?

If that is impossible then if I boot from this location , will I be able to traverse to folders higher than the boot folder, as to at least copy my files via ssh?

UPDATE

I manage to do the following

 grub rescue> set prefix=(hd0,1)/home/path_to_boot/boot/grub
 grub rescue> set root=(hd0,1)/home/path_to_boot/
 grub rescue> insmod normal
 grub rescue> normal

Which launches a menu with options in choosing Ubuntu boot. I press c to enter console and get to grub mode to issue linux command.

grub> linux /home/path_to_boot/boot/vmlinuz-3.xx.x-67-generic
grub> initrd /home/path_to_boot/boot/initrd.img-3.xx.x-67-generic
grub> boot

After that I get stuck at

(initramfs)

At this point I have no access to /home folder, only to folders inside /home/path_to_boot/boot.

Any ideas how to proceed?

UPDATE 2

I contacted my servers company and got the option to boot via a live cd.

With it I did a

gksudo nautilus

And managed to copy my files.

Unfortunately though I wasn't able to save my system via grub, but so I got the files I needed.

Alexphys
  • 241

2 Answers2

2

If you have direct access to this machine (perhaps via this browser terminal popup thing (?)), you could try to load your kernel and the initramfs and boot it.

This won't bring up your system again (because the boot process doesn't only depend on /boot) but you can get into a shell.

If you have full access to GRUB this may work:

linux /<path>/boot/vmlinuz<...>
initrd /<path>/boot/initrd<...>

Because you haven't specified a root file system (via root=...) - because you currently don't have a usable one -, your system will run a busybox shell right from the initramfs.

This (initramfs) prompt is a complete shell. You need to create a folder - run mkdir /rootfs). Then you would need to mount your root file system (mount -o rw /dev/<...> /rootfs) and chroot into it (chroot /rootfs /bin/bash).

Then you can mount your other file systems (mount -a). Then you are able to do whatever you want.

Disclaimer: This is - as the question is, too - a cross-post from Super User.

YtvwlD
  • 290
1

According to the manual, there are no file operation commands in GRUB (aside from ls). Well, it's a boot loader after all, not a file manager.

Since your root directory is not in your partition root, I don't think it's possible to make your Linux boot correctly. You could use the normal command to get to the original boot menu and edit your boot entry so GRUB can find your kernel, but I don't think you can specify a specific subdirectory as your system root.

kraxor
  • 5,627