0

I know there are already some answers targeting both the problem with the initramfs prompt, and the problem about accidentally using dd and writing sda, however, I found no help with those questions, and I thought that mentioning my specific problem can make more sense to someone experimented with this (and can be a life saver for someone who runs into the same problems in the future).

First, I was having a problem with my Ubuntu, I could see no icons, and more than that, some UI things were not working well (which made it hard to use), I was using GNOME Flashback, and well, I eventually got tired of the problem, and decided to reinstall Ubuntu (the idea was to not lose any of the data in /home, I've got the idea from this question). I thought that this solution would restore the system settings, so that I could see the icons, and that I would lose no data at all.

Then, to create the bootable USB, I plugged it in, and ran: dd if=/path/to/iso of=/dev/sda, I realized that I meant /dev/sdb, and then stopped the command fairly quick with CTRL+C. However, the damage was done. The computer did not shut down there, and silly of me, I thought that trying to reinstall Ubuntu would fix that problem too, so I restarted the computer (big mistake, as of this question) after having succesfully created the bootable USB.

Then I got to the state I'm now, I can't boot to my Ubuntu normally, and what is even more worrying, is that I can't even start a live session from the USB. I used this same USB in the past, with this same machine, and all worked fine, and just to be sure, I even went to another computer, and burned the Ubuntu .iso again there, but no luck.

When trying to boot from the live USB (both times), everything goes well until I select 'try Ubuntu without installing' or 'install Ubuntu', none of them works, and leaves me with a console-like view, with a prompt that says: (initramfs) (sometimes with an error that says: "Unable to find a medium containing a live file system). None of the answers given here worked for me, since I can't run most programs from this prompt, I can't run fdisk, nor fsck (I wonder why, does this has anything to do with having used dd to write sda?), so it's a rather useless prompt.

The Ubuntu I was running, and the one I was trying to reinstall is Ubuntu 16.04LTS, and it's a laptop, so I can't take out the hard drive.

I've been hours researching, but I'm not finding anything useful for my specific case. What I would like to do is to:

  • Boot from the live USB, so that I can save important data. I know most of the data is there even after the dd, since I was able to view most of it after having run that command.
  • Reinstall Ubuntu, if I can make the previous step, it's not so important if I reinstall it, or if I install it from zero again, since my data would be backed up. The thing is that I want to have a usable machine.

Why is this question different to other similar questions?:


I'm willing to read any material you can provide to understand more of what's going on, and I'm willing to provide more information if you request.

Sorry if I forgot important details, please specify them in the comments section and I'll try to show those details.

And finally, thank you a lot for your help.

  • 1
    I'd use testdisk program to try to repair /dev/sda before any thing else. – WinEunuuchs2Unix Jan 16 '18 at 18:16
  • @WinEunuuchs2Unix: how can I use testdisk when I'm not able to even boot from live USB? I'm just face with the initramfs prompt, and I can't run a program like that. – Maximiliano Redigonda Jan 16 '18 at 18:19
  • How did you create the USB boot drive (that does not work) in the other computer (which tool did you use)? 2. Can you boot another computer from the USB boot drive? 3. What graphics chip/card and wifi chip/card are there in your computer? 4. Please specify the brand name and model of the computer (or motherboard if custom built). 5. It is possble to remove the internal drive from many (but not all) laptops.
  • – sudodus Jan 16 '18 at 18:23
  • I ran testdisk in windows to recover Linux. On my phone so can't research and post options. – WinEunuuchs2Unix Jan 16 '18 at 18:23
  • @WinEunuuchs2Unix oh, okay, sorry, I'm on a laptop :( so I don't feel it will be possible to test my disk using Windows. – Maximiliano Redigonda Jan 16 '18 at 18:26
  • No I was thinking a gparted live boot or something with testdisk on it but I can't google and link options from my phone. – WinEunuuchs2Unix Jan 16 '18 at 18:28
  • Try this link: https://www.cgsecurity.org/wiki/TestDisk_Livecd – sudodus Jan 16 '18 at 18:30
  • Oh, okay, I'll do this, I'll update soon (hopefully). – Maximiliano Redigonda Jan 16 '18 at 18:34
  • 1
    Did /dev/sda happen to refer to the USB drive with the Ubuntu Live system when you ran dd on it? Does the drive boot on other systems? You should probably recreate the bootable drive from scratch. – David Foerster Jan 16 '18 at 19:03
  • 1
    @DavidFoerster I've already done that, and nope, /dev/sda was my hard drive. I'm trying to use testdisk from a GParted live session and following this guide to fix this problem. – Maximiliano Redigonda Jan 16 '18 at 19:37
  • Well, I think that I've already restored the partition table, since running fdisk l from the live session of GParted doesn't give me errors, but I'm not able to boot normally, a blinking underscore appears. As other people said, the dd command might have deleted the /boot/ folder, maybe deleting the grub. I don't know much of this, should I try to install grub from the live session or something like that? – Maximiliano Redigonda Jan 16 '18 at 20:56
  • While in the live session, I could see the files I wanted to keep. I tried copying them to another flash drive, but when opening that drive in Windows, the data seems to be corrupted D: Any idea of how to save those files? – Maximiliano Redigonda Jan 16 '18 at 22:35
  • @sudodus Thanks for finding that link on how to create testdisk on a boot USB! Saved me some after-work home-work. – WinEunuuchs2Unix Jan 17 '18 at 00:58
  • @MaximilianoRedigonda You never tried testdisk on the drive as the first repair attempt? – WinEunuuchs2Unix Jan 17 '18 at 01:05
  • 1
    @WinEunuuchs2Unix I tried using testdisk, I think I fixed the partitions, but I was unable to boot, not even a live session of Ubuntu. I decided to use the GParted session to format the hard drive as clean space, and then I was able to boot from a live session of Ubuntu, and I ran testdisk on this new session, and now I am able to view some of the files, some of them I think are doomed, but I think I can save some data. After that, I will install Ubuntu, and all the not saved data will be gone. – Maximiliano Redigonda Jan 17 '18 at 01:16
  • 1
    @MaximilianoRedigonda I had to run testdisk for something like 24 hours over two days using various techniques it offers and multiple passes to get everything back except a few Megabytes of the disk and then rebuild the MBR. Luckily the beginning of the disk was all programs that couldn't be recovered so no great loss. – WinEunuuchs2Unix Jan 17 '18 at 01:30
  • 1
    @MaximilianoRedigonda To stop DD from destroying Hard Drives and SSD's I created this script which you and others might be interested in some day. – WinEunuuchs2Unix Jan 17 '18 at 02:23
  • I agree that you should use some tool that is safer than dd, when you want to create your USB boot drive. The tool should help you identify the drives and there should be a final checkpoint, where you can double-check that everything is correct. The script by @WinEunuuchs2Unix is such a tool. There are also other tools with similar properties and more or less 'bells and whistles', while dd is very basic and does what you tell it to do without any questions. – sudodus Jan 17 '18 at 06:42