Bug 350539

Summary: yast2 repair remove fstab entries in error
Product: [openSUSE] openSUSE 11.0 Reporter: Casual J. Programmer <casualprogrammer>
Component: YaST2Assignee: Jiří Suchomel <jsuchome>
Status: RESOLVED FIXED QA Contact: Jiri Srain <jsrain>
Severity: Major    
Priority: P5 - None    
Version: Alpha 2   
Target Milestone: ---   
Hardware: x86   
OS: openSUSE 11.0   
Whiteboard:
Found By: Beta-Customer Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: yast2logs
patch for /usr/share/YaST2/modules/OSRFstab.ycp
patch for /usr/share/YaST2/modules/OSRFstab.ycp
Screenshot for fstab suggestion #1
Screenshot for fstab suggestion #2
yast2logs
patch for /usr/share/YaST2/modules/OSRFstab.ycp
/usr/share/YaST2/modules/OSRFstab.ycp.rej
patch for /usr/share/YaST2/modules/OSRFstab.ycp
Screenshot for fstab suggestion #1
Screenshot for fstab suggestion #2
yast2logs

Description Casual J. Programmer 2007-12-23 09:29:40 UTC
In the course of a yast2 repair session a point is reached where fstab entries are checked. It seems that the repair tool does not recognize the new format used recently.

My disk has two Windows XP NTFS Partions, fstab entries created during installation and working perfectly well are complained about by yast2 repair.

/dev/disk/by-id/scsi-SATA_FUJITSU_MHV2080_NW78T662BLKF-part1 /windows/C           ntfs-3g    users,gid=users,fmask=133,dmask=022,locale=en_US.UTF-8 0 0
/dev/disk/by-id/scsi-SATA_FUJITSU_MHV2080_NW78T662BLKF-part2 /windows/D           ntfs-3g    users,gid=users,fmask=133,dmask=022,locale=en_US.UTF-8 0 0

Hardware: Notebook FSC Amilo Si1520 
Graphics: Intel 945 GM, LCD 1280*800
Wireless: Intel ipw3945
Sound:    Intel ICH7
Desktop:  GNOME
OS:       openSUSE 11.0 (i586) Alpha0 VERSION = 11.0
Kernel:   2.6.24-rc5-git7-2-default

rpm -qa | grep yast

yast2-trans-wa-2.15.20-2
yast2-trans-cy-2.15.1-34
yast2-trans-pt-2.15.20-2
yast2-trans-zh_CN-2.15.13-2
yast2-control-center-gnome-2.13.2-127
yast2-trans-af-2.15.5-11
yast2-gtk-2.15.9-53
yast2-testsuite-2.16.0-13
yast2-ldap-2.15.1-108
yast2-autofs-2.15.2-95
yast2-control-center-qt-2.16.0-7
yast2-restore-2.16.0-15
yast2-sudo-2.15.3-118
yast2-slide-show-SuSELinux-2.15.16-2
yast2-trans-ar-2.15.4-15
yast2-trans-pot-2.15.2-25
yast2-core-2.16.16-2
yast2-ncurses-2.16.7-3
yast2-sshd-2.16.0-9
yast2-apparmor-2.1-54
yast2-samba-client-2.16.1-13
yast2-ldap-server-2.15.5-104
yast2-storage-evms-2.16.7-2
yast2-trans-bg-2.15.6-2
yast2-trans-hr-2.15.20-2
yast2-trans-vi-2.15.1-34
yast2-trans-pa-2.15.12-11
yast2-pkg-bindings-2.16.7-2
yast2-firewall-2.15.8-35
yast2-printer-2.16.6-7
yast2-kerberos-client-2.16.1-3
yast2-kerberos-server-2.16.0-11
yast2-inetd-2.15.1-72
yast2-printer-devel-doc-2.16.6-7
yast2-trans-xh-2.13.10-2
yast2-trans-zu-2.13.11-2
yast2-trans-stats-2.15.0-46
yast2-trans-ja-2.15.10-2
yast2-CASA-1.7.1461-41
yast2-iscsi-server-2.14.3-115
yast2-tv-2.16.0-27
yast2-dirinstall-2.16.0-13
yast2-installation-2.16.8-2
autoyast2-2.16.3-3
yast2-trans-en_US-2.15.5-19
yast2-trans-de-2.15.29-2
yast2-trans-it-2.15.13-2
yast2-trans-ka-2.15.1-31
yast2-transfer-2.16.0-4
yast2-x11-2.15.11-56
yast2-ldap-client-2.16.5-3
yast2-nfs-client-2.15.0-52
yast2-network-2.16.17-3
yast2-nis-server-devel-doc-2.16.0-31
yast2-casa-ats-1.7.1451-70
yast2-storage-devel-2.16.7-2
yast2-trans-tr-2.15.2-11
yast2-trans-zh_TW-2.15.13-2
yast2-trans-pl-2.15.14-2
yast2-trans-lt-2.15.12-2
yast2-trans-sr-2.15.3-2
yast2-trans-ko-2.15.5-2
yast2-trans-id-2.15.1-34
yast2-xml-2.16.0-10
yast2-add-on-creator-2.16.3-3
yast2-bluetooth-2.15.4-46
yast2-iscsi-client-2.16.2-9
yast2-repair-2.16.2-14
yast2-http-server-2.15.9-4
yast2-theme-openSUSE-2.16.2-2
yast2-trans-nb-2.15.12-2
yast2-trans-en_GB-2.15.6-2
yast2-trans-ta-2.15.5-11
yast2-country-data-2.16.4-3
yast2-trans-ro-2.15.26-2
yast2-trans-ru-2.15.26-2
yast2-trans-nl-2.15.12-2
yast2-trans-mr-2.15.5-11
yast2-trans-lo-2.15.1-31
yast2-core-devel-2.16.16-2
yast2-2.16.18-3
yast2-slp-server-2.15.0-70
yast2-runlevel-2.16.0-15
yast2-multipath-2.13.0-113
yast2-instserver-2.15.4-69
yast2-ntp-client-2.16.2-9
yast2-bootloader-2.16.3-3
yast2-tune-2.15.7-51
yast2-product-creator-2.16.6-4
yast2-samba-server-2.16.0-27
yast2-storage-2.16.7-2
yast2-metapackage-handler-0.7.3-13
yast2-trans-cs-2.15.14-2
yast2-network-devel-doc-2.16.17-3
yast2-trans-fi-2.15.22-2
yast2-trans-sk-2.15.14-2
yast2-trans-da-2.15.14-2
yast2-trans-bs-2.15.1-34
yast2-trans-et-2.15.12-2
yast2-tftp-server-2.14.0-132
yast2-security-2.15.1-52
yast2-ruby-bindings-0.2.0-29
yast2-python-bindings-2.16.2-5
yast2-drbd-2.13.1-78
yast2-scanner-2.15.5-70
yast2-control-center-2.16.0-7
yast2-mouse-2.16.0-13
yast2-update-2.16.1-15
yast2-update-FACTORY-2.16.1-15
yast2-mail-2.15.23-34
yast2-ftp-server-2.15.9-55
yast2-trans-fr-2.15.17-2
yast2-devtools-2.16.3-5
yast2-ca-management-2.16.4-3
yast2-sysconfig-2.15.3-85
yast2-fingerprint-reader-2.16.2-3
yast2-users-2.16.5-3
yast2-live-installer-2.16.1-13
yast2-storage-lib-2.16.7-2
yast2-trans-gu-2.13.6-11
yast2-trans-bn-2.15.7-11
yast2-trans-es-2.15.7-2
yast2-trans-pt_BR-2.15.15-2
yast2-trans-allpacks-2.15.0-48
yast2-country-2.16.4-3
yast2-squid-2.16.0-23
yast2-online-update-2.16.6-3
yast2-online-update-frontend-2.16.6-3
yast2-backup-2.16.1-3
yast2-firstboot-2.16.2-16
yast2-trans-km-2.15.28-2
yast2-trans-jv-2.15.1-31
yast2-trans-uk-2.15.23-2
yast2-trans-fa-2.15.1-31
yast2-irda-2.15.1-122
yast2-isns-1.0.4-34
yast2-registration-2.16.0-15
autoyast2-installation-2.16.3-3
yast2-dhcp-server-2.15.5-47
yast2-trans-sl-2.15.4-2
yast2-trans-el-2.15.14-2
yast2-trans-sv-2.15.12-2
yast2-trans-ca-2.15.4-11
yast2-slp-2.15.0-59
yast2-pkg-bindings-devel-doc-2.16.7-2
yast2-packager-2.16.12-3
yast2-support-2.15.3-42
yast2-mcs-plugin-0.1.0-64
yast2-kdump-2.16.8-3
yast2-profile-manager-2.16.0-14
yast2-qt-2.16.11-2
yast2-trans-gl-2.15.1-34
yast2-trans-si-2.15.2-34
yast2-trans-hi-2.15.6-11
yast2-trans-hu-2.15.18-2
yast2-perl-bindings-2.16.0-29
yast2-devel-doc-2.16.18-3
yast2-nfs-server-2.15.4-52
yast2-nis-server-2.16.0-31
yast2-phone-services-2.15.0-108
yast2-schema-2.15.0-156
yast2-trans-mk-2.15.2-2
yast2-mail-plugins-2.15.23-34
yast2-hardware-detection-2.16.0-7
yast2-sound-2.16.1-17
yast2-pam-2.16.0-24
yast2-nis-client-2.16.0-23
yast2-dns-server-2.16.1-3
yast2-add-on-2.16.0-22
Comment 1 Jiří Suchomel 2008-01-03 09:17:47 UTC
Please attach the y2log with the testcase.
Comment 2 Casual J. Programmer 2008-01-03 09:27:50 UTC
Created attachment 189123 [details]
yast2logs

This should cover the incident.
Comment 3 Jiří Suchomel 2008-01-03 09:54:33 UTC
Created attachment 189129 [details]
patch for /usr/share/YaST2/modules/OSRFstab.ycp

Please try patching  your /usr/share/YaST2/modules/OSRFstab.ycp. Than call "ycpc -c /usr/share/YaST2/modules/OSRFstab.ycp" and try again.
Comment 4 Casual J. Programmer 2008-01-03 10:20:49 UTC
workstation6l:/home/antonyarendt # cp /usr/share/YaST2/modules/OSRFstab.ycp /usr/share/YaST2/modules/OSRFstab.ycp.bak
workstation6l:/home/antonyarendt # patch /usr/share/YaST2/modules/OSRFstab.ycp Download/bug-350539_OSRFstab.diff
patching file /usr/share/YaST2/modules/OSRFstab.ycp
workstation6l:/home/antonyarendt # ycpc -c /usr/share/YaST2/modules/OSRFstab.ycpcompiling to '/usr/share/YaST2/modules/OSRFstab.ybc'
parsing '/usr/share/YaST2/modules/OSRFstab.ycp'
modules/OSRFstab.ycp:871  [Parser] Undeclared identifier 'partition'
Error

Maybe I'm missing something here, I am also a _very_ casual patcher ;-)
Comment 5 Jiří Suchomel 2008-01-03 10:27:09 UTC
Created attachment 189136 [details]
patch for /usr/share/YaST2/modules/OSRFstab.ycp

No, it's my fault, sorry. Hopefully this patch is correct.

Or just replace that "partition" with "part" on the line 871 of OSRFstab.ycp and run ycpc again.
Comment 6 Casual J. Programmer 2008-01-03 11:17:31 UTC
OK, now it works.

This is looking even more funny. It suggests an fstab entry for /dev/sdb1 and devpts (whatever that may be) and then rejects two existing entries, while offering the same two entries as replacement. ( Provided the parts of the entries not visible also match.)

The visibility issue should be fixed as well I think.
Comment 7 Casual J. Programmer 2008-01-03 11:18:24 UTC
Created attachment 189144 [details]
Screenshot for fstab suggestion #1
Comment 8 Casual J. Programmer 2008-01-03 11:18:47 UTC
Created attachment 189145 [details]
Screenshot for fstab suggestion #2
Comment 9 Casual J. Programmer 2008-01-03 11:20:57 UTC
Created attachment 189146 [details]
yast2logs
Comment 10 Jiří Suchomel 2008-01-03 12:57:31 UTC
Created attachment 189173 [details]
patch for /usr/share/YaST2/modules/OSRFstab.ycp

Please patch again your OSRFstab.ycp, run ycpc, try again and attach fresh logs. This time I'm only adding some debug output to see what's going on.

Thanks for testing!
Comment 11 Casual J. Programmer 2008-01-03 15:26:16 UTC
:-(

# patch /usr/share/YaST2/modules/OSRFstab.ycp bug-350539-1_OSRFstab.diff
patching file /usr/share/YaST2/modules/OSRFstab.ycp
Hunk #2 FAILED at 870.
1 out of 2 hunks FAILED -- saving rejects to file /usr/share/YaST2/modules/OSRFstab.ycp.rej
Comment 12 Casual J. Programmer 2008-01-03 15:27:59 UTC
Created attachment 189197 [details]
/usr/share/YaST2/modules/OSRFstab.ycp.rej
Comment 13 Jiří Suchomel 2008-01-04 08:10:46 UTC
Created attachment 189312 [details]
patch for /usr/share/YaST2/modules/OSRFstab.ycp

The patch was against the original (unpatched) code. Try this one, hopefully it will work.
Comment 14 Casual J. Programmer 2008-01-04 08:57:25 UTC
OK, now it runs, I thought I had reset to the original file from backup :-( never mind.

It now suggests /media as mountpoint for /dev/sdb1, I still don't see why it suggests putting up an fstab entry for a removable drive,please explain.

In the second step I maximized display it now is possible to see some difference in the mount points listed. Although still some details remain invisible. I think this window needs a slider to enable visibility of the complete line.

Obviously it complains about the user space ntfs ( which is favoured by install ) and suggests the kernel ntfs file system instead.

This should be checked and made identical for install and repair. 


Comment 15 Casual J. Programmer 2008-01-04 08:58:02 UTC
Created attachment 189322 [details]
Screenshot for fstab suggestion #1
Comment 16 Casual J. Programmer 2008-01-04 08:58:24 UTC
Created attachment 189323 [details]
Screenshot for fstab suggestion #2
Comment 17 Casual J. Programmer 2008-01-04 09:00:36 UTC
Created attachment 189324 [details]
yast2logs
Comment 18 Jiří Suchomel 2008-01-04 09:14:22 UTC
(In reply to comment #14 from Casual J. Programmer)

> I think this window needs a slider to enable visibility of the
> complete line.

I agree.

> Obviously it complains about the user space ntfs ( which is favoured by install
> ) and suggests the kernel ntfs file system instead.

Thomas, why is this different? Technically, I call FileSystems::GetMountString with `ntfs parameter (= value of "detected_fs" key) and it returns the default value ("ntfs") instead of "ntfs-3g". 

The second issue is with mount options: FileSystems::CheckFstabOptions returns "fmask=133,dmask=022,locale=en_US.UTF-8" in the "unknown_options" entry. I assume they were generated during instalation, so I wonder why are they unknown now?
Comment 19 Casual J. Programmer 2008-01-04 09:37:25 UTC
@ Jiří­ Suchomel

Can you please eludicate on this topic from #14 also ?

"It now suggests /media as mountpoint for /dev/sdb1, I still don't see why it
suggests putting up an fstab entry for a removable drive,please explain."

I was under the impression only permanent devices go into fstab.
Comment 20 Jiří Suchomel 2008-01-04 09:41:52 UTC
(In reply to comment #19 from Casual J. Programmer)

> Can you please eludicate on this topic from #14 also ?
> 
> "It now suggests /media as mountpoint for /dev/sdb1, I still don't see why it
> suggests putting up an fstab entry for a removable drive,please explain."
> 
> I was under the impression only permanent devices go into fstab.

I'll look into this as well, I hope after other issues are done.
Comment 21 Jiří Suchomel 2008-01-04 10:13:30 UTC
Thomas, additonal question about the removable devices: how could I know that a device is removable? For example, by usb stick gives me this map (result of Storage::GetPartition I think):

$[
     "detected_fs":`vfat,
     "dev_name":"/dev/sdd1",
     "device":"/dev/sdd1",
     "found":"dev",
     "fsid":11,
     "fstype":"Win95 FAT32",
     "label":"CORSAIR",
     "mount":"/media/CORSAIR",
     "mountby":`id,
     "name":"sdd1",
     "nr":1,
     "region":[
                0,
                123
     ],
     "size_k":987966,
     "type":`primary,
     "udev_id":[
                 "usb-Corsair_Flash_Voyager_AA12300000001023-0:0-part1"
     ],
     "udev_path":"pci-0000:00:1d.7-usb-0:5:1.0-scsi-0:0:0:0-part1",
     "used_fs":`vfat,
     "uuid":"2C9E-7178"
]

And about that entry for devpts (see comment 6), what do you think, it probably shouldn't be offered to fstab... ?
Comment 22 Casual J. Programmer 2008-01-04 10:24:33 UTC
@ Jiří­ Suchomel
Thank you on #20

re #21
Not sure if this is what you want:

hwinfo --disk | grep Features
  Features: Hotpluggable
  Features: Hotpluggable
Comment 23 Jiří Suchomel 2008-01-04 10:28:57 UTC
> re #21
> Not sure if this is what you want:
> 
> hwinfo --disk | grep Features

That's why I'm asking Thomas Fehr to provide ycp API :-)
Comment 24 Thomas Fehr 2008-01-07 10:35:40 UTC
ad comment #18:
- Due to the added ntfs-3g driver now there are more than on possibility to
  mount ntfs filesystems (both "mount -t ntfs" and "mount -t ntfs-3g" should
  work). I can change GetMountString to return ntfs-3g if you prefer that.
- The fact that some of the options show up under "Other Options" is because
  there are no UI-fields to set these options, all options without special
  UI fields show up under "Other Options", this is not new and was similar
  for older ntfs and vfat fstab options. 

ad comment #21:
The property of hotplugability is not a property of a partition, but of a disk.
So the key is contained in the map describing the disk, not a partition of
the disk. You can get the map of a certain disk with e.g.

map disk = Storage::GetDisk( Storage::GetTargetMap(), "/dev/sda" );
boolean pluggable = disk["hotpluggable"]:false;
Comment 25 Jiří Suchomel 2008-01-07 11:13:45 UTC
(In reply to comment #24 from Thomas Fehr)
> ad comment #18:
> - Due to the added ntfs-3g driver now there are more than on possibility to
>   mount ntfs filesystems (both "mount -t ntfs" and "mount -t ntfs-3g" should
>   work). I can change GetMountString to return ntfs-3g if you prefer that.

My problem with that GetMountString call is that it actually returns the default value, passed as seconf parameter. According to the function code, it looks like it _should_ return ntfs-3g so I wonder what's wrong here?

> - The fact that some of the options show up under "Other Options" is because
>   there are no UI-fields to set these options, all options without special
>   UI fields show up under "Other Options", this is not new and was similar
>   for older ntfs and vfat fstab options. 

I only need the way to verify if current settings in /etc/fstab are somehow correct. That's why I'm using FileSystems::CheckFstabOptions and report an error where the key "all_known" in the return map is set to false. If this case is only that you offer no configuration for extra options but they are actually at correct place, please either change the return value of CheckFstabOptions or giv e me other way to verify such fact.

> ad comment #21:
> The property of hotplugability is not a property of a partition, but of a disk.
> So the key is contained in the map describing the disk, not a partition of
> the disk. You can get the map of a certain disk with e.g.
> 
> map disk = Storage::GetDisk( Storage::GetTargetMap(), "/dev/sda" );
> boolean pluggable = disk["hotpluggable"]:false;

In the time when I need this information, I only ave the data shown in comment 21. But the map Storage::GetDisk (Storage::GetTargetMap(), part["device"]:"") (where "device" is /dev/sdd1) doesn't have hotpluggable key at all. I'm testing it on 10.3 is it some new feature?
Comment 26 Thomas Fehr 2008-01-07 12:12:15 UTC
> My problem with that GetMountString call is that it actually returns the
> default value, passed as seconf parameter. According to the function code, it
> looks like it _should_ return ntfs-3g so I wonder what's wrong here?

Just try with newest SVN code, it should return "ntfs-3g" now. If not I need
y2log file.

> I only need the way to verify if current settings in /etc/fstab are somehow
> correct. That's why I'm using FileSystems::CheckFstabOptions and report an
> error where the key "all_known" in the return map is set to false. If this case
> is only that you offer no configuration for extra options but they are actually
> at correct place, please either change the return value of CheckFstabOptions or
> give me other way to verify such fact.

Ah, now I see. Forgot to add "locale=", "fmask=", "dmask=" to FstabOptionRegex.
Please retry with newest SVN version of FileSystems.ycp.

> In the time when I need this information, I only ave the data shown in comment
> 21. But the map Storage::GetDisk (Storage::GetTargetMap(), part["device"]:"")
> (where "device" is /dev/sdd1) doesn't have hotpluggable key at all. I'm testing
> it on 10.3 is it some new feature?

Calling GetDisk with a partition as device argument will of course not do 
what you want since the device name of the disk is "/dev/sdd", not "/dev/sdd1". 
If you want to use a partition device name you need to call Storage::GetDiskPartititon which accepts partition devices and searches and
returns the corresponding disk map from Storage
BTW: The "hotpluggable" key is only present if it is true.
Comment 27 Thomas Fehr 2008-01-07 12:31:22 UTC
I just fixed a problem propagating "hotpluggable" property to target map.
Please use newest SVN version for testing.
Comment 28 Thomas Fehr 2008-01-07 12:32:11 UTC
Sorry forgot to mention that last changes module was StorageDevices.ycp
Comment 29 Jiří Suchomel 2008-01-07 12:45:09 UTC
Thanks for the help! I just tested the change in StorageDevices.ycp, it works. I do not have a testing environment to test the change of that parameters, so I hope it will work in next alpha.

There was one question remaining: for now-unknown reasons, yast2-repair offers creationg a mount point for devpts (see comment 6). What do you think of it, it probably shouldn't be offered there... ?
Comment 30 Thomas Fehr 2008-01-07 12:59:23 UTC
I have some rudimentary tests for some aspects of fstab handling code.
(see ~fehr/src/ycp/CheckFstabOptions.ycp). At least I checked that it now
accepts new ntfs-3g options and GetMountString correctly returns "ntfs-3g" 
instead of "ntfs".

As far as I see it, the option to create a mount point for devpts is not needed
in yast2-repair (no idea why it is there either). 

The mount point for devpts is /dev/pts and this is mounted automatically in 
/etc/init.d/boot.localfs. So there is no influence of an entry regarding devpts contained in /etc/fstab. No idea why this entry is still added to fstab. 
Probably just someone forgot that it is created by yast2-storage at all.
Comment 31 Jiří Suchomel 2008-01-07 14:38:44 UTC
Fixed in yast2-repair-2.16.3