Bug 3550 - /etc/fstab entries for removable media should be removed while installing Mageia2*
Summary: /etc/fstab entries for removable media should be removed while installing Mag...
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: Installer (show other bugs)
Version: Cauldron
Hardware: i586 Linux
Priority: High normal
Target Milestone: ---
Assignee: Colin Guthrie
QA Contact:
URL:
Whiteboard:
Keywords: USABILITY
: 4774 4915 (view as bug list)
Depends on:
Blocks: 3342
  Show dependency treegraph
 
Reported: 2011-12-01 06:37 CET by Doug Laidlaw
Modified: 2012-04-03 14:50 CEST (History)
11 users (show)

See Also:
Source RPM: systemd-44-2.mga2.src.rpm
CVE:
Status comment:


Attachments
/lib/systemd/mageia-media-mountpoints (270 bytes, text/plain)
2012-03-26 21:45 CEST, Dave Hodgins
Details
/lib/systemd/system/mageia-media-mountpoints.service (288 bytes, text/plain)
2012-03-26 21:48 CEST, Dave Hodgins
Details

Description Doug Laidlaw 2011-12-01 06:37:27 CET
Description of problem:

On booting into Alpha 2, all subdirectories of /media are deleted (except Windows.)  I need to re-create /media/cdrom before I can mount to it.


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.  Boot into Alpha 2.
2.
3.
Comment 1 Manuel Hiebel 2011-12-01 17:33:04 CET
alpha 2 ?

your directory are not in the fstab ?
Manuel Hiebel 2011-12-01 17:33:14 CET

Keywords: (none) => NEEDINFO

Comment 2 Doug Laidlaw 2011-12-01 18:02:26 CET
Sorry, yes.  There is only one, for cdrom.  The relevant line is:

/dev/cdrom /media/cdrom auto umask=0,users,iocharset=utf8,noauto,ro,exec 0 0

Once I have created the directory, I can rely on that line to say "mount /media/cdrom."
Comment 3 Manuel Hiebel 2011-12-01 18:14:38 CET
So I don't see the issue
Comment 4 Doug Laidlaw 2011-12-01 23:46:37 CET
So it is normal to need to put that directory back on each bootup?  Everybody has to do it?
Comment 5 Dave Hodgins 2011-12-02 05:39:47 CET
mount | grep media
tmpfs on /media type tmpfs (rw,nosuid,nodev,noexec,relatime,mode=755)

I'm seeing the same problem, although I didn't notice it before, as I had
disabled the dvd repository in drakrpm-edit-media.

Manuel, I'm using systemd and dracut.

Doug, if you run "umount /media", I expect you'll find the cdrom
directory is there.

I haven't yet tracked down where /media is getting mounted as a tmpfs.

CC: (none) => davidwhodgins

Comment 6 Doug Laidlaw 2011-12-02 06:29:52 CET
Yes, I see the same line for tmpfs that you saw.  In addition, there is a line for windows on /dev/sda1 :

 mount | grep media
tmpfs on /media type tmpfs (rw,nosuid,nodev,noexec,relatime,mode=755)
/dev/sda1 on /media/windows type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,blksize=4096)

I notice that tmpfs is mounted rw.

cd /media should show the contents of tmpfs.  It shows only the windows/ subdirectory.   "ls -a" shows nothing more.

If there is a filesystem mounted to /media, shouldn't it hide the windows/ subdirectory?  I can browse /media/windows/ quite normally.

The command "umount /media" gives:
      
     umount: /media: device is busy.   -- even if I cd back to / .
Comment 7 Doug Laidlaw 2011-12-02 06:48:25 CET
Sorry, I wasn't thinking straight.  Of course /media was busy, because /media/windows was mounted.  After unmounting Windows, I could unmount /media cleanly.  Then I couldn't get it back - not in /etc/fstab.

After rebooting I unmounted /media/windows again.  Then I got only the one line as Dave did for tmpfs, but there was nothing in /media except the (empty) windows/ directory.
Comment 8 Doug Laidlaw 2011-12-03 04:19:29 CET
Here is the output of the "df" command.  I have never seen one like it.  When I installed from the LiveCD, "df" showed a copy of what I would see with the LiveCD running, but this was a clean reinstall:

Filesystem      Size  Used Avail Use% Mounted on
rootfs          8.5G  3.5G  4.6G  44% /
/dev/root       8.5G  3.5G  4.6G  44% /
/dev            2.0G     0  2.0G   0% /dev
tmpfs           2.0G  1.2M  2.0G   1% /dev/shm
tmpfs           2.0G  516K  2.0G   1% /run
tmpfs           2.0G     0  2.0G   0% /sys/fs/cgroup
tmpfs           2.0G     0  2.0G   0% /media
/dev/sda1        33G   12G   21G  38% /media/windows
/dev/sda10       68G   55G   13G  81% /media/oldhome

And here is fstab (sda12 is my root and only partition for Alpha) :

# Entry for /dev/sda12 :
UUID=001e97d6-99b0-4cfb-a9ee-1d42cd37a8dd / ext4 acl,relatime 1 1
/dev/cdrom /media/cdrom auto umask=0,users,iocharset=utf8,noauto,ro,exec 0 0
/dev/fd0 /media/floppy auto umask=0,users,iocharset=utf8,noauto,exec,flush 0 0
# Entry for /dev/sda10 :
UUID=26e485e0-9453-4898-909c-873d51613cd6 /media/oldhome ext4 defaults 1 2
# Entry for /dev/sda1 :
UUID=D8C4D6BCC4D69C56 /media/windows ntfs-3g defaults 0 0
none /proc proc defaults 0 0
# Entry for /dev/sda6 :
UUID=3b53204e-112c-4384-b5f2-1fedd2562b9e swap swap defaults 0 0
Comment 9 Dave Hodgins 2011-12-04 00:18:59 CET
It's /lib/systemd/system/media.mount that causes /media to be mounted
as a tmpfs file system.

The idea is that systemd will now automatically create mount points, as
needed for removable filesystems.

The windows directory gets created automatically, in the tmpfs, when
that filesystem gets mounted.

Try removing the fstab entry for the cdrom (or at least comment it out),
and then insert a cd/dvd.  The device notifier should give you an option
to open it in a file manager.  Select that option, and confirm it gets
mounted ok.

Did the installer create the fstab cdrom entry, or is it left over
from a prior installation?
Comment 10 Doug Laidlaw 2011-12-04 04:19:16 CET
Plugging in a USB key for the first time was OK.

Commenting out the fstab entry:  On first attempt KDE Notifier said it could not mount it.  On a second attempt, it was mounted OK to /media/1-i586 and opened in Dolphin.  Fine for keyboard-and-monitor Windows types.

In answer to your question, I can't say. The installer looks at my previous file list even on a clean reinstall: I don't know how much is temporarily backed up.  But the previous system was the liveCD, so I think that the installer for the DVD created it.
Comment 11 Dave Hodgins 2011-12-04 05:17:12 CET
I just checked the fstab from a clean install of mageia 2 alpha 1,
and it does not have an entry for the cdrom, so this should be ok.

I'll keep an eye out for fstab cd/dvd entries, in future test
installs.

I will also suggest a release notes entry suggesting that people
should remove cd/dvd entries from their fstab with systemd.

I'll have to experiment a bit first to see what happens with run
level 3 only installations.
Comment 12 Marja Van Waes 2012-01-19 17:08:35 CET
(In reply to comment #11)
> I just checked the fstab from a clean install of mageia 2 alpha 1,
> and it does not have an entry for the cdrom, so this should be ok.
> 
> I'll keep an eye out for fstab cd/dvd entries, in future test
> installs.
> 
> I will also suggest a release notes entry suggesting that people
> should remove cd/dvd entries from their fstab with systemd.
> 

I don't see it in the Errata. Is that because this got fixed?

https://wiki.mageia.org/en/Mageia_2_Errata


> I'll have to experiment a bit first to see what happens with run
> level 3 only installations.

CC: (none) => marja11

Comment 13 Sander Lepik 2012-01-19 17:47:10 CET
AFAIK even Mandriva didn't need cdrom entry in fstab nor cdrom directory under media. That directory was created automatically when mounting.

CC: (none) => sander.lepik

Comment 14 Dave Hodgins 2012-01-21 03:29:30 CET
I've added an entry about this to
https://wiki.mageia.org/en/Mageia_2_Errata#Base_system
Comment 15 Doug Laidlaw 2012-01-21 03:44:30 CET
(In reply to comment #13)
> AFAIK even Mandriva didn't need cdrom entry in fstab nor cdrom directory under
> media. That directory was created automatically when mounting.

That wasn't my experience. The disk was mounted only when inserted, but the mount point had to exist from the beginning.  With the new arrangement in Mageia RC3, everything seems to be created on-the-fly, and it may be different.  The problem seems not to exist any longer.  I use a CD only for package installation, and I have to click in MCC after it has had a chance to mount, but that was always the case.  Installation then proceeds normally.
Comment 16 Doug Laidlaw 2012-01-21 03:51:57 CET
(In reply to comment #15)
> (In reply to comment #13)
> > AFAIK even Mandriva didn't need cdrom entry in fstab nor cdrom directory under
> > media. That directory was created automatically when mounting.
> 
> That wasn't my experience. The disk was mounted only when inserted, but the
> mount point had to exist from the beginning.  With the new arrangement in
> Mageia RC3, everything seems to be created on-the-fly, and it may be different.
>  The problem seems not to exist any longer.  I use a CD only for package
> installation, and I have to click in MCC after it has had a chance to mount,
> but that was always the case.  Installation then proceeds normally.

Further to the above, if I insert a CD just to browse, it is not visible in Dolphin until I mount it in a Konsole.  My USB key, on the other hand, is visible in Dolphin but not mounted, and no mount point is created until I open it.
Comment 17 Marja Van Waes 2012-01-21 09:56:22 CET
@ Doug

I understand (from comment 5) that Dave installed from DVD. 
In comment 8, you say:
> When I installed from the LiveCD, "df" showed a copy of what I would see with
> the LiveCD running, but this was a clean reinstall:

The word "but" gives me the impression that this time, you did not use the LiveCD. Do I misunderstand?

It would be nice if those /etc/fstab entries for removable media were removed during install

Assigning to drakx-installer-stage2 maintainer and cc'ing draklive-install maintainer. 

I'll clone this bug for LiveCD install, when someone confirms this is an issue there, too.

Keywords: NEEDINFO => USABILITY
Priority: Normal => High
CC: (none) => mageia
Component: RPM Packages => Installer
Blocks: (none) => 3342
Summary: Mount point /media/cdrom absent after each boot => /etc/fstab entries for removable media should be removed while installing Mageia2*
Source RPM: (none) => drakx-installer-stage2

Comment 18 John Balcaen 2012-01-22 11:04:11 CET
/media is mount as tmpfs due to systemd.

CC: (none) => balcaen.john

Comment 19 Marja Van Waes 2012-01-22 16:06:18 CET
(In reply to comment #17)

> 
> It would be nice if those /etc/fstab entries for removable media were removed
> during install
> 
> Assigning to drakx-installer-stage2 maintainer and cc'ing draklive-install
> maintainer. 
> 
> I'll clone this bug for LiveCD install, when someone confirms this is an issue
> there, too.

Assigning and cc'ing at the same time didn't work, this time.
Assigning again

Assignee: bugsquad => thierry.vignaud

Comment 20 Marja Van Waes 2012-01-23 06:53:18 CET
(In reply to comment #17)

> I'll clone this bug for LiveCD install, when someone confirms this is an issue
> there, too.

Bug 3476 (this one is more or less a duplicate of that one) is now left open for the same issue with draklive-install
Marcello Anni 2012-02-16 22:08:54 CET

CC: (none) => marcello.anni

Comment 21 Andrew Willson 2012-02-25 15:36:40 CET
I can confirm this bug on a clean install x64 system, commeting out the entry fixes the issue.

CC: (none) => lazerousz

Comment 22 Dave Hodgins 2012-03-03 00:26:14 CET
*** Bug 4774 has been marked as a duplicate of this bug. ***

CC: (none) => AndrewL733

Comment 23 Manuel Hiebel 2012-03-03 00:32:00 CET
Any fix possible for this bug ?
Comment 24 Dave Hodgins 2012-03-03 03:39:40 CET
I've posted a comment on the developers mailing list.

Three options I can see ...

1. Have the installer remove /media fstab entries

2. Have systemd parse fstab and generate the mountpoints.

3. Have dracut parse fstab and generate the mountpoints.

As it's systemd that's forcing /media to be on tmpfs,
that would be the logical place to put it, however
dracut already has code to parse fstab (for finding
/usr etc.), so that would be the simplest in my opinion.
Comment 25 Dave Hodgins 2012-03-13 03:59:50 CET
*** Bug 4915 has been marked as a duplicate of this bug. ***

CC: (none) => t.blackwell

Comment 26 Tony Blackwell 2012-03-13 06:32:59 CET
my bug 4915 has been marked as a duplicate of this.  They are clearly related, but mine had a different emphasis.  Fully installed system failed to make any updates because there was no /media/cdrom directory created so the mount of install disk failed and no update was possible - until manually creating the /media/cdrom mount point. 

I mention this again as reading the discussion here it is mainly about cleaning up /media, not about stalled package updates (or anything else requiring the DVD) failing due to not creating the mount point directory.
Comment 27 Dave Hodgins 2012-03-26 21:45:56 CEST
Created attachment 1861 [details]
/lib/systemd/mageia-media-mountpoints

I've put together a solution for this.

The attached script has been tested, and works on my system.
Comment 28 Dave Hodgins 2012-03-26 21:48:57 CEST
Created attachment 1863 [details]
/lib/systemd/system/mageia-media-mountpoints.service

In addition to adding the to files, the symlink has to be created in
/lib/systemd/system/local-fs.target.wants/
as
ln -s ../mageia-media-mountpoints.service

If the systemd maintainer could add these to the package, then
this bug can be closed.
Comment 29 Dave Hodgins 2012-03-26 21:50:14 CEST
I've changed the rpm this bug is about, as this is a change needed
for systemd.

Source RPM: drakx-installer-stage2 => systemd-44-2.mga2.src.rpm

Dave Hodgins 2012-03-26 21:51:30 CEST

Attachment 1863 mime type: application/octet-stream => text/plain

Manuel Hiebel 2012-03-27 02:25:47 CEST

CC: (none) => mageia

Comment 30 Colin Guthrie 2012-03-27 10:40:24 CEST
Yeah I think this seems like a reasonable solution. I'll see what upstream think about this as if it's a common problem we may be able to drop the mageia prefix. 

That said, perhaps /media is meant to be reserved for removable media. Static mounts are perhaps meant to be in /mnt... Obviously people will still set things up like this so it's no harm in being extra safe I guess.


As a side note, you probably want a:

[Install]
WantedBy=local-fs.target

in your unit. This way we can enable it by default, but allow users to disable/reenable it as needed.

If /media is meant to be reserved (as I suspect) then this script should probably put a big fat warning into syslog (i.e. just by echoing it out thanks to the journal) to let users know (for various values "let them know") that their mountpoint decisions are bad.
Colin Guthrie 2012-03-27 10:41:29 CEST

Status: NEW => ASSIGNED
Assignee: thierry.vignaud => mageia

David Walser 2012-03-27 19:13:20 CEST

CC: (none) => luigiwalser

Comment 31 Dave Hodgins 2012-03-28 01:08:36 CEST
(In reply to comment #30)
> As a side note, you probably want a:
> 
> [Install]
> WantedBy=local-fs.target
> 
> in your unit. This way we can enable it by default, but allow users to
> disable/reenable it as needed.

Ah. Thanks.  I wasn't sure how the symlinks normally
get created, so I just did it manually.
Comment 32 Doug Laidlaw 2012-03-28 04:50:49 CEST
(In reply to comment #30)
> 
> That said, perhaps /media is meant to be reserved for removable media. Static
> mounts are perhaps meant to be in /mnt... Obviously people will still set
> things up like this so it's no harm in being extra safe I guess.
> 
> 
It isn't only the users.  The trend seems to be for distros to put everything under /media, the Windows partition, for one.
Comment 33 Colin Guthrie 2012-03-28 09:40:09 CEST
The general chat with a few folk (from various distros) upstream was that /media should be reserved for transient media and /mnt still used for administrator configured mounts.

So while I agree we should do something about this for mga2, we should also ensure users are "reeducated" too :)

I suspect we'll use something pretty much like Dave's script, but will add in a warning too (there are things this script doesn't catch such as automounts etc. but provided we get 99% of it, I suspect the kitten casualties can be minimised).
Comment 34 Colin Guthrie 2012-03-28 09:47:50 CEST
Just for reference, a thread spawned while discussing with upstream on IRC:
http://thread.gmane.org/gmane.comp.sysutils.systemd.devel/4761
Comment 35 Colin Guthrie 2012-03-28 09:53:28 CEST
So basically, we'll solve this issue by simply abandoning making /media a tmpfs mount. Job done :)
Comment 36 Colin Guthrie 2012-04-03 14:50:55 CEST
OK, so current systemd no longer makes /media a tmpfs mount:

[colin@jimmy ~]$ mountpoint /media
/media is not a mountpoint


Resolved I think.

Status: ASSIGNED => RESOLVED
Resolution: (none) => FIXED


Note You need to log in before you can comment on or make changes to this bug.