Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
What do you think about Fedora/FreeDesktop.org UsrMove Plan?
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3, 4, 5  Next  
Reply to topic    Gentoo Forums Forum Index Gentoo Chat
View previous topic :: View next topic  
Author Message
Yamakuzure
Veteran
Veteran


Joined: 21 Jun 2006
Posts: 1378
Location: Bardowick, Germany

PostPosted: Tue Mar 20, 2012 4:07 pm    Post subject: Reply with quote

I would like to know why everybody is going nuts about this "move". We have several servers (about 20 internal and external), all running with debian and they never had neither /usr nor /var on a different partition but the root partition. Backups were never an issue, everything that has to be backed up is on other drives. My two machines at work are running with gentoo on it with a non-extra /usr partition, and everything (udev-181 included) is working well.

People keep saying they have /usr in LVM, but why? Once everything is set up, /usr isn't growing this much any more. And if you really need something on a different partition (I have /usr/portage and /usr/lib/debug on other partitions) you can mount them or symlink them.

So, basically speaking, apart from the hassle to change the root partition size and to move /usr, what exactly is the problem?
_________________
I *do* know that I easily aggravate people due to my condensed writing. Rule of thumb: If I wrote anything that can be understood in two different ways, and one way offends you, then I meant the other! ;)
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 2289
Location: Canada

PostPosted: Tue Mar 20, 2012 4:19 pm    Post subject: Reply with quote

Hypnos wrote:

Counterargument: non-developers are rarely sufficiently intimate with the workings of a real-world software system to have good ideas, and without a working proof-of-concept ideas aren't worth much.

I would say the obvious exception is if the project is "user facing," like a GUI or theme, in which case the non-developer's experience may be germane.

Classic expert v. wisdom-of-crowds argument. I think in free software we can rely on the question to resolve itself organically.


Actually, your argument points into one issue which software industry/open source development started to face relatively recently and will have to adapt to: now existence of not just developers versus newbies/masses, but also of a user base with 10+, 15+, 20+ years of experience of using computers. They perhaps are not intimate with the innards
of software system, but they have seen technologies (next best things after sliced bread) come and go, have more experience in real-world software applications than many young developers, and have tools and habits accumulated over the years.
Back to top
View user's profile Send private message
aidanjt
Veteran
Veteran


Joined: 20 Feb 2005
Posts: 1102
Location: Rep. of Ireland

PostPosted: Tue Mar 20, 2012 4:21 pm    Post subject: Reply with quote

Yamakuzure wrote:
I would like to know why everybody is going nuts about this "move". We have several servers (about 20 internal and external), all running with debian and they never had neither /usr nor /var on a different partition but the root partition. Backups were never an issue, everything that has to be backed up is on other drives. My two machines at work are running with gentoo on it with a non-extra /usr partition, and everything (udev-181 included) is working well.

People keep saying they have /usr in LVM, but why? Once everything is set up, /usr isn't growing this much any more. And if you really need something on a different partition (I have /usr/portage and /usr/lib/debug on other partitions) you can mount them or symlink them.

So, basically speaking, apart from the hassle to change the root partition size and to move /usr, what exactly is the problem?

The problem is not everyone wants /usr in their / partition, for various reasons unique to them, there's lots of good reasons to keep /usr separate, but more important are the ones you can't think of, and no good reason to *require* that /usr be lumped in with /. The real question is, why are udev developers so bloody stupid as to think this is a good idea to *require* it? This is just more in a long line of faildesktop.org piss poor design decisions being wedged into and warping the Linux desktop.
_________________
juniper wrote:
you experience political reality dilation when travelling at american political speeds. it's in einstein's formulas. it's not their fault.
Back to top
View user's profile Send private message
Hypnos
Advocate
Advocate


Joined: 18 Jul 2002
Posts: 2867
Location: Omnipresent

PostPosted: Tue Mar 20, 2012 4:24 pm    Post subject: Reply with quote

Yamakuzure wrote:
So, basically speaking, apart from the hassle to change the root partition size and to move /usr, what exactly is the problem?

My main argument is that if /usr has to be on the root partition because the tools needed to boot the system are in /usr and cannot easily be moved to /, this means your core system is too bloated and will be prone to bugs.

My secondary argument is that there are common, valid use cases in which /usr is not on /, and it's annoying to have to make an initrd just to get a bootable system. These include /usr on RAID, SSD, network mounts for thin clients, etc.
_________________
Personal overlay | Simple backup scheme
Back to top
View user's profile Send private message
Hypnos
Advocate
Advocate


Joined: 18 Jul 2002
Posts: 2867
Location: Omnipresent

PostPosted: Tue Mar 20, 2012 4:31 pm    Post subject: Reply with quote

dmpogo wrote:
Actually, your argument points into one issue which software industry/open source development started to face relatively recently and will have to adapt to: now existence of not just developers versus newbies/masses, but also of a user base with 10+, 15+, 20+ years of experience of using computers. [...]

How do you see the "veteran user" changing the process of software design?

Speaking for myself, I still pine for OpenVMS and OPENSTEP, and think everything that has followed is garbage :P

I also have a curmudgeonly sig.
_________________
Personal overlay | Simple backup scheme
Back to top
View user's profile Send private message
baaann
Guru
Guru


Joined: 23 Jan 2006
Posts: 492
Location: uk

PostPosted: Tue Mar 20, 2012 4:53 pm    Post subject: Reply with quote

aidenjt wrote:
Frankly, it's hostile developers like you


Wow, that is seriously off target. ssuominen is one of the most supportive devs on the forums, including pre-emptive advice
Back to top
View user's profile Send private message
aidanjt
Veteran
Veteran


Joined: 20 Feb 2005
Posts: 1102
Location: Rep. of Ireland

PostPosted: Tue Mar 20, 2012 5:13 pm    Post subject: Reply with quote

baaann wrote:
Wow, that is seriously off target. ssuominen is one of the most supportive devs on the forums, including pre-emptive advice

That doesn't alter the attitude of the comments in this thread.
_________________
juniper wrote:
you experience political reality dilation when travelling at american political speeds. it's in einstein's formulas. it's not their fault.
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 2289
Location: Canada

PostPosted: Tue Mar 20, 2012 8:04 pm    Post subject: Reply with quote

Hypnos wrote:
dmpogo wrote:
Actually, your argument points into one issue which software industry/open source development started to face relatively recently and will have to adapt to: now existence of not just developers versus newbies/masses, but also of a user base with 10+, 15+, 20+ years of experience of using computers. [...]

How do you see the "veteran user" changing the process of software design?

Speaking for myself, I still pine for OpenVMS and OPENSTEP, and think everything that has followed is garbage :P

I also have a curmudgeonly sig.


I am saying that software design should (and will at some stage) take into account a 'veteran' user, and in time, there will be more and more 'veteran' users in the target audience.
It will become like with cars. Try to sell an experienced driver a car with radically changed user interface. The problem did not exist circa 1910, when all the drivers were novices, who will accept whenever thrown at them.
Back to top
View user's profile Send private message
sphakka
n00b
n00b


Joined: 24 Jun 2003
Posts: 64

PostPosted: Tue Mar 20, 2012 9:01 pm    Post subject: Reply with quote

aCOSwt wrote:
radio_flyer wrote:
I don't see any choice but to migrate to the initramfs

echo ">=sys-fs/udev-172" >> /etc/portage/package.mask :wink:
G.R.O.S.S(oftwares) ! :wink: :wink:


Me too!! That was the first thing I did after reading the news -- safety measures, you know. Another vote for masking ;-)
Jeez, 12 years living without an init image... golden age ending soon?

Anyway, since (blindly) disregarding official emerge news might be a bit... ugh, unwise, I'd like to know what might be the most programmatic way of maintaining an intiramfs -- has anybody tried dracut?

--
^s
Back to top
View user's profile Send private message
greyspoke
Tux's lil' helper
Tux's lil' helper


Joined: 08 Jan 2010
Posts: 98

PostPosted: Wed Mar 21, 2012 9:53 am    Post subject: Reply with quote

sphakka wrote:
aCOSwt wrote:
radio_flyer wrote:
I don't see any choice but to migrate to the initramfs

echo ">=sys-fs/udev-172" >> /etc/portage/package.mask :wink:
G.R.O.S.S(oftwares) ! :wink: :wink:


Me too!! That was the first thing I did after reading the news -- safety measures, you know. Another vote for masking ;-)
Jeez, 12 years living without an init image... golden age ending soon?

Anyway, since (blindly) disregarding official emerge news might be a bit... ugh, unwise, I'd like to know what might be the most programmatic way of maintaining an intiramfs -- has anybody tried dracut?

--
^s

My system seems to boot OK with my separate /usr and /var filesystems mounted by an init script what I wrote that runs in the sysinit runlevel before udev. I still have an initramfs because my / is on a software raid, but if it wasn't, I wouldn't need one. So if you are dead against having an initramfs, this would be a way to go. Simpler than creating an initramfs and an init as well.

I use a list of initramfs contents and the tools that come with the kernel sources to make my initramfs more or less like it says on the wiki here. Only the contents and the init are a bit different.
Back to top
View user's profile Send private message
sphakka
n00b
n00b


Joined: 24 Jun 2003
Posts: 64

PostPosted: Wed Mar 21, 2012 10:58 am    Post subject: Reply with quote

Quote:

My system seems to boot OK with my separate /usr and /var filesystems mounted by an init script what I wrote that runs in the sysinit runlevel before udev. I still have an initramfs because my / is on a software raid, but if it wasn't, I wouldn't need one. So if you are dead against having an initramfs, this would be a way to go. Simpler than creating an initramfs and an init as well.


It sounds a bit of a trickery ;-) but I'm curious: could you please post your script or point me to some URL?

Quote:

I use a list of initramfs contents and the tools that come with the kernel sources to make my initramfs more or less like it says on the wiki here. Only the contents and the init are a bit different.


I already checked it, thanks anyway. Technically speaking I'm OK with writing initramfs scripts -- did it already several times to boot from external USB drives. But I'd prefer a more pragmatic way, based on distribution tools like dracut; since my /urs is on LVM, this might do the magic:

https://rich0gentoo.wordpress.com/2012/01/21/a-quick-dracut-module/
Back to top
View user's profile Send private message
greyspoke
Tux's lil' helper
Tux's lil' helper


Joined: 08 Jan 2010
Posts: 98

PostPosted: Wed Mar 21, 2012 4:20 pm    Post subject: Reply with quote

sphakka wrote:
Quote:

My system seems to boot OK with my separate /usr and /var filesystems mounted by an init script what I wrote that runs in the sysinit runlevel before udev. I still have an initramfs because my / is on a software raid, but if it wasn't, I wouldn't need one. So if you are dead against having an initramfs, this would be a way to go. Simpler than creating an initramfs and an init as well.


It sounds a bit of a trickery ;-) but I'm curious: could you please post your script or point me to some URL?
...


No trickier than a DIY initramfs. Here's how it goes, I have added some comments. Don't assume I know what I am doing. I don't. Anyone who really understands gentoo initscripts and stuff, it would be interesting to hear from you.

Flag up what you want mounted early in /etc/fstab using a "comment" option - my fstab
Code:

...
# <fs>         <mountpoint>   <type>      <opts>      <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
/dev/md122      /boot      ext2      noauto,noatime       1 2
/dev/md123      /      ext3      noatime         0 1
/dev/sda6      none      swap      sw,pri=1      0 0
/dev/sdb6      none      swap      sw,pri=1      0 0
# early mounts see /etc/init.d/earlymounts - the comment= option doesn't result in a
# "invalid option" error as mount appears to recognise it
# set pass to 0 to avoid fsck trying to check it and throwing an error because it is already mounted
/dev/mapper/vg-usr   /usr      ext3      noatime,comment=early   1 0
/dev/mapper/vg-var   /var      ext3      noatime,comment=early   1 0
/dev/mapper/vg-vartmp   /var/tmp   ext2      noatime         1 2
/dev/mapper/vg-tmp   /tmp      ext2      noatime         1 2
/dev/mapper/vg-opt   /opt      ext3      noatime         1 2
/dev/mapper/vg-home   /home      xfs      noatime         1 2
...


/etc/conf.d/earlymounts
Code:
# earlymounts configuration file for early mounts init script

# set to true if raids need assembling, default is false
#mdadm=true

# set to true if logical volumes need activating, default is false, no
# lvm will be done if false
lvm2=true

# comma separated list of names of volume groups to activate, if not set
# then all volume groups will be activated if lvm2 is set to true
#vgs=vg

# comma separated list of lvm2 paths of volumes to activate
# if set and lvm2 is set to true the specified volumes will be activated
# as well as all volumes in any groups specified by vgs
lvs=vg/usr,vg/var


/etc/init.d/earlymounts
Code:
#!/sbin/runscript
# earlymounts - Gentoo Linux runscript to mount partitions early on in
# the init process.  Relies on the mounts being in /etc/fstab and will
# try to run fsck and then mount only those fstab entries that have the
# mount option comment=early set (no quotes around early)

# As this will happen early, will need all needed devices in a static /dev or to
# have already mounted devtmpfs on /dev via an initramfs or by setting
# CONFIG_DEVTMPfS_MOUNT in the kernel

depend() {
  before udev
}

doline () {
    ebegin "checking and mounting $1 on $2"
    fsck -C $1
    local err=$?
    if [[ $err == 4 ]]; then
        eerror "errors on $3 filesystem on $1 couldn't be correct, will not mount"
        return 1
    elif [[ $err -gt 4 ]]; then
        ewarn "fsck couldn't check $3 filesystem on $1"
    elif [[ $err -gt 0 ]]; then
        ewarn "errors found on $3 filelsystem on $1 and corrected"
    fi
    mount $1
    err=$?
    eend $err "couldn't mount filesystem $1 on $2"
    return $err
}

start () {
    ebegin "starting early mount service"
    # build the raid arrays
    if ${mdadm:=false}; then
        if [[ -f /etc/mdadm.conf ]]; then
            mdadm --assemble --scan
        else
            mdadm --assemble
        fi
    fi
   
    # now need to assemble the logical volumes
    if ${lvm2:=false}; then
        if ! [[ -z $vgs ]]; then
            IFS=","
            for vg in $vgs; do
                unset IFS
                vgchange -aly --sysinit $vg
                IFS=","
            done
            unset IFS
        fi
        if ! [[ -z $lvs ]]; then
            IFS=","
            for lv in $lvs; do
                unset IFS
                lvchange -aly --sysinit $lv
                IFS=","
            done
            unset IFS
        fi
        if [[ -z $vgs ]] && [[ -z $lvs ]]; then
            vgchange -aly --sysinit
        fi
    fi
   
# there is probably an easier way of doing this!
    mntlines=$(< /etc/fstab sed -n '/^[ \t]*[^#]/p' | sed -n '/^[ \t]*\([^ \t]\+[ \t]\+\)\{3\},*\([^ ,\t]\+,\+\)*comment=early[ ,\t]/p')
    # this only prints non comment lines, then looks for comment=early
    # bounded by comma or space in the fourth word of the line
    local err=0, retval=0
    IFS=$'\n'
    eindent
    for line in $mntlines; do
        unset IFS
        doline $line
        retval=$?
        err=$(($err + $retval))
        IFS=$'\n'
    done
    eoutdent
    eend $err "some filesystems not mounted or not checked"
# to see if it worked before it all scrolls by
#    read -p "press any key to continue"
    unset IFS
}

# no exit at the end of a runscript


Then just
Code:
rc-update add earlymounts sysinit

and Bob's your uncle, possibly.
Back to top
View user's profile Send private message
sphakka
n00b
n00b


Joined: 24 Jun 2003
Posts: 64

PostPosted: Wed Mar 21, 2012 7:09 pm    Post subject: Reply with quote

Thanks, greyspoke!

Quote:

No trickier than a DIY initramfs. Here's how it goes, I have added some comments. Don't assume I know what I am doing. I don't. Anyone who really understands gentoo initscripts and stuff, it would be interesting to hear from you.


That looks neat, indeed! I didn't think about sysinit, though have been wondering for a while if that was possible in a specific runlevel. I'm going to try it.

Quote:
and Bob's your uncle, possibly.


Of course ;-)
Back to top
View user's profile Send private message
ExecutorElassus
l33t
l33t


Joined: 11 Mar 2004
Posts: 758
Location: Stuttgart, Germany

PostPosted: Thu Mar 22, 2012 12:30 am    Post subject: Reply with quote

So, it seems there are already ebuilds that depend on >=sys-fs/udev-182 (on my system, todays sync results in sys-auth/consolekit-0.4.5-r3[acl] needing it. I suspect more will come.

So, does that earlymount script you posted work? Like, should I try it out, or is this something best left to people who know what they're doing?

I guess my problem is, I'm still not sure what exactly I should do before unmasking udev. greyspoke, you give some init scripts; are those sufficient, or do I have to follow the wiki to build that initramfs as well?

And as far as the freedesktop people causing problems with this, didn't they say they're just complying with what is already the standard practice (that is, that scripts calling on things across the /usr boundary have been loading earlier in the boot process for some time, and just fail gracefully), and got tired of all the errors about it?

I'm fine with a script or whatever pre-mounting /usr to run udev rules. But I have zero experience with building an initramfs, and build my kernel manually (so, no genkernel, and I've never heard of dracut). What I would really love - since it seems we can do this with a couple system tools and a script - would simply be a clear documentation for how to build an initramfs that does what's necessary to keep udev from puking. It seems like what they'd prefer to have happen is to stop splitting system tools across the /usr boundary anyway, and it seems like the tradeoff (if I understand it correctly, which I probably don't) is to pre-mount /usr.

So, greyspoke's scripts look like fun. Anybody mind spelling out for idiots (me) how to implement them?

Thanks,

EE
Back to top
View user's profile Send private message
greyspoke
Tux's lil' helper
Tux's lil' helper


Joined: 08 Jan 2010
Posts: 98

PostPosted: Thu Mar 22, 2012 9:02 am    Post subject: Reply with quote

Quote:
So, does that earlymount script you posted work? Like, should I try it out, or is this something best left to people who know what they're doing?

Well it works for me, but I don't have the knowledge to cater for all possible situations, so it may not in some cases. I don't think an initramfs is needed unless (like me) your / is on a raid or lvm. As far as I can see, there's nowt in it that is likely to break anything else on your system, all that will happen if it doesn't succeed in mounting what you tell it to is that you will see some errors and those partitions will be mounted in the usual way later on by localmount, but not checked (assuming you set pass to 0).

But there is a good argument to say you shouldn't go running scripts like this that some guy posted on the internet unless you are able to check for yourself what they do.

You will need to make sure the modules to deal with the filesystems you want mounted are compiled in the kernel (because this happens before modules are loaded), which will probably be the case, plus raid and logical volume support if needed.

If your /usr etc are on not on raids or logical volumes then you can comment out the mdadm and lvm lines in earlymounts.conf, in fact you can omit that file completely.

So what you need to do is copy earlymounts.conf and earlymounts into files with those names on your computer, edit as needed and copy to /etc/conf.d and /etc/init.d respectively. Edit your /etc/fstab to flag up the filesystems you want mounted early. Then add earlymounts to the sysinit runlevel, and see what happens when you reboot.
Back to top
View user's profile Send private message
FastTurtle
Guru
Guru


Joined: 03 Sep 2002
Posts: 409
Location: Shake & Bake

PostPosted: Thu Mar 22, 2012 3:43 pm    Post subject: Reply with quote

As I was one of the many that build tested w/o udev/hotplug and a number of other so called features, I don't understand what the problem is with deprecating udev and its flag. Seriously those of us that actually tested the lack didn't have many issues - most were related to automounting and we quickly discovered that there were fewer headaches by not allowing things to automout - things like perms failing to update, can't umount something automounted except as root - or partial mounting and having to su to root and fix the problems from that.

Even on my work machine, the IT dept doesn't allow windows to automount/autorun anything anymore and it's been that way for the last 7-8 years in the good shops. So why should linux be any different. People are already used to manually mounting things except maybe music cd's and where I work, after the Sony Root Kit debacle, they don't even allow us to do that for safety reasons and you know what, we don't miss it.

What I suggest be done is for the devs and everyone to begin testing to see if they really need udev/hotplug and the features it supposedly brings with it as I suspect you'll be suprised just how little benefit it offers now.

For the devs, they should be able to list all packages that depend on udev so we can begin looking at whether it's an explict dependency or a use-flag issue. Sure it's going to take some effort but isn't Q/A testing why catalyst and the autobuild systems are there? I know, who wants to babysit something like this where there's more exciting things going on but the benefits should outweight the effort if we can freeze and deprecate udev before completely removing it.

IMO udev simply adds another layer of complexity that doesn't offer any real benefit, thus it should be removed as quickly as possible for stability reasons. For those who think the system can't mount your raid/lvm setups, then you haven't configured your fstab correctly. That's exactly what it is for. It's the same for every filesystem on a Linux box. If fstab isn't setup right, things break and it's a PEBKAC (user error). Do it right folks. That means the simplest method possible, not as MS likes, the most complex, convuluted, misbegotten excersie in frustration we've all seen. In other words, if you're working for the computer, then you're doing it wrong as the computer is supposed to work for you. So why isn't it?

Those using disk encryption shouldn't have anymore problem setting up their fstab then those using raid. If they do then there's something wrong with the encryption method as it shouldn't add anymore complexity then the PW being needed during boot/mounting of the drive/partitions. Yes I'm a lazy person but it's a smart lazy as I prefer the system to work for me, not me for it. This means that once it's configured, I shouldn't have to do anything more to it unless it breaks or something fails. Until then I follow the "If it aint broke - don't fix it" principle and it works quite well for this lazy penguin.
Back to top
View user's profile Send private message
ExecutorElassus
l33t
l33t


Joined: 11 Mar 2004
Posts: 758
Location: Stuttgart, Germany

PostPosted: Thu Mar 22, 2012 5:42 pm    Post subject: Reply with quote

Turtle: I like your approach even better.

Okay, so what's the process to wean myself from udev? Again, I'm kinda stupid with this stuff, so I depend on documentation. On my system, I have a couple packages that seem to depend explicitly on udev:

chromium
udisks
devmanager
lvm2

and a couple others.

Cheers,

EE
Back to top
View user's profile Send private message
sphakka
n00b
n00b


Joined: 24 Jun 2003
Posts: 64

PostPosted: Thu Mar 22, 2012 5:56 pm    Post subject: Reply with quote

So I tried greyspoke's method. I had to make some adjustments which I'd like to discuss -- that might actually depend on the fact that I use OpenRC (~)0.9.9.3:

1) the regex to catch relevant lines in fstab is IMHO more robust and (possibly) POSIX-ish like this:
Code:

    mntlines=$(< /etc/fstab sed -nr '/^[[:blank:]#]+/!p' | sed -nr '/^[[:blank:]]*([^[:blank:]]+[[:blank:]]+){3}[^[:blank:]]+?,?comment=early,?[^[:blank:]]*[[:blank:]]+/p')

(I wonder if there's a way to ask the mount command about 'comment=...' options)

2) is fsck-ing really needed at this stage? Indeed, there's later on the normal fsck in boot runlevel. This also suggests that:

3) any early mount should be *read-only*, indeed
- there shouldn't be any reason to write anything at this stage;
- mounting RW will break RC later on, when boot runlevel's fsck aborts on RW-mounted file systems, thus leaving the system half-booted.

All in all, it works with just a minor, possibly harmless glitch: LVM (at boot runlevel) complains for any logical volume:
Code:

  The link /dev/.../... should had been created by udev but it was not found. Falling back to direct link creation.

...which is really weird as I have CONFIG_DEVTMPFS_MOUNT in my kernel config, and booting from a regular initramfs doesn't complain at all. Someone (http://bugs.gentoo.org/show_bug.cgi?id=334125#c9) suggests running 'udevadm trigger...' to solve this kind of issues, but in our scenario udev is not up yet -- chicken and egg problem! Hopefully udev would be fixed before I spend too much time or... better off, gone for ever ;-)

To ExecutorElassus. You may want to try dracut for managing initramfs: after minimal configuration it's as simple as calling, well... '# dracut'.

Cheers,

--^s
Back to top
View user's profile Send private message
comprookie2000
Developer
Developer


Joined: 25 Jul 2004
Posts: 901
Location: Pompano Beach, Florida

PostPosted: Thu Mar 22, 2012 6:45 pm    Post subject: Reply with quote

Its a work in progress;
https://bugs.gentoo.org/show_bug.cgi?id=407959
_________________
http://dev.gentoo.org/~dabbott/
Back to top
View user's profile Send private message
steveL
Advocate
Advocate


Joined: 13 Sep 2006
Posts: 2486
Location: The Peanut Gallery

PostPosted: Thu Mar 22, 2012 7:24 pm    Post subject: Reply with quote

You can do the extraction with one awk command:
Code:
awk '$0 !~ /^[[:blank:]]*(#|$)/ && index($4, "comment=early") {print $1, $2}' /etc/fstab

Also, the runscript uses BASH-specific stuff, but you're supposed to keep it POSIX-sh compatible.

So, for example, use:
Code:
[ -z "$var" ]
as opposed to:
Code:
[[ -z $var ]]

You must be very careful with quoting in shellscripts of all sorts; bash allows you to avoid it in [[ ]] usually, but it doesn't change that you should quote "$1" in: fsck -C $1 - it's ok here just by luck (the data is a space-separated field from fstab) but you shouldn't count on that kind of thing (what if you want to re-use a function you've written?)

You can't use == you must use = inside [ ]. = works inside [[ ]] as well, so bash-scripters tend to just use =.

To see what you can do with portable sh, check out:
http://pubs.opengroup.org/onlinepubs/009695399/utilities/contents.html (POSIX 2001)
and:
http://www.opengroup.org/onlinepubs/9699919799/utilities/contents.html (POSIX 2008)

Basically you should stick to the utilities listed there as well, in general-- even in BASH.

I heartily recommend #bash on chat.freenode.net for anyone who wants to know more-- they can help you with sh as well as bash.

edit: Oh, btw, there's another initscript-based method here which is a bit trickier in that it needs minor edits to init.d/udev and udev-mount, and means you have to switch udev's runlevel and set a flag in conf.d/udev.conf, but it doesn't have any issue with fsck. (It basically just makes udev start after localmount in boot runlevel.)
Back to top
View user's profile Send private message
greyspoke
Tux's lil' helper
Tux's lil' helper


Joined: 08 Jan 2010
Posts: 98

PostPosted: Thu Mar 22, 2012 10:01 pm    Post subject: Reply with quote

Thanks for the feedback sphakka and steveL. A difference between hacking for one's own use and writing stuff that works more generally, I wouldn't pretend to be a proper programmer but I will look into being POSIX compatible.

sphakka - if things are mounted ro initially, how do you get them unmounted, checked and remounted later? If I just change the script to mount ro, fsck complains and won't do a check, and after that the world and its wife whinge about not being able to write to various files. I have noticed messages about lvm (on shutdown) as well, I think they are just informational.

steveL - your method appears more relevant, thanks for pointing it out. As I see it, having udev start early and decide what services to run based on the hardware it finds is useful for achieving a "no configuration required" system. But if your basic system hardware doesn't change much and you don't mind configuring it manually, all you want udev for is hotplugging/ naming of peripheral things once the basic box has started up. So starting it late (rather than mounting things early) makes more sense.

Having said all this, if I was building my system now, I would bung everything on one partition and be done with it.
Back to top
View user's profile Send private message
sphakka
n00b
n00b


Joined: 24 Jun 2003
Posts: 64

PostPosted: Fri Mar 23, 2012 8:24 am    Post subject: Reply with quote

greyspoke wrote:
Thanks for the feedback sphakka and steveL. A difference between hacking for one's own use and writing stuff that works more generally, I wouldn't pretend to be a proper programmer but I will look into being POSIX compatible.


You're welcome!

Quote:

sphakka - if things are mounted ro initially, how do you get them unmounted, checked and remounted later? If


AFAIK, the 'localmount' service in runlevel boot takes care of that. Bear in mind, that whatever was mounted RO can usually be remounted RW (the contrary is trickier) by means of calling 'mount -o rw /mount/point'. The point is that the system shouldn't be really trying to write anything at that early stage (maybe OK in /var?) -- udev needs bits in /usr just to carry on clean...

Quote:

I just change the script to mount ro, fsck complains and won't do a check, and after that the world and its wife whinge about not being able to write to various files. I have noticed messages about lvm (on shutdown) as well, I think they are just informational.


That's weird -- it should be the other way around. What's exactly the error reported by fsck? Are you using OpenRC, and which version?

BTW, greyspoke, since this is getting technical, I suggest to open a dedicated thread for this early mount discussion. I like this method, and am willing to contribute.

p.s. I had already taken a look the udev patching method reported by SteveL and got so much scared that... I ended up here ;-)
Back to top
View user's profile Send private message
steveL
Advocate
Advocate


Joined: 13 Sep 2006
Posts: 2486
Location: The Peanut Gallery

PostPosted: Sat Mar 24, 2012 6:52 pm    Post subject: Reply with quote

greyspoke wrote:
Thanks for the feedback sphakka and steveL. A difference between hacking for one's own use and writing stuff that works more generally, I wouldn't pretend to be a proper programmer but I will look into being POSIX compatible.

You're very welcome :)
Quote:
steveL - your method appears more relevant, thanks for pointing it out. As I see it, having udev start early and decide what services to run based on the hardware it finds is useful for achieving a "no configuration required" system. But if your basic system hardware doesn't change much and you don't mind configuring it manually, all you want udev for is hotplugging/ naming of peripheral things once the basic box has started up. So starting it late (rather than mounting things early) makes more sense.

It still starts fairly early; in fact it used to start in the same boot runlevel before. Having said that, it does make sense to do it your way: after all, what's needed is to get partitions mounted before udev starts, so that's what you're doing (and still keeping it before all the stuff it was before.) Additionally, it's cleaner in that it doesn't require changing any other services, just adding your one to sysinit.

When I did my one, I was just concerned to get localmount and all its dependencies up and running before udev started; theoretically udev scripts can install anywhere which I think is the reason for the requirement for an initramfs which can get all that done before anything else happens. There are an awful lot of initscripts in boot nowadays, though.
Quote:
Having said all this, if I was building my system now, I would bung everything on one partition and be done with it.

Yuck :) At bare minimum, you have to have a separate /home. Personally, I like to be able to move stuff around over time, and to leave space for other OS. lvm fits perfectly for that (and I feel better knowing that I can give any partition more space if it should need it: it's happened to me on too many other machines.)
sphakka wrote:
p.s. I had already taken a look the udev patching method reported by SteveL and got so much scared that... I ended up here ;-).

Lol; I totally understand. (I feel I have to point out it's only a minor patch to two initscripts, but I do understand the worry.) I might well switch to using greyspoke's script myself; I'll play with it when I get some time.
Back to top
View user's profile Send private message
greyspoke
Tux's lil' helper
Tux's lil' helper


Joined: 08 Jan 2010
Posts: 98

PostPosted: Mon Mar 26, 2012 9:01 am    Post subject: Reply with quote

I will start a thread in "kernel and hardware" when I get the chance then.
Back to top
View user's profile Send private message
aCOSwt
Moderator
Moderator


Joined: 19 Oct 2007
Posts: 2537
Location: Hilbert space

PostPosted: Fri Mar 30, 2012 11:05 am    Post subject: Reply with quote

Initramfs-less, is this all-in-one filesystem charming tendency ? fashion ? whim ? policy ? (pardon-me, english is not my native language)...
likely to concern /tmp ; /var/tmp ; /var/log too in a more or less near future ?
_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo Chat All times are GMT
Goto page Previous  1, 2, 3, 4, 5  Next
Page 3 of 5

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum