Bug 126203 - Internal error: Device not correctly defined
Summary: Internal error: Device not correctly defined
Status: RESOLVED WORKSFORME
Alias: None
Product: kfloppy
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified FreeBSD
: NOR crash
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
: 187720 233243 250710 252077 373962 374136 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-04-25 02:42 UTC by Lawrence Sayre
Modified: 2021-01-16 04:33 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lawrence Sayre 2006-04-25 02:42:57 UTC
Version:           3.5.1 (using KDE 3.5.1, compiled sources)
Compiler:          gcc version 3.4.4 [FreeBSD] 20050518
OS:                FreeBSD (i386) release 6.0-RELEASE-p4

The error message in the title above is all I get when I try to format floppies.  I never saw this in Linux.  I'm now using FreeBSD 6.0 (from PC-BSD)
Comment 1 Alexander Malashenko 2006-05-15 22:40:51 UTC
I've got the same problem on ASPlinux11 (the same as FC4)
Comment 2 Mike 2006-09-01 23:01:17 UTC
Your possible solution/workaround, should you choose to accept it:

-This is a permission problem -- not kfloppy's fault. As root, add the following line to your devfs.conf:

perm fd[0-1] 0666

-Then, (still as root) from your shell, type in '/etc/rc.d/devfs restart' and press enter. This solved it for me. If you don't want other users being able to format floppies and you are in the GROUP which owns the fd0/fd1 devices, then just change the perm line to say '0660' instead of '0666'
Comment 3 Alexander Malashenko 2006-09-09 21:52:55 UTC
Unfortunately, it didn't help me.
Comment 4 d.account 2007-04-05 02:01:31 UTC
KFLOPPY 3.5.5 Release 45
OpenSUSE 10.2

The following issue has been reported in SUSE user forums and continues to be a problem.  see: forums.suselinuxsupport.de on Mar 25 2007

When attempting to format a floppy disk, the operation fails and reports error message:
Internal error: device not correctly defined

I have the following additional information:

In openSUSE the block device /dev/fd0 has permissions of 0640. These settings do not give permission for allowing formating by a standard user.  Changing permissions to rw for groups/all-users does not allow groups/all-users to format using kfloppy, however gfloppy will operate successfully.

In openSUSE the block device names /dev/fd0uxxx (where xxx is number corresponding to disk size) have permissions of 0000. Changing the permission of the proper disk size block device to rw for groups/all-users allows groups/all-users to format using kfloppy but not gfloppy.

The problem is a permissions issue.  However, gfloppy is dependant upon the settings for fd0 block device; whereas kfloppy is dependant upon settings for fd0uxxx. The tools in SUSE have been a problem in changing and keeping the file permissions changed. This is causing considerable confusion and problems among us newbies.

Wish list request:

1) Can the error message be modified for this problem to something like "User does not have write access to this device"?  This would make the problem easier for users to understand.

2) Add a section to the user help manuals that would explain the error messages and possible fixes.

THANK YOU
Comment 5 d.account 2007-04-12 23:38:33 UTC
Continuing on comment #4 with a work-around:

A user attempting to format a floppy with kfloppy gets the cryptic error message "internal error: device not correctly defined".  The issue is probably a permissions issue.  The default permissions of key files are set to limit standard users access of the floppy drive.

First, attempt to format a floppy as the administrator.  Either start the computer as root and format by using the menu system -or- go to a terminal window and issue the su command then start the kfloppy program by typing kfloppy at the terminal prompt.  This should format the floppy.  If it does, then it is the permissions problem and not a hardware or device problem.

Check the settings of the block devices for the floppy drive.  There are a series of block devices in the folder /dev.  The block device /dev/fd0 is the main floppy link and as originally installed by openSUSE 10.2 has permissions of (root, disk) -rw-r-----[640].  The block device names /dev/fd0uxxx (where xxx is number corresponding to disk size and type) have permissions of (root, root) ---------- [000].  After some trial and error, it appears kfloppy is dependant upon settings for fd0uxxx block devices.

Changing the permissions of these files will allow you to format the floppy disks.  The problem is that the permissions do not stick - the files are created every time the system is restarted.  This is due to usage of the program udev.  This program dynamically creates the floppy block devices upon startup according to a series of rules.

These rules are located in common text files that are editable.  They can be found in /etc/udev/rules.d directory.  The grep for fd0 shows several files that contain information, but the file 50-udev-default.rules is the key.

The following rule runs the program create_floppy_devices whenever a floppy drive is added to the system, either by hot-mount or during system device recognition during startup.  This program creates the /dev/fd0uxxx block devices.

KERNEL=="fd[0-9]*", ACTION=="add", ATTRS{cmos}=="*", RUN+="create_floppy_devices -c -t $attr{cmos} -m %M $root/%k"

Within the code of create_floppy_devices is a variable of mode = 0, thus setting the /dev/fd0uxxx permissions.  There is no group or owner attribute, so the system defaults of (root, root) are used.

Adding the -M switch to the call for create_floppy_devices will change the permissions assigned to the fd0uxxx devices.  It allows changing of all permissions except the assignment of write permissions to group and others.  Through the series of calls the program makes, probably in mknod, it prevents these write permissions from being set.  Also, in its present form it does not allow for the modification of group or owner attributes.

The only way I have found to change the permissions and group for fd0uxxx devices is through the creation of a separate permission setting script, and then adding a call to that script in the udev rules.

First, make a text file in the /lib/udev directory called device_permissions and set the owners/groups/permissions to match the other files in that directory.  Specifically, make the file executable by owner, group and others.  The content for this file is as follows between the cut markers (be sure the #! /bin/bash is the first line):

------------------------ cut ----------------------------------
#! /bin/bash
#
# change permissions of the requested device(s) in /dev directory
# arguments:
#       name of device  (required)
#       octal numeric code for permissions - see chmod (required)
#       group name (optional)

PATH="/sbin:/bin"

chmod -f ${2} /dev/${1}

if [[ $# -eq 3 ]]; then
  chgrp -f ${3} /dev/${1};
fi

exit 0

--------------------------- cut ------------------------------

Second, add the following rule to the rule files in directory /etc/udev/rules.d

KERNEL=="fd[0-9]*", ACTION=="add", RUN+="device_permissions %k* 0660 floppy"

This will set read/write permissions for group floppy on all fd0uxxx devices.  You can change the 0660 to 0666 if you wish everyone to have formating capability.  The group floppy is pre-installed in the system for most distros, and appears to be preferred over disk, since disk is a security risk giving members access to many critical devices.  You can use any or no group as you desire.

Third, add the desired users to the group floppy to gain formating access.

Now kfloppy will format for users in the floppy group!!!!!!!!!!!!

Note:  the rules are run in order, so be sure that you are modifying the attributes AFTER the system has created the device.  Place the rules lower in the pertanent rules script -or- it is suggested by the developers that user added rules go into a separate rules file.  In that case, start the rules file with a name/number greater than 50.

These modifications are general enough that any size floppy or any number of floppy drives should be corrected.

More information on udev can be found by man udev or by searching the internet for udev.  

This is specific to SUSE, but most distros are using udev.  However, each has its own implementation, so check for file locations and rules specific to your distro.  If this doesn't work for the system you are running, then hopefully it will give you some pointers to look at.

******************************************************************
Longer term - the program gfloppy utilizes the fd0 device for formating.   Simply adding the udev rule:

KERNEL=="fd[0-9]*", GROUP:="floppy", MODE:="0660"

changes the device permissions, without requiring a separate script.  Udev requires some contortions to get the fd0uxxx devices.  It may be better to re-write kfloppy similar to gfloppy's use of fd0.  Especially if some distros are not creating the fd0uxxx and similar files on the fly.
Comment 6 Mauricio 2008-05-06 01:08:40 UTC
En mi caso el problema es de permisos, ejecuté el kfloppy como root y me deja formatear. Uso Mandriva 2008.1 spring.
Comment 7 Stefan Böhmann 2010-04-19 12:37:05 UTC
*** Bug 187720 has been marked as a duplicate of this bug. ***
Comment 8 Christoph Feck 2010-07-21 20:21:58 UTC
*** Bug 233243 has been marked as a duplicate of this bug. ***
Comment 9 Christoph Feck 2010-09-23 00:07:21 UTC
*** Bug 252077 has been marked as a duplicate of this bug. ***
Comment 10 Christoph Feck 2010-09-23 00:11:21 UTC
*** Bug 250710 has been marked as a duplicate of this bug. ***
Comment 11 Christoph Feck 2016-12-20 17:38:46 UTC
*** Bug 373962 has been marked as a duplicate of this bug. ***
Comment 12 proteus5 2016-12-29 14:55:01 UTC
What's the fix to this problem? thanks I'm using Kflppy progrma on Kubuntu 16.10 Kfloppy release is 5.0
Comment 13 Christoph Feck 2016-12-31 05:32:58 UTC
*** Bug 374136 has been marked as a duplicate of this bug. ***
Comment 14 Justin Zobel 2020-12-17 05:25:15 UTC
Thank you for the crash report.

As it has been a while since this was reported, can you please test and confirm if this issue is still occurring or if this bug report can be marked as resolved.

I have set the bug status to "needsinfo" pending your response, please change back to "reported" or "resolved/worksforme" when you respond, thank you.
Comment 15 Bug Janitor Service 2021-01-01 04:34:11 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 16 Bug Janitor Service 2021-01-16 04:33:47 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!