g2p / blocks

Enable bcache or LVM on existing block devices
GNU General Public License v3.0
376 stars 43 forks source link

permission issues #23

Open shadow-identity opened 9 years ago

shadow-identity commented 9 years ago

I have troubles with permissions. Running blocks using sudo or under root:

$ sudo blocks 
Traceback (most recent call last):
  File "/bin/blocks", line 9, in <module>
    load_entry_point('blocks==0.1.4', 'console_scripts', 'blocks')()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 519, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2630, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2310, in load
    return self.resolve()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2316, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/nedr/src/blocks/blocks/__main__.py", line 63
    def __init__(self, *, device, **kwargs):
                        ^
SyntaxError: invalid syntax

running from user, blocks installed to system:

$ blocks
Traceback (most recent call last):
  File "/bin/blocks", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3018, in <module>
    working_set = WorkingSet._build_master()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 612, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 918, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 805, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: maintboot

running from user, blocks installed to user directory (the one way to make blocks run, but I have permission issue here):

$ /home/nedr/.local/bin/blocks to-lvm --vg-name home /dev/sdb3
Will shrink the filesystem (ext4) by 4194304 bytes
Checking the filesystem before resizing it
e2fsck 1.42.12 (29-Aug-2014)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sdb3: 11/192000 files (0.0% non-contiguous), 29572/768000 blocks
Copying 4194304 bytes from pos 0 to pos 3141533696... ok
Preparing LVM metadata... /dev/mapper/control: open failed: Permission denied
Failure to communicate with kernel device-mapper driver.
Incompatible libdevmapper (unknown version) and kernel driver (unknown version).
Command failed
/dev/mapper/control: open failed: Permission denied
Failure to communicate with kernel device-mapper driver.
Incompatible libdevmapper (unknown version) and kernel driver (unknown version).
Command failed
Traceback (most recent call last):
  File "/home/nedr/.local/bin/blocks", line 9, in <module>
    load_entry_point('blocks==0.1.4', 'console_scripts', 'blocks')()
  File "/home/nedr/src/blocks/blocks/__main__.py", line 2012, in script_main
    sys.exit(main())
  File "/home/nedr/src/blocks/blocks/__main__.py", line 1678, in main
    return args.action(args)
  File "/home/nedr/src/blocks/blocks/__main__.py", line 1886, in cmd_to_lvm
    synth_device(pe_size, device.size - pe_size))
  File "/usr/lib64/python3.4/contextlib.py", line 283, in enter_context
    result = _cm_type.__enter__(cm)
  File "/usr/lib64/python3.4/contextlib.py", line 59, in __enter__
    return next(self.gen)
  File "/home/nedr/src/blocks/blocks/__main__.py", line 1258, in synth_device
    exit_stack=st)
  File "/home/nedr/src/blocks/blocks/__main__.py", line 150, in mk_dm
    assert proc.returncode == 0, 'Report to https://github.com/g2p/blocks/issues/8 if you see this'
AssertionError: Report to https://github.com/g2p/blocks/issues/8 if you see this

So how should I run it? I'm on Fedora 22. Thanks

krichter722 commented 9 years ago
def __init__(self, *, device, **kwargs):
                        ^
SyntaxError: invalid syntax

happens because you invoke the program with pthon2, rebuild the application with python3 setup.py build && sudo python3 setup.py install (I opened #25 to prevent this in the future).