You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

运行Bash脚本后Linux Mint冻结硬关机,现无法启动求技术排查

Troubleshooting Linux Mint Boot Failure After Script Run & Hard Shutdown

Hey there, let's work through diagnosing why your Linux Mint system won't boot after running that custom Bash script and doing a hard shutdown. We'll cover filesystem checks, script impact analysis, and hardware health to narrow down the cause step by step.

1. First: Fix Filesystem Corruption (Most Likely from Hard Shutdown)

Hard shutdowns often leave filesystems in an inconsistent state—this is the most common culprit here. Let's use a Linux Mint live USB to address this:

  • Create a Linux Mint live USB if you don’t have one, then boot your machine from it.
  • Open a terminal and run sudo fdisk -l to identify your system partition (look for the entry labeled Linux filesystem, usually something like /dev/sda2 or /dev/nvme0n1p2).
  • Critical note: Never run filesystem checks on a mounted partition. If your system partition auto-mounted, unmount it first with sudo umount /dev/sdXn (replace sdXn with your actual partition path).
  • Run the filesystem repair tool: sudo fsck /dev/sdXn. Follow any prompts to confirm fixes (usually typing y when asked).
  • Once done, reboot your machine and see if it boots normally.

If the filesystem check didn’t resolve the problem, your script might have modified critical system files or caused disk overload. Let’s dig in:

  • Boot back into the live USB and mount your system partition: sudo mount /dev/sdXn /mnt.
  • Locate and examine your Bash script to spot risky operations:
    cat /mnt/home/your-username/Pictures/EastTrip/Finals/your-script-name.sh
    
    Look for red flags like rm -rf targeting system directories, overwriting system config files, or infinite loops generating massive amounts of data (which could clog the filesystem).
  • Check system logs for clues about what went wrong before the shutdown:
    less /mnt/var/log/syslog
    less /mnt/var/log/messages
    
    Scan for errors around the time you ran the script—things like disk IO failures, process crashes, or permission denied warnings.

3. Verify Hard Drive Health (Rule Out Coincidental Hardware Failure)

It’s possible the hard drive had a coincidental failure. Let’s check its SMART status:

  • In the live terminal, run sudo smartctl -a /dev/sdX (replace sdX with your hard drive path, e.g., /dev/sda—this is the whole drive, not a partition).
  • Look for the line SMART overall-health self-assessment test result. If it says FAILED!, your drive is likely failing and needs replacement.
  • Also watch for high values in Reallocated_Sector_Ct (indicates bad sectors) or Current_Pending_Sector (signals pending bad sector issues).

4. Fix GRUB Bootloader If Needed

If the filesystem is intact but the system still won’t boot, the GRUB bootloader might be corrupted:

  • From the live USB, set up a chroot environment to access your system:
    sudo mount /dev/sdXn /mnt
    sudo mount --bind /dev /mnt/dev
    sudo mount --bind /proc /mnt/proc
    sudo mount --bind /sys /mnt/sys
    sudo chroot /mnt
    
  • Reinstall GRUB to your hard drive: grub-install /dev/sdX (use the whole drive path, not a partition).
  • Update GRUB: update-grub
  • Exit chroot with exit, unmount all partitions, and reboot.

内容的提问来源于stack exchange,提问作者Scorb

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 04:03:48