Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debian/*.postinst: add adduser as a dependency and specify --home when adduser #55218

Merged
merged 6 commits into from Feb 20, 2024

Conversation

tchaikov
Copy link
Contributor

@tchaikov tchaikov commented Jan 17, 2024

in this changeset, we

  • add adduser as the runtime dependency of ceph-common and cephadm
  • pass --home to adduser in the postinst script to accommodate the recent change in this tool

Fixes: https://tracker.ceph.com/issues/64069

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows
  • jenkins test rook e2e

@mcv21
Copy link
Contributor

mcv21 commented Jan 17, 2024

I'm slightly confused by the whitespace changes, but the substantive changes here look right to me. Thanks for getting to this more quickly than I did! :)

@tchaikov
Copy link
Contributor Author

tchaikov commented Jan 18, 2024

I'm slightly confused by the whitespace changes, but the substantive changes here look right to me. Thanks for getting to this more quickly than I did! :)

@mcv21 hi Matthew, thank you for your review. regarding the "the white space changes", please check its commit message. my editor does not use 8 spaces when rendering tab by default, hence i noticed this inconsistency. and since i was editing that file, i fixed it as well.

@tchaikov
Copy link
Contributor Author

tchaikov commented Jan 18, 2024

  • note to myself, please reference the tracker ticket.

@tchaikov tchaikov self-assigned this Jan 18, 2024
@tchaikov
Copy link
Contributor Author

@tchaikov tchaikov removed their assignment Jan 18, 2024
@mcv21
Copy link
Contributor

mcv21 commented Jan 18, 2024

build-tested at https://shaman.ceph.com/builds/ceph/kefu-debian-postinst-1/6b6e81398c4958477fd92cba5671c217b70a0a08/

At the risk of opening a can of worms, would it be possible to build-test on Debian too?

@tchaikov
Copy link
Contributor Author

build-tested at https://shaman.ceph.com/builds/ceph/kefu-debian-postinst-1/6b6e81398c4958477fd92cba5671c217b70a0a08/

At the risk of opening a can of worms, would it be possible to build-test on Debian too?

@mcv21 i am building the debian packages using a sid pbuilder env, is this good enough? or you prefer building it in a bookworm pbuilder env?

@mcv21
Copy link
Contributor

mcv21 commented Jan 18, 2024

sid is probably OK, though I think bookworm is better given that's the release we're targetting; I'd just not seen any Debian in the shaman output you linked.

@tchaikov
Copy link
Contributor Author

[ 13%] Building CXX object src/msg/CMakeFiles/common-msg-objs.dir/async/Stack.cc.o
cd /var/ssd/ceph/obj-x86_64-linux-gnu/src/msg && /usr/bin/c++ -DBOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION -DBOOST_ASIO_HAS_IO_URING -DBOOST_ASIO_NO_TS_EXECUTORS -DHAVE_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D_REENTRANT -D_THREAD_SAFE -D__CEPH__ -D__STDC_FORMAT_MACROS -D__linux__ -I/var/ssd/ceph/obj-x86_64-linux-gnu/src/include -I/var/ssd/ceph/src -isystem /var/ssd/ceph/obj-x86_64-linux-gnu/boost/include -isystem /var/ssd/ceph/obj-x86_64-linux-gnu/include -isystem /var/ssd/ceph/src/xxHash -isystem /var/ssd/ceph/src/fmt/include -g -O2 -ffile-prefix-map=/var/ssd/ceph=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wdate-time -D_FORTIFY_SOURCE=2 -std=c++20 -fPIC   -U_FORTIFY_SOURCE -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -DBOOST_PHOENIX_STL_TUPLE_H_ -Wall -fno-strict-aliasing -fsigned-char -Wtype-limits -Wignored-qualifiers -Wpointer-arith -Werror=format-security -Winit-self -Wno-unknown-pragmas -Wnon-virtual-dtor -Wno-ignored-qualifiers -ftemplate-depth-1024 -Wpessimizing-move -Wredundant-move -Wstrict-null-sentinel -Woverloaded-virtual -fstack-protector-strong -fdiagnostics-color=auto -MD -MT src/msg/CMakeFiles/common-msg-objs.dir/async/Stack.cc.o -MF CMakeFiles/common-msg-objs.dir/async/Stack.cc.o.d -o CMakeFiles/common-msg-objs.dir/async/Stack.cc.o -c /var/ssd/ceph/src/msg/async/Stack.cc
In file included from /var/ssd/ceph/src/spawn/include/spawn/detail/net.hpp:16,
                 from /var/ssd/ceph/src/spawn/include/spawn/spawn.hpp:21,
                 from /var/ssd/ceph/src/common/async/yield_context.h:23,
                 from /var/ssd/ceph/src/crypto/openssl/openssl_crypto_accel.h:19,
                 from /var/ssd/ceph/src/crypto/openssl/openssl_crypto_plugin.h:19,
                 from /var/ssd/ceph/src/crypto/openssl/openssl_crypto_plugin.cc:16:
/var/ssd/ceph/obj-x86_64-linux-gnu/boost/include/boost/asio/bind_executor.hpp: In instantiation of ‘class boost::asio::detail::executor_binder_base<void (*)(), boost::asio::executor, false>’:
/var/ssd/ceph/obj-x86_64-linux-gnu/boost/include/boost/asio/bind_executor.hpp:209:7:   required from ‘class boost::asio::executor_binder<void (*)(), boost::asio::executor>’
/var/ssd/ceph/src/spawn/include/spawn/spawn.hpp:114:11:   required from ‘class spawn::basic_yield_context<boost::asio::executor_binder<void (*)(), boost::asio::executor> >’
/var/ssd/ceph/src/common/async/yield_context.h:36:17:   required from here
/var/ssd/ceph/obj-x86_64-linux-gnu/boost/include/boost/asio/bind_executor.hpp:185:12: error: ‘boost::asio::detail::executor_binder_base<T, Executor, false>::executor_’ has incomplete type
  185 |   Executor executor_;
      |            ^~~~~~~~~
In file included from /var/ssd/ceph/obj-x86_64-linux-gnu/boost/include/boost/asio/detail/completion_handler.hpp:21,
                 from /var/ssd/ceph/obj-x86_64-linux-gnu/boost/include/boost/asio/impl/io_context.hpp:18,
                 from /var/ssd/ceph/obj-x86_64-linux-gnu/boost/include/boost/asio/io_context.hpp:1523,
                 from /var/ssd/ceph/src/crypto/crypto_plugin.h:23,
                 from /var/ssd/ceph/src/crypto/openssl/openssl_crypto_plugin.h:18:
/var/ssd/ceph/obj-x86_64-linux-gnu/boost/include/boost/asio/detail/handler_work.hpp:39:7: note: forward declaration of ‘class boost::asio::executor’
   39 | class executor;
      |       ^~~~~~~~
make[3]: *** [src/crypto/openssl/CMakeFiles/ceph_crypto_openssl.dir/build.make:93: src/crypto/openssl/CMakeFiles/ceph_crypto_openssl.dir/openssl_crypto_plugin.cc.o] Error 1

FWIW, the latest tree fails to build on sid. i don't think it's related to the change in this PR though.

@tchaikov
Copy link
Contributor Author

jenkins test api

@tchaikov
Copy link
Contributor Author

@mcv21 i am afraid that i don't have enough bandwidth chasing the FTBFS issue. do you think it's a blocker? since ubuntu focal was released back in 2020-04, while bookworm 2023-06, the dependency changes should be safe. what do you think?

@tchaikov tchaikov requested a review from a team January 23, 2024 16:33
@tchaikov
Copy link
Contributor Author

@ljflores hi Laura, could you please help review this change? i am not sure whom i should ping for review, if you are not, would you mind pinging the reviewer(s) who can help on this?

@ljflores
Copy link
Contributor

@tchaikov Sure, will take a look

@ljflores ljflores added the core label Jan 23, 2024
@ljflores ljflores requested review from adk3798 and a team January 23, 2024 16:44
@ljflores
Copy link
Contributor

Since this is an update to a cephadm package, one of the orch members (or @adk3798) would probably be best to review this.

Copy link
Contributor

@adk3798 adk3798 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just reviewing from orch side. Don't know the build stuff very well, especially debian specific build stuff, but seems good to me.

Copy link
Contributor

@ljflores ljflores left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the core side of things, I would definitely like to have this go through integration testing. Logistically it makes sense, but I'm wondering if there is there anything specific that was done (or that can be done) to verify this change?

debian/cephadm.postinst Show resolved Hide resolved
@tchaikov
Copy link
Contributor Author

@tchaikov Sure, will take a look

thank you for your review and approval.

@mcv21
Copy link
Contributor

mcv21 commented Jan 24, 2024

@mcv21 i am afraid that i don't have enough bandwidth chasing the FTBFS issue. do you think it's a blocker? since ubuntu focal was released back in 2020-04, while bookworm 2023-06, the dependency changes should be safe. what do you think?

It'll presumably need fixing at some point, but I can't see that it's related to this change (so I don't think it should block it).

--system \
--disabled-password \
--home /home/cephadm \
--gecos 'cephadm user for mgr/cephadm' \

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, I am new to ceph, I was trying to install cephamd on Debian bookworm and ran into the problem this PR solves.

I was going through the Debian docs and found that they are going to remove --gecos option in the next release. Instead, --comment should be used. I see that for the other postinst script --comment is already used.

Does it make sense to use the new option for this script too as a part of this PR or should it be solved in a different ticket?

Copy link
Contributor Author

@tchaikov tchaikov Jan 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Sitiritis hi Tymur, thank you for the reminder. since this change is being tested in lab, and i hope that this fix can be backported sooner. also, --gecos has not been deprecated, so guess we can live with it a little bit longer. but once this change lands, i will create another PR to s/--gecos/--comment/ to be more future-proof. so, "in a different ticket" or pull request. in general, we file a ticket so that it can be tracked and the corresponding fixes can be backported. if the --gecos does not cause any real-world issues yet, we could dispense a ticket on tracker.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Sitiritis since our CI is still using ubuntu:jammy, and the adduser shipped along with it does not support --comment yet, i am not using --comment and since --gecos is going to be removed after bookworm, as you point out. i am adding a commit to use usermod directly. once we have the luxury of dropping the support of release before debian/trixie or ubuntu/mantic. we can start using adduser --comment. to be more future-proof, i will add a commit in this PR to switch to usermod.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you :)
I just got access to ceph's redmine to create a ticket for this change, but it seems I don't need to do this anymore.

@tchaikov
Copy link
Contributor Author

@mcv21 i am afraid that i don't have enough bandwidth chasing the FTBFS issue. do you think it's a blocker? since ubuntu focal was released back in 2020-04, while bookworm 2023-06, the dependency changes should be safe. what do you think?

It'll presumably need fixing at some point, but I can't see that it's related to this change (so I don't think it should block it).

@mcv21 thank you for confirming this. could you please elaborate a little bit on what will need fixing? since this change is being tested in lab. i will create a follow-up change if we need more changes.

@NitzanMordhai
Copy link
Contributor

@tchaikov can you please take a look at a few of the following failures? it looks related to the new added adduser
https://pulpito.ceph.com/yuriw-2024-01-31_19:19:23-rados-wip-yuri7-testing-2024-01-29-1434-distro-default-smithi/7540563/

@tchaikov tchaikov self-assigned this Feb 2, 2024
@tchaikov
Copy link
Contributor Author

tchaikov commented Feb 2, 2024

@NitzanMordhai thank you Nitzan! sure. will take a look this weekend.

@mcv21
Copy link
Contributor

mcv21 commented Feb 2, 2024

@NitzanMordhai thank you Nitzan! sure. will take a look this weekend.

The failure is because the build is being run on Ubuntu 22.04, and adduser there does not support --comment 22.04 manual. By the 24.04 manual --gecos is deprecated, but I think it'll still work; so I think we have to punt moving to --comment until we no longer need to support 22.04.

@mcv21
Copy link
Contributor

mcv21 commented Feb 2, 2024

@mcv21 i am afraid that i don't have enough bandwidth chasing the FTBFS issue. do you think it's a blocker? since ubuntu focal was released back in 2020-04, while bookworm 2023-06, the dependency changes should be safe. what do you think?

It'll presumably need fixing at some point, but I can't see that it's related to this change (so I don't think it should block it).

@mcv21 thank you for confirming this. could you please elaborate a little bit on what will need fixing? since this change is being tested in lab. i will create a follow-up change if we need more changes.

I'm afraid I don't really know - it looks like a problem building boost, but evidently boost can be built on Debian sid, so I don't know why it's failing here. [I guess this is the side-effect of so many submodules in the build rather than pulling libraries in from the distro, you end up with what might be entirely unrelated build failures]

@tchaikov
Copy link
Contributor Author

tchaikov commented Feb 3, 2024

@mcv21 i am afraid that i don't have enough bandwidth chasing the FTBFS issue. do you think it's a blocker? since ubuntu focal was released back in 2020-04, while bookworm 2023-06, the dependency changes should be safe. what do you think?

It'll presumably need fixing at some point, but I can't see that it's related to this change (so I don't think it should block it).

@mcv21 thank you for confirming this. could you please elaborate a little bit on what will need fixing? since this change is being tested in lab. i will create a follow-up change if we need more changes.

I'm afraid I don't really know - it looks like a problem building boost, but evidently boost can be built on Debian sid, so I don't know why it's failing here. [I guess this is the side-effect of so many submodules in the build rather than pulling libraries in from the distro, you end up with what might be entirely unrelated build failures]

i see. you were referencing the FTBFS i reported in this PR. let's leave it for a rainy weekend maybe.

and thank you for looking into the test failure!

@tchaikov
Copy link
Contributor Author

tchaikov commented Feb 3, 2024

changelog

  • do not use adduser --comment as the test fails on ubuntu jammy.
  • added a commit to switch from adduser --gecos to usermod --comment

in `debian/ceph-common.postinst` and `debian/cephadm.postinst`, we
use `adduser --system` to create the system user when configuring
the corresponding package.

before this change, the dependency is not listed in the runtime
`Depends` section of ceph-common and cephadm.

in this change, the dependency is added. this is also suggested
by Securing Debian Manual, see
https://www.debian.org/doc/manuals/securing-debian-manual/bpp-lower-privs.en.html

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
now that adduser allows us to set its home directory, we can do
this using adduser instead of using usermod. this change also
silences the warning from lintian
"maintainer-script-lacks-home-in-adduser". lintian complains if
`adduser --system` is called without passing `--home` option.

also, take this opportunity to s/-c/--comment/ in the command line
of `usermod`, for better readability.

Fixes: https://tracker.ceph.com/issues/64069
Signed-off-by: Kefu Chai <tchaikov@gmail.com>
for better readability.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
quote from adduser/NEWS.Debian.gz:

>  System user home defaults to /nonexistent if --home is not specified.
>  Packages that call adduser to create system accounts should explicitly
>  specify a location for /home (see Lintian check
>  maintainer-script-lacks-home-in-adduser).

so let's follow this change in adduser. otherwise "cephadm"
would have a $HOME at `/nonexistent`.

Fixes: https://tracker.ceph.com/issues/64069
Signed-off-by: Kefu Chai <tchaikov@gmail.com>
for better readability, and to be more consistent with the rest
of this file, and other .postinst scripts of this project.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
--gecos option of adduser is deprecated in debian/bookworm, and
will be removed in debian/trixie,
see https://manpages.debian.org/bookworm/adduser/adduser.8.en.html.
so to be future-proof, let's switch to `usermod --comment`. please
note, since we still need to support ubuntu/jammy which is used in
our CI, and `adduser` shipped by ubuntu/jammy does not support
`--comment` yet, so we cannot use this option.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
@tchaikov
Copy link
Contributor Author

tchaikov commented Feb 4, 2024

test passed at https://pulpito.ceph.com/kchai-2024-02-04_08:45:31-rados-wip-kefu-pr-55218-1-distro-default-smithi/

@ljflores @adk3798 hi Laura and Adam, thank you for your reviews. could you take another look?

@yuriw yuriw merged commit d74e98d into ceph:main Feb 20, 2024
11 of 12 checks passed
@mcv21
Copy link
Contributor

mcv21 commented Feb 20, 2024

@tchaikov thanks for working on this; are you OK to backport it to reef, please? :)
[I mean if not I can probably open a MR myself, but...]

@tchaikov
Copy link
Contributor Author

tchaikov commented Feb 20, 2024

@tchaikov thanks for working on this; are you OK to backport it to reef, please? :) [I mean if not I can probably open a MR myself, but...]

@mcv21 Hi Mathew, would be great if you could help on this. i am tied up with my daytime job recently.

@tchaikov tchaikov deleted the debian/postinst branch February 20, 2024 16:43
@mcv21
Copy link
Contributor

mcv21 commented Feb 20, 2024

@tchaikov thanks for working on this; are you OK to backport it to reef, please? :) [I mean if not I can probably open a MR myself, but...]

@mcv21 Hi Mathew, would be great if you could help on this. i am tied up with my daytime job recently.

I will endeavour to, but can you set the tracker task to state: pending backport please? the ceph-backport.sh script won't run at the moment because the tracker task isn't in that state (and I don't have enough redmine permissions to do it myself).

@tchaikov
Copy link
Contributor Author

@mcv21 changed. thanks in advance!

@mcv21
Copy link
Contributor

mcv21 commented Feb 20, 2024

@tchaikov sorry, the backport tasks are assigned to you, so ceph-backport.sh won't continue. Can you assign them to me (or maybe just unassigning them to yourself is sufficient)?

@jhrcz-ls
Copy link
Contributor

i would like to warn before using hardcoded /home/cephadm as home for cephadm user... because in debian distro package ceph (a way to get 16.2 on debian bookworm) uses /var/lib/cephadm and when upgrading from debian package to ceph-io package this causes problems. (good thing is that other issue, the different behaviour of adduser on deb bookworm is fixed with this PR). i'm not sure that clean transition from debians package to ceph-io package is something to expect.

i filled issue in tracker (https://tracker.ceph.com/issues/64488) but later found issue related to this PR (https://tracker.ceph.com/issues/64069)

@mcv21
Copy link
Contributor

mcv21 commented Feb 22, 2024

I'd like to bring the Debian packaging in ceph-upstream and ceph-Debian (if you see what I mean) closer together; but I think fixing this bug is not the place to change where ceph-upstream sets the cephadm user's $HOME to be.

@mcv21
Copy link
Contributor

mcv21 commented Feb 22, 2024

@tchaikov sorry, the backport tasks are assigned to you, so ceph-backport.sh won't continue. Can you assign them to me (or maybe just unassigning them to yourself is sufficient)?

NVM, I found the --force option :)

@tchaikov
Copy link
Contributor Author

i would like to warn before using hardcoded /home/cephadm as home for cephadm user... because in debian distro package ceph (a way to get 16.2 on debian bookworm) uses /var/lib/cephadm and when upgrading from debian package to ceph-io package this causes problems. (good thing is that other issue, the different behaviour of adduser on deb bookworm is fixed with this PR). i'm not sure that clean transition from debians package to ceph-io package is something to expect.

i filled issue in tracker (https://tracker.ceph.com/issues/64488) but later found issue related to this PR (https://tracker.ceph.com/issues/64069)

@jhrcz-ls hi Jan, thanks for filing this issue. i think we'd need a separate PR to address it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
8 participants