g2p / bedup

Btrfs deduplication
http://pypi.python.org/pypi/bedup
GNU General Public License v2.0
323 stars 50 forks source link

Running bedup as root, then as a normal user results in a unhelpful error message #94

Open leijurv opened 6 years ago

leijurv commented 6 years ago

The sqlite database can't be read, because it was created as root, and my normal user doesn't have permission to read it.

The resulting error simply says it was unable to read the database file, so I thought it might be corrupted or missing, but actually it just didn't have permission.

bedup dedup --size-cutoff 1000000 | tee -a ~/.bedup.log
Traceback (most recent call last):
  File "/home/leijurv/.local/lib/python3.5/site-packages/SQLAlchemy-1.2.0-py3.5-linux-x86_64.egg/sqlalchemy/engine/base.py", line 2158, in _wrap_pool_connect
    return fn()
  File "/home/leijurv/.local/lib/python3.5/site-packages/SQLAlchemy-1.2.0-py3.5-linux-x86_64.egg/sqlalchemy/pool.py", line 345, in unique_connection
    return _ConnectionFairy._checkout(self)
  File "/home/leijurv/.local/lib/python3.5/site-packages/SQLAlchemy-1.2.0-py3.5-linux-x86_64.egg/sqlalchemy/pool.py", line 782, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/leijurv/.local/lib/python3.5/site-packages/SQLAlchemy-1.2.0-py3.5-linux-x86_64.egg/sqlalchemy/pool.py", line 532, in checkout
    rec = pool._do_get()
  File "/home/leijurv/.local/lib/python3.5/site-packages/SQLAlchemy-1.2.0-py3.5-linux-x86_64.egg/sqlalchemy/pool.py", line 1089, in _do_get
    c = self._create_connection()
  File "/home/leijurv/.local/lib/python3.5/site-packages/SQLAlchemy-1.2.0-py3.5-linux-x86_64.egg/sqlalchemy/pool.py", line 350, in _create_connection
    return _ConnectionRecord(self)
  File "/home/leijurv/.local/lib/python3.5/site-packages/SQLAlchemy-1.2.0-py3.5-linux-x86_64.egg/sqlalchemy/pool.py", line 477, in __init__
    self.__connect(first_connect_check=True)
  File "/home/leijurv/.local/lib/python3.5/site-packages/SQLAlchemy-1.2.0-py3.5-linux-x86_64.egg/sqlalchemy/pool.py", line 679, in __connect
    pool.dispatch.connect(self.connection, self)
  File "/home/leijurv/.local/lib/python3.5/site-packages/SQLAlchemy-1.2.0-py3.5-linux-x86_64.egg/sqlalchemy/event/attr.py", line 256, in __call__
    fn(*args, **kw)
  File "/home/leijurv/.local/lib/python3.5/site-packages/bedup-0.10.1-py3.5-linux-x86_64.egg/bedup/__main__.py", line 88, in sql_setup
    cur.execute('PRAGMA journal_mode = WAL')
sqlite3.OperationalError: unable to open database file

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/leijurv/.local/bin/bedup", line 11, in <module>
    sys.exit(script_main())
  File "/home/leijurv/.local/lib/python3.5/site-packages/bedup-0.10.1-py3.5-linux-x86_64.egg/bedup/__main__.py", line 497, in script_main
    sys.exit(main(sys.argv))
  File "/home/leijurv/.local/lib/python3.5/site-packages/bedup-0.10.1-py3.5-linux-x86_64.egg/bedup/__main__.py", line 486, in main
    return args.action(args)
  File "/home/leijurv/.local/lib/python3.5/site-packages/bedup-0.10.1-py3.5-linux-x86_64.egg/bedup/__main__.py", line 122, in vol_cmd
    sess = get_session(args)
  File "/home/leijurv/.local/lib/python3.5/site-packages/bedup-0.10.1-py3.5-linux-x86_64.egg/bedup/__main__.py", line 103, in get_session
    upgrade_schema(engine)
  File "/home/leijurv/.local/lib/python3.5/site-packages/bedup-0.10.1-py3.5-linux-x86_64.egg/bedup/migrations.py", line 38, in upgrade_schema
    context = MigrationContext.configure(engine.connect())
  File "/home/leijurv/.local/lib/python3.5/site-packages/SQLAlchemy-1.2.0-py3.5-linux-x86_64.egg/sqlalchemy/engine/base.py", line 2102, in connect
    return self._connection_cls(self, **kwargs)
  File "/home/leijurv/.local/lib/python3.5/site-packages/SQLAlchemy-1.2.0-py3.5-linux-x86_64.egg/sqlalchemy/engine/base.py", line 90, in __init__
    if connection is not None else engine.raw_connection()
  File "/home/leijurv/.local/lib/python3.5/site-packages/SQLAlchemy-1.2.0-py3.5-linux-x86_64.egg/sqlalchemy/engine/base.py", line 2188, in raw_connection
    self.pool.unique_connection, _connection)
  File "/home/leijurv/.local/lib/python3.5/site-packages/SQLAlchemy-1.2.0-py3.5-linux-x86_64.egg/sqlalchemy/engine/base.py", line 2162, in _wrap_pool_connect
    e, dialect, self)
  File "/home/leijurv/.local/lib/python3.5/site-packages/SQLAlchemy-1.2.0-py3.5-linux-x86_64.egg/sqlalchemy/engine/base.py", line 1476, in _handle_dbapi_exception_noconnection
    exc_info
  File "/home/leijurv/.local/lib/python3.5/site-packages/SQLAlchemy-1.2.0-py3.5-linux-x86_64.egg/sqlalchemy/util/compat.py", line 203, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/home/leijurv/.local/lib/python3.5/site-packages/SQLAlchemy-1.2.0-py3.5-linux-x86_64.egg/sqlalchemy/util/compat.py", line 186, in reraise
    raise value.with_traceback(tb)
  File "/home/leijurv/.local/lib/python3.5/site-packages/SQLAlchemy-1.2.0-py3.5-linux-x86_64.egg/sqlalchemy/engine/base.py", line 2158, in _wrap_pool_connect
    return fn()
  File "/home/leijurv/.local/lib/python3.5/site-packages/SQLAlchemy-1.2.0-py3.5-linux-x86_64.egg/sqlalchemy/pool.py", line 345, in unique_connection
    return _ConnectionFairy._checkout(self)
  File "/home/leijurv/.local/lib/python3.5/site-packages/SQLAlchemy-1.2.0-py3.5-linux-x86_64.egg/sqlalchemy/pool.py", line 782, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/leijurv/.local/lib/python3.5/site-packages/SQLAlchemy-1.2.0-py3.5-linux-x86_64.egg/sqlalchemy/pool.py", line 532, in checkout
    rec = pool._do_get()
  File "/home/leijurv/.local/lib/python3.5/site-packages/SQLAlchemy-1.2.0-py3.5-linux-x86_64.egg/sqlalchemy/pool.py", line 1089, in _do_get
    c = self._create_connection()
  File "/home/leijurv/.local/lib/python3.5/site-packages/SQLAlchemy-1.2.0-py3.5-linux-x86_64.egg/sqlalchemy/pool.py", line 350, in _create_connection
    return _ConnectionRecord(self)
  File "/home/leijurv/.local/lib/python3.5/site-packages/SQLAlchemy-1.2.0-py3.5-linux-x86_64.egg/sqlalchemy/pool.py", line 477, in __init__
    self.__connect(first_connect_check=True)
  File "/home/leijurv/.local/lib/python3.5/site-packages/SQLAlchemy-1.2.0-py3.5-linux-x86_64.egg/sqlalchemy/pool.py", line 679, in __connect
    pool.dispatch.connect(self.connection, self)
  File "/home/leijurv/.local/lib/python3.5/site-packages/SQLAlchemy-1.2.0-py3.5-linux-x86_64.egg/sqlalchemy/event/attr.py", line 256, in __call__
    fn(*args, **kw)
  File "/home/leijurv/.local/lib/python3.5/site-packages/bedup-0.10.1-py3.5-linux-x86_64.egg/bedup/__main__.py", line 88, in sql_setup
    cur.execute('PRAGMA journal_mode = WAL')
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file (Background on this error at: http://sqlalche.me/e/e3q8)