Ask your questions here.
Post a reply

Re: Refracta2USB doesnt see /dev/sdb1

Sun Aug 31, 2014 5:57 pm

I was able to reproduce your problem in sid (with systemd). The problem is that refracta2usb uses '/sbin/fdisk -l' and that no longer works for an unprivileged user, and it does not even give a 'command not found' error.
'/sbin/fdisk -v' does work - it shows the version of fdisk. If the user just tries to run 'fdisk -l' (without the full path) the system does give the 'command not found' error. The same is true for blkid.

Even weirder is that this no longer works in wheezy. The current version of refracta2usb was extensively tested on wheezy last winter and spring. I'm too lazy to comb through the changelogs, but I guess there was a security update that introduced this feature/bug.

The quick fix is to comment out a few tests in the script. Edit the check_device function, which starts on line 168 so that this:
Code:
check_device () {

#check if is mounted
if [ "$device" = "" ]; then
   exit_message="\n No device was selected"
   exit_dialog
fi

MOUNTED=$(grep "${device}" /proc/mounts |awk '{print $1}')
echo "$MOUNTED"

if  [[ -n "$MOUNTED" ]]; then
   echo "$MOUNTED is mounted"
   exit_message="\nDevice ${device}1 appears to be mounted."
   exit_dialog
fi

# Check that first partition exists (blkid still shows result after zeroing device)
if ! $(/sbin/fdisk -l | grep -q "${device}1") ; then
   echo "${device}1 does not exist."
   exit_message="\nDevice ${device}1 does not exist.
Maybe you need to format it?"
   exit_dialog
fi

#check if part1 is vfat
ISFAT=$(/sbin/blkid|grep "${device}1"|grep -i fat|grep -o "/dev/sd[a-z][0-9]")

echo $ISFAT

if [ "$ISFAT" = "" ]; then
   exit_message="Cannot continue!\n\n${device}1 must be FAT formatted."
   exit_dialog
fi

}


...looks like this:
Code:
check_device () {

#check if is mounted
if [ "$device" = "" ]; then
   exit_message="\n No device was selected"
   exit_dialog
fi

MOUNTED=$(grep "${device}" /proc/mounts |awk '{print $1}')
echo "$MOUNTED"

if  [[ -n "$MOUNTED" ]]; then
   echo "$MOUNTED is mounted"
   exit_message="\nDevice ${device}1 appears to be mounted."
   exit_dialog
fi

# Check that first partition exists (blkid still shows result after zeroing device)
#if ! $(/sbin/fdisk -l | grep -q "${device}1") ; then
#   echo "${device}1 does not exist."
#   exit_message="\nDevice ${device}1 does not exist.
#Maybe you need to format it?"
#   exit_dialog
#fi

#check if part1 is vfat
#ISFAT=$(/sbin/blkid|grep "${device}1"|grep -i fat|grep -o "/dev/sd[a-z][0-9]")

#echo $ISFAT

#if [ "$ISFAT" = "" ]; then
#   exit_message="Cannot continue!\n\n${device}1 must be FAT formatted."
#   exit_dialog
#fi

}


With those changes, refracta2usb won't check to make sure the partition exists and won't check to make sure that it's a fat32 partition. The user will have to make sure of those things himself/herself.

Also, there are two tasks in the advanced menu that won't work - Encrypted 04 and Add_LUKS 05. There may be other tasks that don't work, because of the same problem. I haven't checked all the scripts to see what uses fdisk or blkid as unprivileged user. I don't know what the final fix will be. (Maybe get the device from 'ls -l /dev/disk/by-id')

Edit: Even though '/sbin/blkid' and '/sbin/fsidk -l' don't work in wheezy, refracta2usb did not give me an error. I don't understand that.

Re: Refracta2USB doesnt see /dev/sdb1

Sun Aug 31, 2014 9:56 pm

Well, '/sbin/blkid' really does work for unprivileged user in sid, so I fixed refracta2usb to use '/sbin/blkid -c /dev/null' instead of '/sbin/fdisk -l' which only works for root. Rolled it into a new deb. Tests for fat32 and for existing partition should work, so commenting them out is not necessary - just install the newer version -
http://distro.ibiblio.org/refracta/file ... 6+sid1.deb

Re: Refracta2USB doesnt see /dev/sdb1

Mon Sep 01, 2014 9:07 pm

You are awesome fsmithred. I will try new version tomorrow after work.

Re: Refracta2USB doesnt see /dev/sdb1

Wed Sep 03, 2014 5:44 pm

Hi, i finally tried it and there is still the same problem.

I ran refracta and this showed up in terminal window:

Code:
        LIST OF USB DEVICES

  /dev/sdb             Kingston DataTraveler 2.0

/dev/sdb1
/dev/sdb1 is mounted



Then this message poped up:
Image

This was in /home/user/.refracta2usb/refracta2usb.log

Code:
** (zenity:25150): WARNING **: Couldn't register with accessibility bus: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.


Im using zenity because yad is no longer in repository. It was actually a virtual package i think.
Its not working even after mkfs.vfat, /dev/sdb1 still "not exists" for refracta.

Re: Refracta2USB doesnt see /dev/sdb1

Wed Sep 03, 2014 10:55 pm

OK, it must be a problem with zenity. I might be able to tell you more if you run it in debug mode and show me the error log. I'd really like to see that.

You can get deb files for several versions of yad here -
http://debs.slavino.sk/pool/main/y/yad/

For wheezy, get 0.20.3-1.

Re: Refracta2USB doesnt see /dev/sdb1

Thu Sep 04, 2014 11:45 am

Forgot to mention in my previous post...

Make sure it's not mounted, and make sure it hasn't been mounted and unmounted. If it has, you may need to unplug and re-plug the usb stick.

Please run the following before you install yad (if that's what you're planning to do.)
Code:
refracta2usb -d

Then show me the entire error log. If you don't want to post it publicly, send me a pm.

Re: Refracta2USB doesnt see /dev/sdb1

Thu Sep 04, 2014 8:16 pm

So, i connected my USB Stick, didn't mount it.

There is output from terminal:

Code:
hans@Intrepid:~$ refracta2usb -d

   LIST OF USB DEVICES

  /dev/sdb             Generic Flash Disk
  /dev/sdc             Kingston DataTraveler 2.0


/dev/sdc1 does not exist.
hans@Intrepid:~$ refracta2usb -d

   LIST OF USB DEVICES

  /dev/sdb             Kingston DataTraveler 2.0


/dev/sdb1 does not exist.


And debug log is in PM.

Re: Refracta2USB doesnt see /dev/sdb1

Thu Sep 04, 2014 11:38 pm

Thanks. It's the same problem as before, and it's the same problem I had. Using yad won't help. So that leaves the first fix that I suggested - comment out the lines in the check_device function, just as I described above.

What happens when you run '/sbin/blkid -c /dev/null' as ordinary user? Does it give normal blkid output, or does it just return you to the prompt?

Re: Refracta2USB doesnt see /dev/sdb1

Fri Sep 05, 2014 11:13 pm

/sbin/blkid -c /dev/null does nothing. Resp. its output is nothing.

Code:
hans@Intrepid:~$ /sbin/blkid -c /dev/null
hans@Intrepid:~$


Im not sure what you want me to do with that function, resp where am i supposed to find it?

Re: Refracta2USB doesnt see /dev/sdb1

Sat Sep 06, 2014 2:32 am

Well, that's strange. You're using jessie, right? I checked versions, and jessie is using the same version of util-linux (which includes blkid) as sid, and blkid works for me in sid. I'm not sure what the problem is, but here's a link to the full script with the offending tests commented out. Click on the "Raw" button, so you don't see the line numbers, copy/paste the whole script and then (as root) copy it to /usr/bin/refracta2usb to replace the one that's there.
https://gist.github.com/fsmithred/c14b3e131a4af8c6d697

Edit: I just played with it some more, and '/sbin/blkid -c /dev/null' doesn't work for me in sid now. I'm pretty sure it did work before. If I just run '/sbin/blkid' then it does give output. The reason I added the '-c /dev/null' is because I ran into problems previously when running blkid right after formatting a partition, and it wouldn't give the new uuid of the partition. Instead, it showed the old uuid that existed before reformatting the partition.

Once again, I don't know what the final fix will be, but the script I posted in this message should work for you. (Yeah, I know I said that before an turned out to be wrong. Thanks for testing and helping to make this tool better.)
Post a reply