Ubuntu 22.04 corrupt system after HD issue - Page 1
Forum section: electronics / general

author: edy
author_rank: Super Contributor
timestamp: May 12, 2023, 10:28:50 pm
content: Hi,I have an Ubuntu studio 22.04 install and one day after waking it from hibernation it started to give me errors of certain system files not found (in the gear-icon dialog). I decided to reboot to see if it would clear up and on reboot gave me error messages and wouldn’t boot fully. So I used a USB drive to boot and backup all my work files, ran fsck and it fixed a bunch of errors. I was able to reboot but it gets stuck now launching the graphical desktop. I got into a terminal and it gives me an error not being able to find libstdc++.so.6 or such. I’m sorry about being vague, I’ll upload more details soon.The bottom line is, graphical desktop just stuck with flashing cursor in corner of window. Also when I am trying to startx it is also blank. I’m pretty sure some files were corrupted in the system as fsck did what it could but probably some now missing.Is there any way to have Ubuntu scan the system and rebuild itself with the basic core files that is found in a fresh install from a live USB? I don’t want to have to reinstall the whole thing I can avoid it. Thanks!

author: tunk
author_rank: Super Contributor
timestamp: May 12, 2023, 10:34:59 pm
content: I think I first would run smartctl to see if there's a hardware problem with the disk.

author: ataradov
author_rank: Super Contributor
timestamp: May 12, 2023, 11:06:57 pm
content: sudo aptitude reinstall '~i'This would reinstall all currently installed packages. There is no way to tell what is broken and what is not, so reinstalling everything might help. But if the system is really broken, then there is no way to tell if this would work reliably.

author: Infraviolet
author_rank: Super Contributor
timestamp: May 13, 2023, 10:35:54 pm
content: This works for Mint, ought to work for Ubuntu...There is a way to avoid "having to reinstall everything" if you do it before a system is damaged. There's a tool called Timeshift, which ships with Mint by default and can be apt-get installled for Ubuntu. It is designed for system files mostly, you make a backup image (on an external drive or a spare HDD partition, must be an ext4 partition, can't save on FAT32 or NTFS, can't compress in to zip/7z/tar files either), and can restore to it later if your system is damaged. With some sketchy methods you can also get it to clone all your installed programs, even installed under Wine and such, and user settings files in various home folder subdirectories. I use this technique, with the fiddly additions to clone some home diretory stuff too, to make system images I can use to restore to. And the same system image can also be loaded on to a different PC, so long as you tinker with some UUID values once on the new system so it recognises the new hard drive rather than trying to find the original one.In the case of fixing a corrupted system it may even be able to identify just those files changed (including deliberately changed, but also corrupted ones) since you made the Timeshift image and replace those with old working copies.

author: JeremyC
author_rank: Regular Contributor
timestamp: May 14, 2023, 12:47:55 am
content: Quote from: edy on May 12, 2023, 10:28:50 pmEdy, it seems like a file system corruption. You could try to run “fsck” utility when boot from an live/rescue Linux (Ubuntu, Debian, Fedora, etc.) If possible then backup important files/directories using tar to an external storage.BTW, I suggest you go readout from Ubuntu, it’s another OS loaded with spy/malwares… trash it!Try to use Debian, default is maybe too conservative and difficult to use on laptops, just download the “Unofficial CD/DVD images for "stable" with non-free firmware included” release, it will be sure much more safe than any of the Ubuntu based distros.

author: edy
author_rank: Super Contributor
timestamp: May 15, 2023, 02:46:31 am
content: Thanks for all the advice. I’ve backed up all my data, I can boot the machine using a USB key and pretty much access all my files. Only the system data appears to be corrupt, I’ve already copied all my home folder with no issues…. but I’m worried the drive is likely done for. Lots of read errors on boot, probably why it can’t load stuff. Anyways, it is a pain but I’ll just install whatever I need once I replace the internal HDD and go from there. I have all the installation files but it’s just time consuming. Nothing too custom though so hopefully will be up and running again quickly and then I can go from there.

author: Monkeh
author_rank: Super Contributor
timestamp: May 17, 2023, 04:57:22 pm
content: Quote from: JeremyC on May 14, 2023, 12:47:55 amYou want to back that up?

author: edy
author_rank: Super Contributor
timestamp: May 17, 2023, 06:42:38 pm
content: Hey everyone, just a quick update on my progress here. I've managed to finally create a new Ubuntu 22.04 LTS USB key. It was a bit of a pain as I tried RUFUS, UnetBootin and some others and kept having issues on boot getting dumped to an (initramfs) prompt with BusyBox giving some error about unable to access or mount /dev/loop0 for the squashfs filesystem. Note that I have never had any problems before making keys, but most were under 4 GB. Perhaps something to do with FAT32. One posting suggested using an ext4 partition but when I did that, the drive wasn't recognized on boot at all (22.04 LTS is around 4.5 GB). Finally I got it to work using MX Linux Live USB Maker.... It basically just writes the ISO to the USB key using "dd" ISO9960 standard.I bought a new laptop drive, 500 GB SSD. My previous failed drive is a Samsung 750 GB (ST750LM022) with DOM 10.2012. I'm now in the process of "reducing" my storage needs because honestly I do not want 750 GB sitting on my working computer taking up space. A big chunk of that can be archived and sit in backups, I don't need daily access to it. Also, I'd rather have a smaller "core" set of files that I can easily backup to multiple places.I've noticed something interesting though... not sure if it is a coincidence or not. I have a USB 2.0 to SATA/IDE cable that lets me plug in hard drives (internal ones) to read on a computer. I have no problems mounting the larger desktop HDD's. However, I tried both this recently "failed" Samsung laptop HDD and another laptop Kingston 120 GB SSD that I had sitting around and neither of them seem to elicit any response when I plug the USB in to the computer. However, the Samsung *was* reading fine when it was plugged directly in the laptop (albeit with errors, when I booted off a LiveUSB key I was still able to mount and access it when it was internally connected). So I'm not sure if this is a bug or problem with the USB 2.0 to SATA/IDE adapter thing I have, or the drive died more. Also I seem to remember my Kingston 120GB SSD still being alive but now unable to read with this adapter. I will have to plug both into an actual laptop or desktop connection again and see if they mount, then I'll know if it's the drive or the adapter, and if not the drive why would the adapter read a standard desktop HDD and not a laptop one?