Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • aports aports
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 749
    • Issues 749
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 324
    • Merge requests 324
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • alpine
  • aportsaports
  • Issues
  • #13070

Closed
Open
Created Oct 07, 2021 by Rich Felker@dalias

openrc bootmisc script rm -rf'd my box

This was discussed extensively on IRC when it happened at the end of June, and I thought an issue had been opened, but apparently not. So here it is.

Somehow, after rebooting following a system crash, the boot hung during init scripts with "Wiping /tmp directory" on the screen. After about 15 or 20 seconds I realized it was probably wiping something other than /tmp and hit the power switch, but the damage had already been done. Thankfully I was able to recover most important things, but this should never have happened.

The bootmisc init script has some Rube Goldberg machine around figuring out which directories it should wipe, and performs the deletion via cd "$dir" || return 1 followed by rm -rf -- [!ajlq\.]* which might as well be rm -rf *. I don't know how it got past the cd without being in the right directory or if that's even how it happened, but a command line that rm command should not be present anywhere in any script, much less one that's preinstalled as part of the base system. There should be no complex logic to determine the directories to wipe, and the absolute pathname should be in the glob on the rm command line itself, not depending on being in a particular working directory. If it's even done at all.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking