- Debugger: Getting mixed signals
- 'Packaging Infrastructure' Contract Weekly Report #4
- Haiku monthly activity report - 06/2015
- 'Packaging Infrastructure' Contract Weekly Report #3
- 'Packaging Infrastructure' Contract Weekly Report #2
- GCI 2014 winners trip report (mentor side)
- TeX Live and LyX; Changes to the boot code
- 'Packaging Infrastructure' Contract Weekly Report #1
- Beginning of 'Packaging Infrastructure' Contract
- Haiku monthly activity report - 05/2015
Package Management: System in a Package
After a week of working on the package management support as per my contract with Haiku, Inc., I have reached my first milestone: The base system is packaged... and it boots again. Here's a short account of what I have been doing exactly and what I'm up to next.
First of all, anyone watching Haiku's main source repository for anything I have done so far or will do in the next weeks will be disappointed. In anticipation of our switch from subversion to git as our source control management system and to ease joint work on the package management feature, Oliver has migrated the package management branch to git and made it available on GitHub. I'm currently working in my pm-flat branch ("flat" due to the fact that Oliver squashed all subversion changesets into a single git changeset to simplify the migration).
As the first step I started to get the package building tool, "package", working on the build platform (so far only tested on Linux). I originally wrote it as Haiku program and later Oliver refactored and extended the code into a proper Haiku package kit. After getting the package kit and the "package" program building and actually working on the build platform, I butchered the build system to produce a Haiku package (HPKG) file, "haiku.hpkg", and put it into "/boot/system/packages" in the Haiku image.
This package -- weighing about 52 MiB -- contains the whole core system, including the Haiku kernel, boot loader, runtime loader, the libraries, servers, add-ons, drivers, lots of CLI programs, applications (Tracker, Deskbar, ShowImage,...). That's most of the previous contents of the "/boot/system" directory. For the remaining "/boot/system" software separate packages are built. E.g. one for the "Welcome" and one for the User Guide documentation. Furthermore there's a basic development package, containing the header files, a few static libraries, the glue code, and a bit of adminstrative infrastructure for development (symlinks, scripts). That leaves the ICU libraries and the BeBook, which are downloadable packages that I simply repackaged from the pre-existing zip files.
When looking into the image file the "system" folder is extremely spartan now. It only contains "haiku_loader" (the boot loader) and a "packages" subdirectory with the six packages I mentioned. "haiku_loader" itself is also in the "haiku.hpkg" package, but since it would prove very tough to implement package file support in the stage one boot loader (those eight hundred something bytes in the first two blocks of the partition that load the stage two (i.e. main) boot loader), we keep the unpacked version for the time being.
Since the core system is now packaged, the boot sequence needs to work somewhat differently. The stage one boot loader is unchanged (yet). It still loads the stage two boot loader, "haiku_loader", and hands over control to it. The stage two boot loader, however, has to understand package files, now. It looks for the "haiku.hpkg" package and extracts anything that's needed to get the system up and running -- the kernel and a bunch of fundamental kernel modules and drivers. The kernel required only one change: After mounting the boot volume, it does now mount the packagefs in "/boot/system". Packagefs virtually extracts all packages it finds in the "packages" subdirectory and lays their unified contents over "/boot/system". Thereafter "/boot/system" looks as we knew it and the boot process continues as usual.
Well, there are a few differences. First of all "/boot/system" is now read-only. Conceptually it should have been read-only before as well, but it wasn't really. E.g. the MIME update task that runs on the first boot is no longer able to assign the correct MIME types to the documentation files. I.e. we will have to do that already in the build system when building the packages. ATM packagefs doesn't support queries. Besides "/boot/system" being a blind spot for Tracker "Find" now, there are also other consequences, like the Deskbar replicants no longer showing up. Obviously that needs to be rectified eventually, though it might not present an immediate obstacle for continuing work on the package management infrastructure.
The next two features I will be working on are, however, vital for that infrastructure. Both are extensions of the packagefs itself. The first is support for "shine-through" directories. ATM when packagefs is mounted at "/boot/system" the "packages" subdirectory will be hidden by the package contents tree that is laid over the "/boot/system" directory on the disk. Hence one cannot add anymore packages there. While that might be less of a problem for "/boot/system" it is major one for "/boot/common" and "/boot/home/config" which will soon work exactly the same way. There are subdirectories -- not only "packages" but also "settings" and others -- that have to be writable and whose contents have to live on the disk. The plan is to let those directories "shine through" from the normally hidden directory on the disk. That's something that might best be implemented with the help of the kernel's VFS subsystem. I'll have to investigate that.
The other feature to be implemented soon are automatically created (virtual) symbolic links for all active (aka installed) packages and their dependencies. This aims at solving two problems both caused by the fact that we have three different installation locations for packages (system, common, and home). The first problem is that some software requires absolute paths to other software (e.g. to an executable). Since at build time it is not known where the other software will be installed, packagefs will provide a fixed location that doesn't depend on where the package is installed. That fixed location will probably be in "/boot/system/package-links" and, for shorter paths, with a symlink "/package-links pointing" to it.
Say for example the "autoconf-2.68-1" package, which desires an absolute path to the "m4" program, is installed in "/boot/common", packagefs will provide a (virtual) directory "/package-links/autoconf-2.68-1". That directory will contain a symlink "cmd:m4" which points to the installation base directory of another package that provides the "m4" command, e.g. the "m4-1.4.16-1" package also installed in "/boot/common". The absolute "m4" path that can be built into "autoconf" is therefore "/package-links/autoconf-2.68-1/cmd:m4/bin/m4". If instead of the m4 package in "/boot/common" a different one is installed in "/boot/home/config", packagefs will simply let the "/package-links/autoconf-2.68-1/cmd:m4" symlink point there and the same absolute path still refers to a valid "m4" program.
That second issue the package links will solve is somewhat related. If several different versions of a package, e.g. for m4, are installed, and another package needs a particular (or minimum) version, the package link will point to the installation location of the matching one. This use case is not quite as urgent as the other one -- it can be put off until the whole package building infrastructure is set. This first one is more pressing though, since it must already work when we build packages.
I've added a more complete list of things that still have to be done in package management land to the Wiki. I also plan to add a bit more package management related documentation.- bonefish's blog
- Login or register to post comments

Comments
Re: Package Management: System in a Package
Thanks for the update and keep at it.
Re: Package Management: System in a Package
Great! Thanks for the update!
Is that correct that putting /boot/system contents into the package will eventually allow updating the whole system via package manager?
Re: Package Management: System in a Package
Re: Package Management: System in a Package
I'm amazed by the 52 Mb footprint of the core module. This feels exactly like an OS I would like to use!
Re: Package Management: System in a Package
Putting core system in package it's great idea!! But what about boot time? It's not affected?
Re: Package Management: System in a Package
Re: Package Management: System in a Package
Yes, that's a good point. And what happens when you update the core systems package? is that going to need reboots or is it going to be transparent like ksplice?
Re: Package Management: System in a Package
Re: Package Management: System in a Package
Probably a silly question, but is the core system package just a temporary measure? Will Tracker, bash, the kernel etc. all eventually be individually packaged?
Re: Package Management: System in a Package
Re: Package Management: System in a Package
Amazing stuff!
Re: Package Management: System in a Package
Oh dear, can't wait to use this.
Re: Package Management: System in a Package
Nice progress, so system updates are going to be super simple, is there any performance penalty for compressing the system folders ?
Re: Package Management: System in a Package
I honestly have to say, that after reading this post, I'm scared shitless for the future of Haiku.
The 10th paragraph down left me pretty speechless.
I'm not sure if this is the result of Haiku starting to travel down its own paths and doing its own thing- since the whole "Be like BeOS" thing is done and over with. But I can tell you one thing- what I've just read here is not the answer to this "problem" that everyone seems to have invented.
A standardized package file format is a good thing to have. Like any OS, they've all got their various package installers and managers. For Windows it's Installshield or MSI. For Mac, it's *.pkg as handled by Installer.app. For Linux, well, there's yum, apt, emerge, etc. Depends on the distro.
The difference here is that these operating systems install files *where they need to go*, and nowhere else. Then they keep track of those files (with the exception of OS X, which sort of skimped on that part) in case you ever want to remove the program.
This... "Package Management"... Or whatever the hell it is for Haiku, is a complete mess. I almost stopped reading at the symlinks part, because that alone is a huge kludgy hack. And frankly, if nobody else is stepping up and saying "This is crap, we don't need this"- then the OS is truly doomed to depths of unfathomable complexity and eventual death. No other operating system on the planet has delved down to what I just read. And it's sad to see things going this way.
I know you guys are trying and all of that stuff, but jeeze. Give the OS a proper package installer. Give it a way to track what is installed and remove stuff. But for the love of god, don't resort to spamming symlinks everywhere just to keep things happy. You're opening a huge can of worms here that will set Haiku apart from everything else- and not in a good way.
-SC
Re: Package Management: System in a Package
for the love of god, don't resort to spamming symlinks everywhere
I think you misread it. These symlinks won't be "spammed everywhere" but in a fixed location. Well contained.
Ingo mentions these links solving two problems
* some software requires absolute paths to other software
* having different versions of the same software needs to be supported
Haiku will go multiuser eventually, which is why there is now a 3-way split between system, common and user. Software will be possible to install per-user or shared (under /boot/common). The same package should work in both common and user locations. Links help accomplish that, if I understand things right.
Re: Package Management: System in a Package
for the love of god, don't resort to spamming symlinks everywhere
I think you misread it. These symlinks won't be "spammed everywhere" but in a fixed location. Well contained.
Ingo mentions these links solving two problems
* some software requires absolute paths to other software
* having different versions of the same software needs to be supported
-
-
- Haiku will go multiuser eventually
, which is why there is now a 3-way split between system, common and user. Software will be possible to install per-user or shared (under /boot/common). The same package should work in both common and user locations. Links help accomplish that, if I understand things right.NNNNOOOOOOOOOOOOOOO
Re: Package Management: System in a Package
? Lack of multi-user support is probably Haiku's most prominent flaw and a significant barrier to widespread adoption.
Re: Package Management: System in a Package
? Lack of multi-user support is probably Haiku's most prominent flaw and a significant barrier to widespread adoption.
the question must be posed, what does it actually get you, also consider like 95% of windows PC's have multiuser capability that never gets used.
Re: Package Management: System in a Package
the question must be posed, what does it actually get you, also consider like 95% of windows PC's have multiuser capability that never gets used.
For Haiku to even have a shot in hell to be considered as a enterprise desktop solution (something I'm hoping it will some day) it will need multiuser and corresponding file ownership/permissions. Also, while there are other solutions (sudo/uac style) it also helps with the current problem of everyone using Haiku running as the equivalent of root/administrator. That's a recipe for disaster should Haiku gain popularity outside of geek circles.
XP users running as administrator have always been the wet dream of botnet harvesters. Any program you can exploit for system entrance gives you full access to the entire OS since it's running under an administrative account, no need for priviledge escalation hacks. Same holds true for Haiku atm, although it's currently not a target for malware/exploits by any stretch of the imagination given it's small userbase.
While home users would generally be fine with a default limited priviledge user and a sudo/uac solution, Haiku needs multi-user with adjustable priviledges and file ownership if it is ever to find desktop use beyond the home. Which again is something I hope it will, since I think it's one of the few places were Haiku could get commercial backing.
Re: Package Management: System in a Package
? Lack of multi-user support is probably Haiku's most prominent flaw and a significant barrier to widespread adoption.
The fact that very few (I've seen none) complain about the lack of multi-user and/or login support in alpha3 tells against your statement. I think that they are important, but not as important as many other features that needs to be implemented, like WPA encryption.
Re: Package Management: System in a Package
+1
NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO!
Re: Package Management: System in a Package
Oh, please... it's not like you'll even notice it exists if you only set a single user. Also, if/when user passwords are implemented, a login window will be needed anyway.
Aside from that, like it or not, but multiuser (and user passwords) are needed if you don't want any Average Joe that comes and powers up your computer to sift through your personal files.
Yes, it's not necessary as of now, but it's needed to have a full desktop OS. 95% of users don't use it? Fine, the remaining 5% will still complain about the lack of it if it's not implemented. Heck, I think that 95% of users also don't need Cortex, but it's in there anyway. Remember that it's not those (Windows) users who make decisions about Haiku, it's its developers. Why? Because they work on it. When a developer will want to implement multi-user support, he'll do that.
Re: Package Management: System in a Package
Oh, please... it's not like you'll even notice it exists if you only set a single user. Also, if/when user passwords are implemented, a login window will be needed anyway.
Aside from that, like it or not, but multiuser (and user passwords) are needed if you don't want any Average Joe that comes and powers up your computer to sift through your personal files.
Yes, it's not necessary as of now, but it's needed to have a full desktop OS. 95% of users don't use it? Fine, the remaining 5% will still complain about the lack of it if it's not implemented. Heck, I think that 95% of users also don't need Cortex, but it's in there anyway. Remember that it's not those (Windows) users who make decisions about Haiku, it's its developers. Why? Because they work on it. When a developer will want to implement multi-user support, he'll do that.
do you need multiuser to password secure your computer ? A built in function like TrueCrypt would be a personal prefrence for me. Secured in totality. Go ahead steal the computer, ain't gonna do any good.
Re: Package Management: System in a Package
You need it to set a guest account, in case the Average Joe is your friend and asks you to check something out (on the internet). I agree that a user password is more important than multiuser, though.
Re: Package Management: System in a Package
You need it to set a guest account, in case the Average Joe is your friend and asks you to check something out (on the internet). I agree that a user password is more important than multiuser, though.
thats why I own multiple computer. I have my machine which is a rip snorting overclocked behemouth of a monster, and then the computer everyone else in the house uses. If joe downloads something that currupts the drive, its not helping me in the least. I think a multiuser BROWSER makes more sense in reality and adress more security concerns in reality. sandbox the browser away from the OS and make that enviroment multiuser, should be considerably easier to IMHO. .
Re: Package Management: System in a Package
In order to provide a significant level of security, you will need a multiuser environment. OS X, Windows NT6 and even Linux can be used in a simple single-user-esque way, only asking for a root password when installing software. iOS also contains a similar method when installing apps. I can't hear the millions of iOS users complaining, can you? Sure, it can be an annoyance sometimes, but it's there for a reason.
The reason Jailbreakme.com works with iOS is that the MobileSafari browser runs as root. It is actually one of the few apps that does in the iOS universe. By exploiting bugs in the browser, you can run a payload on the device easily, installing whatever software you want. Be it code for an untethered jailbreak or a botnet.
If you don't believe in the strengths of multiuser, go use Windows 98 for a bit ;)
Re: Package Management: System in a Package
In order to provide a significant level of security, you will need a multiuser environment. OS X, Windows NT6 and even Linux can be used in a simple single-user-esque way, only asking for a root password when installing software. iOS also contains a similar method when installing apps. I can't hear the millions of iOS users complaining, can you? Sure, it can be an annoyance sometimes, but it's there for a reason.
The reason Jailbreakme.com works with iOS is that the MobileSafari browser runs as root. It is actually one of the few apps that does in the iOS universe. By exploiting bugs in the browser, you can run a payload on the device easily, installing whatever software you want. Be it code for an untethered jailbreak or a botnet.
If you don't believe in the strengths of multiuser, go use Windows 98 for a bit ;)
I have seen multi user win7 winxp win2000 and even a few linux machines get rooted and malwared. Multi user provies the feeling of protection, but its doesn't really offer any. Its more a nuasance for a malware creator then anything else. the network port to the WWW is the hole, adding geust account does nothing for security and a few high level linux hackers have demonstrated this flawed philosphy.
Multy user for a host/client or shared computer is a great concept, but from a security standpoint, its all hot air.
Re: Package Management: System in a Package
I have seen multi user win7 winxp win2000 and even a few linux machines get rooted and malwared. Multi user provies the feeling of protection, but its doesn't really offer any.
Of course it does, it helps make it HARDER to 'root' a machine. You are basically saying that 'since there are instances where criminals has been able to open a bank valves the banks might aswell leave the door open', not to mention the fact that previous exploits get patched/removed leading to increasingly more secure systems.
Every measure made to make it harder for someone to take over a machine either from the inside (user unknowingly launches a program containing a trojan) or outside (black hat exploits user-launched program which is vulnerable from outside attack). If the user is 'root', both these cases mean that the attacker have FULL control of the system, in case of a limited priviledge account the attacker only have the system priviledges available to the current user. The latter is much easier to contain.
Its more a nuasance for a malware creator then anything else. the network port to the WWW is the hole, adding geust account does nothing for security and a few high level linux hackers have demonstrated this flawed philosphy
No, the port has nothing to do with it, it's the programs which are LISTENING on it, in this case the browsers who are cause for exploits. If no programs opens a port for listening then obviously the machine cannot be attacked that way (Windows learnt this the hard way since it used to default to launching tons of services which listened to the internet and were also easily exploited leading to Windows often being compromised within 60 seconds of going online). Again, if you launch your browser as root, any exploit in that browser will give the attacker FULL system control (just like root has). However if you launch that browser as a limited user, any exploit will have LIMITED system control, there's a HUGE difference here from a security standpoint.
Beyond that, multiuser is needed in the enterprise not mainly because of fear of malware/exploits, but because you can't have everyone having full read/write access to all files on the company systems. That's just not acceptable/practical from an administrative standpoint. So again, if Haiku is ever to gain traction outside the home desktop, it will need user groups and file ownership/permissions.
Re: Package Management: System in a Package
The reason Jailbreakme.com works with iOS is that the MobileSafari browser runs as root. It is actually one of the few apps that does in the iOS universe.
I.. the.. what?
MobileSafari runs as 'mobile', the same user under which all other user-facing iOS apps run.
It used to run as root in version 1.0 and maybe 1.1 (so, about four years ago; ca. 2007), but 2.x, with the advent of the app store, killed that. Everything is properly separated by both sandboxing and standard UNIX user permissions. We're just about to see the release of iOS 5.0, for comparison's sake.
The reason jailbreakme.com works with iOS is that one of the IOKit services (IOMobileFrameBuffer, if you must know) in the kernel had an exploitable vulnerability that led to privilege escalation. Even before that, however, we needed to exploit a font rendering overflow to even get code execution to exploit the kernel vulnerability.
Re: Package Management: System in a Package
Why not to hold all versions for all users. Haven't enough space?
Same for packages why not to hold all packages or application bundles self-contained with all dependencies for user packages?
And maintain system-level dependencies like Python and Git through the port system?
--
Maxim
synrc.com