Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

How to replace libsystemd-login0's .so library.

Share your HowTo, Documentation, Tips and Tricks. Not for support questions!.
Post Reply
Message
Author
User avatar
edbarx
Posts: 5401
Joined: 2007-07-18 06:19
Location: 35° 50 N, 14 º 35 E
Been thanked: 2 times

How to replace libsystemd-login0's .so library.

#1 Post by edbarx »

Since it is becoming more evident that dealing with packaging, apt and dpkg is an art by itself, I think, the best thing I can do, is to post a howto explaining how my version of libsystemd-login0.so can be installed by bypassing the package management system. Keep in mind however, that upgrades to libsystemd-login0 will break what we will do restoring the system to the state it is supposed to be. I tested my patch on Debian Stable and found that it works.



Let us begin. :)

Copy 'my' c++ code and save it to a text file, say liblogin0.cpp. The code is pasted here:

Once that you have the c++ file, open a terminal and issue the commands:

Code: Select all

g++ -c -fPIC login0.cpp -o library.o
This creates an object file which contains the compiled functions but not in the format of an exporting library.

To create the library, issue this command:

Code: Select all

g++ -shared -o liblogin.so library.o
If you belong to the curious type, and want to have a glimpse at what functions we are exporting, issue this command:

Code: Select all

nm -C liblogin.so | grep " T "
Now, as root copy the freshly compiled library to the directory: /lib/x86_64-linux-gnu

Code: Select all

cp -n liblogin.so /lib/x86_64-linux-gnu
If you have a different architecture, you will need to search where libsystemd-login0.so is in your directory tree.

Change directory to x86_64-linux-gnu:

Code: Select all

cd /lib/x86_64-linux-gnu
Search for:

Code: Select all

lrwxrwxrwx 1 root root      25 Oct  9  2013 libsystemd-login.so.0 -> libsystemd-login.so.0.2.1
-rw-r--r-- 1 root root   43496 Oct  9  2013 libsystemd-login.so.0.2.1
Rename these two files so that the system does not find them. You can delete them but be warned that you will be deleting two system files. Reinstalling libsystemd-login0 restores them.

The renaming:

Code: Select all

mv libsystemd-login.so.0 disable_libsystemd-login0.so.0
mv libsystemd-login.so.0.2.1 disable_libsystemd-login0.so.0.2.1
The actual installation of the library besides copying it.

Code: Select all

ln --symbolic liblogin.so libsystemd-login.so.0
ln --symbolic liblogin.so libsystemd-login0.so.0.2.1
List the files for a final scrutiny. You should have two symbolic links pointing to liblogin.so and the names of the links must be the original names of the two renamed files, otherwise the the system wouldn't be able to find them.

Hopefully, this helps those who want to try the library although it is not much.

Thanks.
Debian == { > 30, 000 packages }; Debian != systemd
The worst infection of all, is a false sense of security!
It is hard to get away from CLI tools.

dzz
Posts: 257
Joined: 2007-02-05 20:39
Location: Devon, England

Re: How to replace libsystemd-login0's .so library.

#2 Post by dzz »

Code: Select all

:~$ lsof | grep liblogin.so
dbus-daem 3989                dzz  mem       REG        8,6     9054   131163 /lib/i386-linux-gnu/liblogin.so
Thanks edbark .. works here on wheezy.

User avatar
edbarx
Posts: 5401
Joined: 2007-07-18 06:19
Location: 35° 50 N, 14 º 35 E
Been thanked: 2 times

Re: How to replace libsystemd-login0's .so library.

#3 Post by edbarx »

liblogin.so's file ownership must be root:root like all the other shared libraries.
Debian == { > 30, 000 packages }; Debian != systemd
The worst infection of all, is a false sense of security!
It is hard to get away from CLI tools.

User avatar
stevepusser
Posts: 12930
Joined: 2009-10-06 05:53
Has thanked: 41 times
Been thanked: 71 times

Re: How to replace libsystemd-login0's .so library.

#4 Post by stevepusser »

It should be possible to change the code in the original Debian source code to your version, and then add an epoch to the front of the version to make sure it doesn't get upgraded--i.e. version 1.2 becomes 1:1.2.

You can just make the changes to the source code and build the changed source with "debuild binary". If you want to do it the Debian way, which is keeping the source unchanged and your changes turned into a patch in /debian/patches, it's easy with the new quilt source format:

make your changes
run "dpkg-source --commit"
you'll then be able to name your patch and edit the headers as you wish in nano. Hit <Ctl> <X> to finish up editing in nano. You really don't need to edit the headers for the patch to work, it's just that Debian packagers will need to per policy.
MX Linux packager and developer

dzz
Posts: 257
Joined: 2007-02-05 20:39
Location: Devon, England

Re: How to replace libsystemd-login0's .so library.

#5 Post by dzz »

liblogin.so's file ownership must be root:root like all the other shared libraries.
Thanks edbarx for that reminder (hope I got this right)..

liblogin.so was actually -rwxr-xr-x (still root owned but that did not look like the other shared libraries) It is now:

Code: Select all

# ls -la /lib/i386-linux-gnu|grep login
lrwxrwxrwx  1 root root      25 Oct  9  2013 disable_libsystemd-login0.so.0 -> libsystemd-login.so.0.2.1
-rw-r--r--  1 root root   42580 Oct  9  2013 disable_libsystemd-login0.so.0.2.1
-rw-r--r--  1 root root    9054 Oct  1 13:44 liblogin.so
lrwxrwxrwx  1 root root      11 Oct  1 13:46 libsystemd-login0.so.0.2.1 -> liblogin.so
lrwxrwxrwx  1 root root      11 Oct  1 13:46 libsystemd-login.so.0 -> liblogin.so

timbgo
Posts: 265
Joined: 2013-04-14 12:17

Re: How to replace libsystemd-login0's .so library.

#6 Post by timbgo »

Everybody spread the word.
I did it in System Configuration:

How can systemd be uninstalled?
http://forums.debian.net/viewtopic.php? ... 50#p555150

If I understand correctly (read somewhere, but I too, as others said they were, am having hard times keeping up with all the systemd threads and topics, esp. because I have other urgent things to do now)...

If I understand correctly systemd is Poettering's euphemism for consolekit.

Namely, as I stated openly in Gentoo Forums in the topic on...

Wait, I just wrote it openly there, pls. accept reading from there, I type fast, but still not so fast...

Uninstalling dbus and *kits (to Unfacilitate Remote Seats)
http://forums.gentoo.org/viewtopic-t-99 ... ml#7626248

And, as I said there, if I stated something inaccurate, feel free to correct me. Time scarce here, resources of intellect and stamina of limited availability.

Miroslav Rovis
Zagreb, Croatia
www.CroatiaFidelis.hr
Miroslav Rovis
Zagreb, Croatia
http://www.CroatiaFidelis.hr
Anyone can dismiss these: kernel hooks for rootkits
linux capabilities for intrusion?

User avatar
edbarx
Posts: 5401
Joined: 2007-07-18 06:19
Location: 35° 50 N, 14 º 35 E
Been thanked: 2 times

Re: How to replace libsystemd-login0's .so library.

#7 Post by edbarx »

Thanks stevepusser for giving me that hint about using epochs, it worked. I also managed to package the library using dpkg -b. Anyone interested in using the .deb file to install my libarry version can send a private message to me. However, I think it is best to place the .deb file where it can be downloaded easily.
Debian == { > 30, 000 packages }; Debian != systemd
The worst infection of all, is a false sense of security!
It is hard to get away from CLI tools.

timbgo
Posts: 265
Joined: 2013-04-14 12:17

Re: How to replace libsystemd-login0's .so library.

#8 Post by timbgo »

edbarx wrote:Thanks stevepusser for giving me that hint about using epochs, it worked. I also managed to package the library using dpkg -b. Anyone interested in using the .deb file to install my libarry version can send a private message to me. However, I think it is best to place the .deb file where it can be downloaded easily.
========================================================================
edbarx, pls. do post it public somewhere. It's always the best way, it really is. My Grsecurity packages were first used by less then a dozen people in a month, now much, much more...
========================================================================

Dear Maltese [1] , I have only dropped by to see how things are faring, and I don't understand enough without dedicating it a lot of time, and I have huge issues to deal with in Gentoo currently, so time is not available yet.

But I really can only offer wishes (prayers in religeous terminology, which I haven't stopped and I won't stop till your health recovers), wishes in the first place for your health, but also for this project.

And not just because I will then be among the benficiaries of your work, but because of the common interest which I do place above my own, and Debian will prosper again if more Debianers do so.

If any other good developers are reading this, pls. join edbarx in this work! (And sorry I can't even test till I solve issues I have in Gentoo and with Grsecurity.)

Miro
[1] for the reading public, I mean edbarx, my fellow European, who is from Malta
Miroslav Rovis
Zagreb, Croatia
http://www.CroatiaFidelis.hr
Anyone can dismiss these: kernel hooks for rootkits
linux capabilities for intrusion?

timbgo
Posts: 265
Joined: 2013-04-14 12:17

Re: How to replace libsystemd-login0's .so library.

#9 Post by timbgo »

Solution may be on the horizon from Thorsten mirabilos Glaser's repo.
I have started testing his solutions with my sid installed system. See here:
How to Remove Systemd and Related Packages from Your Debian
http://forums.debian.net/viewtopic.php?f=16&t=118197
What do you think edbarx of those solutions? I'd be so happy to see you contribute there, if you see those are viable solutions. And, yes, I may need you to check on my attempts there...
Miroslav Rovis
Zagreb, Croatia
http://www.CroatiaFidelis.hr
Anyone can dismiss these: kernel hooks for rootkits
linux capabilities for intrusion?

Post Reply